From df648bdb9a11f2270942049ea5b14cc2c84f4a3b Mon Sep 17 00:00:00 2001 From: Will Meister Date: Wed, 29 Apr 2020 15:58:52 -0500 Subject: [PATCH 1/2] changing sh script because of version of sh on debian --- aws/synthetix/dev/full-node/docker-compose.yml | 3 +++ aws/synthetix/prod/web/docker-compose.yml | 3 +++ aws/synthetix/uat/web/docker-compose.yml | 3 +++ docker/the-graph/wait-for-ovm.sh | 2 +- 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/aws/synthetix/dev/full-node/docker-compose.yml b/aws/synthetix/dev/full-node/docker-compose.yml index 99be11644265..1320fa60fef2 100644 --- a/aws/synthetix/dev/full-node/docker-compose.yml +++ b/aws/synthetix/dev/full-node/docker-compose.yml @@ -112,6 +112,9 @@ services: RUST_LOG: info STARTUP_WAIT_TIMEOUT: 30 OVM_URL_WITH_PORT: 'http://0.0.0.0:8545' + volumes: + - postgres-data:/data/postgres + - ipfs-data:/data/ipfs logging: driver: awslogs diff --git a/aws/synthetix/prod/web/docker-compose.yml b/aws/synthetix/prod/web/docker-compose.yml index 3fdd36d03417..46aaf2358824 100644 --- a/aws/synthetix/prod/web/docker-compose.yml +++ b/aws/synthetix/prod/web/docker-compose.yml @@ -86,6 +86,9 @@ services: RUST_LOG: info STARTUP_WAIT_TIMEOUT: 30 OVM_URL_WITH_PORT: 'http://0.0.0.0:8545' + volumes: + - postgres-data:/data/postgres + - ipfs-data:/data/ipfs logging: driver: awslogs diff --git a/aws/synthetix/uat/web/docker-compose.yml b/aws/synthetix/uat/web/docker-compose.yml index a1d166d74992..298853271b15 100644 --- a/aws/synthetix/uat/web/docker-compose.yml +++ b/aws/synthetix/uat/web/docker-compose.yml @@ -86,6 +86,9 @@ services: RUST_LOG: info STARTUP_WAIT_TIMEOUT: 30 OVM_URL_WITH_PORT: 'http://0.0.0.0:8545' + volumes: + - postgres-data:/data/postgres + - ipfs-data:/data/ipfs logging: driver: awslogs diff --git a/docker/the-graph/wait-for-ovm.sh b/docker/the-graph/wait-for-ovm.sh index 9f6adcb4be6b..5ba7d924a668 100755 --- a/docker/the-graph/wait-for-ovm.sh +++ b/docker/the-graph/wait-for-ovm.sh @@ -36,7 +36,7 @@ clear_data_if_necessary() DATA_DIRECTORY=${DATA_DIRECTORY:-/data} CLEAR_DATA_FILE_PATH="$DATA_DIRECTORY/.clear_data_key_$CLEAR_DATA_KEY" - if [[ -n "$CLEAR_DATA_KEY" && ! -f "$CLEAR_DATA_FILE_PATH" ]]; then + if [ -n "$CLEAR_DATA_KEY" -a ! -f "$CLEAR_DATA_FILE_PATH" ]; then echo "Detected change in CLEAR_DATA_KEY. Purging data." rm -rf ${DATA_DIRECTORY}/* rm -rf ${DATA_DIRECTORY}/.clear_data_key_* From f687e16b52ea1714fb1b075c136adbc94c19d406 Mon Sep 17 00:00:00 2001 From: Will Meister Date: Wed, 29 Apr 2020 16:28:40 -0500 Subject: [PATCH 2/2] fixing directory clearing portion of startup script --- docker/the-graph/wait-for-ovm.sh | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/docker/the-graph/wait-for-ovm.sh b/docker/the-graph/wait-for-ovm.sh index 5ba7d924a668..836fff2213e5 100755 --- a/docker/the-graph/wait-for-ovm.sh +++ b/docker/the-graph/wait-for-ovm.sh @@ -1,6 +1,6 @@ #!/bin/sh # wait-for-ovm.sh -# NOTE: set the CLEAR_DATA_KEY environment variable to clear the /data directory on startup. +# NOTE: set the CLEAR_DATA_KEY environment variable to clear the $POSTGRES_DIR and $IPFS_DIR on startup. # Directory will only be cleared if CLEAR_DATA_KEY is set AND different from last start. set -e @@ -33,16 +33,23 @@ wait_for_server_to_be_reachable() clear_data_if_necessary() { - DATA_DIRECTORY=${DATA_DIRECTORY:-/data} - CLEAR_DATA_FILE_PATH="$DATA_DIRECTORY/.clear_data_key_$CLEAR_DATA_KEY" + POSTGRES_DIR=${POSTGRES_DIR:-/data/postgres} + IPFS_DIR=${IPFS_DIR:-/data/ipfs} + CLEAR_DATA_FILE_PATH="${IPFS_DIR}/.clear_data_key_${CLEAR_DATA_KEY}" if [ -n "$CLEAR_DATA_KEY" -a ! -f "$CLEAR_DATA_FILE_PATH" ]; then echo "Detected change in CLEAR_DATA_KEY. Purging data." - rm -rf ${DATA_DIRECTORY}/* - rm -rf ${DATA_DIRECTORY}/.clear_data_key_* - echo "Local data cleared from '${DATA_DIRECTORY}/*'" - echo "Contents of data dir: $(ls -alh $DATA_DIRECTORY)" + rm -rf ${IPFS_DIR}/* + rm -rf ${IPFS_DIR}/.clear_data_key_* + echo "Local data cleared from '${IPFS_DIR}/*'" + echo "Contents of ipfs dir: $(ls -alh $IPFS_DIR)" + + rm -rf ${POSTGRES_DIR}/* + echo "Local data cleared from '${POSTGRES_DIR}/*'" + echo "Contents of postgres dir: $(ls -alh $POSTGRES_DIR)" touch $CLEAR_DATA_FILE_PATH + else + echo "No change detected in CLEAR_DATA_KEY not deleting data." fi }