ipld-eth-server/dockerfiles
2020-03-18 12:21:29 -05:00
..
migrations split running migrations into separate compose step; docker-compose files for different processes 2020-03-18 12:21:29 -05:00
postgraphile split running migrations into separate compose step; docker-compose files for different processes 2020-03-18 12:21:29 -05:00
resync split running migrations into separate compose step; docker-compose files for different processes 2020-03-18 12:21:29 -05:00
rinkeby dockerfiles/rinkeby: added named volume for pg container 2018-06-25 23:34:49 +03:00
super_node split running migrations into separate compose step; docker-compose files for different processes 2020-03-18 12:21:29 -05:00
README.md (VDB-560) Rename lightSync to headerSync 2019-05-01 12:12:55 -05:00
startup_script.sh (VDB-560) Rename lightSync to headerSync 2019-05-01 12:12:55 -05:00

S Dockerfile will build an alpine image containing:

  • vDB as a binary with runtime deps statically linked: /app/vulcanizedb
  • The migration tool goose: /app/goose
  • Two services for running headerSync and continuousLogSync, started with the default configuration environments/staging.toml.

By default, vDB is configured towards the Kovan deploy. The configuration values can be overridden using environment variables, using the same hierarchical naming pattern but in CAPS and using underscores. For example, the contract address for the Pit can be set with the variable CONTRACT_ADDRESS_PIT="0x123...".

To use the container:

  1. Setup a postgres database with superuser vulcanize
  2. Set the env variables DATABASE_NAME, DATABASE_HOSTNAME, DATABASE_PORT, DATABASE_USER & DATABASE_PASSWORD
  3. Run the DB migrations:
  • ./goose postgres "postgresql://$(DATABASE_USER):$(DATABASE_PASSWORD)@$(DATABASE_HOSTNAME):$(DATABASE_PORT)/$(DATABASE_NAME)?sslmode=disable" e
  1. Set CLIENT_IPCPATH to a node endpoint
  2. Set the contract variables:
  • CONTRACT_ADDRESS_[CONTRACT NAME]=0x123...
  • CONTRACT_ABI_[CONTRACT NAME]="ABI STRING"
  • CONTRACT_DEPLOYMENT-BLOCK_[CONTRACT NAME]=0 (doesn't really matter on a short chain, just avoids long unnecessary searching)
  1. Start the headerSync and continuousLogSync services:
  • ./vulcanizedb headerSync --config environments/staging.toml
  • ./vulcanizedb continuousLogSync --config environments/staging.toml

Automated

The steps above have been rolled into a script: /app/startup_script.sh, which just assumes the DB env variables have been set, and defaults the rest to Kovan according to environments/staging.toml. This can be called with something like:

docker run -d -e DATABASE_NAME=vulcanize_public -e DATABASE_HOSTNAME=localhost -e DATABASE_PORT=5432 -e DATABASE_USER=vulcanize -e DATABASE_PASSWORD=vulcanize m0ar/images:vDB

Logging

When running, vDB services log to /app/vulcanizedb.log.