Browse Source

Merge branch 'fix/fix-service-integrations-and-urls' into 'develop'

Fix/fix service integrations and urls

See merge request ecentrics/concordia!19
develop
Apostolos Fanakis 4 years ago
parent
commit
3660907fcc
  1. 14
      docker/Makefile
  2. 2
      docker/docker-compose.yml
  3. 2
      docker/env/concordia.env
  4. 1
      docker/env/contracts-provider.env
  5. 2
      docker/env/contracts.env
  6. 7
      docker/env/pinner.env
  7. 16
      jenkins/Jenkinsfile
  8. 6
      jenkins/env/concordia.production.jenkins.env
  9. 6
      jenkins/env/concordia.staging.jenkins.env
  10. 2
      jenkins/env/contracts.production.jenkins.env
  11. 3
      jenkins/env/contracts.provider.production.env
  12. 3
      jenkins/env/contracts.provider.staging.env
  13. 2
      jenkins/env/contracts.staging.jenkins.env
  14. 8
      jenkins/env/pinner.production.jenkins.env
  15. 8
      jenkins/env/pinner.staging.jenkins.env
  16. 2
      packages/concordia-app/src/utils/drizzleUtils.js
  17. 7
      packages/concordia-contracts-provider/src/constants.js
  18. 2
      packages/concordia-contracts/utils/contractsProviderUtils.js
  19. 1
      packages/concordia-pinner/src/constants.js
  20. 13
      packages/concordia-pinner/src/options/ipfsOptions.js
  21. 4
      packages/concordia-pinner/src/utils/drizzleUtils.js
  22. 13
      packages/concordia-pinner/src/utils/ipfsUtils.js
  23. 1
      packages/concordia-pinner/src/utils/orbitUtils.js
  24. 2
      packages/concordia-shared/src/configuration/breezeConfiguration.js
  25. 6
      packages/concordia-shared/src/constants/configuration/defaults.js
  26. 5
      packages/concordia-shared/src/utils/rendezvous.js

14
docker/Makefile

@ -34,7 +34,7 @@ run-ganache-test:
# Rendezvous targets # Rendezvous targets
run-rendezvous: 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 # Contracts targets
build-contracts: build-contracts:
@ -74,21 +74,21 @@ run-app-host-chain:
build-contracts-provider: build-contracts-provider:
@docker build ../ -f ./concordia-contracts-provider/Dockerfile -t ecentrics/concordia-contracts-provider --build-arg TZ=Europe/Athens @docker build ../ -f ./concordia-contracts-provider/Dockerfile -t ecentrics/concordia-contracts-provider --build-arg TZ=Europe/Athens
run-contracts-provider-staging: 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: 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 # Pinner targets
build-pinner: build-pinner:
@docker build ../ -f ./concordia-pinner/Dockerfile -t ecentrics/concordia-pinner --build-arg TZ=Europe/Athens @docker build ../ -f ./concordia-pinner/Dockerfile -t ecentrics/concordia-pinner --build-arg TZ=Europe/Athens
run-pinner-staging: 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: 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: 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: 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 # Other
clean-images: clean-images:

2
docker/docker-compose.yml

@ -21,7 +21,7 @@ services:
restart: always restart: always
rendezvous: 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 container_name: concordia-rendezvous
networks: networks:
concordia_network: concordia_network:

2
docker/env/concordia.env

@ -1,4 +1,4 @@
# Variables needed in runtime (in browser) # 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 REACT_APP_RENDEZVOUS_PORT=9090
USE_EXTERNAL_CONTRACTS_PROVIDER=true USE_EXTERNAL_CONTRACTS_PROVIDER=true

1
docker/env/contracts-provider.env

@ -1,2 +1,3 @@
UPLOAD_CONTRACTS_DIRECTORY=/mnt/concordia/contracts/ UPLOAD_CONTRACTS_DIRECTORY=/mnt/concordia/contracts/
LOGS_PATH=/mnt/concordia/logs/ 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"

