3a68f64eb6
Add a set of guest-facing and operator-facing features that make the deployment-strategy demos (recreate, rolling, canary) more visual: - Emoji reactions (heart/tada/thumbsup/smile): visitors react without an account, a first-party cookie keeps counts honest, the tally streams live to every tab over SSE. Backed by a new reactions table with an idempotent upsert; whitelisted emoji so the endpoint can't be abused. - Light & dark themes: the wall follows the OS preference, visitors can toggle it (persisted locally), and a moderator can force a theme for everyone from the admin console, pushed live over SSE. - Per-replica request counter: a middleware tallies requests answered by each replica; surfaced in /healthz, /api/info and the admin replica table. Under load-balancing the counts diverge, and a rolling update resets them one container at a time — the rollout made visible. - Rolling-update wave in the Chaos lab: bounces replicas one at a time (via the crash endpoint) while polling the replica table, so a training session can watch each replica reset and rejoin — what a rolling update looks like from the inside. - Admin console: reactions tile, per-replica Requests column, reaction tallies in moderation, and a wall-theme setting. - Favicon + /favicon.ico redirect. Tests cover reactions (idempotency, tallies, whitelist) and the theme setting round-trip. Akili-Task: tsk_xgg6sfuzkzymyc6gstr4 Akili-Agent: goldfish
62 lines
2.4 KiB
Bash
62 lines
2.4 KiB
Bash
# Copy to .env for local development (docker compose reads it automatically).
|
|
|
|
# HTTP port the app listens on.
|
|
PORT=8080
|
|
|
|
# Display name shown in the UI / health payload.
|
|
APP_NAME=Miabi Guestbook
|
|
|
|
# Version shown in the UI / /api/info. Overrides the build-time version.
|
|
# Set to different values per app (e.g. 1.0.0 vs 2.0.0) for a canary demo.
|
|
# APP_VERSION=1.0.0
|
|
|
|
# Seed sample entries on first run (only when the table is empty). Set to
|
|
# false to start with an empty wall.
|
|
SEED=true
|
|
|
|
# === Database ======================
|
|
# Driver: "postgres" or "sqlite". Leave unset to auto-detect: Postgres when
|
|
# it is configured (DATABASE_URL or DB_HOST present), otherwise SQLite.
|
|
# DB_DRIVER=postgres
|
|
|
|
# SQLite (zero-config; used when no Postgres is configured). File path, or
|
|
# ":memory:" for an ephemeral database. The parent directory is created on
|
|
# startup. Locally this defaults to ./data/guestbook.db; the container image
|
|
# uses /data/guestbook.db (a volume). On Miabi, mount a volume at /data.
|
|
# DB_PATH=data/guestbook.db
|
|
|
|
# Postgres — when you attach a Miabi managed database, Miabi injects these for
|
|
# you. DATABASE_URL takes precedence; otherwise the discrete DB_* parts are
|
|
# assembled into a DSN.
|
|
DATABASE_URL=postgres://postgres:postgres@db:5432/guestbook?sslmode=disable
|
|
|
|
# Discrete parts (used only when DATABASE_URL is empty):
|
|
# DB_HOST=db
|
|
# DB_PORT=5432
|
|
# DB_USER=postgres
|
|
# DB_PASSWORD=postgres
|
|
# DB_NAME=guestbook
|
|
# DB_SSL_MODE=disable
|
|
|
|
# === Scaling / live updates ========
|
|
# Redis for cross-replica live updates and presence. Without it each replica
|
|
# only pushes to its own clients. On Miabi, attach a managed Redis with the
|
|
# "REDIS" env prefix and REDIS_DATABASE_URL is injected (also accepted).
|
|
# REDIS_URL=redis://redis:6379
|
|
|
|
# === Admin console =================
|
|
# Enables /admin: overview (stats, replicas with per-replica request counters),
|
|
# moderation (pin / hide / delete, reaction tallies, CSV export) and wall
|
|
# settings (pause signing, banner, forced light/dark theme).
|
|
# Store the token as a secret. Generate with: openssl rand -hex 16
|
|
# ADMIN_TOKEN=
|
|
|
|
# CIDRs whose X-Forwarded-For is trusted for the signer IP shown in /admin.
|
|
# Unset trusts the header as-is (fine behind the Miabi gateway).
|
|
# TRUSTED_PROXIES=10.0.0.0/8
|
|
|
|
# Expose /api/debug/* failure injection (crash, slow, 5xx, CPU, memory, logs)
|
|
# and the admin "rolling-update wave" tool. Still requires admin auth.
|
|
# Demo environments only.
|
|
# DEBUG_ENDPOINTS=false
|