Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
dd644d8
Update dependency go to v1.27.4
renovate[bot] Nov 15, 2026
b564dcd
Update actions/setup-go digest to d8cbb80
renovate[bot] Nov 17, 2026
d2f1a15
Update postgres:18-bookworm Docker digest to 194e55f
renovate[bot] Nov 20, 2026
18ec4fc
Update postgres:18-alpine Docker digest to 0115267
renovate[bot] Nov 21, 2026
3df5e80
Update postgres Docker tag to v19
renovate[bot] Nov 23, 2026
b896406
chore(deps): integrate backup image update prerequisite
kaanyagci Nov 23, 2026
1d7ff6c
chore(deps): integrate reviewed PostgreSQL image prerequisites
kaanyagci Nov 23, 2026
596929e
chore(ci): integrate Go toolchain and image prerequisites
kaanyagci Nov 23, 2026
c15ff47
fix(postgres): validate PostgreSQL 19 fallback compatibility
kaanyagci Nov 23, 2026
e31453b
chore(deps): integrate reviewed PostgreSQL prerequisites
kaanyagci Nov 23, 2026
0c18631
Update postgres:18-alpine Docker digest to 0115267
renovate[bot] Nov 21, 2026
9fd9b9a
Update dependency go to v1.27.4
renovate[bot] Nov 15, 2026
54822fd
Update actions/setup-go digest to d8cbb80
renovate[bot] Nov 17, 2026
39a66ec
chore(integration): align postgres fallback after native prefix merge
kaanyagci Nov 23, 2026
2ae0aa8
Update postgres:18-bookworm Docker digest to e742a26
renovate[bot] Nov 24, 2026
66ecfab
chore(postgres): integrate reviewed backup image prerequisite for 86
kaanyagci Nov 24, 2026
90cc7db
chore(postgres): integrate reviewed backup image prerequisite for 87
kaanyagci Nov 24, 2026
3469c1c
chore(postgres): integrate reviewed backup image prerequisite for 112
kaanyagci Nov 24, 2026
9d69a59
chore(postgres): retain reviewed major fallback above backup digest u…
kaanyagci Nov 24, 2026
0460462
chore(postgres): preserve reviewed fallback after native prefix merge
kaanyagci Nov 24, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/betacrew-safety.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ jobs:
run: python3 scripts/test-betacrew-safety.py
- name: Real encrypted database restore over verified TLS
run: python3 scripts/test-betacrew-encrypted-restore.py
- name: Verify configured fallback backup image
run: |
POSTGRES_TEST_IMAGE=$(sed -n 's/.*BETACREW_BACKUP_IMAGE:-\([^}]*\)}.*/\1/p' compose.host.yml) \
python3 scripts/test-betacrew-encrypted-restore.py
- name: Encryption contract (mock database dump)
run: bash scripts/test-betacrew-backup.sh
- name: Configuration and shell syntax
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/jotwink-safety.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ jobs:
run: python3 scripts/test-jotwink-safety.py
- name: Real encrypted database restore over verified TLS
run: python3 scripts/test-jotwink-encrypted-restore.py
- name: Verify configured fallback backup image
run: |
POSTGRES_TEST_IMAGE=$(sed -n 's/.*JOTWINK_BACKUP_IMAGE:-\([^}]*\)}.*/\1/p' compose.host.yml) \
python3 scripts/test-jotwink-encrypted-restore.py
- name: Encryption contract (mock database dump)
run: bash scripts/test-jotwink-backup.sh
- name: Configuration and shell syntax
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -923,27 +923,27 @@ script at `/srv/makepad/visitaki-backups/visitaki-encrypted-backup.py` and the t
pass. Enable only the Visitaki timer; preserve other applications' jobs. MinIO
objects require separate backup coverage.

## PostgreSQL 18 default and existing clusters
## PostgreSQL 19 default and existing clusters

The configuration validator requires matching immutable fallback digests across
the base, host and backup-service Compose references. Regression tests reject a
split fallback pin and an accidental production major-version override change.

