diff --git a/abra.sh b/abra.sh index ccca725..1d31a8d 100644 --- a/abra.sh +++ b/abra.sh @@ -1,4 +1,4 @@ -export PG_BACKUP_VERSION=v3 +export PG_BACKUP_VERSION=v4 export APP_ENTRYPOINT_VERSION=v2 export APP_INSTALL_SSL_VERSION=v1 export APP_MIGRATE_UPLOADS_VERSION=v1 diff --git a/pg_backup.sh b/pg_backup.sh index a99c70c..9f26058 100755 --- a/pg_backup.sh +++ b/pg_backup.sh @@ -4,23 +4,13 @@ set -e -# constants +# dump goes at the volume root so backupbot's backup.sql label finds it BACKUP_FILE='/var/lib/postgresql/backup.sql' DATADIR="${PGDATA:-/var/lib/postgresql/18/docker}" DB_NAME="${POSTGRES_DB:-discourse}" -# The bootstrap superuser (install user, oid 10) differs between deployments -# (`postgres` on bitnami-origin clusters, `discourse` on others). Detect it at -# runtime over the local trust socket rather than hard-coding a name. -detect_superuser() { - local u name - for u in discourse postgres; do - name="$(psql -U "$u" -d "$DB_NAME" -tAc 'select rolname from pg_roles where oid = 10' 2>/dev/null | tr -d '[:space:]')" - if [ -n "$name" ]; then echo "$name"; return 0; fi - done - echo postgres -} -SU="$(detect_superuser)" +# bootstrap superuser for the dump/drop/recreate; same POSTGRES_USER the db service sets +SU="${POSTGRES_USER:-postgres}" function backup { pg_dump -U "$SU" "$DB_NAME" | gzip > "$BACKUP_FILE" diff --git a/release/1.0.0+3.5.3 b/release/1.0.0+3.5.3 index 1d620bd..bcb61cd 100644 --- a/release/1.0.0+3.5.3 +++ b/release/1.0.0+3.5.3 @@ -8,3 +8,13 @@ Rename these in your app's .env (the values carry over): DISCOURSE_SMTP_USER --> DISCOURSE_SMTP_USER_NAME DISCOURSE_SMTP_AUTH --> DISCOURSE_SMTP_AUTHENTICATION DISCOURSE_SMTP_PROTOCOL --> DISCOURSE_SMTP_ENABLE_START_TLS (takes a boolean true/false, not the old tls/ssl value, so translate it rather than copying it straight across) + +The database now runs the discourse/postgres image, which upgrades your existing +postgres cluster to a new major version in place on first boot (no dump/restore). + +That upgrade runs as the cluster's bootstrap superuser ("install user"), which the +recipe sets via POSTGRES_USER, defaulting to `postgres`. This default is correct +for clusters created by this recipe and the old bitnami recipe, so most operators +need to do nothing. ONLY if your cluster was bootstrapped with a different +superuser (e.g. `discourse`) must you set POSTGRES_USER in your app's .env before +upgrading -- otherwise pg_upgrade aborts with an install-user mismatch.