Reopen advanced edits from their saved recipe, seed or take over the quick editor from them, refresh thumbnails after a save, and add an edited-only download. Also fixes the Lumenroom library collapsing to slivers on large shoots and documents deploying both containers on a new host. 🤖 Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com>
This commit is contained in:
@@ -13,6 +13,7 @@ Built with Next.js 15, React 19, TypeScript, PostgreSQL 16, and Drizzle ORM. It
|
||||
- [Features](#features)
|
||||
- [Stack](#stack)
|
||||
- [Quick start (Docker)](#quick-start-docker)
|
||||
- [Deploying the combined stack on another system](#deploying-the-combined-stack-on-another-system)
|
||||
- [Local development](#local-development)
|
||||
- [Configuration](#configuration)
|
||||
- [Email delivery](#email-delivery)
|
||||
@@ -108,10 +109,19 @@ cp .env.example .env
|
||||
docker compose up -d db
|
||||
docker compose --profile tools build migrate
|
||||
docker compose --profile tools run --rm migrate # migrations + seed
|
||||
docker compose up -d --build app
|
||||
docker compose up -d --build app lumenroom
|
||||
```
|
||||
|
||||
Open <http://localhost:3000>. The app publishes on host port `3000`; Postgres is published on `5433` but bound to `127.0.0.1` by default (set `POSTGRES_BIND=0.0.0.0` only if another host must reach it).
|
||||
Open <http://localhost:3000>. The advanced photo editor (Lumenroom) is the
|
||||
vendored second container and publishes on <http://localhost:8787>; it is
|
||||
optional, and the **Advanced** button stays disabled until `BRIDGE_SECRET` and
|
||||
`LUMENROOM_URL` are set in `.env` (see [step 15](#15-advanced-photo-editor-bridge-optional)).
|
||||
The app publishes on host port `3000`; Postgres is published on `5433` but bound to `127.0.0.1` by default (set `POSTGRES_BIND=0.0.0.0` only if another host must reach it).
|
||||
|
||||
```bash
|
||||
curl -fsS http://localhost:3000/api/health # dashboard
|
||||
curl -fsS http://localhost:8787/api/health # advanced editor
|
||||
```
|
||||
|
||||
With the default local configuration (`MAGIC_LINK_DEV_TRANSPORT=true`), requesting a sign-in link shows it in the browser and prints it in the app log:
|
||||
|
||||
@@ -123,6 +133,93 @@ Sign in with the seeded admin, `admin@glenloch.local`. Other seeded accounts: `c
|
||||
|
||||
Migrations are **not** run automatically by `docker compose up`. Re-run the `migrate` command after pulling schema changes. The seed is idempotent.
|
||||
|
||||
## Deploying the combined stack on another system
|
||||
|
||||
One clone deploys everything: the dashboard (`app`), the advanced photo editor
|
||||
(`lumenroom`, vendored under `lumenroom/`) and PostgreSQL (`db`). The detailed
|
||||
Ubuntu walkthrough below covers each step; this is the short version for moving
|
||||
the stack to a new host.
|
||||
|
||||
**What the target host needs**
|
||||
|
||||
- Docker Engine 24+ with Compose v2, and sudo access.
|
||||
- A DNS name per app (for example `media.example.org` and `edit.example.org`),
|
||||
or the host's LAN IP if it is not exposed to the internet.
|
||||
- Inbound TCP 80 and 443 only. Ports 3000, 5433 and 8787 stay on the private
|
||||
interface (`APP_BIND`, `POSTGRES_BIND`, `LUMENROOM_BIND` = `127.0.0.1`).
|
||||
- The media export mounted on the host for original photos and videos
|
||||
([step 9](#9-media-storage-on-nfs-or-a-local-path-required-for-event-media)).
|
||||
|
||||
**Get the code and secrets**
|
||||
|
||||
```bash
|
||||
git clone <repository-url> /opt/glenloch-media
|
||||
cd /opt/glenloch-media
|
||||
cp .env.example .env
|
||||
chmod 600 .env
|
||||
|
||||
openssl rand -base64 32 # NEXTAUTH_SECRET
|
||||
openssl rand -hex 32 # CRON_SECRET
|
||||
openssl rand -hex 24 # POSTGRES_PASSWORD (hex avoids URL encoding)
|
||||
openssl rand -hex 32 # BRIDGE_SECRET, shared by app and lumenroom
|
||||
```
|
||||
|
||||
Minimum `.env` for both containers:
|
||||
|
||||
```dotenv
|
||||
NEXTAUTH_URL=https://media.example.org
|
||||
NEXTAUTH_SECRET=<base64 value>
|
||||
PUBLIC_ORIGIN=https://media.example.org
|
||||
APP_ORIGIN=https://media.example.org
|
||||
APP_BIND=127.0.0.1
|
||||
POSTGRES_BIND=127.0.0.1
|
||||
POSTGRES_USER=media
|
||||
POSTGRES_PASSWORD=<hex value>
|
||||
POSTGRES_DB=media
|
||||
DATABASE_URL=postgres://media:<hex value>@localhost:5433/media
|
||||
CRON_SECRET=<hex value>
|
||||
MEDIA_ARCHIVE_DIR=/mnt/glenloch-media
|
||||
|
||||
# Advanced editor bridge
|
||||
LUMENROOM_URL=https://edit.example.org
|
||||
LUMENROOM_BIND=127.0.0.1
|
||||
BRIDGE_SECRET=<hex value>
|
||||
```
|
||||
|
||||
`BRIDGE_SECRET` is passed to both services from this one value; they must match.
|
||||
`LUMENROOM_URL` is the browser-facing editor address, while the app reaches
|
||||
Lumenroom inside the Compose network by service name.
|
||||
|
||||
**Build, migrate, start**
|
||||
|
||||
```bash
|
||||
docker compose config --quiet
|
||||
docker compose up -d db
|
||||
docker compose --profile tools build migrate
|
||||
docker compose --profile tools run --rm migrate
|
||||
docker compose up -d --build app lumenroom
|
||||
docker compose ps
|
||||
curl -fsS http://127.0.0.1:3000/api/health
|
||||
curl -fsS http://127.0.0.1:8787/api/health
|
||||
```
|
||||
|
||||
Both `app` and `lumenroom` must be `healthy`. `docker compose up -d --build`
|
||||
without a service name also works and builds both images; naming them is just an
|
||||
explicit version of the same command.
|
||||
|
||||
**Finish and verify**
|
||||
|
||||
1. Complete first sign-in and admin bootstrap ([step 5](#5-first-sign-in-and-admin-bootstrap)).
|
||||
2. Save the media share in Settings → Media storage ([step 9](#9-media-storage-on-nfs-or-a-local-path-required-for-event-media)).
|
||||
3. Put both hostnames in the reverse proxy ([step 6](#6-reverse-proxy-and-tls-with-caddy)) and reload Caddy.
|
||||
4. Open an event photo and click **Advanced**: the editor should open in a new tab, already signed in, with a banner showing **Save to event**. If it reports the editor is not configured, `BRIDGE_SECRET` or `LUMENROOM_URL` is missing or the two secrets differ.
|
||||
|
||||
**Moving an existing installation.** Run Admin → Backup & restore on the old
|
||||
host, copy the ZIP and `.env` (especially `NEXTAUTH_SECRET`) to the new host,
|
||||
bring the stack up as above, then restore through the same admin panel. Original
|
||||
media comes from the ZIP or the share itself. The `lumenroom-data` volume holds
|
||||
only temporary bridge data and does not need to move.
|
||||
|
||||
## Local development
|
||||
|
||||
```bash
|
||||
@@ -176,6 +273,8 @@ Copy `.env.example` to `.env`; never commit real secrets (`.env*` is ignored, `.
|
||||
| `UPLOAD_DIR` | Training attachments only (`/tmp/uploads` in compose). Event photos and videos never live here. |
|
||||
| `ARCHIVE_DIR`, `NFS_SHARE`, `ARCHIVE_FOLDER` | Mount path inside the container, the reported share, and the default folder. This is the primary storage for original event photos and videos; a named share plus a writable path is required or uploads and photo editing stay disabled. |
|
||||
| `MEDIA_ARCHIVE_DIR` | **Compose-only host path** mounted at `/archive` for the NFS export. |
|
||||
| `LUMENROOM_URL`, `BRIDGE_SECRET` | Advanced editor bridge: the browser-facing address of the Lumenroom container and the shared token secret. Both are required for the **Advanced** button; leave empty to run without the editor. |
|
||||
| `LUMENROOM_PORT`, `LUMENROOM_BIND` | **Compose-only** host publishing for Lumenroom. Default `8787` on all interfaces; set `127.0.0.1` behind a reverse proxy. |
|
||||
| `SENTRY_DSN` | Declared but not wired to any integration. |
|
||||
|
||||
Volumes in Compose: `pgdata`, `outbox-data`, `uploads-data`, and either `archive-data` or the host `MEDIA_ARCHIVE_DIR` bind mount (the latter is what holds original photos and videos). Back these up together.
|
||||
@@ -327,6 +426,11 @@ MAGIC_LINK_DEV_TRANSPORT=true
|
||||
CRON_SECRET=<hex value>
|
||||
POSTMARK_FROM=media@example.org
|
||||
# POSTMARK_SERVER_TOKEN=... # optional; Gmail can be configured in Admin instead
|
||||
|
||||
# Advanced photo editor (optional; omit to run without it)
|
||||
LUMENROOM_URL=https://edit.example.org
|
||||
LUMENROOM_BIND=127.0.0.1
|
||||
BRIDGE_SECRET=<hex value>
|
||||
```
|
||||
|
||||
Notes:
|
||||
@@ -348,9 +452,10 @@ docker compose config --quiet
|
||||
docker compose up -d db
|
||||
docker compose --profile tools build migrate
|
||||
docker compose --profile tools run --rm migrate
|
||||
docker compose up -d --build app
|
||||
docker compose up -d --build app lumenroom
|
||||
docker compose ps
|
||||
curl -fsS http://127.0.0.1:3000/api/health
|
||||
curl -fsS http://127.0.0.1:8787/api/health
|
||||
```
|
||||
|
||||
Rebuild `migrate` as shown; `docker compose run` reuses the last built tools image, so without the build step an update can run stale seed code against a newer schema.
|
||||
@@ -401,8 +506,18 @@ media.example.org {
|
||||
encode zstd gzip
|
||||
reverse_proxy 127.0.0.1:3000
|
||||
}
|
||||
|
||||
edit.example.org {
|
||||
reverse_proxy 127.0.0.1:8787
|
||||
}
|
||||
```
|
||||
|
||||
The second site is the advanced editor. Give it the same pattern as the app:
|
||||
set `LUMENROOM_BIND=127.0.0.1` and `LUMENROOM_URL=https://edit.example.org`, and
|
||||
point DNS for that hostname at the server too. If you leave the editor out,
|
||||
remove its site block and set no `BRIDGE_SECRET`; the **Advanced** button then
|
||||
reports that the editor is not configured.
|
||||
|
||||
```bash
|
||||
sudo caddy validate --config /etc/caddy/Caddyfile
|
||||
sudo systemctl reload caddy
|
||||
@@ -421,7 +536,7 @@ sudo ufw enable
|
||||
sudo ufw status
|
||||
```
|
||||
|
||||
`APP_BIND=127.0.0.1` and `POSTGRES_BIND=127.0.0.1` keep the app and database off the public interface.
|
||||
`APP_BIND=127.0.0.1`, `LUMENROOM_BIND=127.0.0.1` and `POSTGRES_BIND=127.0.0.1` keep the app, the editor and the database off the public interface; only Caddy listens on 80/443.
|
||||
|
||||
### 8. Background jobs (cron)
|
||||
|
||||
@@ -541,6 +656,10 @@ Use Admin → Backup & restore to download a ZIP of the database dump, uploads,
|
||||
|
||||
At minimum, back up after every schedule/training/media milestone and before every upgrade. The database, uploads, and archive volumes live under Docker's volume directory; the application-level ZIP is the supported portable backup.
|
||||
|
||||
The `lumenroom-data` volume is different: it holds only Lumenroom's temporary
|
||||
bridge catalog, cached previews and thumbnails, so it can be left out of backups
|
||||
and rebuilt by opening events again.
|
||||
|
||||
### 12. Updating the deployment
|
||||
|
||||
Take a backup, then:
|
||||
@@ -550,9 +669,10 @@ cd /opt/glenloch-media
|
||||
git pull --ff-only
|
||||
docker compose --profile tools build migrate
|
||||
docker compose --profile tools run --rm migrate
|
||||
docker compose up -d --build app
|
||||
docker compose up -d --build app lumenroom
|
||||
docker compose ps
|
||||
curl -fsS http://127.0.0.1:3000/api/health
|
||||
curl -fsS http://127.0.0.1:8787/api/health
|
||||
```
|
||||
|
||||
`migrate` is idempotent and also runs the seed, which does not duplicate authored lessons or existing rows. If a release is bad, rebuild the previous commit:
|
||||
@@ -560,7 +680,7 @@ curl -fsS http://127.0.0.1:3000/api/health
|
||||
```bash
|
||||
git log --oneline -5
|
||||
git checkout <previous-commit>
|
||||
docker compose up -d --build app
|
||||
docker compose up -d --build app lumenroom
|
||||
# after fixing:
|
||||
git switch main
|
||||
```
|
||||
@@ -578,6 +698,8 @@ git switch main
|
||||
| Uploads/editing are disabled | Settings → Media storage needs a share name and a mounted path that UID 100 can write to; the banner states the exact failure. |
|
||||
| Uploads are blocked with "not a network mount" | The export is not actually mounted: either add `docker-compose.nfs.yml` (`NFS_ADDR`/`NFS_EXPORT`) or mount it on the host and point `MEDIA_ARCHIVE_DIR` at that mount. `docker compose exec app grep ' /archive ' /proc/self/mounts` shows what the container really has. |
|
||||
| Cron returns 401 | `CRON_SECRET` is set in `.env` and matches the value read by `/usr/local/bin/media-hub-cron`. |
|
||||
| **Advanced** reports the editor is not configured | `LUMENROOM_URL` and `BRIDGE_SECRET` are set in the app's environment, and Lumenroom has the same `BRIDGE_SECRET`. Restart both: `docker compose up -d app lumenroom`. |
|
||||
| Advanced opens but the editor fails to load or is blank | `docker compose ps` should show `lumenroom` as `healthy`; `curl -fsS http://127.0.0.1:8787/api/health`; check `LUMENROOM_URL` is reachable from users' browsers and the proxy forwards `edit.example.org` to `127.0.0.1:8787`. |
|
||||
| Disk filling up | Docker log rotation is capped at 10 MB × 3 per service; remove old backups, exports, and unused media. |
|
||||
|
||||
### 14. Production checklist
|
||||
@@ -592,6 +714,8 @@ git switch main
|
||||
- [ ] Cron jobs installed and returning success.
|
||||
- [ ] Backup downloaded, stored off-host, and restore tested once.
|
||||
- [ ] Media storage share configured in Settings → Media storage and writable (required for event photos and videos).
|
||||
- [ ] `LUMENROOM_BIND=127.0.0.1`, `LUMENROOM_URL` set to the editor's HTTPS origin, and `BRIDGE_SECRET` identical in both containers.
|
||||
- [ ] `edit.example.org` (or the chosen editor hostname) proxies to `127.0.0.1:8787`, and **Advanced** opens the editor signed in.
|
||||
- [ ] The `/api/dev/*` prefix is historical: the guards, not the URL, are the security boundary.
|
||||
|
||||
### 15. Advanced photo editor bridge (optional)
|
||||
@@ -610,12 +734,16 @@ that bridge session expires (12 hours by default).
|
||||
|
||||
**One deployment.** Lumenroom is vendored under `lumenroom/`, and
|
||||
`docker-compose.yml` builds it as a second service next to the app. One clone
|
||||
and one command deploy both:
|
||||
and one command deploy both (add `--build` when the sources changed):
|
||||
|
||||
```bash
|
||||
docker compose up -d --build
|
||||
docker compose up -d --build app lumenroom
|
||||
```
|
||||
|
||||
Deployment steps are in [Deploying the combined stack on another
|
||||
system](#deploying-the-combined-stack-on-another-system); the editor only needs
|
||||
the extra `LUMENROOM_*` and `BRIDGE_SECRET` values shown there.
|
||||
|
||||
Values in `.env` (all optional except the secret):
|
||||
|
||||
```dotenv
|
||||
@@ -692,7 +820,7 @@ that the gallery shows.
|
||||
│ ├── domain/ Pure, unit-tested business rules
|
||||
│ └── lib/ Timezone, tokens, email, storage, media, backup helpers
|
||||
├── Dockerfile Multi-stage build; tools stage for migrations
|
||||
├── docker-compose.yml App + Postgres + one-shot migrate/seed
|
||||
├── docker-compose.yml App + Lumenroom + Postgres + one-shot migrate/seed
|
||||
├── drizzle.config.ts
|
||||
├── next.config.ts
|
||||
├── playwright.config.ts
|
||||
|
||||
Reference in New Issue
Block a user