From c39f4864db965e6391d6d6f31da3484c4fbbc730 Mon Sep 17 00:00:00 2001 From: apostolof Date: Thu, 25 Feb 2021 19:48:32 +0200 Subject: [PATCH 1/3] fix: add multiple virtual host definitions --- jenkins/env/concordia.production.jenkins.env | 4 ++-- jenkins/env/concordia.staging.jenkins.env | 4 ++-- jenkins/env/contracts.provider.production.env | 4 ++-- jenkins/env/contracts.provider.staging.env | 4 ++-- jenkins/env/ganache.production.jenkins.env | 4 ++-- jenkins/env/ganache.staging.jenkins.env | 4 ++-- jenkins/env/pinner.production.jenkins.env | 4 ++-- jenkins/env/pinner.staging.jenkins.env | 4 ++-- jenkins/env/rendezvous.jenkins.env | 4 ++-- 9 files changed, 18 insertions(+), 18 deletions(-) diff --git a/jenkins/env/concordia.production.jenkins.env b/jenkins/env/concordia.production.jenkins.env index 4a36173..a3f3d6c 100755 --- a/jenkins/env/concordia.production.jenkins.env +++ b/jenkins/env/concordia.production.jenkins.env @@ -1,6 +1,6 @@ -VIRTUAL_HOST=concordia.ecentrics.net +VIRTUAL_HOST=concordia.ecentrics.net,www.concordia.ecentrics.net VIRTUAL_PORT=7777 -LETSENCRYPT_HOST=concordia.ecentrics.net +LETSENCRYPT_HOST=concordia.ecentrics.net,www.concordia.ecentrics.net LETSENCRYPT_EMAIL=ecentricsgr@gmail.com # Variables needed in runtime (in browser) diff --git a/jenkins/env/concordia.staging.jenkins.env b/jenkins/env/concordia.staging.jenkins.env index 64f76cc..6a08a97 100755 --- a/jenkins/env/concordia.staging.jenkins.env +++ b/jenkins/env/concordia.staging.jenkins.env @@ -1,6 +1,6 @@ -VIRTUAL_HOST=staging.concordia.ecentrics.net +VIRTUAL_HOST=staging.concordia.ecentrics.net,www.staging.concordia.ecentrics.net VIRTUAL_PORT=7000 -LETSENCRYPT_HOST=staging.concordia.ecentrics.net +LETSENCRYPT_HOST=staging.concordia.ecentrics.net,www.staging.concordia.ecentrics.net LETSENCRYPT_EMAIL=ecentricsgr@gmail.com # Variables needed in runtime (in browser) diff --git a/jenkins/env/contracts.provider.production.env b/jenkins/env/contracts.provider.production.env index 2a3a37c..81ff6d4 100755 --- a/jenkins/env/contracts.provider.production.env +++ b/jenkins/env/contracts.provider.production.env @@ -1,6 +1,6 @@ -VIRTUAL_HOST=contracts.concordia.ecentrics.net +VIRTUAL_HOST=contracts.concordia.ecentrics.net,www.contracts.concordia.ecentrics.net VIRTUAL_PORT=8400 -LETSENCRYPT_HOST=contracts.concordia.ecentrics.net +LETSENCRYPT_HOST=contracts.concordia.ecentrics.net,www.contracts.concordia.ecentrics.net LETSENCRYPT_EMAIL=ecentricsgr@gmail.com CONTRACTS_PROVIDER_PORT=8400 diff --git a/jenkins/env/contracts.provider.staging.env b/jenkins/env/contracts.provider.staging.env index b51622f..f0206e7 100755 --- a/jenkins/env/contracts.provider.staging.env +++ b/jenkins/env/contracts.provider.staging.env @@ -1,6 +1,6 @@ -VIRTUAL_HOST=staging.contracts.concordia.ecentrics.net +VIRTUAL_HOST=staging.contracts.concordia.ecentrics.net,www.staging.contracts.concordia.ecentrics.net VIRTUAL_PORT=8450 -LETSENCRYPT_HOST=staging.contracts.concordia.ecentrics.net +LETSENCRYPT_HOST=staging.contracts.concordia.ecentrics.net,www.staging.contracts.concordia.ecentrics.net LETSENCRYPT_EMAIL=ecentricsgr@gmail.com CONTRACTS_PROVIDER_PORT=8450 diff --git a/jenkins/env/ganache.production.jenkins.env b/jenkins/env/ganache.production.jenkins.env index c97e078..ff72611 100755 --- a/jenkins/env/ganache.production.jenkins.env +++ b/jenkins/env/ganache.production.jenkins.env @@ -1,6 +1,6 @@ -VIRTUAL_HOST=ganache.ecentrics.net +VIRTUAL_HOST=ganache.ecentrics.net,www.ganache.ecentrics.net VIRTUAL_PORT=8545 -LETSENCRYPT_HOST=ganache.ecentrics.net +LETSENCRYPT_HOST=ganache.ecentrics.net,www.LETSENCRYPT_HOST LETSENCRYPT_EMAIL=ecentricsgr@gmail.com ACCOUNTS_NUMBER=1000 diff --git a/jenkins/env/ganache.staging.jenkins.env b/jenkins/env/ganache.staging.jenkins.env index ce93acd..de438cd 100755 --- a/jenkins/env/ganache.staging.jenkins.env +++ b/jenkins/env/ganache.staging.jenkins.env @@ -1,6 +1,6 @@ -VIRTUAL_HOST=staging.ganache.ecentrics.net +VIRTUAL_HOST=staging.ganache.ecentrics.net,www.staging.ganache.ecentrics.net VIRTUAL_PORT=8555 -LETSENCRYPT_HOST=staging.ganache.ecentrics.net +LETSENCRYPT_HOST=staging.ganache.ecentrics.net,www.staging.ganache.ecentrics.net LETSENCRYPT_EMAIL=ecentricsgr@gmail.com ACCOUNTS_NUMBER=100 diff --git a/jenkins/env/pinner.production.jenkins.env b/jenkins/env/pinner.production.jenkins.env index 227eec4..8602631 100755 --- a/jenkins/env/pinner.production.jenkins.env +++ b/jenkins/env/pinner.production.jenkins.env @@ -1,6 +1,6 @@ -VIRTUAL_HOST=pinner.concordia.ecentrics.net +VIRTUAL_HOST=pinner.concordia.ecentrics.net,www.pinner.concordia.ecentrics.net VIRTUAL_PORT=4444 -LETSENCRYPT_HOST=pinner.concordia.ecentrics.net +LETSENCRYPT_HOST=pinner.concordia.ecentrics.net,www.pinner.concordia.ecentrics.net LETSENCRYPT_EMAIL=ecentricsgr@gmail.com USE_EXTERNAL_CONTRACTS_PROVIDER=true diff --git a/jenkins/env/pinner.staging.jenkins.env b/jenkins/env/pinner.staging.jenkins.env index d94eb98..2b56987 100755 --- a/jenkins/env/pinner.staging.jenkins.env +++ b/jenkins/env/pinner.staging.jenkins.env @@ -1,6 +1,6 @@ -VIRTUAL_HOST=staging.pinner.concordia.ecentrics.net +VIRTUAL_HOST=staging.pinner.concordia.ecentrics.net,www.staging.pinner.concordia.ecentrics.net VIRTUAL_PORT=5555 -LETSENCRYPT_HOST=staging.pinner.concordia.ecentrics.net +LETSENCRYPT_HOST=staging.pinner.concordia.ecentrics.net,www.staging.pinner.concordia.ecentrics.net LETSENCRYPT_EMAIL=ecentricsgr@gmail.com USE_EXTERNAL_CONTRACTS_PROVIDER=true diff --git a/jenkins/env/rendezvous.jenkins.env b/jenkins/env/rendezvous.jenkins.env index 09ea661..2604411 100644 --- a/jenkins/env/rendezvous.jenkins.env +++ b/jenkins/env/rendezvous.jenkins.env @@ -1,5 +1,5 @@ -VIRTUAL_HOST=rendezvous.ecentrics.net +VIRTUAL_HOST=rendezvous.ecentrics.net,www.rendezvous.ecentrics.net VIRTUAL_PORT=9090 -LETSENCRYPT_HOST=rendezvous.ecentrics.net +LETSENCRYPT_HOST=rendezvous.ecentrics.net,www.rendezvous.ecentrics.net LETSENCRYPT_EMAIL=ecentricsgr@gmail.com From 38edc413c754d42ae65a7cd93e697d15c8747856 Mon Sep 17 00:00:00 2001 From: apostolof Date: Thu, 25 Feb 2021 20:21:03 +0200 Subject: [PATCH 2/3] fix: stop ipfs on errors --- packages/concordia-pinner/src/index.js | 12 +++++++++++- yarn.lock | 3 +++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/packages/concordia-pinner/src/index.js b/packages/concordia-pinner/src/index.js index c23d648..f2d7743 100644 --- a/packages/concordia-pinner/src/index.js +++ b/packages/concordia-pinner/src/index.js @@ -10,13 +10,19 @@ import downloadContractArtifacts from './utils/drizzleUtils'; import getIpfsOptions from './options/ipfsOptions'; import { logger } from './utils/logger'; -process.on('unhandledRejection', (error) => { +let ipfsSingleton; + +process.on('unhandledRejection', async (error) => { // This happens when attempting to initialize without any available Swarm addresses (e.g. Rendezvous) if (error.code === 'ERR_NO_VALID_ADDRESSES') { logger.error(`unhandledRejection: ${error.message}`); process.exit(1); } + if (ipfsSingleton) { + await ipfsSingleton.stop(); + } + // Don't swallow other errors logger.error(error); throw error; @@ -71,6 +77,10 @@ const main = async () => { getDeployedContract(web3) .then(({ contract, contractAddress }) => getIpfsOptions() .then((ipfsOptions) => IPFS.create(ipfsOptions)) + .then((ipfs) => { + ipfsSingleton = ipfs; + return ipfs; + }) .then((ipfs) => createOrbitInstance(ipfs, contractAddress)) .then((orbit) => openExistingUsersDatabases(contract, orbit) .then(() => { diff --git a/yarn.lock b/yarn.lock index 43f21aa..0cf9450 100644 --- a/yarn.lock +++ b/yarn.lock @@ -16469,6 +16469,9 @@ snake-case@^3.0.4: version "3.0.4" resolved "https://registry.yarnpkg.com/snake-case/-/snake-case-3.0.4.tgz#4f2bbd568e9935abdfd593f34c691dadb49c452c" integrity sha512-LAOh4z89bGQvl9pFfNF8V146i7o7/CqFPbqzYgP+yYzDIDeS9HaNFtXABamRW+AQzEVODcvE79ljJ+8a9YSdMg== + dependencies: + dot-case "^3.0.4" + tslib "^2.0.3" snapdragon-node@^2.0.1: version "2.1.1" From b6a30bce5f041a9ba6b8572d70aa2006f14f217e Mon Sep 17 00:00:00 2001 From: apostolof Date: Thu, 25 Feb 2021 21:00:59 +0200 Subject: [PATCH 3/3] fix: add www prefixed URLs to CORS allowed origins --- jenkins/env/contracts.provider.staging.env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jenkins/env/contracts.provider.staging.env b/jenkins/env/contracts.provider.staging.env index f0206e7..2210d6a 100755 --- a/jenkins/env/contracts.provider.staging.env +++ b/jenkins/env/contracts.provider.staging.env @@ -6,4 +6,4 @@ LETSENCRYPT_EMAIL=ecentricsgr@gmail.com CONTRACTS_PROVIDER_PORT=8450 UPLOAD_CONTRACTS_DIRECTORY=/mnt/concordia/contracts/ LOGS_PATH=/mnt/concordia/logs/ -CORS_ALLOWED_ORIGINS="https://staging.concordia.ecentrics.net:443;https://staging.concordia.ecentrics.net;http://127.0.0.1:5555;127.0.0.1:5555" +CORS_ALLOWED_ORIGINS="https://staging.concordia.ecentrics.net:443;https://staging.concordia.ecentrics.net;http://127.0.0.1:5555;127.0.0.1:5555;https://www.staging.concordia.ecentrics.net:443;https://www.staging.concordia.ecentrics.net;http://www.127.0.0.1:5555;www.127.0.0.1:5555"