chore: drop parallel-run setup, document direct rollout and rollback

The UI goes live on the main domain directly, so the second-instance
compose file and the AUTO_RULE_SYNC_DISABLED switch are not needed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Leon TonhäuserandClaude Opus 5.5 committed 2026-11-30 18:30:44 +01:00
1 parent affa046b4a
commit c40ccf77cf
5 files changed
+21 -128

No files matched your search

-6
View File
@@ -26,9 +26,3 @@ LEGAL_TERMS_URL=https://leon-tonhaeuser.de/agb
# Optional bearer token to trigger the sync externally via # Optional bearer token to trigger the sync externally via
# POST /api/cron/album-sync (Authorization: Bearer <CRON_SECRET>). # POST /api/cron/album-sync (Authorization: Bearer <CRON_SECRET>).
# CRON_SECRET=replace-with-a-long-random-secret # CRON_SECRET=replace-with-a-long-random-secret
# Parallel run of the new UI (see docs/operations.md §8). Only needed while
# compose.parallel.yaml is in use; the parallel container sets
# AUTO_RULE_SYNC_DISABLED=true itself so the sync does not run twice.
# PARALLEL_BASE_URL=https://neu.redaktionen.leon-tonhaeuser.de
# PARALLEL_PORT=3001
-40
View File
@@ -1,40 +0,0 @@
# Parallel run of the new (Sakani) UI next to the live portal: same database,
# same Immich, own subdomain. Run it from the LIVE checkout so the service joins
# the live compose project and its networks — see docs/operations.md §8:
#
# docker compose -f compose.yaml -f ../portal-sakani/compose.parallel.yaml up -d portal-app-next
#
# The image is built beforehand from the Sakani branch checkout:
# docker build -t portal-app:sakani ../portal-sakani
services:
portal-app-next:
image: ${PARALLEL_IMAGE:-portal-app:sakani}
container_name: portal-app-next
restart: unless-stopped
ports:
- "${PARALLEL_PORT:-3001}:3000"
environment:
DATABASE_URL: ${DATABASE_URL:-postgres://portal:change-me@portal-db:5432/portal}
BETTER_AUTH_SECRET: ${BETTER_AUTH_SECRET}
# Public URL of the parallel instance (links in e-mails, auth callbacks).
BETTER_AUTH_URL: ${PARALLEL_BASE_URL:?set PARALLEL_BASE_URL in .env, e.g. https://neu.redaktionen.leon-tonhaeuser.de}
IMMICH_BASE_URL: ${IMMICH_BASE_URL}
IMMICH_API_KEY: ${IMMICH_API_KEY}
SMTP_HOST: ${SMTP_HOST}
SMTP_PORT: ${SMTP_PORT:-587}
SMTP_USER: ${SMTP_USER}
SMTP_PASSWORD: ${SMTP_PASSWORD}
SMTP_FROM: ${SMTP_FROM}
LEGAL_IMPRINT_URL: ${LEGAL_IMPRINT_URL:-https://leon-tonhaeuser.de/impressum}
LEGAL_PRIVACY_URL: ${LEGAL_PRIVACY_URL:-https://leon-tonhaeuser.de/datenschutz}
LEGAL_TERMS_URL: ${LEGAL_TERMS_URL:-https://leon-tonhaeuser.de/agb}
# The live instance keeps running the album auto-rule sync and the cron
# endpoint; the parallel one must not do either a second time.
AUTO_RULE_SYNC_DISABLED: "true"
CRON_SECRET: ""
depends_on:
portal-db:
condition: service_healthy
networks:
- portal-internal
- immich_default
+21 -52
View File
@@ -36,7 +36,6 @@ All production configuration is provided via environment variables (e.g. `.env`
| `LEGAL_TERMS_URL` | Public Nutzungsbedingungen link | `https://leon-tonhaeuser.de/agb` | | `LEGAL_TERMS_URL` | Public Nutzungsbedingungen link | `https://leon-tonhaeuser.de/agb` |
| `AUTO_RULE_SYNC_INTERVAL_SECONDS` | Interval of the album auto-rule sync in seconds (min 30) | `120` (default) | | `AUTO_RULE_SYNC_INTERVAL_SECONDS` | Interval of the album auto-rule sync in seconds (min 30) | `120` (default) |
| `CRON_SECRET` | Optional bearer token for `POST /api/cron/album-sync`; unset disables the endpoint | `openssl rand -hex 32` | | `CRON_SECRET` | Optional bearer token for `POST /api/cron/album-sync`; unset disables the endpoint | `openssl rand -hex 32` |
| `AUTO_RULE_SYNC_DISABLED` | `true` skips the in-process album auto-rule sync (for a second instance on the same DB, see §8) | unset (sync runs) |
--- ---
@@ -143,62 +142,32 @@ docker compose start portal-app
--- ---
## 8. Parallel Run of the New UI (Sakani) and Cutover ## 8. Rolling Out a New App Version (e.g. the Sakani UI, v2.0)
The Sakani redesign can run next to the live portal on its own subdomain, against UI releases such as v2.0 change no database schema; the app keeps using the
the **same database and Immich**, until it is accepted. The branch contains no existing `portal-db`, so all editorials, grants, usages, billing reports and
database migrations, so both versions work on the same schema. announcements carry over unchanged.
**What "parallel" means in practice** 1. Back up the database (see §6):
- Every action in the new UI is real: approvals, album grants, downloads, usages,
billing reports and announcements land in the production database.
- Sessions are per domain: users log in separately on the new subdomain.
- E-mails sent by the parallel instance (verification, password reset, album
notifications) link to the new subdomain (`PARALLEL_BASE_URL`).
- Only the live instance runs the album auto-rule sync and the cron endpoint; the
parallel one has `AUTO_RULE_SYNC_DISABLED=true` and no `CRON_SECRET`.
**Start the parallel instance** (on the server, next to the live checkout):
1. Push the branch, then check it out beside the live checkout:
```bash ```bash
git fetch origin && git worktree add ../portal-sakani origin/<sakani-branch> scripts/backup-db.sh /var/backups/immich-portal
``` ```
2. Build its image: 2. Note the running commit for a rollback: `git rev-parse HEAD`.
3. Update and rebuild:
```bash ```bash
docker build -t portal-app:sakani ../portal-sakani git pull
docker compose build portal-app
docker compose --profile ops run --rm migrate # no-op when there are no new migrations
docker compose up -d portal-app
``` ```
3. In the live `.env`, add the public URL of the new subdomain: 4. Verify: `GET /api/health/ready` → 200, then log in as admin and as an
```bash editorial account.
PARALLEL_BASE_URL=https://neu.redaktionen.leon-tonhaeuser.de
```
4. Start it from the **live** checkout (so it joins the live networks and DB):
```bash
docker compose -f compose.yaml -f ../portal-sakani/compose.parallel.yaml up -d portal-app-next
```
5. DNS: point the subdomain at the server. Reverse proxy (Zoraxy): add a rule
`neu.redaktionen…` → `localhost:3001` with the same settings as the live rule
(no buffering for `/api/downloads/`, `X-Forwarded-For` as described in §3).
6. Smoke test: `GET https://<subdomain>/api/health/ready` → 200, then log in as
admin and as an editorial account.
**Update the parallel instance** after new commits on the branch: **Rollback**: check out the noted commit (`git checkout <commit>`), then
`git -C ../portal-sakani pull`, rebuild the image (step 2), re-run step 4. `docker compose build portal-app && docker compose up -d portal-app`, and
return to `main` with `git checkout main` afterwards. A UI-only release needs no
**Roll back** at any time: stop only the parallel container — the live portal is database restore.
untouched.
```bash
docker compose -f compose.yaml -f ../portal-sakani/compose.parallel.yaml rm -sf portal-app-next
```
**Cutover** (the new UI replaces the old one on the main domain):
1. Merge the Sakani branch into `main`.
2. In the live checkout: `git pull`, then
`docker compose build portal-app && docker compose up -d portal-app`.
(`BETTER_AUTH_URL` stays the main domain; no other env changes are needed.)
3. Stop the parallel container (rollback command above), remove the Zoraxy rule
or turn it into a redirect to the main domain, delete `PARALLEL_BASE_URL` from
`.env`, and `git worktree remove ../portal-sakani`.
**Release notes popup**: users see "Was ist neu?" once per version after
signing in. For the next release, bump `RELEASE.version` and replace the notes
in `src/components/layout/release-notes.tsx`.
-24
View File
@@ -1,24 +0,0 @@
import { afterEach, expect, test, vi } from "vitest";
const { startAutoRuleScheduler } = vi.hoisted(() => ({ startAutoRuleScheduler: vi.fn() }));
vi.mock("@/modules/albums/auto-rule-scheduler", () => ({ startAutoRuleScheduler }));
import { register } from "./instrumentation";
afterEach(() => {
vi.unstubAllEnvs();
startAutoRuleScheduler.mockClear();
});
test("starts the auto-rule sync on the node runtime", async () => {
vi.stubEnv("NEXT_RUNTIME", "nodejs");
await register();
expect(startAutoRuleScheduler).toHaveBeenCalledOnce();
});
test("AUTO_RULE_SYNC_DISABLED=true keeps a second instance from syncing", async () => {
vi.stubEnv("NEXT_RUNTIME", "nodejs");
vi.stubEnv("AUTO_RULE_SYNC_DISABLED", "true");
await register();
expect(startAutoRuleScheduler).not.toHaveBeenCalled();
});
-6
View File
@@ -5,12 +5,6 @@ export async function register(): Promise<void> {
if (process.env.NEXT_RUNTIME !== "nodejs") { if (process.env.NEXT_RUNTIME !== "nodejs") {
return; return;
} }
// A second instance on the same DB (e.g. the parallel Sakani UI) must not
// run the sync a second time; the live instance keeps doing it.
if (process.env.AUTO_RULE_SYNC_DISABLED === "true") {
console.log("[auto-rule-sync] disabled via AUTO_RULE_SYNC_DISABLED");
return;
}
try { try {
const { startAutoRuleScheduler } = await import("@/modules/albums/auto-rule-scheduler"); const { startAutoRuleScheduler } = await import("@/modules/albums/auto-rule-scheduler");
startAutoRuleScheduler(); startAutoRuleScheduler();