The Compose fallback image is PostgreSQL 18. Production and canary environment
The Compose fallback image is PostgreSQL 19. Production and canary environment
files still explicitly select PostgreSQL 16; changing the default does not perform
a production major upgrade. Both Compose entry points set `PGDATA` explicitly to
`/var/lib/postgresql/data`, matching the existing bind mount for either version.
Without this setting, the PostgreSQL 18 image rejects that legacy mount layout.
Without this setting, the PostgreSQL 19 image rejects that legacy mount layout.

Never point PostgreSQL 18 at an existing 16 data directory as an upgrade method.
Never point PostgreSQL 19 at an existing 16 data directory as an upgrade method.
The server must refuse that directory, and the 16 image must be able to restart it
unchanged. A real major upgrade requires a separate target directory, verified
backup/restore or a reviewed `pg_upgrade` procedure, application compatibility
checks, and an explicit cutover of the environment pin. Keep the predecessor
directory and backup until rollback acceptance is complete.

`./scripts/test-postgres-major-compat.sh` uses isolated volumes and synthetic rows
to check fresh 18 persistence, logical 16-to-18 restore, refusal of an in-place
to check fresh 19 persistence, logical 16-to-19 restore, refusal of an in-place
image swap, and successful restart of the untouched 16 cluster. These tests do
not authorize or claim a production data migration.

Expand Down
2 changes: 1 addition & 1 deletion compose.betacrew.host.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
services:
betacrew_backup:
image: ${BETACREW_BACKUP_IMAGE:-postgres:18-bookworm@sha256:e742a2668255221388004f3a42b6150a2103f5054ab3a4a93ae9e4f01e551c35}
image: ${BETACREW_BACKUP_IMAGE:-postgres:19-bookworm@sha256:f4859caf96de494e38efa69ed703b08a5bbd9605e152e604f2daec8841c87c41}
user: "999:999"
network_mode: host
command: [/usr/local/bin/run-betacrew-backup-loop.sh]
Expand Down
8 changes: 4 additions & 4 deletions compose.host.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
services:
postgres:
image: ${POSTGRES_IMAGE:-postgres:18-alpine@sha256:0115267ab5a509022df9319c77be365cef335adb71556c75f60f5360ee247e71}
image: ${POSTGRES_IMAGE:-postgres:19-alpine@sha256:cac45fb483caee3668946088a1c0532db89d5285c28dbfeac889b4068296e06f}
network_mode: host
environment:
PGDATA: /var/lib/postgresql/data
Expand Down Expand Up @@ -38,7 +38,7 @@ services:
max-file: "${MAKEPAD_POSTGRES_LOG_MAX_FILES:-5}"

runtrace_backup:
image: ${POSTGRES_IMAGE:-postgres:18-alpine@sha256:0115267ab5a509022df9319c77be365cef335adb71556c75f60f5360ee247e71}
image: ${POSTGRES_IMAGE:-postgres:19-alpine@sha256:cac45fb483caee3668946088a1c0532db89d5285c28dbfeac889b4068296e06f}
user: "70:70"
network_mode: host
command:
Expand Down Expand Up @@ -134,7 +134,7 @@ services:
max-file: "${MAKEPAD_POSTGRES_BACKUP_LOG_MAX_FILES:-5}"

jotwink_backup:
image: ${JOTWINK_BACKUP_IMAGE:-postgres:18-bookworm@sha256:e742a2668255221388004f3a42b6150a2103f5054ab3a4a93ae9e4f01e551c35}
image: ${JOTWINK_BACKUP_IMAGE:-postgres:19-bookworm@sha256:f4859caf96de494e38efa69ed703b08a5bbd9605e152e604f2daec8841c87c41}
profiles: [jotwink]
user: "999:999"
network_mode: host
Expand Down Expand Up @@ -183,7 +183,7 @@ services:
max-file: "${MAKEPAD_POSTGRES_BACKUP_LOG_MAX_FILES:-5}"

betacrew_backup:
image: ${BETACREW_BACKUP_IMAGE:-postgres:18-bookworm@sha256:e742a2668255221388004f3a42b6150a2103f5054ab3a4a93ae9e4f01e551c35}
image: ${BETACREW_BACKUP_IMAGE:-postgres:19-bookworm@sha256:f4859caf96de494e38efa69ed703b08a5bbd9605e152e604f2daec8841c87c41}
profiles: [betacrew]
user: "999:999"
network_mode: host
Expand Down
2 changes: 1 addition & 1 deletion compose.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
services:
postgres:
image: ${POSTGRES_IMAGE:-postgres:18-alpine@sha256:0115267ab5a509022df9319c77be365cef335adb71556c75f60f5360ee247e71}
image: ${POSTGRES_IMAGE:-postgres:19-alpine@sha256:cac45fb483caee3668946088a1c0532db89d5285c28dbfeac889b4068296e06f}
environment:
PGDATA: /var/lib/postgresql/data
command:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# PostgreSQL 18 major-version upgrade
# PostgreSQL 19 major-version upgrade

