diff --git a/package-lock.json b/package-lock.json index 3f3a5a2..92f7b15 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,7 +14,7 @@ "bcryptjs": "2.4.3", "glob": "7.1.6", "ipfs": "0.62.3", - "ipfs-coord": "8.0.2", + "ipfs-coord": "8.0.4", "ipfs-http-client": "55.0.0", "jsonrpc-lite": "2.2.0", "jsonwebtoken": "8.5.1", @@ -8839,10 +8839,9 @@ } }, "node_modules/ipfs-coord": { - "version": "8.0.2", - "resolved": "http://94.130.170.209:4873/ipfs-coord/-/ipfs-coord-8.0.2.tgz", - "integrity": "sha512-CdUH4GLLFArUDb8LIRAXxPlhbRQ44A5PEWB4J9zzDB3by93O7DLEgjqPqLDolalzrtiQBVzoARO/exZvdxBF+w==", - "license": "MIT", + "version": "8.0.4", + "resolved": "https://registry.npmjs.org/ipfs-coord/-/ipfs-coord-8.0.4.tgz", + "integrity": "sha512-jwZsrDlEWSHMnAde8PdyUScTzRlTCIvPAziChoczj5ZOZJIUbxLNkGphBI0xDj2G/LzjPrU1Ko/QZrU+oLFUnw==", "dependencies": { "axios": "0.21.4", "bch-encrypt-lib": "2.0.0", @@ -28417,9 +28416,9 @@ } }, "ipfs-coord": { - "version": "8.0.2", - "resolved": "http://94.130.170.209:4873/ipfs-coord/-/ipfs-coord-8.0.2.tgz", - "integrity": "sha512-CdUH4GLLFArUDb8LIRAXxPlhbRQ44A5PEWB4J9zzDB3by93O7DLEgjqPqLDolalzrtiQBVzoARO/exZvdxBF+w==", + "version": "8.0.4", + "resolved": "https://registry.npmjs.org/ipfs-coord/-/ipfs-coord-8.0.4.tgz", + "integrity": "sha512-jwZsrDlEWSHMnAde8PdyUScTzRlTCIvPAziChoczj5ZOZJIUbxLNkGphBI0xDj2G/LzjPrU1Ko/QZrU+oLFUnw==", "requires": { "axios": "0.21.4", "bch-encrypt-lib": "2.0.0", diff --git a/package.json b/package.json index c7be66b..197654f 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "bcryptjs": "2.4.3", "glob": "7.1.6", "ipfs": "0.62.3", - "ipfs-coord": "8.0.2", + "ipfs-coord": "8.0.4", "ipfs-http-client": "55.0.0", "jsonrpc-lite": "2.2.0", "jsonwebtoken": "8.5.1", diff --git a/production/docker/docker-compose.yml b/production/docker/docker-compose.yml index 3f77abf..797a050 100644 --- a/production/docker/docker-compose.yml +++ b/production/docker/docker-compose.yml @@ -4,7 +4,7 @@ version: '3.9' services: mongo-bch-consumer: - image: mongo + image: mongo:4.2.0 container_name: mongo-bch-consumer ports: - '5555:27017' # : @@ -14,7 +14,7 @@ services: restart: always ipfs-bch-consumer: - image: ipfs/go-ipfs:v0.13.0 + image: ipfs/go-ipfs:v0.14.0 container_name: ipfs-bch-consumer environment: MY_ENV_VAR: 'placeholder' @@ -26,11 +26,12 @@ services: mem_limit: 2000mb ports: - 4001:4001 + - 4003:4003 - 172.17.0.1:5001:5001 - 172.17.0.1:8080:8080 volumes: - ../data/go-ipfs/data:/data/ipfs - - ../../swarm.key:/data/ipfs/swarm.key + # - ../../swarm.key:/data/ipfs/swarm.key # https://docs.docker.com/compose/compose-file/compose-file-v3/#command # https://github.com/ipfs/go-ipfs/blob/91c52657166bcf86f2476926e4fe56694dc26562/Dockerfile#L115 command: diff --git a/production/docker/start-production.sh b/production/docker/start-production.sh index 219b509..968a5d0 100755 --- a/production/docker/start-production.sh +++ b/production/docker/start-production.sh @@ -33,6 +33,6 @@ export CONSUMER_ENV=production export IPFS_HOST=172.17.0.1 export IPFS_API_PORT=5001 export IPFS_TCP_PORT=4001 -#export IPFS_WS_PORT=5269 +export IPFS_WS_PORT=4003 npm start diff --git a/src/adapters/ipfs/index.js b/src/adapters/ipfs/index.js index d2a7379..3b5128d 100644 --- a/src/adapters/ipfs/index.js +++ b/src/adapters/ipfs/index.js @@ -5,6 +5,7 @@ // Local libraries const IpfsAdapter = require('./ipfs') const IpfsCoordAdapter = require('./ipfs-coord') +const config = require('../../../config') class IPFS { constructor (localConfig = {}) { @@ -20,6 +21,7 @@ class IPFS { this.ipfsAdapter = new IpfsAdapter() this.IpfsCoordAdapter = IpfsCoordAdapter this.process = process + this.config = config this.ipfsCoordAdapter = {} // placeholder @@ -40,8 +42,9 @@ class IPFS { // Start ipfs-coord this.ipfsCoordAdapter = new this.IpfsCoordAdapter({ - ipfs: this.ipfs - // eventEmitter: this.eventEmitter + ipfs: this.ipfs, + tcpPort: this.config.ipfsTcpPort, + wsPort: this.config.ipfsWsPort }) await this.ipfsCoordAdapter.start() console.log('ipfs-coord is ready.') diff --git a/test/unit/mocks/adapters/index.js b/test/unit/mocks/adapters/index.js index f4a8ca3..121ac27 100644 --- a/test/unit/mocks/adapters/index.js +++ b/test/unit/mocks/adapters/index.js @@ -2,12 +2,19 @@ Mocks for the Adapter library. */ -const ipfs = { - ipfsAdapter: { - ipfs: {} - }, - ipfsCoordAdapter: { - ipfsCoord: { +class IpfsAdapter { + constructor () { + this.ipfs = { + files: { + stat: () => {} + } + } + } +} + +class IpfsCoordAdapter { + constructor () { + this.ipfsCoord = { useCases: { peer: { sendPrivateMessage: () => {} @@ -24,6 +31,12 @@ const ipfs = { } } +const ipfs = { + ipfsAdapter: new IpfsAdapter(), + ipfsCoordAdapter: new IpfsCoordAdapter() +} +ipfs.ipfs = ipfs.ipfsAdapter.ipfs + const localdb = { Users: class Users { static findById () {}