2
docker/env/contracts.env

@ -3,6 +3,6 @@ MIGRATE_NETWORK=env
WEB3_HOST=concordia-ganache WEB3_HOST=concordia-ganache
WEB3_PORT=8545 WEB3_PORT=8545
CONTRACTS_PROVIDER_HOST=concordia-contracts-provider CONTRACTS_PROVIDER_HOST=http://concordia-contracts-provider
CONTRACTS_PROVIDER_PORT=8400 CONTRACTS_PROVIDER_PORT=8400
CONTRACTS_VERSION_TAG=docker CONTRACTS_VERSION_TAG=docker

7
docker/env/pinner.env

@ -1,15 +1,16 @@
USE_EXTERNAL_CONTRACTS_PROVIDER=true USE_EXTERNAL_CONTRACTS_PROVIDER=true
IPFS_DIRECTORY=/mnt/concordia/ipfs
ORBIT_DIRECTORY=/mnt/concordia/orbitdb ORBIT_DIRECTORY=/mnt/concordia/orbitdb
LOGS_PATH=/mnt/concordia/logs/ LOGS_PATH=/mnt/concordia/logs/
CONTRACTS_PROVIDER_HOST=concordia-contracts-provider CONTRACTS_PROVIDER_HOST=http://concordia-contracts-provider
CONTRACTS_PROVIDER_PORT=8400 CONTRACTS_PROVIDER_PORT=8400
CONTRACTS_VERSION_HASH=latest CONTRACTS_VERSION_HASH=docker
PINNER_API_HOST=127.0.0.1 PINNER_API_HOST=127.0.0.1
PINNER_API_PORT=4444 PINNER_API_PORT=4444
RENDEZVOUS_HOST=concordia-rendezvous RENDEZVOUS_HOST=/docker/concordia-rendezvous
RENDEZVOUS_PORT=9090 RENDEZVOUS_PORT=9090
WEB3_HOST=concordia-ganache WEB3_HOST=concordia-ganache

16
jenkins/Jenkinsfile

