From e9cf1ed119a4efe8f76af938f1039989bec272fa Mon Sep 17 00:00:00 2001 From: Stuart Maxwell Date: Tue, 8 Oct 2024 02:56:01 +1300 Subject: [PATCH] Add named volume and final tweaks --- docker-compose.yml | 6 ++++++ entrypoint.sh | 8 +------- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index a2c86b1..45da6fb 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,6 +8,7 @@ services: - "S3_BUCKET=${S3_BUCKET}" - "AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID}" - "AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY}" + - "AWS_ENDPOINT_URL=${AWS_ENDPOINT_URL}" - "SECRET_KEY=${SECRET_KEY}" - "DEBUG=${DEBUG}" - "ALLOWED_HOSTS=${ALLOWED_HOSTS}" @@ -28,3 +29,8 @@ services: - "SENTRY_ENVIRONMENT=${SENTRY_ENVIRONMENT}" - "SENTRY_DSN=${SENTRY_DSN}" - "SENTRY_TRACES_SAMPLE_RATE=${SENTRY_TRACES_SAMPLE_RATE}" + volumes: + - app_data:/app + +volumes: + app_data: diff --git a/entrypoint.sh b/entrypoint.sh index b237a02..95af9f5 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,7 +1,7 @@ #!/bin/bash # Exit immediately if any command fails -# set -e +set -euf -o pipefail # Function to download the latest SQLite database backup from S3 download_latest_backup() { @@ -17,7 +17,6 @@ download_latest_backup() { fi } - if [ "$DB_ENGINE" = "django.db.backends.postgresql" ] then echo "Waiting for postgresql..." @@ -31,11 +30,6 @@ fi # Check if the database engine is SQLite and the database file doesn't exist echo "Checking if SQLite database file exists" -# Print out environment variables -echo "DB_ENGINE: $DB_ENGINE" -echo "DB_NAME: $DB_NAME" -echo "S3_BUCKET: $S3_BUCKET" -echo "AWS_ENDPOINT_URL: $AWS_ENDPOINT_URL" if [ "$DB_ENGINE" = "django.db.backends.sqlite3" ] && [ ! -f "/app/$DB_NAME.sqlite3" ]; then download_latest_backup fi