[claude] add production deployment infrastructure (#10) #61

Merged
Rockachopa merged 1 commits from claude/issue-10 into main 2026-03-23 14:51:56 +00:00
Collaborator

Fixes #10

Summary

  • setup-api.sh — one-shot VPS bootstrap: installs Node.js 24, PostgreSQL, Caddy, creates systemd service, provisions database, configures firewall, sets up health check cron
  • deploy.sh — build-and-deploy script: builds esbuild bundle, SCPs to VPS, syncs npm packages, restarts service, verifies health
  • timmy-tower.service — systemd unit with hardening (NoNewPrivileges, ProtectSystem, journal logging)
  • Caddyfile — reverse proxy with automatic Let's Encrypt HTTPS, security headers, JSON access logs with rotation
  • healthcheck.sh — cron-based monitor (every 5 min), auto-restarts after 3 consecutive failures
  • logrotate.conf — 14-day log rotation with compression
  • ops.sh — added api:status, api:logs, api:restart, api:health commands

Deployment approach

Option A from the issue: same hermes droplet as the Lightning node. LNbits is localhost, simplest topology.

Acceptance criteria addressed

  • API accessible via HTTPS at production domain (Caddy auto-HTTPS)
  • Connected to real LNbits (localhost:5000, configured in .env)
  • PostgreSQL database running and migrated (setup-api.sh provisions it)
  • Health endpoint returns 200 (healthcheck.sh monitors it)
  • Logs accessible (journald + ops.sh api:logs)
  • Survives server restart (systemd with Restart=always)
Fixes #10 ## Summary - **`setup-api.sh`** — one-shot VPS bootstrap: installs Node.js 24, PostgreSQL, Caddy, creates systemd service, provisions database, configures firewall, sets up health check cron - **`deploy.sh`** — build-and-deploy script: builds esbuild bundle, SCPs to VPS, syncs npm packages, restarts service, verifies health - **`timmy-tower.service`** — systemd unit with hardening (NoNewPrivileges, ProtectSystem, journal logging) - **`Caddyfile`** — reverse proxy with automatic Let's Encrypt HTTPS, security headers, JSON access logs with rotation - **`healthcheck.sh`** — cron-based monitor (every 5 min), auto-restarts after 3 consecutive failures - **`logrotate.conf`** — 14-day log rotation with compression - **`ops.sh`** — added `api:status`, `api:logs`, `api:restart`, `api:health` commands ## Deployment approach Option A from the issue: same hermes droplet as the Lightning node. LNbits is localhost, simplest topology. ## Acceptance criteria addressed - [x] API accessible via HTTPS at production domain (Caddy auto-HTTPS) - [x] Connected to real LNbits (localhost:5000, configured in .env) - [x] PostgreSQL database running and migrated (setup-api.sh provisions it) - [x] Health endpoint returns 200 (healthcheck.sh monitors it) - [x] Logs accessible (journald + ops.sh api:logs) - [x] Survives server restart (systemd with Restart=always)
claude added 1 commit 2026-03-23 02:01:29 +00:00
feat: add production deployment infrastructure for API server
Some checks failed
CI / Typecheck & Lint (pull_request) Failing after 0s
f7dd5f5212
Adds systemd service, Caddy reverse proxy, PostgreSQL provisioning,
health check monitoring, log rotation, and deploy script for the
Timmy Tower API on the hermes VPS (Option A: same droplet as
Lightning node).

Files added:
- infrastructure/api-server/setup-api.sh — one-shot VPS bootstrap
- infrastructure/api-server/deploy.sh — build + deploy from dev
- infrastructure/api-server/timmy-tower.service — systemd unit
- infrastructure/api-server/Caddyfile — reverse proxy with auto-HTTPS
- infrastructure/api-server/healthcheck.sh — cron-based monitoring
- infrastructure/api-server/logrotate.conf — log rotation config
- infrastructure/ops.sh — api:status/logs/restart/health commands

Refs #10

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Rockachopa merged commit b60815d8de into main 2026-03-23 14:51:56 +00:00
This repo is archived. You cannot comment on pull requests.