1
0
mirror of https://github.com/oceanprotocol/barge.git synced 2024-12-02 05:57:21 +01:00

Merge pull request #28 from oceanprotocol/feature/dev-friendly-run

Enable a few env vars to make it easier to setup the docker-compose r…
This commit is contained in:
Samer 2018-09-28 14:15:00 +02:00 committed by GitHub
commit fbbfbcd5a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 183 additions and 7 deletions

View File

@ -37,6 +37,16 @@ Then bring up an instance of the whole Ocean Protocol network stack with:
git clone git@github.com:oceanprotocol/docker-images.git
cd docker-images/
./start_ocean.sh
```
Or
```bash
git clone git@github.com:oceanprotocol/docker-images.git
cd docker-images/
docker-compose --project-name=ocean up
```
@ -65,6 +75,22 @@ export OCEAN_VERSION=latest
docker-compose --project-name=ocean up
```
### Options
The keeper-contracts component runs with ganache by default and every run will produce and deploy new instances of the keeper contracts.
Ganache can be run with a specific database path by setting the env var `REUSE_DATABASE` to "true". By default, the ganache database will be setup in the cwd.
The following env vars enable some customization:
* DEPLOY_CONTRACTS: skip deploying smart contracts by setting this to "false", in this case `REUSE_DATABASE` should be set to True in the previous run when using ganache
* KEEPER_NETWORK_NAME: set to one of "ganache" (default), "kovan", or "ocean_poa_net_local"
* ARTIFACTS_FOLDER: this is where the deployed smart contracts abi files will be available. This can be pointed at any path you like. When running a separate pleuston instance, it may be necessary to copy the abi files from this artifacts folder to the @oceanprotocol/keeper-contracts/artifacts folder in pleuston
A subset of the components can be run by modifying the docker-compose file directly or by using one
of the other pre-built compose files:
* `docker-compose-no-pleuston.yml` runs all components without the pleuston. This is useful for developing/debugging
the front-end app. So first the docker compose container can be started then pleuston can be started separately from source. You can also use `./start_ocean.sh --no-pleuston` to do this
* `docker-compose-local-parity-node.yml` is similar to the above with no pleuston, but runs a local parity POA node instead of ganache-cli. You can also use `./start_ocean.sh --local-parity-node` instead
## Contributing
We use GitHub as a means for maintaining and tracking issues and source code development.

View File

@ -0,0 +1,72 @@
version: '2.1'
# Run: docker-compose --project-name=ocean up
services:
mongodb:
image: mongo:3.6
ports:
- "27017:27017"
command: mongod
networks:
- backend
parity-node:
image: parity/parity:stable
command:
--config /parity/config/validator.toml
--engine-signer 0x00bd138abd70e2f00903268f3db08f2d25677c9e
--jsonrpc-interface 0.0.0.0
--ws-interface 0.0.0.0
--ui-interface 0.0.0.0
--unsafe-expose
--jsonrpc-cors all
--unlock 0x00bd138abd70e2f00903268f3db08f2d25677c9e
volumes:
- ./parity/parity/config:/parity/config:ro
- parity-node:/root/.local/share/io.parity.ethereum/
- ./parity/parity/authorities/validator0.json:/root/.local/share/io.parity.ethereum/keys/ocean-network/validator.json:ro
- ./parity/parity/keys:/root/.local/share/io.parity.ethereum/keys/ocean-network
- ./parity/parity/authorities/validator0.pwd:/parity/validator.pwd:ro
- ./parity/parity/node0.network.key:/root/.local/share/io.parity.ethereum/network/key:ro
ports:
- 8545:8545
networks:
- backend
keeper-contracts:
image: oceanprotocol/keeper-contracts:${OCEAN_VERSION:-stable}
networks:
- backend
environment:
LOCAL_CONTRACTS: "true"
DEPLOY_CONTRACTS: ${DEPLOY_CONTRACTS}
DATABASE_PATH: "/ganache-db"
REUSE_DATABASE: ${REUSE_DATABASE}
NETWORK_NAME: ${KEEPER_NETWORK_NAME}
POA_HOST: "parity-node"
volumes:
- ${ARTIFACTS_FOLDER}:/keeper-contracts/artifacts/
- ${GANACHE_DATABASE_PATH}/ganache-db:/ganache-db
provider:
image: oceanprotocol/provider:${OCEAN_VERSION:-stable}
ports:
- 5000:5000
networks:
- backend
depends_on:
- keeper-contracts
environment:
KEEPER_HOST: http://parity-node
DB_HOSTNAME: mongodb
LOCAL_CONTRACTS: 'true'
volumes:
- ${ARTIFACTS_FOLDER}:/usr/local/keeper-contracts/:ro
networks:
backend:
volumes:
parity-node:

