forked from cerc-io/ipld-eth-server
split running migrations into separate compose step; docker-compose files for different processes
This commit is contained in:
@@ -5,64 +5,87 @@ services:
|
||||
restart: always
|
||||
image: postgres:10.12-alpine
|
||||
environment:
|
||||
POSTGRES_USER: "postgres"
|
||||
POSTGRES_USER: "vdbm"
|
||||
POSTGRES_DB: "vulcanize_public"
|
||||
POSTGRES_PASSWORD: "password"
|
||||
volumes:
|
||||
- vulcanizedb_db_data:/var/lib/postgresql/data
|
||||
- vulcanizedb_db_data:/var/lib/postgresql/data
|
||||
expose:
|
||||
- "5432"
|
||||
- "5432"
|
||||
ports:
|
||||
- "127.0.0.1:8079:5432"
|
||||
- "127.0.0.1:8079:5432"
|
||||
|
||||
btc:
|
||||
migrations:
|
||||
restart: on-failure
|
||||
depends_on:
|
||||
- db
|
||||
- db
|
||||
build:
|
||||
context: ./../../
|
||||
cache_from:
|
||||
- alpine:latest
|
||||
- golang:1.12.4
|
||||
- alpine:latest
|
||||
dockerfile: ./dockerfiles/migrations/Dockerfile
|
||||
args:
|
||||
USER: "vdbm"
|
||||
environment:
|
||||
DATABASE_NAME: "vulcanize_public"
|
||||
DATABASE_HOSTNAME: "db"
|
||||
DATABASE_PORT: 5432
|
||||
DATABASE_USER: "vdbm"
|
||||
DATABASE_PASSWORD: "password"
|
||||
|
||||
btc:
|
||||
depends_on:
|
||||
- db
|
||||
- migrations
|
||||
build:
|
||||
context: ./../../
|
||||
cache_from:
|
||||
- alpine:latest
|
||||
- golang:1.12.4
|
||||
dockerfile: ./dockerfiles/super_node/Dockerfile
|
||||
args:
|
||||
USER: "vdbm"
|
||||
CONFIG_FILE: ./environments/superNodeBTC.toml
|
||||
environment:
|
||||
IPFS_INIT: "true"
|
||||
DATABASE_NAME: "vulcanize_public"
|
||||
DATABASE_HOSTNAME: "db"
|
||||
DATABASE_PORT: 5432
|
||||
DATABASE_USER: "postgres"
|
||||
DATABASE_USER: "vdbm"
|
||||
DATABASE_PASSWORD: "password"
|
||||
ports:
|
||||
- "127.0.0.1:8082:8082"
|
||||
- "127.0.0.1:8083:8083"
|
||||
- "127.0.0.1:8082:8082"
|
||||
- "127.0.0.1:8083:8083"
|
||||
|
||||
eth:
|
||||
depends_on:
|
||||
- db
|
||||
- db
|
||||
- migrations
|
||||
build:
|
||||
context: ./../../
|
||||
cache_from:
|
||||
- alpine:latest
|
||||
- golang:1.12.4
|
||||
- alpine:latest
|
||||
- golang:1.12.4
|
||||
dockerfile: ./dockerfiles/super_node/Dockerfile
|
||||
args:
|
||||
USER: "vdbm"
|
||||
CONFIG_FILE: ./environments/superNodeETH.toml
|
||||
environment:
|
||||
IPFS_INIT: "true"
|
||||
DATABASE_NAME: "vulcanize_public"
|
||||
DATABASE_HOSTNAME: "db"
|
||||
DATABASE_PORT: 5432
|
||||
DATABASE_USER: "postgres"
|
||||
DATABASE_USER: "vdbm"
|
||||
DATABASE_PASSWORD: "password"
|
||||
ports:
|
||||
- "127.0.0.1:8080:8080"
|
||||
- "127.0.0.1:8081:8081"
|
||||
- "127.0.0.1:8080:8080"
|
||||
- "127.0.0.1:8081:8081"
|
||||
|
||||
graphql:
|
||||
restart: always
|
||||
depends_on:
|
||||
- db
|
||||
- migrations
|
||||
build:
|
||||
context: ./../../
|
||||
cache_from:
|
||||
@@ -75,7 +98,7 @@ services:
|
||||
command: ["--plugins", "@graphile/pg-pubsub",
|
||||
"--subscriptions",
|
||||
"--simple-subscriptions",
|
||||
"--connection", "postgres://postgres:password@db:5432/vulcanize_public",
|
||||
"--connection", "postgres://vdbm:password@db:5432/vulcanize_public",
|
||||
"--port", "5000",
|
||||
"-n", "0.0.0.0",
|
||||
"--schema", "public,btc,eth",
|
||||
|
||||
@@ -21,28 +21,13 @@ export IPFS_PGDATABASE=$DATABASE_NAME
|
||||
export IPFS_PGPORT=$DATABASE_PORT
|
||||
export IPFS_PGPASSWORD=$DATABASE_PASSWORD
|
||||
|
||||
# Construct the connection string for postgres
|
||||
VDB_PG_CONNECT=postgresql://$DATABASE_USER:$DATABASE_PASSWORD@$DATABASE_HOSTNAME:$DATABASE_PORT/$DATABASE_NAME?sslmode=disable
|
||||
|
||||
# Run the DB migrations
|
||||
echo "Connecting with: $VDB_PG_CONNECT"
|
||||
echo "Running database migrations"
|
||||
./goose -dir migrations/vulcanizedb postgres "$VDB_PG_CONNECT" up
|
||||
|
||||
|
||||
# If the db migrations ran without err
|
||||
if [[ $? -eq 0 ]]; then
|
||||
# and IPFS_INIT is true
|
||||
if [[ "$IPFS_INIT" = true ]] ; then
|
||||
# initialize PG-IPFS
|
||||
echo "Initializing Postgres-IPFS profile"
|
||||
./ipfs init --profile=postgresds
|
||||
else
|
||||
echo "IPFS profile already initialized, skipping initialization"
|
||||
fi
|
||||
# If IPFS_INIT is true
|
||||
if [[ "$IPFS_INIT" = true ]] ; then
|
||||
# initialize PG-IPFS
|
||||
echo "Initializing Postgres-IPFS profile"
|
||||
./ipfs init --profile=postgresds
|
||||
else
|
||||
echo "Could not run migrations. Are the database details correct?"
|
||||
exit
|
||||
echo "IPFS profile already initialized, skipping initialization"
|
||||
fi
|
||||
|
||||
# If IPFS initialization was successful
|
||||
@@ -51,7 +36,7 @@ if [[ $? -eq 0 ]]; then
|
||||
./vulcanizedb superNode --config=config.toml 2>&1 | tee -a vulcanizedb.log &
|
||||
else
|
||||
echo "Could not initialize IPFS."
|
||||
exit
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# If Vulcanizedb startup was successful
|
||||
@@ -59,7 +44,7 @@ if [ $? -eq 0 ]; then
|
||||
echo "Super node successfully booted"
|
||||
else
|
||||
echo "Could not start vulcanizedb super node process. Is the config file correct?"
|
||||
exit
|
||||
exit 1
|
||||
fi
|
||||
|
||||
tail -f vulcanizedb.log
|
||||
|
||||
Reference in New Issue
Block a user