ensure upgradability for postgres database
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
stevensting 2025-02-12 15:03:35 +01:00
parent 6a6f6240b5
commit 11bb2233bf
3 changed files with 17 additions and 1 deletions

View File

@ -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-name> 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 <app-name> smtp_password v1 "<your-password>"`
* `abra app secret generate <app-name> db_password v1`
* `abra app deploy <app-name>`
* set the new password in DB: `abra app cmd <app-name> app set_new_db_password`
* redeploy if necessary
For more, see [docs.coopcloud.tech](https://docs.coopcloud.tech).

View File

@ -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"
}

View File

@ -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