diff --git a/.env.template b/.env.template index 09b602862..60a7295b6 100644 --- a/.env.template +++ b/.env.template @@ -1,42 +1,5 @@ -PYTHONPATH=. - -# for Django -DJANGO_SETTINGS_MODULE=config.settings.dev -POSTGRESQL_ADDON_HOST=localhost -POSTGRESQL_ADDON_DB=communaute -POSTGRESQL_ADDON_USER=communaute -POSTGRESQL_ADDON_PASSWORD=password - -# GITHUB_ACCESS_TOKEN is used to update changelog from last release. -GITHUB_ACCESS_TOKEN=__key_to_be_set__ -GITHUB_REPO=betagouv/itou-communaute-django - -# SENDINBLUE API KEY -SIB_API_KEY=__key_to_be_set__ - -# for Sentry -#SENTRY_DSN=__url_to_be_set__ - -# for Pro Connect -OPENID_CONNECT_BASE_URL=http://127.0.0.1:8080 -OPENID_CONNECT_CLIENT_ID=local_openid_connect -OPENID_CONNECT_CLIENT_SECRET=password - -# parking page -PARKING_PAGE=True - -# Path to the itou-backup project repository. -PATH_TO_BACKUPS=~/path/to/backups - -# bucket for test purpose only -CELLAR_ADDON_KEY_ID=minioadmin -CELLAR_ADDON_KEY_SECRET=minioadmin -CELLAR_ADDON_HOST=localhost:9000 -CELLAR_ADDON_PROTOCOL=http - -# itou-backups -export RCLONE_S3_ACCESS_KEY_ID=ACCESS_KEY_ID -export RCLONE_S3_SECRET_ACCESS_KEY=SECRET_ACCESS_KEY -export RCLONE_CRYPT_PASSWORD=CRYPT-PASSWORD -export RCLONE_CRYPT_PASSWORD2=CRYPT-PASSWORD2 -export RCLONE_REMOTE_NAME=communaute +# for psql +PGDATABASE=communaute +PGHOST=localhost +PGUSER=communaute +PGPASSWORD=password diff --git a/docker/django/entrypoint.sh b/docker/django/entrypoint.sh index 18cd84862..ad3366c4c 100755 --- a/docker/django/entrypoint.sh +++ b/docker/django/entrypoint.sh @@ -1,7 +1,7 @@ #!/bin/sh set -e -while ! pg_isready -h $POSTGRESQL_ADDON_HOST -p 5432; do +while ! pg_isready -h $PGHOST -p 5432; do >&2 echo "Postgres is unavailable - sleeping" sleep 1 done diff --git a/scripts/import-latest-db-backup.sh b/scripts/import-latest-db-backup.sh index 5506af41d..2f5219680 100755 --- a/scripts/import-latest-db-backup.sh +++ b/scripts/import-latest-db-backup.sh @@ -23,13 +23,13 @@ echo "Going to inject DB_BACKUP_PATH=$DB_BACKUP_PATH" docker cp $DB_BACKUP_PATH commu_postgres:/backups echo "dropping current db" -dropdb $POSTGRESQL_ADDON_DB -U $POSTGRESQL_ADDON_USER --if-exists --echo +dropdb $PGDATABASE -U $PGUSER --if-exists --echo echo "creating new db" -createdb $POSTGRESQL_ADDON_DB -O $POSTGRESQL_ADDON_USER -U $POSTGRESQL_ADDON_USER --echo +createdb $PGDATABASE -O $PGUSER -U $PGUSER --echo echo "restoring db" -pg_restore -U $POSTGRESQL_ADDON_USER --dbname=$POSTGRESQL_ADDON_DB --format=c --clean --no-owner $DB_BACKUP_PATH +pg_restore -U $PGUSER --dbname=$PGDATABASE --format=c --clean --no-owner $DB_BACKUP_PATH echo "applying new migrations" python manage.py migrate