Files
discourse/migrate-uploads.sh
notplants 53ba0910a6
All checks were successful
cc-ci/testme cc-ci: success
feat(discourse): switch app to official discourse/discourse image (experimental)
Replaces the paywalled bitnamilegacy app with the official discourse/discourse
image behind Traefik (HTTP-only via an install-ssl override; sidekiq is internal
so its service is dropped). DB is reused as-is; uploads migrate from a legacy
bitnami volume via an idempotent, non-destructive runit hook. db keeps
pgvector/pgvector:pg17 with the install-user-aware pg_upgrade entrypoint, plus
db/redis healthchecks and updated README metadata (lint R002/R007).

Verified on cctest: fresh install, upgrade-from-bitnami-pg17, and
upgrade-from-bitnami-pg13 (incl. 13->17) all serve with data intact.
Upstream marks discourse/discourse experimental; hold prod cutover.

Recipe 0.8.1+3.5.0 -> 1.0.0+3.5.3 (major: new image, env/volume/port changes).
2026-06-16 23:25:29 +00:00

25 lines
1.1 KiB
Bash
Executable File

#!/bin/bash
# One-time, idempotent, NON-destructive migration of uploads + backups from a
# legacy bitnami discourse volume into the official image's /shared.
#
# Runs on every boot as a runit 1.d hook but no-ops after the first success
# (sentinel) and when there is no legacy volume mounted (fresh installs). It only
# ever COPIES from the read-only /legacy mount, so an interruption just re-copies
# on the next boot — there is no move/delete to leave the data half-migrated.
set -e
SENTINEL=/shared/.bitnami-uploads-migrated
[ -e "$SENTINEL" ] && exit 0
if [ -d /legacy/public/uploads ]; then
echo "[migrate-uploads] copying bitnami uploads/backups -> /shared"
mkdir -p /shared/uploads /shared/backups
cp -a /legacy/public/uploads/. /shared/uploads/ 2>/dev/null || true
cp -a /legacy/public/backups/. /shared/backups/ 2>/dev/null || true
# discourse runs as uid 1000; the official boot also chowns /shared, but be explicit
chown -R discourse:discourse /shared/uploads /shared/backups 2>/dev/null || true
echo "[migrate-uploads] done"
fi
touch "$SENTINEL"