mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-07 04:12:04 +00:00
The compose file runs Postgres 18. An install from v1.45 or earlier keeps its Postgres 16 data in `pgdata`, which 18 cannot open, so a one-shot `db-upgrade` service moves it on the first start: it starts Postgres 16 on the old volume inside its own container, streams a dump into 18 in one transaction, compares every table's row count, gathers planner statistics and marks the old volume as moved. The app waits for it to succeed. The old volume is never changed apart from the marker, so the way back is the previous image and volume lines. A move cut short leaves a "moving" marker and runs again from scratch; an emptied new volume after a finished move is refused rather than refilled with the old state. scripts/compose-db-upgrade-check.sh plays all of it against real containers from the v1.45.0 compose file, and runs in CI on every change to the compose file. Pull requests run the integration suite and e2e on Postgres 18; the nightly integration run keeps 16 covered for installs that bring their own database.
52 lines
1.6 KiB
YAML
52 lines
1.6 KiB
YAML
name: Compose database move
|
|
|
|
# Plays the Postgres 16 -> 18 move in docker-compose.yml against real
|
|
# containers: a v1.45 database with every migration applied, then the current
|
|
# compose file's `db-upgrade` on its first start, a second start, a move cut
|
|
# short, an emptied new volume and a new install. The service runs once on an
|
|
# operator's host and has no second chance there, so every change to the
|
|
# compose file or to the check runs it here first.
|
|
# `scripts/compose-db-upgrade-check.sh` is the same check, runnable locally.
|
|
|
|
on:
|
|
pull_request:
|
|
branches: [main]
|
|
paths:
|
|
- docker-compose.yml
|
|
- scripts/compose-db-upgrade-check.sh
|
|
- .github/workflows/compose-db-upgrade.yml
|
|
push:
|
|
branches: [main]
|
|
paths:
|
|
- docker-compose.yml
|
|
- scripts/compose-db-upgrade-check.sh
|
|
- .github/workflows/compose-db-upgrade.yml
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
move:
|
|
name: Postgres 16 -> 18 move
|
|
runs-on: ubuntu-24.04
|
|
timeout-minutes: 20
|
|
steps:
|
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
|
|
# The check reads the v1.45 compose file from its tag.
|
|
- name: Fetch the v1.45.0 tag
|
|
run: git fetch --no-tags --depth=1 origin tag v1.45.0
|
|
|
|
- uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413 # v6.1.0
|
|
|
|
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
|
|
with:
|
|
node-version: 22
|
|
cache: pnpm
|
|
|
|
- run: pnpm install --frozen-lockfile
|
|
|
|
- name: Move check
|
|
run: bash scripts/compose-db-upgrade-check.sh
|