forked from cerc-io/ipld-eth-server
update docker entrypoint
This commit is contained in:
parent
a5fc994c79
commit
eb9c49a3e9
@ -44,6 +44,7 @@ USER $USER
|
|||||||
# note: using $USER is merged, but not in the stable release yet
|
# note: using $USER is merged, but not in the stable release yet
|
||||||
COPY --chown=5000:5000 --from=builder /go/src/github.com/vulcanize/vulcanizedb/$CONFIG_FILE config.toml
|
COPY --chown=5000:5000 --from=builder /go/src/github.com/vulcanize/vulcanizedb/$CONFIG_FILE config.toml
|
||||||
COPY --chown=5000:5000 --from=builder /go/src/github.com/vulcanize/vulcanizedb/dockerfiles/super_node/startup_script.sh .
|
COPY --chown=5000:5000 --from=builder /go/src/github.com/vulcanize/vulcanizedb/dockerfiles/super_node/startup_script.sh .
|
||||||
|
COPY --chown=5000:5000 --from=builder /go/src/github.com/vulcanize/vulcanizedb/dockerfiles/super_node/entrypoint.sh .
|
||||||
|
|
||||||
|
|
||||||
# keep binaries immutable
|
# keep binaries immutable
|
||||||
@ -51,9 +52,8 @@ COPY --from=builder /go/src/github.com/vulcanize/vulcanizedb/vulcanizedb vulcani
|
|||||||
COPY --from=builder /go/src/github.com/pressly/goose/cmd/goose/goose goose
|
COPY --from=builder /go/src/github.com/pressly/goose/cmd/goose/goose goose
|
||||||
COPY --from=builder /go/src/github.com/vulcanize/vulcanizedb/db/migrations migrations/vulcanizedb
|
COPY --from=builder /go/src/github.com/vulcanize/vulcanizedb/db/migrations migrations/vulcanizedb
|
||||||
COPY --from=builder /go/src/github.com/ipfs/go-ipfs/ipfs ipfs
|
COPY --from=builder /go/src/github.com/ipfs/go-ipfs/ipfs ipfs
|
||||||
# XXX dir is already writeable RUN touch vulcanizedb.log
|
|
||||||
|
|
||||||
EXPOSE $EXPOSE_PORT_1
|
EXPOSE $EXPOSE_PORT_1
|
||||||
EXPOSE $EXPOSE_PORT_2
|
EXPOSE $EXPOSE_PORT_2
|
||||||
|
|
||||||
CMD ["./startup_script.sh"]
|
ENTRYPOINT ["/app/entrypoint.sh"]
|
||||||
|
64
dockerfiles/super_node/entrypoint.sh
Executable file
64
dockerfiles/super_node/entrypoint.sh
Executable file
@ -0,0 +1,64 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# Runs the db migrations and starts the super node services
|
||||||
|
|
||||||
|
# Exit if the variable tests fail
|
||||||
|
set -e
|
||||||
|
set +x
|
||||||
|
|
||||||
|
# Check the database variables are set
|
||||||
|
# XXX set defaults, don't silently fail
|
||||||
|
#test $DATABASE_HOSTNAME
|
||||||
|
#test $DATABASE_NAME
|
||||||
|
#test $DATABASE_PORT
|
||||||
|
#test $DATABASE_USER
|
||||||
|
#test $DATABASE_PASSWORD
|
||||||
|
#test $IPFS_INIT
|
||||||
|
#test $IPFS_PATH
|
||||||
|
VDB_COMMAND=${VARIABLE:-headerSync}
|
||||||
|
set +e
|
||||||
|
|
||||||
|
# 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
|
||||||
|
rv=$?
|
||||||
|
|
||||||
|
if [ $rv != 0 ]; then
|
||||||
|
echo "Could not run migrations. Are the database details correct?"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Export our database variables so that the IPFS Postgres plugin can use them
|
||||||
|
export IPFS_PGHOST=$DATABASE_HOSTNAME
|
||||||
|
export IPFS_PGUSER=$DATABASE_USER
|
||||||
|
export IPFS_PGDATABASE=$DATABASE_NAME
|
||||||
|
export IPFS_PGPORT=$DATABASE_PORT
|
||||||
|
export IPFS_PGPASSWORD=$DATABASE_PASSWORD
|
||||||
|
|
||||||
|
|
||||||
|
if [ ! -d "~/.ipfs" ]; then
|
||||||
|
# initialize PG-IPFS
|
||||||
|
echo "Initializing Postgres-IPFS profile"
|
||||||
|
./ipfs init --profile=postgresds
|
||||||
|
|
||||||
|
rv=$?
|
||||||
|
if [ $rv != 0 ]; then
|
||||||
|
echo "Could not initialize ipfs"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Beginning the vulcanizedb super node process"
|
||||||
|
DEFAULT_OPTIONS="--config=config.toml"
|
||||||
|
VDB_FULL_CL=${VARIABLE:-$DEFAULT_OPTIONS}
|
||||||
|
# XXX stdout, not logfile
|
||||||
|
./vulcanizedb ${VDB_COMMAND} $VDB_FULL_CL
|
||||||
|
rv=$?
|
||||||
|
|
||||||
|
if [ $rv != 0 ]; then
|
||||||
|
echo "VulcanizeDB startup failed"
|
||||||
|
exit 1
|
||||||
|
fi
|
Loading…
Reference in New Issue
Block a user