The repository is pinned to PostgreSQL 18. `scripts/preflight-postgres-major.sh`
refuses to start that image against a data directory initialized by an older
major version. A normal deploy is not an upgrade mechanism.
The Compose fallback is pinned to PostgreSQL 19; the production and canary
environment files retain PostgreSQL 16. `scripts/preflight-postgres-major.sh`
refuses to start the fallback image against a data directory initialized by an
older major version. A normal deploy is not an upgrade mechanism.

## Required gate

Expand All @@ -12,11 +13,11 @@ stopping writers, require all of the following:
- a fresh certificate-verified logical backup of every database, including
`amiary`, `amiary_canary`, and `keycloak_amiary`;
- verified checksums and `pg_restore --list` for every custom-format archive;
- a successful isolated restore drill using the PostgreSQL 18 client/server;
- a successful isolated restore drill using the PostgreSQL 19 client/server;
- a separately protected globals export and an inventory of extensions;
- measured rollback time within the four-hour RTO; and
- a filesystem-level snapshot of the PostgreSQL 16 data directory retained
unchanged until the PostgreSQL 18 validation window closes.
unchanged until the PostgreSQL 19 validation window closes.

## Cutover outline

Expand All @@ -27,7 +28,7 @@ stopping writers, require all of the following:
path. Never overwrite or delete it during the cutover.
4. Create a new empty directory at the configured data path with the existing
PostgreSQL uid/gid and mode, then run the major-version preflight.
5. Start the pinned PostgreSQL 18 image, restore reviewed globals and all
5. Start the pinned PostgreSQL 19 image, restore reviewed globals and all
database archives, and re-run every idempotent application bootstrap.
6. Run ownership, grants, RLS isolation, migration checksum, TLS/HBA, backup,
application smoke, and latency checks before enabling writers.
Expand Down
2 changes: 1 addition & 1 deletion envs/production/compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ services:
memory: ${MAKEPAD_POSTGRES_MEMORY_RESERVATION:-512M}

runtrace_backup:
image: ${POSTGRES_IMAGE:-postgres:18-alpine@sha256:0115267ab5a509022df9319c77be365cef335adb71556c75f60f5360ee247e71}
image: ${POSTGRES_IMAGE:-postgres:19-alpine@sha256:cac45fb483caee3668946088a1c0532db89d5285c28dbfeac889b4068296e06f}
user: "70:70"
command:
- /usr/local/bin/run-runtrace-backup-loop.sh
Expand Down
4 changes: 2 additions & 2 deletions scripts/preflight-postgres-major.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
set -euo pipefail

data_path=${1:?Usage: preflight-postgres-major.sh <data-path> [expected-major]}
expected_major=${2:-18}
expected_major=${2:-19}

