Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

changing sh script because of version of sh on debian #122

Merged
merged 2 commits into from
Apr 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions aws/synthetix/dev/full-node/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions aws/synthetix/prod/web/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions aws/synthetix/uat/web/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
23 changes: 15 additions & 8 deletions docker/the-graph/wait-for-ovm.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh
# wait-for-ovm.sh <ovm url with port>
# 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
Expand Down Expand Up @@ -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" && ! -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_*
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
}

Expand Down