From 11bb2233bffcf2a02e94e1e0bab40bb65dfd6e76 Mon Sep 17 00:00:00 2001 From: stevensting Date: Wed, 12 Feb 2025 15:03:35 +0100 Subject: [PATCH] ensure upgradability for postgres database --- README.md | 8 ++++++++ abra.sh | 8 ++++++++ compose.yml | 2 +- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 7eed3bc..6e6fcb9 100644 --- a/README.md +++ b/README.md @@ -22,4 +22,12 @@ * Open the configured domain in your browser to create your user account (only works in case mail is configured correctly) * Give yourself admin rights by running `abra app cmd app make_last_user_admin` +## Manuel migration steps when upgrading from 0.6.0+v2.25.2 and earlier to 1.0.0+v2.25.2 and later + +* insert your smtp password with `abra app secret insert smtp_password v1 ""` +* `abra app secret generate db_password v1` +* `abra app deploy ` +* set the new password in DB: `abra app cmd app set_new_db_password` +* redeploy if necessary + For more, see [docs.coopcloud.tech](https://docs.coopcloud.tech). diff --git a/abra.sh b/abra.sh index 0d72818..47f3c79 100644 --- a/abra.sh +++ b/abra.sh @@ -5,4 +5,12 @@ function make_last_user_admin() { export DATABASE_URL="postgresql://${POSTGRES_USER}:$(cat /run/secrets/db_password)@db/${POSTGRES_DB}" SECRET_KEY_BASE=$(rake secret) rails runner "User.last.update(is_admin: true)" +} + +# only run when upgrading from 0.6.0+v2.25.2 and earlier to 1.0.0+v2.25.2 and later +function set_new_db_password() +{ + echo "setting new password for db user..." + psql -U $POSTGRES_USER -c "ALTER USER $POSTGRES_USER PASSWORD '$(cat /run/secrets/db_password)';" + echo "done" } \ No newline at end of file diff --git a/compose.yml b/compose.yml index 1ea6ccb..fbe1917 100644 --- a/compose.yml +++ b/compose.yml @@ -3,7 +3,7 @@ version: "3.8" x-db-env: &db-env POSTGRES_PASSWORD_FILE: /run/secrets/db_password - POSTGRES_DB: loomio_production + POSTGRES_DB: postgres POSTGRES_USER: postgres x-redis-env: &redis-env