From 823c57384c0b9b8e5740eae42edbc3f3a85dbb3a Mon Sep 17 00:00:00 2001 From: Matt Griswold Date: Sun, 8 Mar 2020 16:49:50 +0000 Subject: [PATCH] build changes --- dockerfiles/super_node/Dockerfile | 8 +++++--- dockerfiles/super_node/startup_script.sh | 22 ++++++++++++---------- environments/superNode.toml | 4 ++-- 3 files changed, 19 insertions(+), 15 deletions(-) diff --git a/dockerfiles/super_node/Dockerfile b/dockerfiles/super_node/Dockerfile index 2a4d2cbd..deb1a26a 100644 --- a/dockerfiles/super_node/Dockerfile +++ b/dockerfiles/super_node/Dockerfile @@ -29,7 +29,6 @@ WORKDIR /go/src/github.com/vulcanize/vulcanizedb # app container FROM alpine -WORKDIR /app ARG USER ARG CONFIG_FILE @@ -38,7 +37,9 @@ ARG EXPOSE_PORT_2 ARG EXPOSE_PORT_3 ARG EXPOSE_PORT_4 -RUN adduser -D 5000 $USER +RUN adduser -Du 5000 $USER +WORKDIR /app +RUN chown $USER /app USER $USER # chown first so dir is writable @@ -46,12 +47,13 @@ USER $USER 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 . + # keep binaries immutable COPY --from=builder /go/src/github.com/vulcanize/vulcanizedb/vulcanizedb vulcanizedb 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/ipfs/go-ipfs/ipfs ipfs -RUN touch vulcanizedb.log +# XXX dir is already writeable RUN touch vulcanizedb.log EXPOSE $EXPOSE_PORT_1 EXPOSE $EXPOSE_PORT_2 diff --git a/dockerfiles/super_node/startup_script.sh b/dockerfiles/super_node/startup_script.sh index 7ecde43b..a1d03dc7 100755 --- a/dockerfiles/super_node/startup_script.sh +++ b/dockerfiles/super_node/startup_script.sh @@ -3,24 +3,26 @@ # Exit if the variable tests fail set -e +set +x # Check the database variables are set -test $VDB_PG_NAME -test $VDB_PG_HOSTNAME -test $VDB_PG_PORT -test $VDB_PG_USER +test $DATABASE_HOSTNAME +test $DATABASE_NAME +test $DATABASE_PORT +test $DATABASE_USER +test $DATABASE_PASSWORD test $IPFS_INIT set +e # Export our database variables so that the IPFS Postgres plugin can use them -export IPFS_PGHOST=$VDB_PG_HOSTNAME -export IPFS_PGUSER=$VDB_PG_USER -export IPFS_PGDATABASE=$VDB_PG_NAME -export IPFS_PGPORT=$VDB_PG_PORT -export IPFS_PGPASSWORD=$VDB_PG_PASSWORD +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 # Construct the connection string for postgres -VDB_PG_CONNECT=postgresql://$VDB_PG_USER:$VDB_PG_PASSWORD@$VDB_PG_HOSTNAME:$VDB_PG_PORT/$VDB_PG_NAME?sslmode=disable +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" diff --git a/environments/superNode.toml b/environments/superNode.toml index 9c77db2a..917616f1 100644 --- a/environments/superNode.toml +++ b/environments/superNode.toml @@ -6,7 +6,7 @@ name = "vulcanize_public" hostname = "localhost" port = 5432 - user = "ec2-user" + user = "vdbm" [superNode.ethereum.sync] on = true @@ -29,7 +29,7 @@ name = "vulcanize_public" hostname = "localhost" port = 5432 - user = "ec2-user" + user = "vdbm" [superNode.bitcoin.sync] on = true