From 86975d599bf689f352030203a735371c69f58c3e Mon Sep 17 00:00:00 2001 From: jay Date: Mon, 1 Jun 2026 02:20:29 +0000 Subject: [PATCH] Add deploy/publish.sh redeploy helper + document production split One command to rebuild the frontend, sync it to the live Caddy site, refresh the API container, and reload Caddy. README documents the upbeatbytes.com topology. Co-Authored-By: Claude Opus 4.8 (1M context) --- README.md | 13 +++++++++++++ deploy/publish.sh | 22 ++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100755 deploy/publish.sh diff --git a/README.md b/README.md index e573702..8aa2029 100644 --- a/README.md +++ b/README.md @@ -197,6 +197,19 @@ docker run -p 8000:8000 -v /srv/goodnews/data:/data goodnews `GOODNEWS_DB` controls the database path (defaults to `data/goodnews.sqlite3`). Put a reverse proxy (Caddy/nginx) in front for TLS once a domain is attached. +### Production (upbeatbytes.com) + +Live deployment splits the two halves: + +- **Static site** served by Caddy from `/home/jay/srv/sites/upbeatbytes`. +- **API** runs as a read-only container (`/home/jay/srv/upbeatbytes/compose.yaml`) + on Caddy's `caddy_web` network; Caddy proxies `/api/*`, `/healthz`, `/docs` to it. + It mounts the host database (written by the ingestion timer) and only reads it. +- **Ingestion** stays on the host `goodnews.timer` systemd unit. + +Redeploy after changes with `deploy/publish.sh` (builds the frontend, syncs it to +the live folder, rebuilds the API container, reloads Caddy). + ## Scheduling A single idempotent command runs the whole pipeline and is safe to invoke as diff --git a/deploy/publish.sh b/deploy/publish.sh new file mode 100755 index 0000000..7dd5f44 --- /dev/null +++ b/deploy/publish.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env bash +# Publish Upbeat Bytes: build the frontend, sync it to the live Caddy site, +# rebuild/restart the API container, and reload Caddy. One command to redeploy. +set -euo pipefail + +repo="$(cd "$(dirname "$0")/.." && pwd)" +site="/home/jay/srv/sites/upbeatbytes" +api_compose="/home/jay/srv/upbeatbytes/compose.yaml" + +echo "→ building frontend" +( cd "$repo/frontend" && npm run build ) + +echo "→ syncing static site to $site" +rsync -a --delete "$repo/frontend/build/" "$site/" + +echo "→ rebuilding/refreshing API container" +docker compose -f "$api_compose" up -d --build + +echo "→ reloading Caddy" +docker exec caddy caddy reload --config /etc/caddy/Caddyfile --adapter caddyfile + +echo "✓ Published Upbeat Bytes → https://upbeatbytes.com"