if [[ "${data_path}" != /* || "${data_path}" == / || "${data_path}" == /var || "${data_path}" == /var/lib ]]; then
echo "PostgreSQL data path must be a narrow absolute path." >&2
Expand Down Expand Up @@ -38,6 +38,6 @@ fi

actual_major=$(tr -d '[:space:]' < "${version_file}")
if [[ "${actual_major}" != "${expected_major}" ]]; then
echo "Refusing PostgreSQL ${expected_major} against data initialized by PostgreSQL ${actual_major}. Complete docs/postgresql-18-upgrade.md first." >&2
echo "Refusing PostgreSQL ${expected_major} against data initialized by PostgreSQL ${actual_major}. Complete docs/postgresql-19-upgrade.md first." >&2
exit 1
fi
4 changes: 2 additions & 2 deletions scripts/test-betacrew-encrypted-restore.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import uuid

SCRIPTS=Path(__file__).resolve().parent
IMAGE='postgres@sha256:721873c34ceb9f8d8fc265984940dc982404c105f19ad51be9fdc5970a6080ea'
IMAGE=os.environ.get('POSTGRES_TEST_IMAGE', 'postgres@sha256:721873c34ceb9f8d8fc265984940dc982404c105f19ad51be9fdc5970a6080ea')
container='betacrew-encrypted-test-'+uuid.uuid4().hex[:10]

def run(*args, **kw):
Expand All @@ -32,7 +32,7 @@ def run(*args, **kw):
def sql(database,query):
return run('docker','exec','-i',container,'psql','-U','postgres','-d',database,'-XAt','-v','ON_ERROR_STOP=1',input=query)
try:
run('docker','run','-d','--network','none','--name',container,'--tmpfs','/var/lib/postgresql/data','--volume',tmp+':'+tmp,'-e','POSTGRES_PASSWORD=disposable-fixture-password',IMAGE)
run('docker','run','-d','--network','none','--name',container,'--tmpfs','/var/lib/postgresql/data','--volume',tmp+':'+tmp,'-e','PGDATA=/var/lib/postgresql/data','-e','POSTGRES_PASSWORD=disposable-fixture-password',IMAGE)
for _ in range(30):
if subprocess.run(['docker','exec',container,'pg_isready','-U','postgres'],capture_output=True).returncode==0:break
time.sleep(1)
Expand Down
4 changes: 2 additions & 2 deletions scripts/test-jotwink-encrypted-restore.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import uuid

SCRIPTS=Path(__file__).resolve().parent
IMAGE='postgres@sha256:721873c34ceb9f8d8fc265984940dc982404c105f19ad51be9fdc5970a6080ea'
IMAGE=os.environ.get('POSTGRES_TEST_IMAGE', 'postgres@sha256:721873c34ceb9f8d8fc265984940dc982404c105f19ad51be9fdc5970a6080ea')
container='jotwink-encrypted-test-'+uuid.uuid4().hex[:10]

def run(*args, **kw):
Expand All @@ -32,7 +32,7 @@ def run(*args, **kw):
def sql(database,query):
return run('docker','exec','-i',container,'psql','-U','postgres','-d',database,'-XAt','-v','ON_ERROR_STOP=1',input=query)
try:
run('docker','run','-d','--network','none','--name',container,'--tmpfs','/var/lib/postgresql/data','--volume',tmp+':'+tmp,'-e','POSTGRES_PASSWORD=disposable-fixture-password',IMAGE)
run('docker','run','-d','--network','none','--name',container,'--tmpfs','/var/lib/postgresql/data','--volume',tmp+':'+tmp,'-e','PGDATA=/var/lib/postgresql/data','-e','POSTGRES_PASSWORD=disposable-fixture-password',IMAGE)
for _ in range(30):
if subprocess.run(['docker','exec',container,'pg_isready','-U','postgres'],capture_output=True).returncode==0:break
time.sleep(1)
Expand Down
4 changes: 2 additions & 2 deletions scripts/test-postgres-fallback-pins.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def test_host_fallback_digest_drift_is_rejected(self):
path = self.root / 'compose.host.yml'
text = path.read_text()
import re
text, count = re.subn(r'postgres:18-alpine@sha256:[0-9a-f]{64}', 'postgres:18-alpine@sha256:' + '0' * 64, text, count=1)
text, count = re.subn(r'postgres:19-alpine@sha256:[0-9a-f]{64}', 'postgres:19-alpine@sha256:' + '0' * 64, text, count=1)
self.assertEqual(count, 1)
path.write_text(text)
result = self.validate()
Expand All @@ -35,7 +35,7 @@ def test_host_fallback_digest_drift_is_rejected(self):

def test_production_major_override_change_is_rejected(self):
path = self.root / 'envs/production/.env.db'
path.write_text(path.read_text().replace('POSTGRES_IMAGE=postgres:16-alpine@', 'POSTGRES_IMAGE=postgres:18-alpine@'))
path.write_text(path.read_text().replace('POSTGRES_IMAGE=postgres:16-alpine@', 'POSTGRES_IMAGE=postgres:19-alpine@'))
result = self.validate()
self.assertNotEqual(result.returncode, 0)
self.assertIn('must pin POSTGRES_IMAGE', result.stdout + result.stderr)
Expand Down
8 changes: 4 additions & 4 deletions scripts/test-postgres-major-compat.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ cd "$(dirname "$0")/.."
old_image=$(sed -n 's/^POSTGRES_IMAGE=//p' envs/production/.env.db)
new_image=$(sed -n 's/.*POSTGRES_IMAGE:-\([^}]*\)}.*/\1/p' compose.yml | head -1)
data_path=$(sed -n 's/^ PGDATA: //p' compose.yml)
[[ "$old_image" == postgres:16-alpine@sha256:* && "$new_image" == postgres:18-alpine@sha256:* ]]
[[ "$old_image" == postgres:16-alpine@sha256:* && "$new_image" == postgres:19-alpine@sha256:* ]]
prefix="postgres-major-review-$$-${RANDOM}"
legacy="${prefix}-legacy"
candidate="${prefix}-candidate"
probe="${prefix}-probe"
old_volume="${prefix}-16"
new_volume="${prefix}-18"
new_volume="${prefix}-19"
cleanup() {
docker rm -fv "$legacy" "$candidate" "$probe" >/dev/null 2>&1 || true
docker volume rm "$old_volume" "$new_volume" >/dev/null 2>&1 || true
Expand Down Expand Up @@ -48,7 +48,7 @@ docker run -d --name "$candidate" --network none --memory 256m \
-e POSTGRES_HOST_AUTH_METHOD=trust "${data_args[@]}" \
-v "$new_volume:/var/lib/postgresql/data" "$new_image" >/dev/null
ready "$candidate"
[[ $(docker exec "$candidate" cat /var/lib/postgresql/data/PG_VERSION) == 18 ]]
[[ $(docker exec "$candidate" cat /var/lib/postgresql/data/PG_VERSION) == 19 ]]
docker exec "$candidate" createdb -U postgres compatibility
docker exec "$legacy" pg_dump -U postgres -Fc compatibility |
docker exec -i "$candidate" pg_restore -U postgres -d compatibility --exit-on-error
Expand All @@ -72,4 +72,4 @@ docker start "$legacy" >/dev/null
ready "$legacy"
[[ $(docker exec "$legacy" psql -U postgres -d compatibility -Atc "$query") == "$expected" ]]
[[ $(docker exec "$legacy" cat /var/lib/postgresql/data/PG_VERSION) == 16 ]]
printf '%s\n' 'PASS: fresh 18 uses the mounted directory, logical 16-to-18 restore preserves rows, and an in-place major swap refuses safely while 16 can restart.'
printf '%s\n' 'PASS: fresh 19 uses the mounted directory, logical 16-to-19 restore preserves rows, and an in-place major swap refuses safely while 16 can restart.'
4 changes: 2 additions & 2 deletions scripts/validate-postgres-config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -227,14 +227,14 @@ for required in (
require("<<'EOF'" not in manual_deploy_workflow, "Manual deploy workflow must not embed the oversized remote deployment heredoc.")
require("DEPLOY_BRIO_STAGING_DB_NETWORK must be makepad_brio_staging_db" in manual_deploy, "Manual deploy must reject a non-canonical Brio database network secret.")
require("Brio deployment bundle must use makepad_brio_staging_db" in manual_deploy, "Remote deploy must revalidate the canonical Brio database network.")
require("postgres:18-alpine@sha256:" in base_compose, "Base Compose must pin the PostgreSQL 18 default to an immutable digest.")
require("postgres:19-alpine@sha256:" in base_compose, "Base Compose must pin the PostgreSQL 19 default to an immutable digest.")
fallback_images = []
for label, content, expected_count in (
("base", base_compose, 1),
("host", host_compose, 2),
("production", production_compose, 1),
):
images = re.findall(r"\$\{POSTGRES_IMAGE:-(postgres:18-alpine@sha256:[0-9a-f]{64})\}", content)
images = re.findall(r"\$\{POSTGRES_IMAGE:-(postgres:19-alpine@sha256:[0-9a-f]{64})\}", content)
require(len(images) == expected_count, f"{label} Compose must retain every immutable PostgreSQL fallback image.")
fallback_images.extend(images)
require(len(set(fallback_images)) == 1, "PostgreSQL fallback image digests must match across Compose entry points and backup services.")
Expand Down