Skip to content

Commit

Permalink
keep minimalistic non-redundant vars declaration
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentporte committed Dec 19, 2024
1 parent 36e3141 commit c20105f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 46 deletions.
47 changes: 5 additions & 42 deletions .env.template
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion docker/django/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -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
Expand Down
6 changes: 3 additions & 3 deletions scripts/import-latest-db-backup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c20105f

Please sign in to comment.