Skip to content

build(deploy): single-host public demo stack with Caddy - #78

Draft
vianbas wants to merge 6 commits into
mainfrom
claude/project-thread-6d6102
Draft

vianbas wants to merge 6 commits into
mainfrom
claude/project-thread-6d6102

Conversation

@vianbas

@vianbas vianbas commented Oct 21, 2026 •

Copy link
Copy Markdown
Owner

Requested by Viko · project thread

Summary

Adds deploy/demo/, a Docker Compose stack for running a public FinWatch demo on one small host, plus docs/operations/demo-deploy.md. On up it applies migrations, creates the demo operator/admin users, and ingests synthetic transactions (which raise alerts). It serves the SPA at / and the API at /api/* (WebSocket at /api/ws) from one TLS origin via Caddy. setup-host.sh prepares a fresh Ubuntu VM (targeting Oracle Cloud Always Free): it installs Docker, opens 80/443 in iptables, generates random secrets, starts the stack, and installs a cron that ingests 10 transactions every 2 minutes plus a nightly reset.

Closes #77

Architecture summary

Security considerations

  • APP_ENV=production: the API refuses the published example JWT secret and the dev fallback demo passwords. demo.env is git-ignored and setup-host.sh creates it with mode 600 and random secrets.
  • Postgres has no published port. Caddy adds HSTS, nosniff, no-referrer, and X-Frame-Options DENY.
  • The demo passwords are deliberately public. The docs say never to reuse them and never to load non-synthetic data, and the nightly reset discards visitors' changes.

Testing evidence

I ran the stack locally against current main with DEMO_DOMAIN=demo.localhost, using Caddy's internal TLS:

migrate/seed-users/seed exited (0) · api healthy · web/caddy running
GET  /api/health/ready -> {"status":"ready"}; SPA + fallback 200
POST /api/login -> accessToken; GET /api/alerts, /api/transactions -> seeded items
WSS  /api/ws (finwatch.v1 + bearer subprotocol) -> open; `seed -n 10`
     -> 18 events (10 transaction.observed, 8 alert.raised)

I also ran setup-host.sh in an Ubuntu 24.04 container with docker, apt, and systemctl stubbed. The iptables rules are inserted ahead of REJECT and stay idempotent on re-run, demo.env is created with mode 600 and is kept on re-run, and the cron file is written. The apt candidates docker.io and docker-compose-v2 exist on Ubuntu 22.04 and 24.04.

Known limitations

  • Not yet run on a real Oracle VM.
  • A burst of about 200 events disconnects live WebSocket clients ("client fell behind"), which is the hub's existing slow-consumer policy. The cron therefore uses small batches.

Follow-up issues

Adds deploy/demo: a Compose stack that runs migrations, seeds demo users
and synthetic transactions, and serves the SPA and API from one TLS origin
via Caddy. Documented in docs/operations/demo-deploy.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011nV6JKZGYFFoLk7YRGPYia
@vianbas vianbas self-assigned this Oct 21, 2026
claude and others added 5 commits October 21, 2026 16:54
setup-host.sh installs Docker, opens 80/443 in the host firewall,
generates demo.env with random secrets, and starts the stack. The guide
covers the Oracle VM, cloud firewall and an sslip.io hostname.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011nV6JKZGYFFoLk7YRGPYia
Passes OUTBOX_POLL_INTERVAL and WS_MAX_CONNECTIONS_PER_USER through to the
demo api, and has setup-host.sh install a cron that ingests small synthetic
batches every two minutes plus a nightly reset.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011nV6JKZGYFFoLk7YRGPYia
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Public demo deployment with synthetic seed data

3 participants