View File

@ -0,0 +1,48 @@
version: '2.1'
# Run: docker-compose --project-name=ocean up
services:
mongodb:
image: mongo:3.6
ports:
- "27017:27017"
command: mongod
networks:
- backend
keeper-contracts:
image: oceanprotocol/keeper-contracts:${OCEAN_VERSION:-stable}
ports:
- 8545:8545
networks:
- backend
environment:
LOCAL_CONTRACTS: "true"
DEPLOY_CONTRACTS: ${DEPLOY_CONTRACTS}
DATABASE_PATH: "/ganache-db"
REUSE_DATABASE: ${REUSE_DATABASE}
NETWORK_NAME: ${KEEPER_NETWORK_NAME}
volumes:
- ${ARTIFACTS_FOLDER}:/keeper-contracts/artifacts/
- ${GANACHE_DATABASE_PATH}/ganache-db:/ganache-db
provider:
image: oceanprotocol/provider:${OCEAN_VERSION:-stable}
ports:
- 5000:5000
networks:
- backend
depends_on:
- keeper-contracts
environment:
KEEPER_HOST: http://keeper-contracts
DB_HOSTNAME: mongodb
LOCAL_CONTRACTS: "true"
volumes:
- ${ARTIFACTS_FOLDER}:/usr/local/keeper-contracts/:ro
networks:
backend:

View File

@ -18,9 +18,14 @@ services:
networks:
- backend
environment:
LOCAL_CONTRACTS: 'true'
LOCAL_CONTRACTS: "true"
DEPLOY_CONTRACTS: ${DEPLOY_CONTRACTS}
DATABASE_PATH: "/ganache-db"
REUSE_DATABASE: ${REUSE_DATABASE}
NETWORK_NAME: ${KEEPER_NETWORK_NAME}
volumes:
- artifacts:/keeper-contracts/artifacts/
- ${ARTIFACTS_FOLDER}:/keeper-contracts/artifacts/
- ${GANACHE_DATABASE_PATH}/ganache-db:/ganache-db
provider:
image: oceanprotocol/provider:${OCEAN_VERSION:-stable}
@ -33,9 +38,9 @@ services:
environment:
KEEPER_HOST: http://keeper-contracts
DB_HOSTNAME: mongodb
LOCAL_CONTRACTS: 'true'
LOCAL_CONTRACTS: "true"
volumes:
- artifacts:/usr/local/keeper-contracts/:ro
- ${ARTIFACTS_FOLDER}:/usr/local/keeper-contracts/:ro
pleuston:
image: oceanprotocol/pleuston:${OCEAN_VERSION:-stable}
@ -48,10 +53,9 @@ services:
OCEAN_HOST: provider
LOCAL_CONTRACTS: 'true'
volumes:
- artifacts:/pleuston/node_modules/@oceanprotocol/keeper-contracts/artifacts/:ro
- ${ARTIFACTS_FOLDER}:/pleuston/node_modules/@oceanprotocol/keeper-contracts/artifacts/:ro
networks:
backend:
volumes:
artifacts:

26
start_ocean.sh Executable file
View File

@ -0,0 +1,26 @@
#!/usr/bin/env bash
export OCEAN_VERSION=latest
# Must be set to true for the first run, change it to "false" to avoid migrating the smart contracts on each run.
export DEPLOY_CONTRACTS="true"
# Ganache specific option, these two options have no effect when not running ganache-cli
export GANACHE_DATABASE_PATH="."
export REUSE_DATABASE="false"
# Specify which ethereum client to run or connect to: kovan, ganache, or ocean_poa_net_local
export KEEPER_NETWORK_NAME="ganache"
export ARTIFACTS_FOLDER=~/.ocean/keeper-contracts/artifacts
if [ "$1" == "--no-pleuston" ]
then
export REUSE_DATABASE="true"
docker-compose -f docker-compose-no-pleuston.yml up
elif [ "$1" == "--local-parity-node" ]
then
export KEEPER_NETWORK_NAME="ocean_poa_net_local"
docker-compose -f docker-compose-local-parity-node.yml up
else
docker-compose up
fi