diff --git a/docker/Makefile b/docker/Makefile index 9e9ec61..679592f 100755 --- a/docker/Makefile +++ b/docker/Makefile @@ -34,7 +34,7 @@ run-ganache-test: # Rendezvous targets run-rendezvous: - @docker run -d -p 9090:9090 --name concordia-rendezvous --net=concordia_concordia_network libp2p/js-libp2p-webrtc-star:version-0.20.5 + @docker run -d -p 9090:9090 --name concordia-rendezvous --net=concordia_concordia_network libp2p/js-libp2p-webrtc-star:version-0.21.1 # Contracts targets build-contracts: @@ -74,21 +74,21 @@ run-app-host-chain: build-contracts-provider: @docker build ../ -f ./concordia-contracts-provider/Dockerfile -t ecentrics/concordia-contracts-provider --build-arg TZ=Europe/Athens run-contracts-provider-staging: - @docker run -d -v ${CONTRACTS_PROVIDER_VOLUMES}/contracts:/mnt/concordia/contracts -v ${CONTRACTS_PROVIDER_VOLUMES}/contracts:/mnt/concordia/logs --env-file=./env/contracts-provider.env -p 8400:8400 --name concordia-contracts-provider --net=concordia_concordia_network ecentrics/concordia-contracts-provider:latest + @docker run -d -v ${CONTRACTS_PROVIDER_VOLUMES}:/mnt/concordia --env-file=./env/contracts-provider.env -p 8400:8400 --name concordia-contracts-provider --net=concordia_concordia_network ecentrics/concordia-contracts-provider:latest run-contracts-provider: - @docker run -d -v ${CONTRACTS_PROVIDER_VOLUMES}/contracts:/mnt/concordia/contracts -v ${CONTRACTS_PROVIDER_VOLUMES}/contracts:/mnt/concordia/logs --env-file=./env/contracts-provider.env -e NODE_ENV=production -p 8400:8400 --name concordia-contracts-provider --net=concordia_concordia_network ecentrics/concordia-contracts-provider:latest + @docker run -d -v ${CONTRACTS_PROVIDER_VOLUMES}:/mnt/concordia --env-file=./env/contracts-provider.env -e NODE_ENV=production -p 8400:8400 --name concordia-contracts-provider --net=concordia_concordia_network ecentrics/concordia-contracts-provider:latest # Pinner targets build-pinner: @docker build ../ -f ./concordia-pinner/Dockerfile -t ecentrics/concordia-pinner --build-arg TZ=Europe/Athens run-pinner-staging: - @docker run -d -v ${PINNER_VOLUMES}/orbitdb:/mnt/concordia/orbitdb -v ${PINNER_VOLUMES}:/mnt/concordia/logs --env-file=./env/pinner.env -p 4444:4444 --name concordia-pinner --net=concordia_concordia_network ecentrics/concordia-pinner:latest + @docker run -d -v ${PINNER_VOLUMES}:/mnt/concordia --env-file=./env/pinner.env -p 4444:4444 --name concordia-pinner --net=concordia_concordia_network ecentrics/concordia-pinner:latest run-pinner: - @docker run -d -v ${PINNER_VOLUMES}/orbitdb:/mnt/concordia/orbitdb -v ${PINNER_VOLUMES}:/mnt/concordia/logs --env-file=./env/pinner.env -e NODE_ENV=production -p 4444:4444 --name concordia-pinner --net=concordia_concordia_network ecentrics/concordia-pinner:latest + @docker run -d -v ${PINNER_VOLUMES}:/mnt/concordia --env-file=./env/pinner.env -e NODE_ENV=production -p 4444:4444 --name concordia-pinner --net=concordia_concordia_network ecentrics/concordia-pinner:latest run-pinner-staging-host: - @docker run -d -v ${PINNER_VOLUMES}/orbitdb:/mnt/concordia/orbitdb -v ${PINNER_VOLUMES}:/mnt/concordia/logs --env-file=./env/pinner.env --net=host --name concordia-pinner ecentrics/concordia-pinner:latest + @docker run -d -v ${PINNER_VOLUMES}:/mnt/concordia --env-file=./env/pinner.env --net=host --name concordia-pinner ecentrics/concordia-pinner:latest run-pinner-host: - @docker run -d -v ${PINNER_VOLUMES}/orbitdb:/mnt/concordia/orbitdb -v ${PINNER_VOLUMES}:/mnt/concordia/logs --env-file=./env/pinner.env -e NODE_ENV=production --net=host --name concordia-pinner ecentrics/concordia-pinner:latest + @docker run -d -v ${PINNER_VOLUMES}:/mnt/concordia --env-file=./env/pinner.env -e NODE_ENV=production --net=host --name concordia-pinner ecentrics/concordia-pinner:latest # Other clean-images: diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index db5f1ea..d6eaf70 100755 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -21,7 +21,7 @@ services: restart: always rendezvous: - image: libp2p/js-libp2p-webrtc-star:version-0.20.5 + image: libp2p/js-libp2p-webrtc-star:version-0.21.1 container_name: concordia-rendezvous networks: concordia_network: diff --git a/docker/env/concordia.env b/docker/env/concordia.env index 42652e7..4f270ad 100755 --- a/docker/env/concordia.env +++ b/docker/env/concordia.env @@ -1,4 +1,4 @@ # Variables needed in runtime (in browser) -REACT_APP_RENDEZVOUS_HOST=127.0.0.1 +REACT_APP_RENDEZVOUS_HOST=/ip4/127.0.0.1 REACT_APP_RENDEZVOUS_PORT=9090 USE_EXTERNAL_CONTRACTS_PROVIDER=true diff --git a/docker/env/contracts-provider.env b/docker/env/contracts-provider.env index 9d43b56..bb882ef 100644 --- a/docker/env/contracts-provider.env +++ b/docker/env/contracts-provider.env @@ -1,2 +1,3 @@ UPLOAD_CONTRACTS_DIRECTORY=/mnt/concordia/contracts/ LOGS_PATH=/mnt/concordia/logs/ +#CORS_ALLOWED_ORIGINS="http://127.0.0.1:7000;http://localhost:7000;http://127.0.0.1:4444;127.0.0.1:4444" diff --git a/docker/env/contracts.env b/docker/env/contracts.env index 4e68772..c1f2ed9 100755 --- a/docker/env/contracts.env +++ b/docker/env/contracts.env @@ -3,6 +3,6 @@ MIGRATE_NETWORK=env WEB3_HOST=concordia-ganache WEB3_PORT=8545 -CONTRACTS_PROVIDER_HOST=concordia-contracts-provider +CONTRACTS_PROVIDER_HOST=http://concordia-contracts-provider CONTRACTS_PROVIDER_PORT=8400 CONTRACTS_VERSION_TAG=docker diff --git a/docker/env/pinner.env b/docker/env/pinner.env index 65b605e..0c7f948 100644 --- a/docker/env/pinner.env +++ b/docker/env/pinner.env @@ -1,15 +1,16 @@ USE_EXTERNAL_CONTRACTS_PROVIDER=true +IPFS_DIRECTORY=/mnt/concordia/ipfs ORBIT_DIRECTORY=/mnt/concordia/orbitdb LOGS_PATH=/mnt/concordia/logs/ -CONTRACTS_PROVIDER_HOST=concordia-contracts-provider +CONTRACTS_PROVIDER_HOST=http://concordia-contracts-provider CONTRACTS_PROVIDER_PORT=8400 -CONTRACTS_VERSION_HASH=latest +CONTRACTS_VERSION_HASH=docker PINNER_API_HOST=127.0.0.1 PINNER_API_PORT=4444 -RENDEZVOUS_HOST=concordia-rendezvous +RENDEZVOUS_HOST=/docker/concordia-rendezvous RENDEZVOUS_PORT=9090 WEB3_HOST=concordia-ganache diff --git a/jenkins/Jenkinsfile b/jenkins/Jenkinsfile index eb980d3..a4eda81 100755 --- a/jenkins/Jenkinsfile +++ b/jenkins/Jenkinsfile @@ -449,7 +449,7 @@ pipeline { -p 9090:9090 \ --name concordia-rendezvous \ --net=ecentrics_concordia_staging_network \ - libp2p/js-libp2p-webrtc-star:version-0.20.5' + libp2p/js-libp2p-webrtc-star:version-0.21.1' } else { sh 'docker network connect ecentrics_concordia_staging_network concordia-rendezvous || true' } @@ -476,7 +476,7 @@ pipeline { sh (script: """docker run \ -d \ - -v concordia-contracts-provider-staging:/mnt/concordia/contracts \ + -v concordia-contracts-provider-staging:/mnt/concordia \ --env-file=./jenkins/env/contracts.provider.staging.env \ -p 8450:8450 \ --name concordia-contracts-provider-staging \ @@ -503,7 +503,7 @@ pipeline { sh (script: 'docker run \ -d \ - -v concordia-ganache-staging:/mnt/concordia/ganache_keys \ + -v concordia-ganache-staging:/mnt/concordia \ -p 8555:8555 \ --env-file=./jenkins/env/ganache.staging.jenkins.env \ --name concordia-ganache-staging \ @@ -556,7 +556,7 @@ pipeline { sh """docker run \ -d \ - -v concordia-pinner-staging:/mnt/concordia/orbitdb \ + -v concordia-pinner-staging:/mnt/concordia/ \ -p 5555:5555 \ --env-file=./jenkins/env/pinner.staging.jenkins.env \ --name concordia-pinner-staging \ @@ -613,7 +613,7 @@ pipeline { -p 9090:9090 \ --name concordia-rendezvous \ --net=ecentrics_concordia_production_network \ - libp2p/js-libp2p-webrtc-star:version-0.20.5' + libp2p/js-libp2p-webrtc-star:version-0.21.1' } else { sh 'docker network connect ecentrics_concordia_production_network concordia-rendezvous || true' } @@ -640,7 +640,7 @@ pipeline { sh (script: """docker run \ -d \ - -v concordia-contracts-provider-production:/mnt/concordia/contracts \ + -v concordia-contracts-provider-production:/mnt/concordia \ --env-file=./jenkins/env/contracts.provider.production.env \ -e NODE_ENV=production \ -p 8400:8400 \ @@ -668,7 +668,7 @@ pipeline { sh (script: 'docker run \ -d \ - -v concordia-ganache-production:/mnt/concordia/ganache_keys \ + -v concordia-ganache-production:/mnt/concordia \ -p 8545:8545 \ --env-file=./jenkins/env/ganache.production.jenkins.env \ --name concordia-ganache-production \ @@ -721,7 +721,7 @@ pipeline { sh """docker run \ -d \ - -v concordia-pinner-production:/mnt/concordia/orbitdb \ + -v concordia-pinner-production:/mnt/concordia \ -p 4444:4444 \ -e NODE_ENV=production \ --env-file=./jenkins/env/pinner.production.jenkins.env \ diff --git a/jenkins/env/concordia.production.jenkins.env b/jenkins/env/concordia.production.jenkins.env index 9dc3550..e41a5c5 100755 --- a/jenkins/env/concordia.production.jenkins.env +++ b/jenkins/env/concordia.production.jenkins.env @@ -4,13 +4,13 @@ LETSENCRYPT_HOST=concordia.ecentrics.net LETSENCRYPT_EMAIL=ecentricsgr@gmail.com # Variables needed in runtime (in browser) -REACT_APP_CONCORDIA_HOST=concordia.ecentrics.net +REACT_APP_CONCORDIA_HOST=https://concordia.ecentrics.net REACT_APP_CONCORDIA_PORT=7777 -REACT_APP_RENDEZVOUS_HOST=rendezvous.ecentrics.net +REACT_APP_RENDEZVOUS_HOST=/dns4/rendezvous.ecentrics.net REACT_APP_RENDEZVOUS_PORT=9090 REACT_APP_USE_EXTERNAL_CONTRACTS_PROVIDER=true -REACT_APP_CONTRACTS_PROVIDER_HOST=contracts.concordia.ecentrics.net +REACT_APP_CONTRACTS_PROVIDER_HOST=https://contracts.concordia.ecentrics.net REACT_APP_CONTRACTS_PROVIDER_PORT=8400 REACT_APP_CONTRACTS_VERSION_HASH=stable diff --git a/jenkins/env/concordia.staging.jenkins.env b/jenkins/env/concordia.staging.jenkins.env index 49278b2..9a6c237 100755 --- a/jenkins/env/concordia.staging.jenkins.env +++ b/jenkins/env/concordia.staging.jenkins.env @@ -4,13 +4,13 @@ LETSENCRYPT_HOST=staging.concordia.ecentrics.net LETSENCRYPT_EMAIL=ecentricsgr@gmail.com # Variables needed in runtime (in browser) -REACT_APP_CONCORDIA_HOST=staging.concordia.ecentrics.net +REACT_APP_CONCORDIA_HOST=https://staging.concordia.ecentrics.net REACT_APP_CONCORDIA_PORT=7000 -REACT_APP_RENDEZVOUS_HOST=rendezvous.ecentrics.net +REACT_APP_RENDEZVOUS_HOST=/dns4/rendezvous.ecentrics.net REACT_APP_RENDEZVOUS_PORT=9090 REACT_APP_USE_EXTERNAL_CONTRACTS_PROVIDER=true -REACT_APP_CONTRACTS_PROVIDER_HOST=staging.contracts.concordia.ecentrics.net +REACT_APP_CONTRACTS_PROVIDER_HOST=https://staging.contracts.concordia.ecentrics.net REACT_APP_CONTRACTS_PROVIDER_PORT=8450 REACT_APP_CONTRACTS_VERSION_HASH=latest diff --git a/jenkins/env/contracts.production.jenkins.env b/jenkins/env/contracts.production.jenkins.env index de1fc9d..1cef914 100755 --- a/jenkins/env/contracts.production.jenkins.env +++ b/jenkins/env/contracts.production.jenkins.env @@ -3,6 +3,6 @@ MIGRATE_NETWORK=env WEB3_HOST=concordia-ganache-production WEB3_PORT=8545 -CONTRACTS_PROVIDER_HOST=contracts.concordia.ecentrics.net +CONTRACTS_PROVIDER_HOST=https://contracts.concordia.ecentrics.net CONTRACTS_PROVIDER_PORT=8400 CONTRACTS_VERSION_TAG=stable diff --git a/jenkins/env/contracts.provider.production.env b/jenkins/env/contracts.provider.production.env index e2b1437..8916775 100755 --- a/jenkins/env/contracts.provider.production.env +++ b/jenkins/env/contracts.provider.production.env @@ -5,4 +5,5 @@ LETSENCRYPT_EMAIL=ecentricsgr@gmail.com CONTRACTS_PROVIDER_PORT=8400 UPLOAD_CONTRACTS_DIRECTORY=/mnt/concordia/contracts/ -CORS_ALLOWED_ORIGINS="concordia.ecentrics.net;http://concordia.ecentrics.net;https://concordia.ecentrics.net;concordia.ecentrics.net:7777;http://concordia.ecentrics.net:7777;https://concordia.ecentrics.net:7777;127.0.0.1;http://127.0.0.1;127.0.0.1:7777;http://127.0.0.1" +LOGS_PATH=/mnt/concordia/logs/ +CORS_ALLOWED_ORIGINS="https://concordia.ecentrics.net;http://127.0.0.1:4444;127.0.0.1:4444" diff --git a/jenkins/env/contracts.provider.staging.env b/jenkins/env/contracts.provider.staging.env index 489ded6..cc49be6 100755 --- a/jenkins/env/contracts.provider.staging.env +++ b/jenkins/env/contracts.provider.staging.env @@ -5,4 +5,5 @@ LETSENCRYPT_EMAIL=ecentricsgr@gmail.com CONTRACTS_PROVIDER_PORT=8450 UPLOAD_CONTRACTS_DIRECTORY=/mnt/concordia/contracts/ -#CORS_ALLOWED_ORIGINS="staging.concordia.ecentrics.net;http://staging.concordia.ecentrics.net;https://staging.concordia.ecentrics.net;staging.concordia.ecentrics.net:7000;http://staging.concordia.ecentrics.net:7000;https://staging.concordia.ecentrics.net:7000;172.21.0.4;http://172.21.0.4;127.0.0.1;http://127.0.0.1" +LOGS_PATH=/mnt/concordia/logs/ +CORS_ALLOWED_ORIGINS="https://staging.concordia.ecentrics.net;http://127.0.0.1:5555;127.0.0.1:5555" diff --git a/jenkins/env/contracts.staging.jenkins.env b/jenkins/env/contracts.staging.jenkins.env index 924f433..106a637 100755 --- a/jenkins/env/contracts.staging.jenkins.env +++ b/jenkins/env/contracts.staging.jenkins.env @@ -3,6 +3,6 @@ MIGRATE_NETWORK=env WEB3_HOST=concordia-ganache-staging WEB3_PORT=8555 -CONTRACTS_PROVIDER_HOST=staging.contracts.concordia.ecentrics.net +CONTRACTS_PROVIDER_HOST=https://staging.contracts.concordia.ecentrics.net CONTRACTS_PROVIDER_PORT=8450 CONTRACTS_VERSION_TAG=latest diff --git a/jenkins/env/pinner.production.jenkins.env b/jenkins/env/pinner.production.jenkins.env index 5558f2c..87052f7 100755 --- a/jenkins/env/pinner.production.jenkins.env +++ b/jenkins/env/pinner.production.jenkins.env @@ -5,15 +5,17 @@ LETSENCRYPT_EMAIL=ecentricsgr@gmail.com USE_EXTERNAL_CONTRACTS_PROVIDER=true ORBIT_DIRECTORY=/mnt/concordia/orbitdb +IPFS_DIRECTORY=/mnt/concordia/ipfs +LOGS_PATH=/mnt/concordia/logs/ -CONTRACTS_PROVIDER_HOST=contracts.concordia.ecentrics.net +CONTRACTS_PROVIDER_HOST=https://contracts.concordia.ecentrics.net CONTRACTS_PROVIDER_PORT=8400 CONTRACTS_VERSION_HASH=stable -PINNER_API_HOST=127.0.0.1 +PINNER_API_HOST=https://127.0.0.1 PINNER_API_PORT=4444 -RENDEZVOUS_HOST=rendezvous.ecentrics.net +RENDEZVOUS_HOST=/dns4/rendezvous.ecentrics.net RENDEZVOUS_PORT=9090 WEB3_HOST=ganache.ecentrics.net diff --git a/jenkins/env/pinner.staging.jenkins.env b/jenkins/env/pinner.staging.jenkins.env index d4998d2..1410813 100755 --- a/jenkins/env/pinner.staging.jenkins.env +++ b/jenkins/env/pinner.staging.jenkins.env @@ -5,15 +5,17 @@ LETSENCRYPT_EMAIL=ecentricsgr@gmail.com USE_EXTERNAL_CONTRACTS_PROVIDER=true ORBIT_DIRECTORY=/mnt/concordia/orbitdb +IPFS_DIRECTORY=/mnt/concordia/ipfs +LOGS_PATH=/mnt/concordia/logs/ -CONTRACTS_PROVIDER_HOST=staging.contracts.concordia.ecentrics.net +CONTRACTS_PROVIDER_HOST=https://staging.contracts.concordia.ecentrics.net CONTRACTS_PROVIDER_PORT=8450 CONTRACTS_VERSION_HASH=latest -PINNER_API_HOST=127.0.0.1 +PINNER_API_HOST=https://127.0.0.1 PINNER_API_PORT=5555 -RENDEZVOUS_HOST=rendezvous.ecentrics.net +RENDEZVOUS_HOST=/dns4/rendezvous.ecentrics.net RENDEZVOUS_PORT=9090 WEB3_HOST=staging.ganache.ecentrics.net diff --git a/packages/concordia-app/src/utils/drizzleUtils.js b/packages/concordia-app/src/utils/drizzleUtils.js index 269d89f..d4f288f 100755 --- a/packages/concordia-app/src/utils/drizzleUtils.js +++ b/packages/concordia-app/src/utils/drizzleUtils.js @@ -20,7 +20,7 @@ function getContractsDownloadRequest() { const xhrRequest = new XMLHttpRequest(); xhrRequest.open('GET', - `http://${contractsProviderHost}:${contractsProviderPort}/contracts/${contractsVersionHash}`, + `${contractsProviderHost}:${contractsProviderPort}/contracts/${contractsVersionHash}`, false); xhrRequest.setRequestHeader('Access-Control-Allow-Origin', `${HOST}:${PORT}`); xhrRequest.setRequestHeader('Access-Control-Allow-Credentials', 'true'); diff --git a/packages/concordia-contracts-provider/src/constants.js b/packages/concordia-contracts-provider/src/constants.js index fff76bd..24143a5 100755 --- a/packages/concordia-contracts-provider/src/constants.js +++ b/packages/concordia-contracts-provider/src/constants.js @@ -1,7 +1,12 @@ import path from 'path'; const UPLOAD_CONTRACTS_DIRECTORY = path.join(__dirname, '..', 'contracts-uploads'); -const CORS_ALLOWED_ORIGINS = ['http://127.0.0.1:7000', 'http://localhost:7000']; +const CORS_ALLOWED_ORIGINS = [ + 'http://127.0.0.1:7000', 'http://localhost:7000', + 'https://127.0.0.1:7000', 'https://localhost:7000', + 'http://127.0.0.1:4444', 'http://localhost:4444', + 'https://127.0.0.1:4444', 'https://localhost:4444', +]; const LOGS_PATH = path.join(__dirname, '..', 'logs'); export default { diff --git a/packages/concordia-contracts/utils/contractsProviderUtils.js b/packages/concordia-contracts/utils/contractsProviderUtils.js index 5777da1..74f038e 100644 --- a/packages/concordia-contracts/utils/contractsProviderUtils.js +++ b/packages/concordia-contracts/utils/contractsProviderUtils.js @@ -5,7 +5,7 @@ const { contractsProviderPort } = require('concordia-shared/src/environment/inte const { contracts } = require('../index'); const uploadContractsToProviderUnirest = (versionHash, tag) => { - const uploadPath = `http://${contractsProviderHost}:${contractsProviderPort}/contracts/${versionHash}`; + const uploadPath = `${contractsProviderHost}:${contractsProviderPort}/contracts/${versionHash}`; const request = unirest('POST', uploadPath) .field('tag', tag); diff --git a/packages/concordia-pinner/src/constants.js b/packages/concordia-pinner/src/constants.js index 7bfe01f..6e18d38 100644 --- a/packages/concordia-pinner/src/constants.js +++ b/packages/concordia-pinner/src/constants.js @@ -1,4 +1,5 @@ import path from 'path'; export const ORBIT_DIRECTORY_DEFAULT = path.join(__dirname, '..', 'orbitdb'); +export const IPFS_DIRECTORY_DEFAULT = path.join(__dirname, '..', 'ipfs'); export const LOGS_PATH = path.join(__dirname, '..', 'logs'); diff --git a/packages/concordia-pinner/src/options/ipfsOptions.js b/packages/concordia-pinner/src/options/ipfsOptions.js index 191fffc..e32f5f8 100644 --- a/packages/concordia-pinner/src/options/ipfsOptions.js +++ b/packages/concordia-pinner/src/options/ipfsOptions.js @@ -1,30 +1,35 @@ import getLibp2pBundle from './libp2pBundle'; import { getSwarmAddresses } from '../utils/ipfsUtils'; import { logger } from '../utils/logger'; +import { IPFS_DIRECTORY_DEFAULT } from '../constants'; const getIpfsOptions = async () => getSwarmAddresses() .then((swarmAddresses) => { logger.info(`Swarm addresses used: ${swarmAddresses.join(', ')}`); return swarmAddresses; - }) - .then((swarmAddresses) => ({ - repo: 'ipfs', - config: { - Profile: 'server', - Addresses: { - Swarm: swarmAddresses, + }).then((swarmAddresses) => { + const IPFS_DIRECTORY = process.env.IPFS_DIRECTORY || IPFS_DIRECTORY_DEFAULT; + logger.info(`Setting up IPFS in repo: ${IPFS_DIRECTORY}`); + + return ({ + repo: IPFS_DIRECTORY, + config: { + Profile: 'server', + Addresses: { + Swarm: swarmAddresses, + }, + }, + libp2p: getLibp2pBundle(swarmAddresses), + EXPERIMENTAL: { + pubsub: true, + }, + preload: { + enabled: false, + }, + init: { + emptyRepo: true, }, - }, - libp2p: getLibp2pBundle(swarmAddresses), - EXPERIMENTAL: { - pubsub: true, - }, - preload: { - enabled: false, - }, - init: { - emptyRepo: true, - }, - })); + }); + }); export default getIpfsOptions; diff --git a/packages/concordia-pinner/src/utils/drizzleUtils.js b/packages/concordia-pinner/src/utils/drizzleUtils.js index a5a4649..7ff5f0b 100644 --- a/packages/concordia-pinner/src/utils/drizzleUtils.js +++ b/packages/concordia-pinner/src/utils/drizzleUtils.js @@ -12,8 +12,8 @@ function getContractsDownloadRequest() { const HOST = pinnerApiHost; const PORT = pinnerApiPort; - const contractsProviderAddress = `http://${contractsProviderHost}:${contractsProviderPort}/contracts/\ - ${contractsVersionHash}`; + const contractsProviderAddress = `${contractsProviderHost}:${contractsProviderPort}/contracts/` + + `${contractsVersionHash}`; const selfAddress = `${HOST}:${PORT}`; logger.info(`Trying contracts provider address: ${contractsProviderAddress}`); diff --git a/packages/concordia-pinner/src/utils/ipfsUtils.js b/packages/concordia-pinner/src/utils/ipfsUtils.js index fabc85f..3491c5f 100644 --- a/packages/concordia-pinner/src/utils/ipfsUtils.js +++ b/packages/concordia-pinner/src/utils/ipfsUtils.js @@ -5,8 +5,17 @@ import { logger } from './logger'; const dnsLookup = util.promisify(dns.lookup); -export const getResolvedRendezvousUrl = async () => dnsLookup(rendezvousHost, { family: 4 }) - .catch((error) => logger.error(new Error(`DNS lookup of ${rendezvousHost} failed.\n${error}`))); +export const getResolvedRendezvousUrl = async () => { + if (rendezvousHost.startsWith('/docker/')) { + return dnsLookup(rendezvousHost.substring('/docker/'.length), { family: 4 }) + .then((resolvedDomain) => `/ip4/${resolvedDomain.address}`) + .catch((error) => logger.error(new Error(`DNS lookup of ${rendezvousHost} failed.\n${error}`))); + } + + return Promise.resolve(rendezvousHost); +}; export const getSwarmAddresses = async () => getResolvedRendezvousUrl() - .then((resolvedRendezvousUrl) => [`/ip4/${resolvedRendezvousUrl.address}/tcp/${rendezvousPort}/wss/p2p-webrtc-star`]); + .then((resolvedRendezvousHost) => [ + `${resolvedRendezvousHost}/tcp/${rendezvousPort}/wss/p2p-webrtc-star`, + ]); diff --git a/packages/concordia-pinner/src/utils/orbitUtils.js b/packages/concordia-pinner/src/utils/orbitUtils.js index e13877a..d1c3326 100644 --- a/packages/concordia-pinner/src/utils/orbitUtils.js +++ b/packages/concordia-pinner/src/utils/orbitUtils.js @@ -25,6 +25,7 @@ export const createOrbitInstance = async (ipfs, contractAddress) => { EthereumContractIdentityProvider.setContractAddress(contractAddress); const ORBIT_DIRECTORY = process.env.ORBIT_DIRECTORY || ORBIT_DIRECTORY_DEFAULT; + logger.info(`Setting up OrbitDB in directory: ${ORBIT_DIRECTORY}`); return OrbitDB.createInstance(ipfs, { directory: ORBIT_DIRECTORY }); }; diff --git a/packages/concordia-shared/src/configuration/breezeConfiguration.js b/packages/concordia-shared/src/configuration/breezeConfiguration.js index e1ab0e0..e936ebe 100644 --- a/packages/concordia-shared/src/configuration/breezeConfiguration.js +++ b/packages/concordia-shared/src/configuration/breezeConfiguration.js @@ -9,7 +9,7 @@ const getBreezeConfiguration = (identityProvider) => ({ Swarm: [ // Use local signaling server (see also rendezvous script in package.json) // For more information: https://github.com/libp2p/js-libp2p-webrtc-star - `/ip4/${rendezvousHost}/tcp/${rendezvousPort}/wss/p2p-webrtc-star`, + `${rendezvousHost}/tcp/${rendezvousPort}/wss/p2p-webrtc-star`, // Use the following public servers if needed // '/dns4/wrtc-star1.par.dwebops.pub/tcp/443/wss/p2p-webrtc-star', diff --git a/packages/concordia-shared/src/constants/configuration/defaults.js b/packages/concordia-shared/src/constants/configuration/defaults.js index 6c68265..4fc34a3 100644 --- a/packages/concordia-shared/src/constants/configuration/defaults.js +++ b/packages/concordia-shared/src/constants/configuration/defaults.js @@ -1,14 +1,14 @@ // Contracts provider -const CONTRACTS_PROVIDER_HOST_DEFAULT = '127.0.0.1'; +const CONTRACTS_PROVIDER_HOST_DEFAULT = 'http://127.0.0.1'; const CONTRACTS_PROVIDER_PORT_DEFAULT = '8400'; const CONTRACTS_VERSION_HASH_DEFAULT = 'latest'; // Pinner -const PINNER_API_HOST_DEFAULT = '127.0.0.1'; +const PINNER_API_HOST_DEFAULT = 'http://127.0.0.1'; const PINNER_API_PORT_DEFAULT = 4444; // Rendezvous -const RENDEZVOUS_HOST_DEFAULT = '127.0.0.1'; +const RENDEZVOUS_HOST_DEFAULT = '/ip4/127.0.0.1'; const RENDEZVOUS_PORT_DEFAULT = '9090'; // Web3 (probably ganache) diff --git a/packages/concordia-shared/src/utils/rendezvous.js b/packages/concordia-shared/src/utils/rendezvous.js deleted file mode 100644 index 8d862fc..0000000 --- a/packages/concordia-shared/src/utils/rendezvous.js +++ /dev/null @@ -1,5 +0,0 @@ -const { rendezvousHost, rendezvousPort } = require('../environment/interpolated/rendezvous'); - -const getRendezvousUrl = () => `http://${rendezvousHost}:${rendezvousPort}`; - -module.exports = getRendezvousUrl;