@ -449,7 +449,7 @@ pipeline {
-p 9090:9090 \ -p 9090:9090 \
--name concordia-rendezvous \ --name concordia-rendezvous \
--net=ecentrics_concordia_staging_network \ --net=ecentrics_concordia_staging_network \
libp2p/js-libp2p-webrtc-star:version-0.20.5' libp2p/js-libp2p-webrtc-star:version-0.21.1'
} else { } else {
sh 'docker network connect ecentrics_concordia_staging_network concordia-rendezvous || true' sh 'docker network connect ecentrics_concordia_staging_network concordia-rendezvous || true'
} }
@ -476,7 +476,7 @@ pipeline {
sh (script: """docker run \ sh (script: """docker run \
-d \ -d \
-v concordia-contracts-provider-staging:/mnt/concordia/contracts \ -v concordia-contracts-provider-staging:/mnt/concordia \
--env-file=./jenkins/env/contracts.provider.staging.env \ --env-file=./jenkins/env/contracts.provider.staging.env \
-p 8450:8450 \ -p 8450:8450 \
--name concordia-contracts-provider-staging \ --name concordia-contracts-provider-staging \
@ -503,7 +503,7 @@ pipeline {
sh (script: 'docker run \ sh (script: 'docker run \
-d \ -d \
-v concordia-ganache-staging:/mnt/concordia/ganache_keys \ -v concordia-ganache-staging:/mnt/concordia \
-p 8555:8555 \ -p 8555:8555 \
--env-file=./jenkins/env/ganache.staging.jenkins.env \ --env-file=./jenkins/env/ganache.staging.jenkins.env \
--name concordia-ganache-staging \ --name concordia-ganache-staging \
@ -556,7 +556,7 @@ pipeline {
sh """docker run \ sh """docker run \
-d \ -d \
-v concordia-pinner-staging:/mnt/concordia/orbitdb \ -v concordia-pinner-staging:/mnt/concordia/ \
-p 5555:5555 \ -p 5555:5555 \
--env-file=./jenkins/env/pinner.staging.jenkins.env \ --env-file=./jenkins/env/pinner.staging.jenkins.env \
--name concordia-pinner-staging \ --name concordia-pinner-staging \
@ -613,7 +613,7 @@ pipeline {
-p 9090:9090 \ -p 9090:9090 \
--name concordia-rendezvous \ --name concordia-rendezvous \
--net=ecentrics_concordia_production_network \ --net=ecentrics_concordia_production_network \
libp2p/js-libp2p-webrtc-star:version-0.20.5' libp2p/js-libp2p-webrtc-star:version-0.21.1'
} else { } else {
sh 'docker network connect ecentrics_concordia_production_network concordia-rendezvous || true' sh 'docker network connect ecentrics_concordia_production_network concordia-rendezvous || true'
} }
@ -640,7 +640,7 @@ pipeline {
sh (script: """docker run \ sh (script: """docker run \
-d \ -d \
-v concordia-contracts-provider-production:/mnt/concordia/contracts \ -v concordia-contracts-provider-production:/mnt/concordia \
--env-file=./jenkins/env/contracts.provider.production.env \ --env-file=./jenkins/env/contracts.provider.production.env \
-e NODE_ENV=production \ -e NODE_ENV=production \
-p 8400:8400 \ -p 8400:8400 \
@ -668,7 +668,7 @@ pipeline {
sh (script: 'docker run \ sh (script: 'docker run \
-d \ -d \
-v concordia-ganache-production:/mnt/concordia/ganache_keys \ -v concordia-ganache-production:/mnt/concordia \
-p 8545:8545 \ -p 8545:8545 \
--env-file=./jenkins/env/ganache.production.jenkins.env \ --env-file=./jenkins/env/ganache.production.jenkins.env \
--name concordia-ganache-production \ --name concordia-ganache-production \
@ -721,7 +721,7 @@ pipeline {
sh """docker run \ sh """docker run \
-d \ -d \
-v concordia-pinner-production:/mnt/concordia/orbitdb \ -v concordia-pinner-production:/mnt/concordia \
-p 4444:4444 \ -p 4444:4444 \
-e NODE_ENV=production \ -e NODE_ENV=production \
--env-file=./jenkins/env/pinner.production.jenkins.env \ --env-file=./jenkins/env/pinner.production.jenkins.env \

6
jenkins/env/concordia.production.jenkins.env

@ -4,13 +4,13 @@ LETSENCRYPT_HOST=concordia.ecentrics.net
LETSENCRYPT_EMAIL=ecentricsgr@gmail.com LETSENCRYPT_EMAIL=ecentricsgr@gmail.com
# Variables needed in runtime (in browser) # 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_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_RENDEZVOUS_PORT=9090
REACT_APP_USE_EXTERNAL_CONTRACTS_PROVIDER=true 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_PROVIDER_PORT=8400
REACT_APP_CONTRACTS_VERSION_HASH=stable REACT_APP_CONTRACTS_VERSION_HASH=stable

6
jenkins/env/concordia.staging.jenkins.env

@ -4,13 +4,13 @@ LETSENCRYPT_HOST=staging.concordia.ecentrics.net
LETSENCRYPT_EMAIL=ecentricsgr@gmail.com LETSENCRYPT_EMAIL=ecentricsgr@gmail.com
# Variables needed in runtime (in browser) # 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_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_RENDEZVOUS_PORT=9090
REACT_APP_USE_EXTERNAL_CONTRACTS_PROVIDER=true 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_PROVIDER_PORT=8450
REACT_APP_CONTRACTS_VERSION_HASH=latest REACT_APP_CONTRACTS_VERSION_HASH=latest

2
jenkins/env/contracts.production.jenkins.env

@ -3,6 +3,6 @@ MIGRATE_NETWORK=env
WEB3_HOST=concordia-ganache-production WEB3_HOST=concordia-ganache-production
WEB3_PORT=8545 WEB3_PORT=8545
CONTRACTS_PROVIDER_HOST=contracts.concordia.ecentrics.net CONTRACTS_PROVIDER_HOST=https://contracts.concordia.ecentrics.net
CONTRACTS_PROVIDER_PORT=8400 CONTRACTS_PROVIDER_PORT=8400
CONTRACTS_VERSION_TAG=stable CONTRACTS_VERSION_TAG=stable

3
jenkins/env/contracts.provider.production.env

@ -5,4 +5,5 @@ LETSENCRYPT_EMAIL=ecentricsgr@gmail.com
CONTRACTS_PROVIDER_PORT=8400 CONTRACTS_PROVIDER_PORT=8400
UPLOAD_CONTRACTS_DIRECTORY=/mnt/concordia/contracts/ 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"

3
jenkins/env/contracts.provider.staging.env

@ -5,4 +5,5 @@ LETSENCRYPT_EMAIL=ecentricsgr@gmail.com
CONTRACTS_PROVIDER_PORT=8450 CONTRACTS_PROVIDER_PORT=8450
UPLOAD_CONTRACTS_DIRECTORY=/mnt/concordia/contracts/ 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"

2
jenkins/env/contracts.staging.jenkins.env

@ -3,6 +3,6 @@ MIGRATE_NETWORK=env
WEB3_HOST=concordia-ganache-staging WEB3_HOST=concordia-ganache-staging
WEB3_PORT=8555 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_PROVIDER_PORT=8450
CONTRACTS_VERSION_TAG=latest CONTRACTS_VERSION_TAG=latest

8
jenkins/env/pinner.production.jenkins.env

@ -5,15 +5,17 @@ LETSENCRYPT_EMAIL=ecentricsgr@gmail.com
USE_EXTERNAL_CONTRACTS_PROVIDER=true USE_EXTERNAL_CONTRACTS_PROVIDER=true
ORBIT_DIRECTORY=/mnt/concordia/orbitdb 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_PROVIDER_PORT=8400
CONTRACTS_VERSION_HASH=stable CONTRACTS_VERSION_HASH=stable
PINNER_API_HOST=127.0.0.1 PINNER_API_HOST=https://127.0.0.1
PINNER_API_PORT=4444 PINNER_API_PORT=4444
RENDEZVOUS_HOST=rendezvous.ecentrics.net RENDEZVOUS_HOST=/dns4/rendezvous.ecentrics.net
RENDEZVOUS_PORT=9090 RENDEZVOUS_PORT=9090
WEB3_HOST=ganache.ecentrics.net WEB3_HOST=ganache.ecentrics.net

8
jenkins/env/pinner.staging.jenkins.env

@ -5,15 +5,17 @@ LETSENCRYPT_EMAIL=ecentricsgr@gmail.com
USE_EXTERNAL_CONTRACTS_PROVIDER=true USE_EXTERNAL_CONTRACTS_PROVIDER=true
ORBIT_DIRECTORY=/mnt/concordia/orbitdb 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_PROVIDER_PORT=8450
CONTRACTS_VERSION_HASH=latest CONTRACTS_VERSION_HASH=latest
PINNER_API_HOST=127.0.0.1 PINNER_API_HOST=https://127.0.0.1
PINNER_API_PORT=5555 PINNER_API_PORT=5555
RENDEZVOUS_HOST=rendezvous.ecentrics.net RENDEZVOUS_HOST=/dns4/rendezvous.ecentrics.net
RENDEZVOUS_PORT=9090 RENDEZVOUS_PORT=9090
WEB3_HOST=staging.ganache.ecentrics.net WEB3_HOST=staging.ganache.ecentrics.net

2
packages/concordia-app/src/utils/drizzleUtils.js

@ -20,7 +20,7 @@ function getContractsDownloadRequest() {
const xhrRequest = new XMLHttpRequest(); const xhrRequest = new XMLHttpRequest();
xhrRequest.open('GET', xhrRequest.open('GET',
`http://${contractsProviderHost}:${contractsProviderPort}/contracts/${contractsVersionHash}`, `${contractsProviderHost}:${contractsProviderPort}/contracts/${contractsVersionHash}`,
false); false);
xhrRequest.setRequestHeader('Access-Control-Allow-Origin', `${HOST}:${PORT}`); xhrRequest.setRequestHeader('Access-Control-Allow-Origin', `${HOST}:${PORT}`);
xhrRequest.setRequestHeader('Access-Control-Allow-Credentials', 'true'); xhrRequest.setRequestHeader('Access-Control-Allow-Credentials', 'true');

7
packages/concordia-contracts-provider/src/constants.js

@ -1,7 +1,12 @@
import path from 'path'; import path from 'path';
const UPLOAD_CONTRACTS_DIRECTORY = path.join(__dirname, '..', 'contracts-uploads'); 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'); const LOGS_PATH = path.join(__dirname, '..', 'logs');
export default { export default {

2
packages/concordia-contracts/utils/contractsProviderUtils.js

@ -5,7 +5,7 @@ const { contractsProviderPort } = require('concordia-shared/src/environment/inte
const { contracts } = require('../index'); const { contracts } = require('../index');
const uploadContractsToProviderUnirest = (versionHash, tag) => { const uploadContractsToProviderUnirest = (versionHash, tag) => {
const uploadPath = `http://${contractsProviderHost}:${contractsProviderPort}/contracts/${versionHash}`; const uploadPath = `${contractsProviderHost}:${contractsProviderPort}/contracts/${versionHash}`;
const request = unirest('POST', uploadPath) const request = unirest('POST', uploadPath)
.field('tag', tag); .field('tag', tag);

1
packages/concordia-pinner/src/constants.js

@ -1,4 +1,5 @@
import path from 'path'; import path from 'path';
export const ORBIT_DIRECTORY_DEFAULT = path.join(__dirname, '..', 'orbitdb'); 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'); export const LOGS_PATH = path.join(__dirname, '..', 'logs');

13
packages/concordia-pinner/src/options/ipfsOptions.js

@ -1,14 +1,18 @@
import getLibp2pBundle from './libp2pBundle'; import getLibp2pBundle from './libp2pBundle';
import { getSwarmAddresses } from '../utils/ipfsUtils'; import { getSwarmAddresses } from '../utils/ipfsUtils';
import { logger } from '../utils/logger'; import { logger } from '../utils/logger';
import { IPFS_DIRECTORY_DEFAULT } from '../constants';
const getIpfsOptions = async () => getSwarmAddresses() const getIpfsOptions = async () => getSwarmAddresses()
.then((swarmAddresses) => { .then((swarmAddresses) => {
logger.info(`Swarm addresses used: ${swarmAddresses.join(', ')}`); logger.info(`Swarm addresses used: ${swarmAddresses.join(', ')}`);
return swarmAddresses; return swarmAddresses;
}) }).then((swarmAddresses) => {
.then((swarmAddresses) => ({ const IPFS_DIRECTORY = process.env.IPFS_DIRECTORY || IPFS_DIRECTORY_DEFAULT;
repo: 'ipfs', logger.info(`Setting up IPFS in repo: ${IPFS_DIRECTORY}`);
return ({
repo: IPFS_DIRECTORY,
config: { config: {
Profile: 'server', Profile: 'server',
Addresses: { Addresses: {
@ -25,6 +29,7 @@ const getIpfsOptions = async () => getSwarmAddresses()
init: { init: {
emptyRepo: true, emptyRepo: true,
}, },
})); });
});
export default getIpfsOptions; export default getIpfsOptions;

4
packages/concordia-pinner/src/utils/drizzleUtils.js

@ -12,8 +12,8 @@ function getContractsDownloadRequest() {
const HOST = pinnerApiHost; const HOST = pinnerApiHost;
const PORT = pinnerApiPort; const PORT = pinnerApiPort;
const contractsProviderAddress = `http://${contractsProviderHost}:${contractsProviderPort}/contracts/\ const contractsProviderAddress = `${contractsProviderHost}:${contractsProviderPort}/contracts/`
${contractsVersionHash}`; + `${contractsVersionHash}`;
const selfAddress = `${HOST}:${PORT}`; const selfAddress = `${HOST}:${PORT}`;
logger.info(`Trying contracts provider address: ${contractsProviderAddress}`); logger.info(`Trying contracts provider address: ${contractsProviderAddress}`);

13
packages/concordia-pinner/src/utils/ipfsUtils.js

@ -5,8 +5,17 @@ import { logger } from './logger';
const dnsLookup = util.promisify(dns.lookup); const dnsLookup = util.promisify(dns.lookup);
export const getResolvedRendezvousUrl = async () => dnsLookup(rendezvousHost, { family: 4 }) 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}`))); .catch((error) => logger.error(new Error(`DNS lookup of ${rendezvousHost} failed.\n${error}`)));
}
return Promise.resolve(rendezvousHost);
};
export const getSwarmAddresses = async () => getResolvedRendezvousUrl() 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`,
]);

1
packages/concordia-pinner/src/utils/orbitUtils.js

@ -25,6 +25,7 @@ export const createOrbitInstance = async (ipfs, contractAddress) => {
EthereumContractIdentityProvider.setContractAddress(contractAddress); EthereumContractIdentityProvider.setContractAddress(contractAddress);
const ORBIT_DIRECTORY = process.env.ORBIT_DIRECTORY || ORBIT_DIRECTORY_DEFAULT; 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 }); return OrbitDB.createInstance(ipfs, { directory: ORBIT_DIRECTORY });
}; };

2
packages/concordia-shared/src/configuration/breezeConfiguration.js

@ -9,7 +9,7 @@ const getBreezeConfiguration = (identityProvider) => ({
Swarm: [ Swarm: [
// Use local signaling server (see also rendezvous script in package.json) // Use local signaling server (see also rendezvous script in package.json)
// For more information: https://github.com/libp2p/js-libp2p-webrtc-star // 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 // Use the following public servers if needed
// '/dns4/wrtc-star1.par.dwebops.pub/tcp/443/wss/p2p-webrtc-star', // '/dns4/wrtc-star1.par.dwebops.pub/tcp/443/wss/p2p-webrtc-star',

6
packages/concordia-shared/src/constants/configuration/defaults.js

@ -1,14 +1,14 @@
// Contracts provider // 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_PROVIDER_PORT_DEFAULT = '8400';
const CONTRACTS_VERSION_HASH_DEFAULT = 'latest'; const CONTRACTS_VERSION_HASH_DEFAULT = 'latest';
// Pinner // 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; const PINNER_API_PORT_DEFAULT = 4444;
// Rendezvous // Rendezvous
const RENDEZVOUS_HOST_DEFAULT = '127.0.0.1'; const RENDEZVOUS_HOST_DEFAULT = '/ip4/127.0.0.1';
const RENDEZVOUS_PORT_DEFAULT = '9090'; const RENDEZVOUS_PORT_DEFAULT = '9090';
// Web3 (probably ganache) // Web3 (probably ganache)

5
packages/concordia-shared/src/utils/rendezvous.js

@ -1,5 +0,0 @@
const { rendezvousHost, rendezvousPort } = require('../environment/interpolated/rendezvous');
const getRendezvousUrl = () => `http://${rendezvousHost}:${rendezvousPort}`;
module.exports = getRendezvousUrl;
Loading…
Cancel
Save