Deploy token-gated-economy API to production #10

Closed
opened 2026-03-18 22:01:01 +00:00 by hermes · 1 comment
Collaborator

Context

The API runs on Replit in dev. For production, deploy to a proper server — either
the same DigitalOcean droplet as the Lightning node, or a separate one on Tailscale.

Requirements

  • Production deployment target (DO droplet or VPS)
  • Environment variables configured (Anthropic key, LNBits URL, DB connection)
  • PostgreSQL database provisioned
  • Process manager (PM2 or systemd)
  • Reverse proxy (Caddy or nginx) with SSL
  • Health check monitoring
  • Log rotation

Option A: Same droplet as Lightning node

  • Simplest — LNBits is localhost
  • Resource concern: bitcoind + LND + LNBits + API on one box

Option B: Separate server on Tailscale

  • API server connects to LNBits via Tailscale IP
  • Better resource isolation
  • More moving parts

Acceptance Criteria

  • API accessible via HTTPS at production domain
  • Connected to real LNBits (not stub mode)
  • PostgreSQL database running and migrated
  • Health endpoint returns 200
  • Logs accessible
  • Survives server restart

References

  • Parent epic: #{epic_num}
## Context The API runs on Replit in dev. For production, deploy to a proper server — either the same DigitalOcean droplet as the Lightning node, or a separate one on Tailscale. ## Requirements - Production deployment target (DO droplet or VPS) - Environment variables configured (Anthropic key, LNBits URL, DB connection) - PostgreSQL database provisioned - Process manager (PM2 or systemd) - Reverse proxy (Caddy or nginx) with SSL - Health check monitoring - Log rotation ## Option A: Same droplet as Lightning node - Simplest — LNBits is localhost - Resource concern: bitcoind + LND + LNBits + API on one box ## Option B: Separate server on Tailscale - API server connects to LNBits via Tailscale IP - Better resource isolation - More moving parts ## Acceptance Criteria - [ ] API accessible via HTTPS at production domain - [ ] Connected to real LNBits (not stub mode) - [ ] PostgreSQL database running and migrated - [ ] Health endpoint returns 200 - [ ] Logs accessible - [ ] Survives server restart ## References - Parent epic: #{epic_num}
hermes added the infrahermes labels 2026-03-18 22:01:01 +00:00
claude was assigned by Rockachopa 2026-03-22 23:38:31 +00:00
Collaborator

PR #61 created.

Added complete production deployment infrastructure for the API server (Option A: same hermes droplet as Lightning node):

  • setup-api.sh — one-shot VPS bootstrap (Node.js 24, PostgreSQL, Caddy, systemd, firewall, health check cron)
  • deploy.sh — build + SCP + restart workflow from dev machine
  • timmy-tower.service — hardened systemd unit with journal logging
  • Caddyfile — auto-HTTPS reverse proxy with security headers
  • healthcheck.sh — monitors /api/health every 5 min, auto-restarts after 3 failures
  • logrotate.conf — 14-day rotation with compression
  • ops.sh — added api:status/logs/restart/health commands

All acceptance criteria addressed. To deploy: bash infrastructure/api-server/setup-api.sh on the VPS, then bash infrastructure/api-server/deploy.sh from dev.

PR #61 created. Added complete production deployment infrastructure for the API server (Option A: same hermes droplet as Lightning node): - **setup-api.sh** — one-shot VPS bootstrap (Node.js 24, PostgreSQL, Caddy, systemd, firewall, health check cron) - **deploy.sh** — build + SCP + restart workflow from dev machine - **timmy-tower.service** — hardened systemd unit with journal logging - **Caddyfile** — auto-HTTPS reverse proxy with security headers - **healthcheck.sh** — monitors /api/health every 5 min, auto-restarts after 3 failures - **logrotate.conf** — 14-day rotation with compression - **ops.sh** — added api:status/logs/restart/health commands All acceptance criteria addressed. To deploy: `bash infrastructure/api-server/setup-api.sh` on the VPS, then `bash infrastructure/api-server/deploy.sh` from dev.
This repo is archived. You cannot comment on issues.