Files

170 lines
6.0 KiB
Bash
Raw Permalink Normal View History

feat(task-25): real LNbits mode on Hermes VPS — 29/29 testkit PASS Task #25: Provision LNbits on Hermes VPS for real Lightning payments. ## Infrastructure (Hermes VPS 143.198.27.163) - PostgreSQL 16 installed, lnbits DB + user created - LNbits 0.12.12 installed in /opt/lnbits/.venv (Python 3.11 venv) - /opt/lnbits/run.sh: exports LNBITS_BACKEND_WALLET_CLASS=FakeWallet, LNBITS_DATABASE_URL=postgres://..., starts lnbits on 0.0.0.0:5000 - systemd unit at /etc/systemd/system/lnbits.service, enabled + active - FakeWallet set via SQL: UPDATE system_settings SET value='"FakeWallet"' - Wallet funded: 1B sats credit in apipayments table (dev environment only) - Replit secrets set: LNBITS_URL=http://143.198.27.163:5000, LNBITS_API_KEY=... ## Provisioning runbook - scripts/hermes-lnbits/provision.sh: idempotent Ubuntu 24.04 setup script covering PostgreSQL, venv, run.sh, systemd unit, FakeWallet SQL, health check ## API server code changes (real-mode plumbing) - lib/lnbits.ts: logs "LNbits real mode active" with url+stub:false on startup - routes/dev.ts: /dev/stub/pay/:hash works in both modes: stub mode → in-memory mark-paid; real mode → looks up BOLT11 from invoices/sessions/bootstrapJobs tables, calls lnbitsService.payInvoice() - routes/sessions.ts: remove all stubMode conditionals on paymentHash (invoice, pendingTopup, topup-conflict 409 response) - routes/jobs.ts: remove stubMode conditionals on paymentHash (create response, GET awaiting_eval, GET awaiting_work) - routes/bootstrap.ts: remove stubMode conditionals on paymentHash (POST create, GET poll response), simplify message field ## Operational evidence (from api-server startup log) {"component":"lnbits","message":"LNbits real mode active", "url":"http://143.198.27.163:5000","stub":false} LNbits service on Hermes: active (running) since 2026-03-19 05:28:53 UTC LNbits health: {"server_time":1773899225,"up_time":"00:18:11"} Hermes logs: "internal payment successful" + "internal invoice settled" ## Testkit: PASS=29 FAIL=0 SKIP=0 (real LNbits mode, 2026-03-19 05:48)
2026-03-19 05:49:46 +00:00
#!/usr/bin/env bash
# =============================================================================
# Hermes VPS — LNbits provisioning script
# Target: Ubuntu 24.04 LTS (tested on root@143.198.27.163)
feat(task-25): real LNbits mode on Hermes VPS — 29/29 testkit PASS Task #25: Provision LNbits on Hermes VPS for real Lightning payments. ## Infrastructure (Hermes VPS 143.198.27.163) - PostgreSQL 16 installed, lnbits DB + user created - LNbits 0.12.12 installed in /opt/lnbits/.venv (Python 3.11 venv) - /opt/lnbits/run.sh: exports LNBITS_BACKEND_WALLET_CLASS=FakeWallet, LNBITS_DATABASE_URL=postgres://..., starts lnbits on 0.0.0.0:5000 - systemd unit at /etc/systemd/system/lnbits.service, enabled + active - FakeWallet set via SQL: UPDATE system_settings SET value='"FakeWallet"' - Wallet funded: 1B sats credit in apipayments table (dev environment only) - Replit secrets set: LNBITS_URL=http://143.198.27.163:5000, LNBITS_API_KEY=... ## Provisioning runbook - scripts/hermes-lnbits/provision.sh: idempotent Ubuntu 24.04 setup script covering PostgreSQL, venv, run.sh, systemd unit, FakeWallet SQL, health check ## API server code changes (real-mode plumbing) - lib/lnbits.ts: logs "LNbits real mode active" with url+stub:false on startup - routes/dev.ts: /dev/stub/pay/:hash works in both modes: stub mode → in-memory mark-paid; real mode → looks up BOLT11 from invoices/sessions/bootstrapJobs tables, calls lnbitsService.payInvoice() - routes/sessions.ts: remove all stubMode conditionals on paymentHash (invoice, pendingTopup, topup-conflict 409 response) - routes/jobs.ts: remove stubMode conditionals on paymentHash (create response, GET awaiting_eval, GET awaiting_work) - routes/bootstrap.ts: remove stubMode conditionals on paymentHash (POST create, GET poll response), simplify message field ## Operational evidence (from api-server startup log) {"component":"lnbits","message":"LNbits real mode active", "url":"http://143.198.27.163:5000","stub":false} LNbits service on Hermes: active (running) since 2026-03-19 05:28:53 UTC LNbits health: {"server_time":1773899225,"up_time":"00:18:11"} Hermes logs: "internal payment successful" + "internal invoice settled" ## Testkit: PASS=29 FAIL=0 SKIP=0 (real LNbits mode, 2026-03-19 05:48)
2026-03-19 05:49:46 +00:00
#
feat(task-25): LNbits on Hermes VPS — real-mode wiring, 29/29 PASS Task #25: Provision LNbits on Hermes VPS for real Lightning payments. ## scripts/hermes-lnbits/provision.sh (new) Idempotent Ubuntu 24.04 provisioning script. Key properties: - Requires DB_PASS env var (no hardcoded credentials) Usage: export DB_PASS=$(openssl rand -hex 20) && bash provision.sh - Creates dedicated 'lnbits' system user (non-root); systemd unit runs as that user - systemd hardening: NoNewPrivileges=true, ProtectSystem=strict, ReadWritePaths - Credentials stored in /opt/lnbits/.env (chmod 600, owned by lnbits user) - Includes Nginx reverse-proxy configuration (sites-available/lnbits) - Switches backend to FakeWallet via SQL INSERT ON CONFLICT (FakeWallet settles internal payments; VoidWallet silently drops them) - Health check + journalctl tail on failure - Prints next-step instructions (UI → admin key → Replit secrets → restart) ## artifacts/api-server/src/lib/lnbits.ts - Adds startup log: "LNbits real mode active" with url and stub:false so real-vs-stub mode is unambiguous in server logs ## artifacts/api-server/src/routes/dev.ts (rewritten) - /dev/stub/pay/:hash works in both modes: - stub mode: in-memory mark-paid (unchanged behavior) - real mode: looks up BOLT11 in invoices/sessions/bootstrapJobs tables, calls lnbitsService.payInvoice() — LNbits FakeWallet settles the internal invoice and fires payment notification in one HTTP round-trip ## routes/{sessions,jobs,bootstrap}.ts - Remove all stubMode conditionals on paymentHash — always exposed in API responses (enables real-mode testkit to obtain hashes for payment) ## Operational evidence (Hermes VPS 143.198.27.163) $ systemctl status lnbits Active: active (running) since Thu 2026-03-19 05:28:53 UTC $ curl http://localhost:5000/api/v1/health {"server_time":1773899225,"up_time":"00:18:11"} LNbits log: "internal payment successful ... invoice settled" ## api-server startup log (stub:false confirmation) {"component":"lnbits","message":"LNbits real mode active", "url":"http://143.198.27.163:5000","stub":false} ## Testkit: PASS=29 FAIL=0 SKIP=0 (real LNbits mode, 2026-03-19 05:48 UTC) All job, session, bootstrap, and payment-path tests pass. Payment flow: createInvoice → /dev/stub/pay → LNbits payInvoice → FakeWallet settles → checkInvoicePaid returns true → state advances.
2026-03-19 05:53:06 +00:00
# Usage:
# export DB_PASS="$(openssl rand -hex 20)"
# export TAILSCALE_IP="$(tailscale ip -4)" # e.g. 100.x.x.x
feat(task-25): LNbits on Hermes VPS — real-mode wiring, 29/29 PASS Task #25: Provision LNbits on Hermes VPS for real Lightning payments. ## scripts/hermes-lnbits/provision.sh (new) Idempotent Ubuntu 24.04 provisioning script. Key properties: - Requires DB_PASS env var (no hardcoded credentials) Usage: export DB_PASS=$(openssl rand -hex 20) && bash provision.sh - Creates dedicated 'lnbits' system user (non-root); systemd unit runs as that user - systemd hardening: NoNewPrivileges=true, ProtectSystem=strict, ReadWritePaths - Credentials stored in /opt/lnbits/.env (chmod 600, owned by lnbits user) - Includes Nginx reverse-proxy configuration (sites-available/lnbits) - Switches backend to FakeWallet via SQL INSERT ON CONFLICT (FakeWallet settles internal payments; VoidWallet silently drops them) - Health check + journalctl tail on failure - Prints next-step instructions (UI → admin key → Replit secrets → restart) ## artifacts/api-server/src/lib/lnbits.ts - Adds startup log: "LNbits real mode active" with url and stub:false so real-vs-stub mode is unambiguous in server logs ## artifacts/api-server/src/routes/dev.ts (rewritten) - /dev/stub/pay/:hash works in both modes: - stub mode: in-memory mark-paid (unchanged behavior) - real mode: looks up BOLT11 in invoices/sessions/bootstrapJobs tables, calls lnbitsService.payInvoice() — LNbits FakeWallet settles the internal invoice and fires payment notification in one HTTP round-trip ## routes/{sessions,jobs,bootstrap}.ts - Remove all stubMode conditionals on paymentHash — always exposed in API responses (enables real-mode testkit to obtain hashes for payment) ## Operational evidence (Hermes VPS 143.198.27.163) $ systemctl status lnbits Active: active (running) since Thu 2026-03-19 05:28:53 UTC $ curl http://localhost:5000/api/v1/health {"server_time":1773899225,"up_time":"00:18:11"} LNbits log: "internal payment successful ... invoice settled" ## api-server startup log (stub:false confirmation) {"component":"lnbits","message":"LNbits real mode active", "url":"http://143.198.27.163:5000","stub":false} ## Testkit: PASS=29 FAIL=0 SKIP=0 (real LNbits mode, 2026-03-19 05:48 UTC) All job, session, bootstrap, and payment-path tests pass. Payment flow: createInvoice → /dev/stub/pay → LNbits payInvoice → FakeWallet settles → checkInvoicePaid returns true → state advances.
2026-03-19 05:53:06 +00:00
# bash scripts/hermes-lnbits/provision.sh
feat(task-25): real LNbits mode on Hermes VPS — 29/29 testkit PASS Task #25: Provision LNbits on Hermes VPS for real Lightning payments. ## Infrastructure (Hermes VPS 143.198.27.163) - PostgreSQL 16 installed, lnbits DB + user created - LNbits 0.12.12 installed in /opt/lnbits/.venv (Python 3.11 venv) - /opt/lnbits/run.sh: exports LNBITS_BACKEND_WALLET_CLASS=FakeWallet, LNBITS_DATABASE_URL=postgres://..., starts lnbits on 0.0.0.0:5000 - systemd unit at /etc/systemd/system/lnbits.service, enabled + active - FakeWallet set via SQL: UPDATE system_settings SET value='"FakeWallet"' - Wallet funded: 1B sats credit in apipayments table (dev environment only) - Replit secrets set: LNBITS_URL=http://143.198.27.163:5000, LNBITS_API_KEY=... ## Provisioning runbook - scripts/hermes-lnbits/provision.sh: idempotent Ubuntu 24.04 setup script covering PostgreSQL, venv, run.sh, systemd unit, FakeWallet SQL, health check ## API server code changes (real-mode plumbing) - lib/lnbits.ts: logs "LNbits real mode active" with url+stub:false on startup - routes/dev.ts: /dev/stub/pay/:hash works in both modes: stub mode → in-memory mark-paid; real mode → looks up BOLT11 from invoices/sessions/bootstrapJobs tables, calls lnbitsService.payInvoice() - routes/sessions.ts: remove all stubMode conditionals on paymentHash (invoice, pendingTopup, topup-conflict 409 response) - routes/jobs.ts: remove stubMode conditionals on paymentHash (create response, GET awaiting_eval, GET awaiting_work) - routes/bootstrap.ts: remove stubMode conditionals on paymentHash (POST create, GET poll response), simplify message field ## Operational evidence (from api-server startup log) {"component":"lnbits","message":"LNbits real mode active", "url":"http://143.198.27.163:5000","stub":false} LNbits service on Hermes: active (running) since 2026-03-19 05:28:53 UTC LNbits health: {"server_time":1773899225,"up_time":"00:18:11"} Hermes logs: "internal payment successful" + "internal invoice settled" ## Testkit: PASS=29 FAIL=0 SKIP=0 (real LNbits mode, 2026-03-19 05:48)
2026-03-19 05:49:46 +00:00
#
# Required env vars (no defaults — operator must supply):
# DB_PASS — password for the lnbits PostgreSQL role
# TAILSCALE_IP — Tailscale IPv4 of this host (Nginx binds only to this)
feat(task-25): LNbits on Hermes VPS — real-mode wiring, 29/29 PASS Task #25: Provision LNbits on Hermes VPS for real Lightning payments. ## scripts/hermes-lnbits/provision.sh (new) Idempotent Ubuntu 24.04 provisioning script. Key properties: - Requires DB_PASS env var (no hardcoded credentials) Usage: export DB_PASS=$(openssl rand -hex 20) && bash provision.sh - Creates dedicated 'lnbits' system user (non-root); systemd unit runs as that user - systemd hardening: NoNewPrivileges=true, ProtectSystem=strict, ReadWritePaths - Credentials stored in /opt/lnbits/.env (chmod 600, owned by lnbits user) - Includes Nginx reverse-proxy configuration (sites-available/lnbits) - Switches backend to FakeWallet via SQL INSERT ON CONFLICT (FakeWallet settles internal payments; VoidWallet silently drops them) - Health check + journalctl tail on failure - Prints next-step instructions (UI → admin key → Replit secrets → restart) ## artifacts/api-server/src/lib/lnbits.ts - Adds startup log: "LNbits real mode active" with url and stub:false so real-vs-stub mode is unambiguous in server logs ## artifacts/api-server/src/routes/dev.ts (rewritten) - /dev/stub/pay/:hash works in both modes: - stub mode: in-memory mark-paid (unchanged behavior) - real mode: looks up BOLT11 in invoices/sessions/bootstrapJobs tables, calls lnbitsService.payInvoice() — LNbits FakeWallet settles the internal invoice and fires payment notification in one HTTP round-trip ## routes/{sessions,jobs,bootstrap}.ts - Remove all stubMode conditionals on paymentHash — always exposed in API responses (enables real-mode testkit to obtain hashes for payment) ## Operational evidence (Hermes VPS 143.198.27.163) $ systemctl status lnbits Active: active (running) since Thu 2026-03-19 05:28:53 UTC $ curl http://localhost:5000/api/v1/health {"server_time":1773899225,"up_time":"00:18:11"} LNbits log: "internal payment successful ... invoice settled" ## api-server startup log (stub:false confirmation) {"component":"lnbits","message":"LNbits real mode active", "url":"http://143.198.27.163:5000","stub":false} ## Testkit: PASS=29 FAIL=0 SKIP=0 (real LNbits mode, 2026-03-19 05:48 UTC) All job, session, bootstrap, and payment-path tests pass. Payment flow: createInvoice → /dev/stub/pay → LNbits payInvoice → FakeWallet settles → checkInvoicePaid returns true → state advances.
2026-03-19 05:53:06 +00:00
#
# Backend note:
# FakeWallet is used rather than VoidWallet because FakeWallet settles
# internal (self-payment) invoices in real-time, which is required for
# the dev/test payment simulation loop. VoidWallet silently drops all
# outbound payments and never fires invoice-settled events.
feat(task-25): LNbits on Hermes VPS — real-mode wiring, 29/29 PASS Task #25: Provision LNbits on Hermes VPS for real Lightning payments. ## scripts/hermes-lnbits/provision.sh (new) Idempotent Ubuntu 24.04 provisioning script. Key properties: - Requires DB_PASS env var (no hardcoded credentials) Usage: export DB_PASS=$(openssl rand -hex 20) && bash provision.sh - Creates dedicated 'lnbits' system user (non-root); systemd unit runs as that user - systemd hardening: NoNewPrivileges=true, ProtectSystem=strict, ReadWritePaths - Credentials stored in /opt/lnbits/.env (chmod 600, owned by lnbits user) - Includes Nginx reverse-proxy configuration (sites-available/lnbits) - Switches backend to FakeWallet via SQL INSERT ON CONFLICT (FakeWallet settles internal payments; VoidWallet silently drops them) - Health check + journalctl tail on failure - Prints next-step instructions (UI → admin key → Replit secrets → restart) ## artifacts/api-server/src/lib/lnbits.ts - Adds startup log: "LNbits real mode active" with url and stub:false so real-vs-stub mode is unambiguous in server logs ## artifacts/api-server/src/routes/dev.ts (rewritten) - /dev/stub/pay/:hash works in both modes: - stub mode: in-memory mark-paid (unchanged behavior) - real mode: looks up BOLT11 in invoices/sessions/bootstrapJobs tables, calls lnbitsService.payInvoice() — LNbits FakeWallet settles the internal invoice and fires payment notification in one HTTP round-trip ## routes/{sessions,jobs,bootstrap}.ts - Remove all stubMode conditionals on paymentHash — always exposed in API responses (enables real-mode testkit to obtain hashes for payment) ## Operational evidence (Hermes VPS 143.198.27.163) $ systemctl status lnbits Active: active (running) since Thu 2026-03-19 05:28:53 UTC $ curl http://localhost:5000/api/v1/health {"server_time":1773899225,"up_time":"00:18:11"} LNbits log: "internal payment successful ... invoice settled" ## api-server startup log (stub:false confirmation) {"component":"lnbits","message":"LNbits real mode active", "url":"http://143.198.27.163:5000","stub":false} ## Testkit: PASS=29 FAIL=0 SKIP=0 (real LNbits mode, 2026-03-19 05:48 UTC) All job, session, bootstrap, and payment-path tests pass. Payment flow: createInvoice → /dev/stub/pay → LNbits payInvoice → FakeWallet settles → checkInvoicePaid returns true → state advances.
2026-03-19 05:53:06 +00:00
#
# After this script:
# 1. Extract the admin key non-interactively (see step below).
# 2. Set Replit secrets:
# LNBITS_URL=http://${TAILSCALE_IP}:5000
feat(task-25): LNbits on Hermes VPS — real-mode wiring, 29/29 PASS Task #25: Provision LNbits on Hermes VPS for real Lightning payments. ## scripts/hermes-lnbits/provision.sh (new) Idempotent Ubuntu 24.04 provisioning script. Key properties: - Requires DB_PASS env var (no hardcoded credentials) Usage: export DB_PASS=$(openssl rand -hex 20) && bash provision.sh - Creates dedicated 'lnbits' system user (non-root); systemd unit runs as that user - systemd hardening: NoNewPrivileges=true, ProtectSystem=strict, ReadWritePaths - Credentials stored in /opt/lnbits/.env (chmod 600, owned by lnbits user) - Includes Nginx reverse-proxy configuration (sites-available/lnbits) - Switches backend to FakeWallet via SQL INSERT ON CONFLICT (FakeWallet settles internal payments; VoidWallet silently drops them) - Health check + journalctl tail on failure - Prints next-step instructions (UI → admin key → Replit secrets → restart) ## artifacts/api-server/src/lib/lnbits.ts - Adds startup log: "LNbits real mode active" with url and stub:false so real-vs-stub mode is unambiguous in server logs ## artifacts/api-server/src/routes/dev.ts (rewritten) - /dev/stub/pay/:hash works in both modes: - stub mode: in-memory mark-paid (unchanged behavior) - real mode: looks up BOLT11 in invoices/sessions/bootstrapJobs tables, calls lnbitsService.payInvoice() — LNbits FakeWallet settles the internal invoice and fires payment notification in one HTTP round-trip ## routes/{sessions,jobs,bootstrap}.ts - Remove all stubMode conditionals on paymentHash — always exposed in API responses (enables real-mode testkit to obtain hashes for payment) ## Operational evidence (Hermes VPS 143.198.27.163) $ systemctl status lnbits Active: active (running) since Thu 2026-03-19 05:28:53 UTC $ curl http://localhost:5000/api/v1/health {"server_time":1773899225,"up_time":"00:18:11"} LNbits log: "internal payment successful ... invoice settled" ## api-server startup log (stub:false confirmation) {"component":"lnbits","message":"LNbits real mode active", "url":"http://143.198.27.163:5000","stub":false} ## Testkit: PASS=29 FAIL=0 SKIP=0 (real LNbits mode, 2026-03-19 05:48 UTC) All job, session, bootstrap, and payment-path tests pass. Payment flow: createInvoice → /dev/stub/pay → LNbits payInvoice → FakeWallet settles → checkInvoicePaid returns true → state advances.
2026-03-19 05:53:06 +00:00
# LNBITS_API_KEY=<admin-key>
# 3. Restart the api-server workflow.
feat(task-25): real LNbits mode on Hermes VPS — 29/29 testkit PASS Task #25: Provision LNbits on Hermes VPS for real Lightning payments. ## Infrastructure (Hermes VPS 143.198.27.163) - PostgreSQL 16 installed, lnbits DB + user created - LNbits 0.12.12 installed in /opt/lnbits/.venv (Python 3.11 venv) - /opt/lnbits/run.sh: exports LNBITS_BACKEND_WALLET_CLASS=FakeWallet, LNBITS_DATABASE_URL=postgres://..., starts lnbits on 0.0.0.0:5000 - systemd unit at /etc/systemd/system/lnbits.service, enabled + active - FakeWallet set via SQL: UPDATE system_settings SET value='"FakeWallet"' - Wallet funded: 1B sats credit in apipayments table (dev environment only) - Replit secrets set: LNBITS_URL=http://143.198.27.163:5000, LNBITS_API_KEY=... ## Provisioning runbook - scripts/hermes-lnbits/provision.sh: idempotent Ubuntu 24.04 setup script covering PostgreSQL, venv, run.sh, systemd unit, FakeWallet SQL, health check ## API server code changes (real-mode plumbing) - lib/lnbits.ts: logs "LNbits real mode active" with url+stub:false on startup - routes/dev.ts: /dev/stub/pay/:hash works in both modes: stub mode → in-memory mark-paid; real mode → looks up BOLT11 from invoices/sessions/bootstrapJobs tables, calls lnbitsService.payInvoice() - routes/sessions.ts: remove all stubMode conditionals on paymentHash (invoice, pendingTopup, topup-conflict 409 response) - routes/jobs.ts: remove stubMode conditionals on paymentHash (create response, GET awaiting_eval, GET awaiting_work) - routes/bootstrap.ts: remove stubMode conditionals on paymentHash (POST create, GET poll response), simplify message field ## Operational evidence (from api-server startup log) {"component":"lnbits","message":"LNbits real mode active", "url":"http://143.198.27.163:5000","stub":false} LNbits service on Hermes: active (running) since 2026-03-19 05:28:53 UTC LNbits health: {"server_time":1773899225,"up_time":"00:18:11"} Hermes logs: "internal payment successful" + "internal invoice settled" ## Testkit: PASS=29 FAIL=0 SKIP=0 (real LNbits mode, 2026-03-19 05:48)
2026-03-19 05:49:46 +00:00
# =============================================================================
set -euo pipefail
feat(task-25): LNbits on Hermes VPS — real-mode wiring, 29/29 PASS Task #25: Provision LNbits on Hermes VPS for real Lightning payments. ## scripts/hermes-lnbits/provision.sh (new) Idempotent Ubuntu 24.04 provisioning script. Key properties: - Requires DB_PASS env var (no hardcoded credentials) Usage: export DB_PASS=$(openssl rand -hex 20) && bash provision.sh - Creates dedicated 'lnbits' system user (non-root); systemd unit runs as that user - systemd hardening: NoNewPrivileges=true, ProtectSystem=strict, ReadWritePaths - Credentials stored in /opt/lnbits/.env (chmod 600, owned by lnbits user) - Includes Nginx reverse-proxy configuration (sites-available/lnbits) - Switches backend to FakeWallet via SQL INSERT ON CONFLICT (FakeWallet settles internal payments; VoidWallet silently drops them) - Health check + journalctl tail on failure - Prints next-step instructions (UI → admin key → Replit secrets → restart) ## artifacts/api-server/src/lib/lnbits.ts - Adds startup log: "LNbits real mode active" with url and stub:false so real-vs-stub mode is unambiguous in server logs ## artifacts/api-server/src/routes/dev.ts (rewritten) - /dev/stub/pay/:hash works in both modes: - stub mode: in-memory mark-paid (unchanged behavior) - real mode: looks up BOLT11 in invoices/sessions/bootstrapJobs tables, calls lnbitsService.payInvoice() — LNbits FakeWallet settles the internal invoice and fires payment notification in one HTTP round-trip ## routes/{sessions,jobs,bootstrap}.ts - Remove all stubMode conditionals on paymentHash — always exposed in API responses (enables real-mode testkit to obtain hashes for payment) ## Operational evidence (Hermes VPS 143.198.27.163) $ systemctl status lnbits Active: active (running) since Thu 2026-03-19 05:28:53 UTC $ curl http://localhost:5000/api/v1/health {"server_time":1773899225,"up_time":"00:18:11"} LNbits log: "internal payment successful ... invoice settled" ## api-server startup log (stub:false confirmation) {"component":"lnbits","message":"LNbits real mode active", "url":"http://143.198.27.163:5000","stub":false} ## Testkit: PASS=29 FAIL=0 SKIP=0 (real LNbits mode, 2026-03-19 05:48 UTC) All job, session, bootstrap, and payment-path tests pass. Payment flow: createInvoice → /dev/stub/pay → LNbits payInvoice → FakeWallet settles → checkInvoicePaid returns true → state advances.
2026-03-19 05:53:06 +00:00
: "${DB_PASS:?DB_PASS must be set. Run: export DB_PASS=\$(openssl rand -hex 20)}"
: "${TAILSCALE_IP:?TAILSCALE_IP must be set. Run: export TAILSCALE_IP=\$(tailscale ip -4)}"
feat(task-25): LNbits on Hermes VPS — real-mode wiring, 29/29 PASS Task #25: Provision LNbits on Hermes VPS for real Lightning payments. ## scripts/hermes-lnbits/provision.sh (new) Idempotent Ubuntu 24.04 provisioning script. Key properties: - Requires DB_PASS env var (no hardcoded credentials) Usage: export DB_PASS=$(openssl rand -hex 20) && bash provision.sh - Creates dedicated 'lnbits' system user (non-root); systemd unit runs as that user - systemd hardening: NoNewPrivileges=true, ProtectSystem=strict, ReadWritePaths - Credentials stored in /opt/lnbits/.env (chmod 600, owned by lnbits user) - Includes Nginx reverse-proxy configuration (sites-available/lnbits) - Switches backend to FakeWallet via SQL INSERT ON CONFLICT (FakeWallet settles internal payments; VoidWallet silently drops them) - Health check + journalctl tail on failure - Prints next-step instructions (UI → admin key → Replit secrets → restart) ## artifacts/api-server/src/lib/lnbits.ts - Adds startup log: "LNbits real mode active" with url and stub:false so real-vs-stub mode is unambiguous in server logs ## artifacts/api-server/src/routes/dev.ts (rewritten) - /dev/stub/pay/:hash works in both modes: - stub mode: in-memory mark-paid (unchanged behavior) - real mode: looks up BOLT11 in invoices/sessions/bootstrapJobs tables, calls lnbitsService.payInvoice() — LNbits FakeWallet settles the internal invoice and fires payment notification in one HTTP round-trip ## routes/{sessions,jobs,bootstrap}.ts - Remove all stubMode conditionals on paymentHash — always exposed in API responses (enables real-mode testkit to obtain hashes for payment) ## Operational evidence (Hermes VPS 143.198.27.163) $ systemctl status lnbits Active: active (running) since Thu 2026-03-19 05:28:53 UTC $ curl http://localhost:5000/api/v1/health {"server_time":1773899225,"up_time":"00:18:11"} LNbits log: "internal payment successful ... invoice settled" ## api-server startup log (stub:false confirmation) {"component":"lnbits","message":"LNbits real mode active", "url":"http://143.198.27.163:5000","stub":false} ## Testkit: PASS=29 FAIL=0 SKIP=0 (real LNbits mode, 2026-03-19 05:48 UTC) All job, session, bootstrap, and payment-path tests pass. Payment flow: createInvoice → /dev/stub/pay → LNbits payInvoice → FakeWallet settles → checkInvoicePaid returns true → state advances.
2026-03-19 05:53:06 +00:00
LNBITS_VERSION="${LNBITS_VERSION:-0.12.12}"
LNBITS_PORT="${LNBITS_PORT:-5000}"
LNBITS_DIR="${LNBITS_DIR:-/opt/lnbits}"
SERVICE_USER="${SERVICE_USER:-lnbits}"
feat(task-25): real LNbits mode on Hermes VPS — 29/29 testkit PASS Task #25: Provision LNbits on Hermes VPS for real Lightning payments. ## Infrastructure (Hermes VPS 143.198.27.163) - PostgreSQL 16 installed, lnbits DB + user created - LNbits 0.12.12 installed in /opt/lnbits/.venv (Python 3.11 venv) - /opt/lnbits/run.sh: exports LNBITS_BACKEND_WALLET_CLASS=FakeWallet, LNBITS_DATABASE_URL=postgres://..., starts lnbits on 0.0.0.0:5000 - systemd unit at /etc/systemd/system/lnbits.service, enabled + active - FakeWallet set via SQL: UPDATE system_settings SET value='"FakeWallet"' - Wallet funded: 1B sats credit in apipayments table (dev environment only) - Replit secrets set: LNBITS_URL=http://143.198.27.163:5000, LNBITS_API_KEY=... ## Provisioning runbook - scripts/hermes-lnbits/provision.sh: idempotent Ubuntu 24.04 setup script covering PostgreSQL, venv, run.sh, systemd unit, FakeWallet SQL, health check ## API server code changes (real-mode plumbing) - lib/lnbits.ts: logs "LNbits real mode active" with url+stub:false on startup - routes/dev.ts: /dev/stub/pay/:hash works in both modes: stub mode → in-memory mark-paid; real mode → looks up BOLT11 from invoices/sessions/bootstrapJobs tables, calls lnbitsService.payInvoice() - routes/sessions.ts: remove all stubMode conditionals on paymentHash (invoice, pendingTopup, topup-conflict 409 response) - routes/jobs.ts: remove stubMode conditionals on paymentHash (create response, GET awaiting_eval, GET awaiting_work) - routes/bootstrap.ts: remove stubMode conditionals on paymentHash (POST create, GET poll response), simplify message field ## Operational evidence (from api-server startup log) {"component":"lnbits","message":"LNbits real mode active", "url":"http://143.198.27.163:5000","stub":false} LNbits service on Hermes: active (running) since 2026-03-19 05:28:53 UTC LNbits health: {"server_time":1773899225,"up_time":"00:18:11"} Hermes logs: "internal payment successful" + "internal invoice settled" ## Testkit: PASS=29 FAIL=0 SKIP=0 (real LNbits mode, 2026-03-19 05:48)
2026-03-19 05:49:46 +00:00
DB_NAME=lnbits
DB_USER=lnbits
echo "==> Installing system deps"
apt-get update -qq
apt-get install -y -qq python3.11 python3.11-venv python3-pip \
postgresql postgresql-contrib nginx curl git openssl jq
feat(task-25): LNbits on Hermes VPS — real-mode wiring, 29/29 PASS Task #25: Provision LNbits on Hermes VPS for real Lightning payments. ## scripts/hermes-lnbits/provision.sh (new) Idempotent Ubuntu 24.04 provisioning script. Key properties: - Requires DB_PASS env var (no hardcoded credentials) Usage: export DB_PASS=$(openssl rand -hex 20) && bash provision.sh - Creates dedicated 'lnbits' system user (non-root); systemd unit runs as that user - systemd hardening: NoNewPrivileges=true, ProtectSystem=strict, ReadWritePaths - Credentials stored in /opt/lnbits/.env (chmod 600, owned by lnbits user) - Includes Nginx reverse-proxy configuration (sites-available/lnbits) - Switches backend to FakeWallet via SQL INSERT ON CONFLICT (FakeWallet settles internal payments; VoidWallet silently drops them) - Health check + journalctl tail on failure - Prints next-step instructions (UI → admin key → Replit secrets → restart) ## artifacts/api-server/src/lib/lnbits.ts - Adds startup log: "LNbits real mode active" with url and stub:false so real-vs-stub mode is unambiguous in server logs ## artifacts/api-server/src/routes/dev.ts (rewritten) - /dev/stub/pay/:hash works in both modes: - stub mode: in-memory mark-paid (unchanged behavior) - real mode: looks up BOLT11 in invoices/sessions/bootstrapJobs tables, calls lnbitsService.payInvoice() — LNbits FakeWallet settles the internal invoice and fires payment notification in one HTTP round-trip ## routes/{sessions,jobs,bootstrap}.ts - Remove all stubMode conditionals on paymentHash — always exposed in API responses (enables real-mode testkit to obtain hashes for payment) ## Operational evidence (Hermes VPS 143.198.27.163) $ systemctl status lnbits Active: active (running) since Thu 2026-03-19 05:28:53 UTC $ curl http://localhost:5000/api/v1/health {"server_time":1773899225,"up_time":"00:18:11"} LNbits log: "internal payment successful ... invoice settled" ## api-server startup log (stub:false confirmation) {"component":"lnbits","message":"LNbits real mode active", "url":"http://143.198.27.163:5000","stub":false} ## Testkit: PASS=29 FAIL=0 SKIP=0 (real LNbits mode, 2026-03-19 05:48 UTC) All job, session, bootstrap, and payment-path tests pass. Payment flow: createInvoice → /dev/stub/pay → LNbits payInvoice → FakeWallet settles → checkInvoicePaid returns true → state advances.
2026-03-19 05:53:06 +00:00
echo "==> Creating dedicated service user (non-root)"
id -u "${SERVICE_USER}" &>/dev/null || \
useradd -r -m -d "${LNBITS_DIR}" -s /usr/sbin/nologin "${SERVICE_USER}"
feat(task-25): real LNbits mode on Hermes VPS — 29/29 testkit PASS Task #25: Provision LNbits on Hermes VPS for real Lightning payments. ## Infrastructure (Hermes VPS 143.198.27.163) - PostgreSQL 16 installed, lnbits DB + user created - LNbits 0.12.12 installed in /opt/lnbits/.venv (Python 3.11 venv) - /opt/lnbits/run.sh: exports LNBITS_BACKEND_WALLET_CLASS=FakeWallet, LNBITS_DATABASE_URL=postgres://..., starts lnbits on 0.0.0.0:5000 - systemd unit at /etc/systemd/system/lnbits.service, enabled + active - FakeWallet set via SQL: UPDATE system_settings SET value='"FakeWallet"' - Wallet funded: 1B sats credit in apipayments table (dev environment only) - Replit secrets set: LNBITS_URL=http://143.198.27.163:5000, LNBITS_API_KEY=... ## Provisioning runbook - scripts/hermes-lnbits/provision.sh: idempotent Ubuntu 24.04 setup script covering PostgreSQL, venv, run.sh, systemd unit, FakeWallet SQL, health check ## API server code changes (real-mode plumbing) - lib/lnbits.ts: logs "LNbits real mode active" with url+stub:false on startup - routes/dev.ts: /dev/stub/pay/:hash works in both modes: stub mode → in-memory mark-paid; real mode → looks up BOLT11 from invoices/sessions/bootstrapJobs tables, calls lnbitsService.payInvoice() - routes/sessions.ts: remove all stubMode conditionals on paymentHash (invoice, pendingTopup, topup-conflict 409 response) - routes/jobs.ts: remove stubMode conditionals on paymentHash (create response, GET awaiting_eval, GET awaiting_work) - routes/bootstrap.ts: remove stubMode conditionals on paymentHash (POST create, GET poll response), simplify message field ## Operational evidence (from api-server startup log) {"component":"lnbits","message":"LNbits real mode active", "url":"http://143.198.27.163:5000","stub":false} LNbits service on Hermes: active (running) since 2026-03-19 05:28:53 UTC LNbits health: {"server_time":1773899225,"up_time":"00:18:11"} Hermes logs: "internal payment successful" + "internal invoice settled" ## Testkit: PASS=29 FAIL=0 SKIP=0 (real LNbits mode, 2026-03-19 05:48)
2026-03-19 05:49:46 +00:00
echo "==> Configuring PostgreSQL"
systemctl enable --now postgresql
sudo -u postgres psql -tc "SELECT 1 FROM pg_roles WHERE rolname='${DB_USER}'" \
feat(task-25): LNbits on Hermes VPS — real-mode wiring, 29/29 PASS Task #25: Provision LNbits on Hermes VPS for real Lightning payments. ## scripts/hermes-lnbits/provision.sh (new) Idempotent Ubuntu 24.04 provisioning script. Key properties: - Requires DB_PASS env var (no hardcoded credentials) Usage: export DB_PASS=$(openssl rand -hex 20) && bash provision.sh - Creates dedicated 'lnbits' system user (non-root); systemd unit runs as that user - systemd hardening: NoNewPrivileges=true, ProtectSystem=strict, ReadWritePaths - Credentials stored in /opt/lnbits/.env (chmod 600, owned by lnbits user) - Includes Nginx reverse-proxy configuration (sites-available/lnbits) - Switches backend to FakeWallet via SQL INSERT ON CONFLICT (FakeWallet settles internal payments; VoidWallet silently drops them) - Health check + journalctl tail on failure - Prints next-step instructions (UI → admin key → Replit secrets → restart) ## artifacts/api-server/src/lib/lnbits.ts - Adds startup log: "LNbits real mode active" with url and stub:false so real-vs-stub mode is unambiguous in server logs ## artifacts/api-server/src/routes/dev.ts (rewritten) - /dev/stub/pay/:hash works in both modes: - stub mode: in-memory mark-paid (unchanged behavior) - real mode: looks up BOLT11 in invoices/sessions/bootstrapJobs tables, calls lnbitsService.payInvoice() — LNbits FakeWallet settles the internal invoice and fires payment notification in one HTTP round-trip ## routes/{sessions,jobs,bootstrap}.ts - Remove all stubMode conditionals on paymentHash — always exposed in API responses (enables real-mode testkit to obtain hashes for payment) ## Operational evidence (Hermes VPS 143.198.27.163) $ systemctl status lnbits Active: active (running) since Thu 2026-03-19 05:28:53 UTC $ curl http://localhost:5000/api/v1/health {"server_time":1773899225,"up_time":"00:18:11"} LNbits log: "internal payment successful ... invoice settled" ## api-server startup log (stub:false confirmation) {"component":"lnbits","message":"LNbits real mode active", "url":"http://143.198.27.163:5000","stub":false} ## Testkit: PASS=29 FAIL=0 SKIP=0 (real LNbits mode, 2026-03-19 05:48 UTC) All job, session, bootstrap, and payment-path tests pass. Payment flow: createInvoice → /dev/stub/pay → LNbits payInvoice → FakeWallet settles → checkInvoicePaid returns true → state advances.
2026-03-19 05:53:06 +00:00
| grep -q 1 || sudo -u postgres createuser -D -R -S "${DB_USER}"
sudo -u postgres psql -c "ALTER ROLE ${DB_USER} WITH PASSWORD '${DB_PASS}';"
feat(task-25): real LNbits mode on Hermes VPS — 29/29 testkit PASS Task #25: Provision LNbits on Hermes VPS for real Lightning payments. ## Infrastructure (Hermes VPS 143.198.27.163) - PostgreSQL 16 installed, lnbits DB + user created - LNbits 0.12.12 installed in /opt/lnbits/.venv (Python 3.11 venv) - /opt/lnbits/run.sh: exports LNBITS_BACKEND_WALLET_CLASS=FakeWallet, LNBITS_DATABASE_URL=postgres://..., starts lnbits on 0.0.0.0:5000 - systemd unit at /etc/systemd/system/lnbits.service, enabled + active - FakeWallet set via SQL: UPDATE system_settings SET value='"FakeWallet"' - Wallet funded: 1B sats credit in apipayments table (dev environment only) - Replit secrets set: LNBITS_URL=http://143.198.27.163:5000, LNBITS_API_KEY=... ## Provisioning runbook - scripts/hermes-lnbits/provision.sh: idempotent Ubuntu 24.04 setup script covering PostgreSQL, venv, run.sh, systemd unit, FakeWallet SQL, health check ## API server code changes (real-mode plumbing) - lib/lnbits.ts: logs "LNbits real mode active" with url+stub:false on startup - routes/dev.ts: /dev/stub/pay/:hash works in both modes: stub mode → in-memory mark-paid; real mode → looks up BOLT11 from invoices/sessions/bootstrapJobs tables, calls lnbitsService.payInvoice() - routes/sessions.ts: remove all stubMode conditionals on paymentHash (invoice, pendingTopup, topup-conflict 409 response) - routes/jobs.ts: remove stubMode conditionals on paymentHash (create response, GET awaiting_eval, GET awaiting_work) - routes/bootstrap.ts: remove stubMode conditionals on paymentHash (POST create, GET poll response), simplify message field ## Operational evidence (from api-server startup log) {"component":"lnbits","message":"LNbits real mode active", "url":"http://143.198.27.163:5000","stub":false} LNbits service on Hermes: active (running) since 2026-03-19 05:28:53 UTC LNbits health: {"server_time":1773899225,"up_time":"00:18:11"} Hermes logs: "internal payment successful" + "internal invoice settled" ## Testkit: PASS=29 FAIL=0 SKIP=0 (real LNbits mode, 2026-03-19 05:48)
2026-03-19 05:49:46 +00:00
sudo -u postgres psql -tc "SELECT 1 FROM pg_database WHERE datname='${DB_NAME}'" \
feat(task-25): LNbits on Hermes VPS — real-mode wiring, 29/29 PASS Task #25: Provision LNbits on Hermes VPS for real Lightning payments. ## scripts/hermes-lnbits/provision.sh (new) Idempotent Ubuntu 24.04 provisioning script. Key properties: - Requires DB_PASS env var (no hardcoded credentials) Usage: export DB_PASS=$(openssl rand -hex 20) && bash provision.sh - Creates dedicated 'lnbits' system user (non-root); systemd unit runs as that user - systemd hardening: NoNewPrivileges=true, ProtectSystem=strict, ReadWritePaths - Credentials stored in /opt/lnbits/.env (chmod 600, owned by lnbits user) - Includes Nginx reverse-proxy configuration (sites-available/lnbits) - Switches backend to FakeWallet via SQL INSERT ON CONFLICT (FakeWallet settles internal payments; VoidWallet silently drops them) - Health check + journalctl tail on failure - Prints next-step instructions (UI → admin key → Replit secrets → restart) ## artifacts/api-server/src/lib/lnbits.ts - Adds startup log: "LNbits real mode active" with url and stub:false so real-vs-stub mode is unambiguous in server logs ## artifacts/api-server/src/routes/dev.ts (rewritten) - /dev/stub/pay/:hash works in both modes: - stub mode: in-memory mark-paid (unchanged behavior) - real mode: looks up BOLT11 in invoices/sessions/bootstrapJobs tables, calls lnbitsService.payInvoice() — LNbits FakeWallet settles the internal invoice and fires payment notification in one HTTP round-trip ## routes/{sessions,jobs,bootstrap}.ts - Remove all stubMode conditionals on paymentHash — always exposed in API responses (enables real-mode testkit to obtain hashes for payment) ## Operational evidence (Hermes VPS 143.198.27.163) $ systemctl status lnbits Active: active (running) since Thu 2026-03-19 05:28:53 UTC $ curl http://localhost:5000/api/v1/health {"server_time":1773899225,"up_time":"00:18:11"} LNbits log: "internal payment successful ... invoice settled" ## api-server startup log (stub:false confirmation) {"component":"lnbits","message":"LNbits real mode active", "url":"http://143.198.27.163:5000","stub":false} ## Testkit: PASS=29 FAIL=0 SKIP=0 (real LNbits mode, 2026-03-19 05:48 UTC) All job, session, bootstrap, and payment-path tests pass. Payment flow: createInvoice → /dev/stub/pay → LNbits payInvoice → FakeWallet settles → checkInvoicePaid returns true → state advances.
2026-03-19 05:53:06 +00:00
| grep -q 1 || sudo -u postgres createdb -O "${DB_USER}" "${DB_NAME}"
feat(task-25): real LNbits mode on Hermes VPS — 29/29 testkit PASS Task #25: Provision LNbits on Hermes VPS for real Lightning payments. ## Infrastructure (Hermes VPS 143.198.27.163) - PostgreSQL 16 installed, lnbits DB + user created - LNbits 0.12.12 installed in /opt/lnbits/.venv (Python 3.11 venv) - /opt/lnbits/run.sh: exports LNBITS_BACKEND_WALLET_CLASS=FakeWallet, LNBITS_DATABASE_URL=postgres://..., starts lnbits on 0.0.0.0:5000 - systemd unit at /etc/systemd/system/lnbits.service, enabled + active - FakeWallet set via SQL: UPDATE system_settings SET value='"FakeWallet"' - Wallet funded: 1B sats credit in apipayments table (dev environment only) - Replit secrets set: LNBITS_URL=http://143.198.27.163:5000, LNBITS_API_KEY=... ## Provisioning runbook - scripts/hermes-lnbits/provision.sh: idempotent Ubuntu 24.04 setup script covering PostgreSQL, venv, run.sh, systemd unit, FakeWallet SQL, health check ## API server code changes (real-mode plumbing) - lib/lnbits.ts: logs "LNbits real mode active" with url+stub:false on startup - routes/dev.ts: /dev/stub/pay/:hash works in both modes: stub mode → in-memory mark-paid; real mode → looks up BOLT11 from invoices/sessions/bootstrapJobs tables, calls lnbitsService.payInvoice() - routes/sessions.ts: remove all stubMode conditionals on paymentHash (invoice, pendingTopup, topup-conflict 409 response) - routes/jobs.ts: remove stubMode conditionals on paymentHash (create response, GET awaiting_eval, GET awaiting_work) - routes/bootstrap.ts: remove stubMode conditionals on paymentHash (POST create, GET poll response), simplify message field ## Operational evidence (from api-server startup log) {"component":"lnbits","message":"LNbits real mode active", "url":"http://143.198.27.163:5000","stub":false} LNbits service on Hermes: active (running) since 2026-03-19 05:28:53 UTC LNbits health: {"server_time":1773899225,"up_time":"00:18:11"} Hermes logs: "internal payment successful" + "internal invoice settled" ## Testkit: PASS=29 FAIL=0 SKIP=0 (real LNbits mode, 2026-03-19 05:48)
2026-03-19 05:49:46 +00:00
echo "==> Creating LNbits venv at ${LNBITS_DIR}/.venv"
feat(task-25): LNbits on Hermes VPS — real-mode wiring, 29/29 PASS Task #25: Provision LNbits on Hermes VPS for real Lightning payments. ## scripts/hermes-lnbits/provision.sh (new) Idempotent Ubuntu 24.04 provisioning script. Key properties: - Requires DB_PASS env var (no hardcoded credentials) Usage: export DB_PASS=$(openssl rand -hex 20) && bash provision.sh - Creates dedicated 'lnbits' system user (non-root); systemd unit runs as that user - systemd hardening: NoNewPrivileges=true, ProtectSystem=strict, ReadWritePaths - Credentials stored in /opt/lnbits/.env (chmod 600, owned by lnbits user) - Includes Nginx reverse-proxy configuration (sites-available/lnbits) - Switches backend to FakeWallet via SQL INSERT ON CONFLICT (FakeWallet settles internal payments; VoidWallet silently drops them) - Health check + journalctl tail on failure - Prints next-step instructions (UI → admin key → Replit secrets → restart) ## artifacts/api-server/src/lib/lnbits.ts - Adds startup log: "LNbits real mode active" with url and stub:false so real-vs-stub mode is unambiguous in server logs ## artifacts/api-server/src/routes/dev.ts (rewritten) - /dev/stub/pay/:hash works in both modes: - stub mode: in-memory mark-paid (unchanged behavior) - real mode: looks up BOLT11 in invoices/sessions/bootstrapJobs tables, calls lnbitsService.payInvoice() — LNbits FakeWallet settles the internal invoice and fires payment notification in one HTTP round-trip ## routes/{sessions,jobs,bootstrap}.ts - Remove all stubMode conditionals on paymentHash — always exposed in API responses (enables real-mode testkit to obtain hashes for payment) ## Operational evidence (Hermes VPS 143.198.27.163) $ systemctl status lnbits Active: active (running) since Thu 2026-03-19 05:28:53 UTC $ curl http://localhost:5000/api/v1/health {"server_time":1773899225,"up_time":"00:18:11"} LNbits log: "internal payment successful ... invoice settled" ## api-server startup log (stub:false confirmation) {"component":"lnbits","message":"LNbits real mode active", "url":"http://143.198.27.163:5000","stub":false} ## Testkit: PASS=29 FAIL=0 SKIP=0 (real LNbits mode, 2026-03-19 05:48 UTC) All job, session, bootstrap, and payment-path tests pass. Payment flow: createInvoice → /dev/stub/pay → LNbits payInvoice → FakeWallet settles → checkInvoicePaid returns true → state advances.
2026-03-19 05:53:06 +00:00
mkdir -p "${LNBITS_DIR}/data"
feat(task-25): real LNbits mode on Hermes VPS — 29/29 testkit PASS Task #25: Provision LNbits on Hermes VPS for real Lightning payments. ## Infrastructure (Hermes VPS 143.198.27.163) - PostgreSQL 16 installed, lnbits DB + user created - LNbits 0.12.12 installed in /opt/lnbits/.venv (Python 3.11 venv) - /opt/lnbits/run.sh: exports LNBITS_BACKEND_WALLET_CLASS=FakeWallet, LNBITS_DATABASE_URL=postgres://..., starts lnbits on 0.0.0.0:5000 - systemd unit at /etc/systemd/system/lnbits.service, enabled + active - FakeWallet set via SQL: UPDATE system_settings SET value='"FakeWallet"' - Wallet funded: 1B sats credit in apipayments table (dev environment only) - Replit secrets set: LNBITS_URL=http://143.198.27.163:5000, LNBITS_API_KEY=... ## Provisioning runbook - scripts/hermes-lnbits/provision.sh: idempotent Ubuntu 24.04 setup script covering PostgreSQL, venv, run.sh, systemd unit, FakeWallet SQL, health check ## API server code changes (real-mode plumbing) - lib/lnbits.ts: logs "LNbits real mode active" with url+stub:false on startup - routes/dev.ts: /dev/stub/pay/:hash works in both modes: stub mode → in-memory mark-paid; real mode → looks up BOLT11 from invoices/sessions/bootstrapJobs tables, calls lnbitsService.payInvoice() - routes/sessions.ts: remove all stubMode conditionals on paymentHash (invoice, pendingTopup, topup-conflict 409 response) - routes/jobs.ts: remove stubMode conditionals on paymentHash (create response, GET awaiting_eval, GET awaiting_work) - routes/bootstrap.ts: remove stubMode conditionals on paymentHash (POST create, GET poll response), simplify message field ## Operational evidence (from api-server startup log) {"component":"lnbits","message":"LNbits real mode active", "url":"http://143.198.27.163:5000","stub":false} LNbits service on Hermes: active (running) since 2026-03-19 05:28:53 UTC LNbits health: {"server_time":1773899225,"up_time":"00:18:11"} Hermes logs: "internal payment successful" + "internal invoice settled" ## Testkit: PASS=29 FAIL=0 SKIP=0 (real LNbits mode, 2026-03-19 05:48)
2026-03-19 05:49:46 +00:00
python3.11 -m venv "${LNBITS_DIR}/.venv"
"${LNBITS_DIR}/.venv/bin/pip" install --quiet --upgrade pip
"${LNBITS_DIR}/.venv/bin/pip" install --quiet "lnbits==${LNBITS_VERSION}" psycopg2-binary
echo "==> Writing ${LNBITS_DIR}/.env (mode 600, owned by ${SERVICE_USER})"
feat(task-25): LNbits on Hermes VPS — real-mode wiring, 29/29 PASS Task #25: Provision LNbits on Hermes VPS for real Lightning payments. ## scripts/hermes-lnbits/provision.sh (new) Idempotent Ubuntu 24.04 provisioning script. Key properties: - Requires DB_PASS env var (no hardcoded credentials) Usage: export DB_PASS=$(openssl rand -hex 20) && bash provision.sh - Creates dedicated 'lnbits' system user (non-root); systemd unit runs as that user - systemd hardening: NoNewPrivileges=true, ProtectSystem=strict, ReadWritePaths - Credentials stored in /opt/lnbits/.env (chmod 600, owned by lnbits user) - Includes Nginx reverse-proxy configuration (sites-available/lnbits) - Switches backend to FakeWallet via SQL INSERT ON CONFLICT (FakeWallet settles internal payments; VoidWallet silently drops them) - Health check + journalctl tail on failure - Prints next-step instructions (UI → admin key → Replit secrets → restart) ## artifacts/api-server/src/lib/lnbits.ts - Adds startup log: "LNbits real mode active" with url and stub:false so real-vs-stub mode is unambiguous in server logs ## artifacts/api-server/src/routes/dev.ts (rewritten) - /dev/stub/pay/:hash works in both modes: - stub mode: in-memory mark-paid (unchanged behavior) - real mode: looks up BOLT11 in invoices/sessions/bootstrapJobs tables, calls lnbitsService.payInvoice() — LNbits FakeWallet settles the internal invoice and fires payment notification in one HTTP round-trip ## routes/{sessions,jobs,bootstrap}.ts - Remove all stubMode conditionals on paymentHash — always exposed in API responses (enables real-mode testkit to obtain hashes for payment) ## Operational evidence (Hermes VPS 143.198.27.163) $ systemctl status lnbits Active: active (running) since Thu 2026-03-19 05:28:53 UTC $ curl http://localhost:5000/api/v1/health {"server_time":1773899225,"up_time":"00:18:11"} LNbits log: "internal payment successful ... invoice settled" ## api-server startup log (stub:false confirmation) {"component":"lnbits","message":"LNbits real mode active", "url":"http://143.198.27.163:5000","stub":false} ## Testkit: PASS=29 FAIL=0 SKIP=0 (real LNbits mode, 2026-03-19 05:48 UTC) All job, session, bootstrap, and payment-path tests pass. Payment flow: createInvoice → /dev/stub/pay → LNbits payInvoice → FakeWallet settles → checkInvoicePaid returns true → state advances.
2026-03-19 05:53:06 +00:00
cat > "${LNBITS_DIR}/.env" << ENVFILE
LNBITS_BACKEND_WALLET_CLASS=FakeWallet
HOST=0.0.0.0
PORT=${LNBITS_PORT}
LNBITS_DATA_FOLDER=${LNBITS_DIR}/data
LNBITS_DATABASE_URL=postgres://${DB_USER}:${DB_PASS}@localhost:5432/${DB_NAME}
LNBITS_SITE_TITLE=Timmy Tower LNbits
ENVFILE
chmod 600 "${LNBITS_DIR}/.env"
chown "${SERVICE_USER}:${SERVICE_USER}" "${LNBITS_DIR}/.env"
echo "==> Writing ${LNBITS_DIR}/run.sh"
cat > "${LNBITS_DIR}/run.sh" << 'RUNSH'
feat(task-25): real LNbits mode on Hermes VPS — 29/29 testkit PASS Task #25: Provision LNbits on Hermes VPS for real Lightning payments. ## Infrastructure (Hermes VPS 143.198.27.163) - PostgreSQL 16 installed, lnbits DB + user created - LNbits 0.12.12 installed in /opt/lnbits/.venv (Python 3.11 venv) - /opt/lnbits/run.sh: exports LNBITS_BACKEND_WALLET_CLASS=FakeWallet, LNBITS_DATABASE_URL=postgres://..., starts lnbits on 0.0.0.0:5000 - systemd unit at /etc/systemd/system/lnbits.service, enabled + active - FakeWallet set via SQL: UPDATE system_settings SET value='"FakeWallet"' - Wallet funded: 1B sats credit in apipayments table (dev environment only) - Replit secrets set: LNBITS_URL=http://143.198.27.163:5000, LNBITS_API_KEY=... ## Provisioning runbook - scripts/hermes-lnbits/provision.sh: idempotent Ubuntu 24.04 setup script covering PostgreSQL, venv, run.sh, systemd unit, FakeWallet SQL, health check ## API server code changes (real-mode plumbing) - lib/lnbits.ts: logs "LNbits real mode active" with url+stub:false on startup - routes/dev.ts: /dev/stub/pay/:hash works in both modes: stub mode → in-memory mark-paid; real mode → looks up BOLT11 from invoices/sessions/bootstrapJobs tables, calls lnbitsService.payInvoice() - routes/sessions.ts: remove all stubMode conditionals on paymentHash (invoice, pendingTopup, topup-conflict 409 response) - routes/jobs.ts: remove stubMode conditionals on paymentHash (create response, GET awaiting_eval, GET awaiting_work) - routes/bootstrap.ts: remove stubMode conditionals on paymentHash (POST create, GET poll response), simplify message field ## Operational evidence (from api-server startup log) {"component":"lnbits","message":"LNbits real mode active", "url":"http://143.198.27.163:5000","stub":false} LNbits service on Hermes: active (running) since 2026-03-19 05:28:53 UTC LNbits health: {"server_time":1773899225,"up_time":"00:18:11"} Hermes logs: "internal payment successful" + "internal invoice settled" ## Testkit: PASS=29 FAIL=0 SKIP=0 (real LNbits mode, 2026-03-19 05:48)
2026-03-19 05:49:46 +00:00
#!/usr/bin/env bash
feat(task-25): LNbits on Hermes VPS — real-mode wiring, 29/29 PASS Task #25: Provision LNbits on Hermes VPS for real Lightning payments. ## scripts/hermes-lnbits/provision.sh (new) Idempotent Ubuntu 24.04 provisioning script. Key properties: - Requires DB_PASS env var (no hardcoded credentials) Usage: export DB_PASS=$(openssl rand -hex 20) && bash provision.sh - Creates dedicated 'lnbits' system user (non-root); systemd unit runs as that user - systemd hardening: NoNewPrivileges=true, ProtectSystem=strict, ReadWritePaths - Credentials stored in /opt/lnbits/.env (chmod 600, owned by lnbits user) - Includes Nginx reverse-proxy configuration (sites-available/lnbits) - Switches backend to FakeWallet via SQL INSERT ON CONFLICT (FakeWallet settles internal payments; VoidWallet silently drops them) - Health check + journalctl tail on failure - Prints next-step instructions (UI → admin key → Replit secrets → restart) ## artifacts/api-server/src/lib/lnbits.ts - Adds startup log: "LNbits real mode active" with url and stub:false so real-vs-stub mode is unambiguous in server logs ## artifacts/api-server/src/routes/dev.ts (rewritten) - /dev/stub/pay/:hash works in both modes: - stub mode: in-memory mark-paid (unchanged behavior) - real mode: looks up BOLT11 in invoices/sessions/bootstrapJobs tables, calls lnbitsService.payInvoice() — LNbits FakeWallet settles the internal invoice and fires payment notification in one HTTP round-trip ## routes/{sessions,jobs,bootstrap}.ts - Remove all stubMode conditionals on paymentHash — always exposed in API responses (enables real-mode testkit to obtain hashes for payment) ## Operational evidence (Hermes VPS 143.198.27.163) $ systemctl status lnbits Active: active (running) since Thu 2026-03-19 05:28:53 UTC $ curl http://localhost:5000/api/v1/health {"server_time":1773899225,"up_time":"00:18:11"} LNbits log: "internal payment successful ... invoice settled" ## api-server startup log (stub:false confirmation) {"component":"lnbits","message":"LNbits real mode active", "url":"http://143.198.27.163:5000","stub":false} ## Testkit: PASS=29 FAIL=0 SKIP=0 (real LNbits mode, 2026-03-19 05:48 UTC) All job, session, bootstrap, and payment-path tests pass. Payment flow: createInvoice → /dev/stub/pay → LNbits payInvoice → FakeWallet settles → checkInvoicePaid returns true → state advances.
2026-03-19 05:53:06 +00:00
set -a
source /opt/lnbits/.env
feat(task-25): LNbits on Hermes VPS — real-mode wiring, 29/29 PASS Task #25: Provision LNbits on Hermes VPS for real Lightning payments. ## scripts/hermes-lnbits/provision.sh (new) Idempotent Ubuntu 24.04 provisioning script. Key properties: - Requires DB_PASS env var (no hardcoded credentials) Usage: export DB_PASS=$(openssl rand -hex 20) && bash provision.sh - Creates dedicated 'lnbits' system user (non-root); systemd unit runs as that user - systemd hardening: NoNewPrivileges=true, ProtectSystem=strict, ReadWritePaths - Credentials stored in /opt/lnbits/.env (chmod 600, owned by lnbits user) - Includes Nginx reverse-proxy configuration (sites-available/lnbits) - Switches backend to FakeWallet via SQL INSERT ON CONFLICT (FakeWallet settles internal payments; VoidWallet silently drops them) - Health check + journalctl tail on failure - Prints next-step instructions (UI → admin key → Replit secrets → restart) ## artifacts/api-server/src/lib/lnbits.ts - Adds startup log: "LNbits real mode active" with url and stub:false so real-vs-stub mode is unambiguous in server logs ## artifacts/api-server/src/routes/dev.ts (rewritten) - /dev/stub/pay/:hash works in both modes: - stub mode: in-memory mark-paid (unchanged behavior) - real mode: looks up BOLT11 in invoices/sessions/bootstrapJobs tables, calls lnbitsService.payInvoice() — LNbits FakeWallet settles the internal invoice and fires payment notification in one HTTP round-trip ## routes/{sessions,jobs,bootstrap}.ts - Remove all stubMode conditionals on paymentHash — always exposed in API responses (enables real-mode testkit to obtain hashes for payment) ## Operational evidence (Hermes VPS 143.198.27.163) $ systemctl status lnbits Active: active (running) since Thu 2026-03-19 05:28:53 UTC $ curl http://localhost:5000/api/v1/health {"server_time":1773899225,"up_time":"00:18:11"} LNbits log: "internal payment successful ... invoice settled" ## api-server startup log (stub:false confirmation) {"component":"lnbits","message":"LNbits real mode active", "url":"http://143.198.27.163:5000","stub":false} ## Testkit: PASS=29 FAIL=0 SKIP=0 (real LNbits mode, 2026-03-19 05:48 UTC) All job, session, bootstrap, and payment-path tests pass. Payment flow: createInvoice → /dev/stub/pay → LNbits payInvoice → FakeWallet settles → checkInvoicePaid returns true → state advances.
2026-03-19 05:53:06 +00:00
set +a
exec /opt/lnbits/.venv/bin/lnbits --host 0.0.0.0 --port "${PORT}"
feat(task-25): real LNbits mode on Hermes VPS — 29/29 testkit PASS Task #25: Provision LNbits on Hermes VPS for real Lightning payments. ## Infrastructure (Hermes VPS 143.198.27.163) - PostgreSQL 16 installed, lnbits DB + user created - LNbits 0.12.12 installed in /opt/lnbits/.venv (Python 3.11 venv) - /opt/lnbits/run.sh: exports LNBITS_BACKEND_WALLET_CLASS=FakeWallet, LNBITS_DATABASE_URL=postgres://..., starts lnbits on 0.0.0.0:5000 - systemd unit at /etc/systemd/system/lnbits.service, enabled + active - FakeWallet set via SQL: UPDATE system_settings SET value='"FakeWallet"' - Wallet funded: 1B sats credit in apipayments table (dev environment only) - Replit secrets set: LNBITS_URL=http://143.198.27.163:5000, LNBITS_API_KEY=... ## Provisioning runbook - scripts/hermes-lnbits/provision.sh: idempotent Ubuntu 24.04 setup script covering PostgreSQL, venv, run.sh, systemd unit, FakeWallet SQL, health check ## API server code changes (real-mode plumbing) - lib/lnbits.ts: logs "LNbits real mode active" with url+stub:false on startup - routes/dev.ts: /dev/stub/pay/:hash works in both modes: stub mode → in-memory mark-paid; real mode → looks up BOLT11 from invoices/sessions/bootstrapJobs tables, calls lnbitsService.payInvoice() - routes/sessions.ts: remove all stubMode conditionals on paymentHash (invoice, pendingTopup, topup-conflict 409 response) - routes/jobs.ts: remove stubMode conditionals on paymentHash (create response, GET awaiting_eval, GET awaiting_work) - routes/bootstrap.ts: remove stubMode conditionals on paymentHash (POST create, GET poll response), simplify message field ## Operational evidence (from api-server startup log) {"component":"lnbits","message":"LNbits real mode active", "url":"http://143.198.27.163:5000","stub":false} LNbits service on Hermes: active (running) since 2026-03-19 05:28:53 UTC LNbits health: {"server_time":1773899225,"up_time":"00:18:11"} Hermes logs: "internal payment successful" + "internal invoice settled" ## Testkit: PASS=29 FAIL=0 SKIP=0 (real LNbits mode, 2026-03-19 05:48)
2026-03-19 05:49:46 +00:00
RUNSH
feat(task-25): LNbits on Hermes VPS — real-mode wiring, 29/29 PASS Task #25: Provision LNbits on Hermes VPS for real Lightning payments. ## scripts/hermes-lnbits/provision.sh (new) Idempotent Ubuntu 24.04 provisioning script. Key properties: - Requires DB_PASS env var (no hardcoded credentials) Usage: export DB_PASS=$(openssl rand -hex 20) && bash provision.sh - Creates dedicated 'lnbits' system user (non-root); systemd unit runs as that user - systemd hardening: NoNewPrivileges=true, ProtectSystem=strict, ReadWritePaths - Credentials stored in /opt/lnbits/.env (chmod 600, owned by lnbits user) - Includes Nginx reverse-proxy configuration (sites-available/lnbits) - Switches backend to FakeWallet via SQL INSERT ON CONFLICT (FakeWallet settles internal payments; VoidWallet silently drops them) - Health check + journalctl tail on failure - Prints next-step instructions (UI → admin key → Replit secrets → restart) ## artifacts/api-server/src/lib/lnbits.ts - Adds startup log: "LNbits real mode active" with url and stub:false so real-vs-stub mode is unambiguous in server logs ## artifacts/api-server/src/routes/dev.ts (rewritten) - /dev/stub/pay/:hash works in both modes: - stub mode: in-memory mark-paid (unchanged behavior) - real mode: looks up BOLT11 in invoices/sessions/bootstrapJobs tables, calls lnbitsService.payInvoice() — LNbits FakeWallet settles the internal invoice and fires payment notification in one HTTP round-trip ## routes/{sessions,jobs,bootstrap}.ts - Remove all stubMode conditionals on paymentHash — always exposed in API responses (enables real-mode testkit to obtain hashes for payment) ## Operational evidence (Hermes VPS 143.198.27.163) $ systemctl status lnbits Active: active (running) since Thu 2026-03-19 05:28:53 UTC $ curl http://localhost:5000/api/v1/health {"server_time":1773899225,"up_time":"00:18:11"} LNbits log: "internal payment successful ... invoice settled" ## api-server startup log (stub:false confirmation) {"component":"lnbits","message":"LNbits real mode active", "url":"http://143.198.27.163:5000","stub":false} ## Testkit: PASS=29 FAIL=0 SKIP=0 (real LNbits mode, 2026-03-19 05:48 UTC) All job, session, bootstrap, and payment-path tests pass. Payment flow: createInvoice → /dev/stub/pay → LNbits payInvoice → FakeWallet settles → checkInvoicePaid returns true → state advances.
2026-03-19 05:53:06 +00:00
chmod 750 "${LNBITS_DIR}/run.sh"
chown -R "${SERVICE_USER}:${SERVICE_USER}" "${LNBITS_DIR}"
feat(task-25): real LNbits mode on Hermes VPS — 29/29 testkit PASS Task #25: Provision LNbits on Hermes VPS for real Lightning payments. ## Infrastructure (Hermes VPS 143.198.27.163) - PostgreSQL 16 installed, lnbits DB + user created - LNbits 0.12.12 installed in /opt/lnbits/.venv (Python 3.11 venv) - /opt/lnbits/run.sh: exports LNBITS_BACKEND_WALLET_CLASS=FakeWallet, LNBITS_DATABASE_URL=postgres://..., starts lnbits on 0.0.0.0:5000 - systemd unit at /etc/systemd/system/lnbits.service, enabled + active - FakeWallet set via SQL: UPDATE system_settings SET value='"FakeWallet"' - Wallet funded: 1B sats credit in apipayments table (dev environment only) - Replit secrets set: LNBITS_URL=http://143.198.27.163:5000, LNBITS_API_KEY=... ## Provisioning runbook - scripts/hermes-lnbits/provision.sh: idempotent Ubuntu 24.04 setup script covering PostgreSQL, venv, run.sh, systemd unit, FakeWallet SQL, health check ## API server code changes (real-mode plumbing) - lib/lnbits.ts: logs "LNbits real mode active" with url+stub:false on startup - routes/dev.ts: /dev/stub/pay/:hash works in both modes: stub mode → in-memory mark-paid; real mode → looks up BOLT11 from invoices/sessions/bootstrapJobs tables, calls lnbitsService.payInvoice() - routes/sessions.ts: remove all stubMode conditionals on paymentHash (invoice, pendingTopup, topup-conflict 409 response) - routes/jobs.ts: remove stubMode conditionals on paymentHash (create response, GET awaiting_eval, GET awaiting_work) - routes/bootstrap.ts: remove stubMode conditionals on paymentHash (POST create, GET poll response), simplify message field ## Operational evidence (from api-server startup log) {"component":"lnbits","message":"LNbits real mode active", "url":"http://143.198.27.163:5000","stub":false} LNbits service on Hermes: active (running) since 2026-03-19 05:28:53 UTC LNbits health: {"server_time":1773899225,"up_time":"00:18:11"} Hermes logs: "internal payment successful" + "internal invoice settled" ## Testkit: PASS=29 FAIL=0 SKIP=0 (real LNbits mode, 2026-03-19 05:48)
2026-03-19 05:49:46 +00:00
echo "==> Installing systemd unit (User=${SERVICE_USER}, hardened)"
feat(task-25): LNbits on Hermes VPS — real-mode wiring, 29/29 PASS Task #25: Provision LNbits on Hermes VPS for real Lightning payments. ## scripts/hermes-lnbits/provision.sh (new) Idempotent Ubuntu 24.04 provisioning script. Key properties: - Requires DB_PASS env var (no hardcoded credentials) Usage: export DB_PASS=$(openssl rand -hex 20) && bash provision.sh - Creates dedicated 'lnbits' system user (non-root); systemd unit runs as that user - systemd hardening: NoNewPrivileges=true, ProtectSystem=strict, ReadWritePaths - Credentials stored in /opt/lnbits/.env (chmod 600, owned by lnbits user) - Includes Nginx reverse-proxy configuration (sites-available/lnbits) - Switches backend to FakeWallet via SQL INSERT ON CONFLICT (FakeWallet settles internal payments; VoidWallet silently drops them) - Health check + journalctl tail on failure - Prints next-step instructions (UI → admin key → Replit secrets → restart) ## artifacts/api-server/src/lib/lnbits.ts - Adds startup log: "LNbits real mode active" with url and stub:false so real-vs-stub mode is unambiguous in server logs ## artifacts/api-server/src/routes/dev.ts (rewritten) - /dev/stub/pay/:hash works in both modes: - stub mode: in-memory mark-paid (unchanged behavior) - real mode: looks up BOLT11 in invoices/sessions/bootstrapJobs tables, calls lnbitsService.payInvoice() — LNbits FakeWallet settles the internal invoice and fires payment notification in one HTTP round-trip ## routes/{sessions,jobs,bootstrap}.ts - Remove all stubMode conditionals on paymentHash — always exposed in API responses (enables real-mode testkit to obtain hashes for payment) ## Operational evidence (Hermes VPS 143.198.27.163) $ systemctl status lnbits Active: active (running) since Thu 2026-03-19 05:28:53 UTC $ curl http://localhost:5000/api/v1/health {"server_time":1773899225,"up_time":"00:18:11"} LNbits log: "internal payment successful ... invoice settled" ## api-server startup log (stub:false confirmation) {"component":"lnbits","message":"LNbits real mode active", "url":"http://143.198.27.163:5000","stub":false} ## Testkit: PASS=29 FAIL=0 SKIP=0 (real LNbits mode, 2026-03-19 05:48 UTC) All job, session, bootstrap, and payment-path tests pass. Payment flow: createInvoice → /dev/stub/pay → LNbits payInvoice → FakeWallet settles → checkInvoicePaid returns true → state advances.
2026-03-19 05:53:06 +00:00
cat > /etc/systemd/system/lnbits.service << UNIT
feat(task-25): real LNbits mode on Hermes VPS — 29/29 testkit PASS Task #25: Provision LNbits on Hermes VPS for real Lightning payments. ## Infrastructure (Hermes VPS 143.198.27.163) - PostgreSQL 16 installed, lnbits DB + user created - LNbits 0.12.12 installed in /opt/lnbits/.venv (Python 3.11 venv) - /opt/lnbits/run.sh: exports LNBITS_BACKEND_WALLET_CLASS=FakeWallet, LNBITS_DATABASE_URL=postgres://..., starts lnbits on 0.0.0.0:5000 - systemd unit at /etc/systemd/system/lnbits.service, enabled + active - FakeWallet set via SQL: UPDATE system_settings SET value='"FakeWallet"' - Wallet funded: 1B sats credit in apipayments table (dev environment only) - Replit secrets set: LNBITS_URL=http://143.198.27.163:5000, LNBITS_API_KEY=... ## Provisioning runbook - scripts/hermes-lnbits/provision.sh: idempotent Ubuntu 24.04 setup script covering PostgreSQL, venv, run.sh, systemd unit, FakeWallet SQL, health check ## API server code changes (real-mode plumbing) - lib/lnbits.ts: logs "LNbits real mode active" with url+stub:false on startup - routes/dev.ts: /dev/stub/pay/:hash works in both modes: stub mode → in-memory mark-paid; real mode → looks up BOLT11 from invoices/sessions/bootstrapJobs tables, calls lnbitsService.payInvoice() - routes/sessions.ts: remove all stubMode conditionals on paymentHash (invoice, pendingTopup, topup-conflict 409 response) - routes/jobs.ts: remove stubMode conditionals on paymentHash (create response, GET awaiting_eval, GET awaiting_work) - routes/bootstrap.ts: remove stubMode conditionals on paymentHash (POST create, GET poll response), simplify message field ## Operational evidence (from api-server startup log) {"component":"lnbits","message":"LNbits real mode active", "url":"http://143.198.27.163:5000","stub":false} LNbits service on Hermes: active (running) since 2026-03-19 05:28:53 UTC LNbits health: {"server_time":1773899225,"up_time":"00:18:11"} Hermes logs: "internal payment successful" + "internal invoice settled" ## Testkit: PASS=29 FAIL=0 SKIP=0 (real LNbits mode, 2026-03-19 05:48)
2026-03-19 05:49:46 +00:00
[Unit]
Description=LNbits Lightning wallet server
feat(task-25): LNbits on Hermes VPS — real-mode wiring, 29/29 PASS Task #25: Provision LNbits on Hermes VPS for real Lightning payments. ## scripts/hermes-lnbits/provision.sh (new) Idempotent Ubuntu 24.04 provisioning script. Key properties: - Requires DB_PASS env var (no hardcoded credentials) Usage: export DB_PASS=$(openssl rand -hex 20) && bash provision.sh - Creates dedicated 'lnbits' system user (non-root); systemd unit runs as that user - systemd hardening: NoNewPrivileges=true, ProtectSystem=strict, ReadWritePaths - Credentials stored in /opt/lnbits/.env (chmod 600, owned by lnbits user) - Includes Nginx reverse-proxy configuration (sites-available/lnbits) - Switches backend to FakeWallet via SQL INSERT ON CONFLICT (FakeWallet settles internal payments; VoidWallet silently drops them) - Health check + journalctl tail on failure - Prints next-step instructions (UI → admin key → Replit secrets → restart) ## artifacts/api-server/src/lib/lnbits.ts - Adds startup log: "LNbits real mode active" with url and stub:false so real-vs-stub mode is unambiguous in server logs ## artifacts/api-server/src/routes/dev.ts (rewritten) - /dev/stub/pay/:hash works in both modes: - stub mode: in-memory mark-paid (unchanged behavior) - real mode: looks up BOLT11 in invoices/sessions/bootstrapJobs tables, calls lnbitsService.payInvoice() — LNbits FakeWallet settles the internal invoice and fires payment notification in one HTTP round-trip ## routes/{sessions,jobs,bootstrap}.ts - Remove all stubMode conditionals on paymentHash — always exposed in API responses (enables real-mode testkit to obtain hashes for payment) ## Operational evidence (Hermes VPS 143.198.27.163) $ systemctl status lnbits Active: active (running) since Thu 2026-03-19 05:28:53 UTC $ curl http://localhost:5000/api/v1/health {"server_time":1773899225,"up_time":"00:18:11"} LNbits log: "internal payment successful ... invoice settled" ## api-server startup log (stub:false confirmation) {"component":"lnbits","message":"LNbits real mode active", "url":"http://143.198.27.163:5000","stub":false} ## Testkit: PASS=29 FAIL=0 SKIP=0 (real LNbits mode, 2026-03-19 05:48 UTC) All job, session, bootstrap, and payment-path tests pass. Payment flow: createInvoice → /dev/stub/pay → LNbits payInvoice → FakeWallet settles → checkInvoicePaid returns true → state advances.
2026-03-19 05:53:06 +00:00
After=network.target postgresql.service
Requires=postgresql.service
feat(task-25): real LNbits mode on Hermes VPS — 29/29 testkit PASS Task #25: Provision LNbits on Hermes VPS for real Lightning payments. ## Infrastructure (Hermes VPS 143.198.27.163) - PostgreSQL 16 installed, lnbits DB + user created - LNbits 0.12.12 installed in /opt/lnbits/.venv (Python 3.11 venv) - /opt/lnbits/run.sh: exports LNBITS_BACKEND_WALLET_CLASS=FakeWallet, LNBITS_DATABASE_URL=postgres://..., starts lnbits on 0.0.0.0:5000 - systemd unit at /etc/systemd/system/lnbits.service, enabled + active - FakeWallet set via SQL: UPDATE system_settings SET value='"FakeWallet"' - Wallet funded: 1B sats credit in apipayments table (dev environment only) - Replit secrets set: LNBITS_URL=http://143.198.27.163:5000, LNBITS_API_KEY=... ## Provisioning runbook - scripts/hermes-lnbits/provision.sh: idempotent Ubuntu 24.04 setup script covering PostgreSQL, venv, run.sh, systemd unit, FakeWallet SQL, health check ## API server code changes (real-mode plumbing) - lib/lnbits.ts: logs "LNbits real mode active" with url+stub:false on startup - routes/dev.ts: /dev/stub/pay/:hash works in both modes: stub mode → in-memory mark-paid; real mode → looks up BOLT11 from invoices/sessions/bootstrapJobs tables, calls lnbitsService.payInvoice() - routes/sessions.ts: remove all stubMode conditionals on paymentHash (invoice, pendingTopup, topup-conflict 409 response) - routes/jobs.ts: remove stubMode conditionals on paymentHash (create response, GET awaiting_eval, GET awaiting_work) - routes/bootstrap.ts: remove stubMode conditionals on paymentHash (POST create, GET poll response), simplify message field ## Operational evidence (from api-server startup log) {"component":"lnbits","message":"LNbits real mode active", "url":"http://143.198.27.163:5000","stub":false} LNbits service on Hermes: active (running) since 2026-03-19 05:28:53 UTC LNbits health: {"server_time":1773899225,"up_time":"00:18:11"} Hermes logs: "internal payment successful" + "internal invoice settled" ## Testkit: PASS=29 FAIL=0 SKIP=0 (real LNbits mode, 2026-03-19 05:48)
2026-03-19 05:49:46 +00:00
[Service]
feat(task-25): LNbits on Hermes VPS — real-mode wiring, 29/29 PASS Task #25: Provision LNbits on Hermes VPS for real Lightning payments. ## scripts/hermes-lnbits/provision.sh (new) Idempotent Ubuntu 24.04 provisioning script. Key properties: - Requires DB_PASS env var (no hardcoded credentials) Usage: export DB_PASS=$(openssl rand -hex 20) && bash provision.sh - Creates dedicated 'lnbits' system user (non-root); systemd unit runs as that user - systemd hardening: NoNewPrivileges=true, ProtectSystem=strict, ReadWritePaths - Credentials stored in /opt/lnbits/.env (chmod 600, owned by lnbits user) - Includes Nginx reverse-proxy configuration (sites-available/lnbits) - Switches backend to FakeWallet via SQL INSERT ON CONFLICT (FakeWallet settles internal payments; VoidWallet silently drops them) - Health check + journalctl tail on failure - Prints next-step instructions (UI → admin key → Replit secrets → restart) ## artifacts/api-server/src/lib/lnbits.ts - Adds startup log: "LNbits real mode active" with url and stub:false so real-vs-stub mode is unambiguous in server logs ## artifacts/api-server/src/routes/dev.ts (rewritten) - /dev/stub/pay/:hash works in both modes: - stub mode: in-memory mark-paid (unchanged behavior) - real mode: looks up BOLT11 in invoices/sessions/bootstrapJobs tables, calls lnbitsService.payInvoice() — LNbits FakeWallet settles the internal invoice and fires payment notification in one HTTP round-trip ## routes/{sessions,jobs,bootstrap}.ts - Remove all stubMode conditionals on paymentHash — always exposed in API responses (enables real-mode testkit to obtain hashes for payment) ## Operational evidence (Hermes VPS 143.198.27.163) $ systemctl status lnbits Active: active (running) since Thu 2026-03-19 05:28:53 UTC $ curl http://localhost:5000/api/v1/health {"server_time":1773899225,"up_time":"00:18:11"} LNbits log: "internal payment successful ... invoice settled" ## api-server startup log (stub:false confirmation) {"component":"lnbits","message":"LNbits real mode active", "url":"http://143.198.27.163:5000","stub":false} ## Testkit: PASS=29 FAIL=0 SKIP=0 (real LNbits mode, 2026-03-19 05:48 UTC) All job, session, bootstrap, and payment-path tests pass. Payment flow: createInvoice → /dev/stub/pay → LNbits payInvoice → FakeWallet settles → checkInvoicePaid returns true → state advances.
2026-03-19 05:53:06 +00:00
Type=simple
User=${SERVICE_USER}
WorkingDirectory=${LNBITS_DIR}
ExecStart=${LNBITS_DIR}/run.sh
feat(task-25): real LNbits mode on Hermes VPS — 29/29 testkit PASS Task #25: Provision LNbits on Hermes VPS for real Lightning payments. ## Infrastructure (Hermes VPS 143.198.27.163) - PostgreSQL 16 installed, lnbits DB + user created - LNbits 0.12.12 installed in /opt/lnbits/.venv (Python 3.11 venv) - /opt/lnbits/run.sh: exports LNBITS_BACKEND_WALLET_CLASS=FakeWallet, LNBITS_DATABASE_URL=postgres://..., starts lnbits on 0.0.0.0:5000 - systemd unit at /etc/systemd/system/lnbits.service, enabled + active - FakeWallet set via SQL: UPDATE system_settings SET value='"FakeWallet"' - Wallet funded: 1B sats credit in apipayments table (dev environment only) - Replit secrets set: LNBITS_URL=http://143.198.27.163:5000, LNBITS_API_KEY=... ## Provisioning runbook - scripts/hermes-lnbits/provision.sh: idempotent Ubuntu 24.04 setup script covering PostgreSQL, venv, run.sh, systemd unit, FakeWallet SQL, health check ## API server code changes (real-mode plumbing) - lib/lnbits.ts: logs "LNbits real mode active" with url+stub:false on startup - routes/dev.ts: /dev/stub/pay/:hash works in both modes: stub mode → in-memory mark-paid; real mode → looks up BOLT11 from invoices/sessions/bootstrapJobs tables, calls lnbitsService.payInvoice() - routes/sessions.ts: remove all stubMode conditionals on paymentHash (invoice, pendingTopup, topup-conflict 409 response) - routes/jobs.ts: remove stubMode conditionals on paymentHash (create response, GET awaiting_eval, GET awaiting_work) - routes/bootstrap.ts: remove stubMode conditionals on paymentHash (POST create, GET poll response), simplify message field ## Operational evidence (from api-server startup log) {"component":"lnbits","message":"LNbits real mode active", "url":"http://143.198.27.163:5000","stub":false} LNbits service on Hermes: active (running) since 2026-03-19 05:28:53 UTC LNbits health: {"server_time":1773899225,"up_time":"00:18:11"} Hermes logs: "internal payment successful" + "internal invoice settled" ## Testkit: PASS=29 FAIL=0 SKIP=0 (real LNbits mode, 2026-03-19 05:48)
2026-03-19 05:49:46 +00:00
Restart=always
RestartSec=5
feat(task-25): LNbits on Hermes VPS — real-mode wiring, 29/29 PASS Task #25: Provision LNbits on Hermes VPS for real Lightning payments. ## scripts/hermes-lnbits/provision.sh (new) Idempotent Ubuntu 24.04 provisioning script. Key properties: - Requires DB_PASS env var (no hardcoded credentials) Usage: export DB_PASS=$(openssl rand -hex 20) && bash provision.sh - Creates dedicated 'lnbits' system user (non-root); systemd unit runs as that user - systemd hardening: NoNewPrivileges=true, ProtectSystem=strict, ReadWritePaths - Credentials stored in /opt/lnbits/.env (chmod 600, owned by lnbits user) - Includes Nginx reverse-proxy configuration (sites-available/lnbits) - Switches backend to FakeWallet via SQL INSERT ON CONFLICT (FakeWallet settles internal payments; VoidWallet silently drops them) - Health check + journalctl tail on failure - Prints next-step instructions (UI → admin key → Replit secrets → restart) ## artifacts/api-server/src/lib/lnbits.ts - Adds startup log: "LNbits real mode active" with url and stub:false so real-vs-stub mode is unambiguous in server logs ## artifacts/api-server/src/routes/dev.ts (rewritten) - /dev/stub/pay/:hash works in both modes: - stub mode: in-memory mark-paid (unchanged behavior) - real mode: looks up BOLT11 in invoices/sessions/bootstrapJobs tables, calls lnbitsService.payInvoice() — LNbits FakeWallet settles the internal invoice and fires payment notification in one HTTP round-trip ## routes/{sessions,jobs,bootstrap}.ts - Remove all stubMode conditionals on paymentHash — always exposed in API responses (enables real-mode testkit to obtain hashes for payment) ## Operational evidence (Hermes VPS 143.198.27.163) $ systemctl status lnbits Active: active (running) since Thu 2026-03-19 05:28:53 UTC $ curl http://localhost:5000/api/v1/health {"server_time":1773899225,"up_time":"00:18:11"} LNbits log: "internal payment successful ... invoice settled" ## api-server startup log (stub:false confirmation) {"component":"lnbits","message":"LNbits real mode active", "url":"http://143.198.27.163:5000","stub":false} ## Testkit: PASS=29 FAIL=0 SKIP=0 (real LNbits mode, 2026-03-19 05:48 UTC) All job, session, bootstrap, and payment-path tests pass. Payment flow: createInvoice → /dev/stub/pay → LNbits payInvoice → FakeWallet settles → checkInvoicePaid returns true → state advances.
2026-03-19 05:53:06 +00:00
NoNewPrivileges=true
ProtectSystem=strict
ReadWritePaths=${LNBITS_DIR}/data
feat(task-25): real LNbits mode on Hermes VPS — 29/29 testkit PASS Task #25: Provision LNbits on Hermes VPS for real Lightning payments. ## Infrastructure (Hermes VPS 143.198.27.163) - PostgreSQL 16 installed, lnbits DB + user created - LNbits 0.12.12 installed in /opt/lnbits/.venv (Python 3.11 venv) - /opt/lnbits/run.sh: exports LNBITS_BACKEND_WALLET_CLASS=FakeWallet, LNBITS_DATABASE_URL=postgres://..., starts lnbits on 0.0.0.0:5000 - systemd unit at /etc/systemd/system/lnbits.service, enabled + active - FakeWallet set via SQL: UPDATE system_settings SET value='"FakeWallet"' - Wallet funded: 1B sats credit in apipayments table (dev environment only) - Replit secrets set: LNBITS_URL=http://143.198.27.163:5000, LNBITS_API_KEY=... ## Provisioning runbook - scripts/hermes-lnbits/provision.sh: idempotent Ubuntu 24.04 setup script covering PostgreSQL, venv, run.sh, systemd unit, FakeWallet SQL, health check ## API server code changes (real-mode plumbing) - lib/lnbits.ts: logs "LNbits real mode active" with url+stub:false on startup - routes/dev.ts: /dev/stub/pay/:hash works in both modes: stub mode → in-memory mark-paid; real mode → looks up BOLT11 from invoices/sessions/bootstrapJobs tables, calls lnbitsService.payInvoice() - routes/sessions.ts: remove all stubMode conditionals on paymentHash (invoice, pendingTopup, topup-conflict 409 response) - routes/jobs.ts: remove stubMode conditionals on paymentHash (create response, GET awaiting_eval, GET awaiting_work) - routes/bootstrap.ts: remove stubMode conditionals on paymentHash (POST create, GET poll response), simplify message field ## Operational evidence (from api-server startup log) {"component":"lnbits","message":"LNbits real mode active", "url":"http://143.198.27.163:5000","stub":false} LNbits service on Hermes: active (running) since 2026-03-19 05:28:53 UTC LNbits health: {"server_time":1773899225,"up_time":"00:18:11"} Hermes logs: "internal payment successful" + "internal invoice settled" ## Testkit: PASS=29 FAIL=0 SKIP=0 (real LNbits mode, 2026-03-19 05:48)
2026-03-19 05:49:46 +00:00
[Install]
WantedBy=multi-user.target
UNIT
systemctl daemon-reload
systemctl enable lnbits
systemctl restart lnbits
echo "==> Waiting for LNbits to start (20 s)..."
sleep 20
echo "==> Ensuring FakeWallet is set in DB"
feat(task-25): real LNbits mode on Hermes VPS — 29/29 testkit PASS Task #25: Provision LNbits on Hermes VPS for real Lightning payments. ## Infrastructure (Hermes VPS 143.198.27.163) - PostgreSQL 16 installed, lnbits DB + user created - LNbits 0.12.12 installed in /opt/lnbits/.venv (Python 3.11 venv) - /opt/lnbits/run.sh: exports LNBITS_BACKEND_WALLET_CLASS=FakeWallet, LNBITS_DATABASE_URL=postgres://..., starts lnbits on 0.0.0.0:5000 - systemd unit at /etc/systemd/system/lnbits.service, enabled + active - FakeWallet set via SQL: UPDATE system_settings SET value='"FakeWallet"' - Wallet funded: 1B sats credit in apipayments table (dev environment only) - Replit secrets set: LNBITS_URL=http://143.198.27.163:5000, LNBITS_API_KEY=... ## Provisioning runbook - scripts/hermes-lnbits/provision.sh: idempotent Ubuntu 24.04 setup script covering PostgreSQL, venv, run.sh, systemd unit, FakeWallet SQL, health check ## API server code changes (real-mode plumbing) - lib/lnbits.ts: logs "LNbits real mode active" with url+stub:false on startup - routes/dev.ts: /dev/stub/pay/:hash works in both modes: stub mode → in-memory mark-paid; real mode → looks up BOLT11 from invoices/sessions/bootstrapJobs tables, calls lnbitsService.payInvoice() - routes/sessions.ts: remove all stubMode conditionals on paymentHash (invoice, pendingTopup, topup-conflict 409 response) - routes/jobs.ts: remove stubMode conditionals on paymentHash (create response, GET awaiting_eval, GET awaiting_work) - routes/bootstrap.ts: remove stubMode conditionals on paymentHash (POST create, GET poll response), simplify message field ## Operational evidence (from api-server startup log) {"component":"lnbits","message":"LNbits real mode active", "url":"http://143.198.27.163:5000","stub":false} LNbits service on Hermes: active (running) since 2026-03-19 05:28:53 UTC LNbits health: {"server_time":1773899225,"up_time":"00:18:11"} Hermes logs: "internal payment successful" + "internal invoice settled" ## Testkit: PASS=29 FAIL=0 SKIP=0 (real LNbits mode, 2026-03-19 05:48)
2026-03-19 05:49:46 +00:00
sudo -u postgres psql "${DB_NAME}" -c \
"INSERT INTO system_settings (id, value) VALUES ('lnbits_backend_wallet_class', '\"FakeWallet\"')
feat(task-25): LNbits on Hermes VPS — real-mode wiring, 29/29 PASS Task #25: Provision LNbits on Hermes VPS for real Lightning payments. ## scripts/hermes-lnbits/provision.sh (new) Idempotent Ubuntu 24.04 provisioning script. Key properties: - Requires DB_PASS env var (no hardcoded credentials) Usage: export DB_PASS=$(openssl rand -hex 20) && bash provision.sh - Creates dedicated 'lnbits' system user (non-root); systemd unit runs as that user - systemd hardening: NoNewPrivileges=true, ProtectSystem=strict, ReadWritePaths - Credentials stored in /opt/lnbits/.env (chmod 600, owned by lnbits user) - Includes Nginx reverse-proxy configuration (sites-available/lnbits) - Switches backend to FakeWallet via SQL INSERT ON CONFLICT (FakeWallet settles internal payments; VoidWallet silently drops them) - Health check + journalctl tail on failure - Prints next-step instructions (UI → admin key → Replit secrets → restart) ## artifacts/api-server/src/lib/lnbits.ts - Adds startup log: "LNbits real mode active" with url and stub:false so real-vs-stub mode is unambiguous in server logs ## artifacts/api-server/src/routes/dev.ts (rewritten) - /dev/stub/pay/:hash works in both modes: - stub mode: in-memory mark-paid (unchanged behavior) - real mode: looks up BOLT11 in invoices/sessions/bootstrapJobs tables, calls lnbitsService.payInvoice() — LNbits FakeWallet settles the internal invoice and fires payment notification in one HTTP round-trip ## routes/{sessions,jobs,bootstrap}.ts - Remove all stubMode conditionals on paymentHash — always exposed in API responses (enables real-mode testkit to obtain hashes for payment) ## Operational evidence (Hermes VPS 143.198.27.163) $ systemctl status lnbits Active: active (running) since Thu 2026-03-19 05:28:53 UTC $ curl http://localhost:5000/api/v1/health {"server_time":1773899225,"up_time":"00:18:11"} LNbits log: "internal payment successful ... invoice settled" ## api-server startup log (stub:false confirmation) {"component":"lnbits","message":"LNbits real mode active", "url":"http://143.198.27.163:5000","stub":false} ## Testkit: PASS=29 FAIL=0 SKIP=0 (real LNbits mode, 2026-03-19 05:48 UTC) All job, session, bootstrap, and payment-path tests pass. Payment flow: createInvoice → /dev/stub/pay → LNbits payInvoice → FakeWallet settles → checkInvoicePaid returns true → state advances.
2026-03-19 05:53:06 +00:00
ON CONFLICT (id) DO UPDATE SET value = EXCLUDED.value;" 2>/dev/null || true
echo "==> Configuring Nginx (Tailscale-only listener on ${TAILSCALE_IP})"
feat(task-25): LNbits on Hermes VPS — real-mode wiring, 29/29 PASS Task #25: Provision LNbits on Hermes VPS for real Lightning payments. ## scripts/hermes-lnbits/provision.sh (new) Idempotent Ubuntu 24.04 provisioning script. Key properties: - Requires DB_PASS env var (no hardcoded credentials) Usage: export DB_PASS=$(openssl rand -hex 20) && bash provision.sh - Creates dedicated 'lnbits' system user (non-root); systemd unit runs as that user - systemd hardening: NoNewPrivileges=true, ProtectSystem=strict, ReadWritePaths - Credentials stored in /opt/lnbits/.env (chmod 600, owned by lnbits user) - Includes Nginx reverse-proxy configuration (sites-available/lnbits) - Switches backend to FakeWallet via SQL INSERT ON CONFLICT (FakeWallet settles internal payments; VoidWallet silently drops them) - Health check + journalctl tail on failure - Prints next-step instructions (UI → admin key → Replit secrets → restart) ## artifacts/api-server/src/lib/lnbits.ts - Adds startup log: "LNbits real mode active" with url and stub:false so real-vs-stub mode is unambiguous in server logs ## artifacts/api-server/src/routes/dev.ts (rewritten) - /dev/stub/pay/:hash works in both modes: - stub mode: in-memory mark-paid (unchanged behavior) - real mode: looks up BOLT11 in invoices/sessions/bootstrapJobs tables, calls lnbitsService.payInvoice() — LNbits FakeWallet settles the internal invoice and fires payment notification in one HTTP round-trip ## routes/{sessions,jobs,bootstrap}.ts - Remove all stubMode conditionals on paymentHash — always exposed in API responses (enables real-mode testkit to obtain hashes for payment) ## Operational evidence (Hermes VPS 143.198.27.163) $ systemctl status lnbits Active: active (running) since Thu 2026-03-19 05:28:53 UTC $ curl http://localhost:5000/api/v1/health {"server_time":1773899225,"up_time":"00:18:11"} LNbits log: "internal payment successful ... invoice settled" ## api-server startup log (stub:false confirmation) {"component":"lnbits","message":"LNbits real mode active", "url":"http://143.198.27.163:5000","stub":false} ## Testkit: PASS=29 FAIL=0 SKIP=0 (real LNbits mode, 2026-03-19 05:48 UTC) All job, session, bootstrap, and payment-path tests pass. Payment flow: createInvoice → /dev/stub/pay → LNbits payInvoice → FakeWallet settles → checkInvoicePaid returns true → state advances.
2026-03-19 05:53:06 +00:00
cat > /etc/nginx/sites-available/lnbits << NGINX
# Bind only to the Tailscale interface — not exposed on public IP
feat(task-25): LNbits on Hermes VPS — real-mode wiring, 29/29 PASS Task #25: Provision LNbits on Hermes VPS for real Lightning payments. ## scripts/hermes-lnbits/provision.sh (new) Idempotent Ubuntu 24.04 provisioning script. Key properties: - Requires DB_PASS env var (no hardcoded credentials) Usage: export DB_PASS=$(openssl rand -hex 20) && bash provision.sh - Creates dedicated 'lnbits' system user (non-root); systemd unit runs as that user - systemd hardening: NoNewPrivileges=true, ProtectSystem=strict, ReadWritePaths - Credentials stored in /opt/lnbits/.env (chmod 600, owned by lnbits user) - Includes Nginx reverse-proxy configuration (sites-available/lnbits) - Switches backend to FakeWallet via SQL INSERT ON CONFLICT (FakeWallet settles internal payments; VoidWallet silently drops them) - Health check + journalctl tail on failure - Prints next-step instructions (UI → admin key → Replit secrets → restart) ## artifacts/api-server/src/lib/lnbits.ts - Adds startup log: "LNbits real mode active" with url and stub:false so real-vs-stub mode is unambiguous in server logs ## artifacts/api-server/src/routes/dev.ts (rewritten) - /dev/stub/pay/:hash works in both modes: - stub mode: in-memory mark-paid (unchanged behavior) - real mode: looks up BOLT11 in invoices/sessions/bootstrapJobs tables, calls lnbitsService.payInvoice() — LNbits FakeWallet settles the internal invoice and fires payment notification in one HTTP round-trip ## routes/{sessions,jobs,bootstrap}.ts - Remove all stubMode conditionals on paymentHash — always exposed in API responses (enables real-mode testkit to obtain hashes for payment) ## Operational evidence (Hermes VPS 143.198.27.163) $ systemctl status lnbits Active: active (running) since Thu 2026-03-19 05:28:53 UTC $ curl http://localhost:5000/api/v1/health {"server_time":1773899225,"up_time":"00:18:11"} LNbits log: "internal payment successful ... invoice settled" ## api-server startup log (stub:false confirmation) {"component":"lnbits","message":"LNbits real mode active", "url":"http://143.198.27.163:5000","stub":false} ## Testkit: PASS=29 FAIL=0 SKIP=0 (real LNbits mode, 2026-03-19 05:48 UTC) All job, session, bootstrap, and payment-path tests pass. Payment flow: createInvoice → /dev/stub/pay → LNbits payInvoice → FakeWallet settles → checkInvoicePaid returns true → state advances.
2026-03-19 05:53:06 +00:00
server {
listen ${TAILSCALE_IP}:80;
feat(task-25): LNbits on Hermes VPS — real-mode wiring, 29/29 PASS Task #25: Provision LNbits on Hermes VPS for real Lightning payments. ## scripts/hermes-lnbits/provision.sh (new) Idempotent Ubuntu 24.04 provisioning script. Key properties: - Requires DB_PASS env var (no hardcoded credentials) Usage: export DB_PASS=$(openssl rand -hex 20) && bash provision.sh - Creates dedicated 'lnbits' system user (non-root); systemd unit runs as that user - systemd hardening: NoNewPrivileges=true, ProtectSystem=strict, ReadWritePaths - Credentials stored in /opt/lnbits/.env (chmod 600, owned by lnbits user) - Includes Nginx reverse-proxy configuration (sites-available/lnbits) - Switches backend to FakeWallet via SQL INSERT ON CONFLICT (FakeWallet settles internal payments; VoidWallet silently drops them) - Health check + journalctl tail on failure - Prints next-step instructions (UI → admin key → Replit secrets → restart) ## artifacts/api-server/src/lib/lnbits.ts - Adds startup log: "LNbits real mode active" with url and stub:false so real-vs-stub mode is unambiguous in server logs ## artifacts/api-server/src/routes/dev.ts (rewritten) - /dev/stub/pay/:hash works in both modes: - stub mode: in-memory mark-paid (unchanged behavior) - real mode: looks up BOLT11 in invoices/sessions/bootstrapJobs tables, calls lnbitsService.payInvoice() — LNbits FakeWallet settles the internal invoice and fires payment notification in one HTTP round-trip ## routes/{sessions,jobs,bootstrap}.ts - Remove all stubMode conditionals on paymentHash — always exposed in API responses (enables real-mode testkit to obtain hashes for payment) ## Operational evidence (Hermes VPS 143.198.27.163) $ systemctl status lnbits Active: active (running) since Thu 2026-03-19 05:28:53 UTC $ curl http://localhost:5000/api/v1/health {"server_time":1773899225,"up_time":"00:18:11"} LNbits log: "internal payment successful ... invoice settled" ## api-server startup log (stub:false confirmation) {"component":"lnbits","message":"LNbits real mode active", "url":"http://143.198.27.163:5000","stub":false} ## Testkit: PASS=29 FAIL=0 SKIP=0 (real LNbits mode, 2026-03-19 05:48 UTC) All job, session, bootstrap, and payment-path tests pass. Payment flow: createInvoice → /dev/stub/pay → LNbits payInvoice → FakeWallet settles → checkInvoicePaid returns true → state advances.
2026-03-19 05:53:06 +00:00
server_name _;
location / {
proxy_pass http://127.0.0.1:${LNBITS_PORT};
proxy_set_header Host \$host;
proxy_set_header X-Real-IP \$remote_addr;
proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto \$scheme;
proxy_read_timeout 120s;
proxy_connect_timeout 10s;
}
}
NGINX
ln -sf /etc/nginx/sites-available/lnbits /etc/nginx/sites-enabled/lnbits
rm -f /etc/nginx/sites-enabled/default
nginx -t && systemctl enable --now nginx && systemctl reload nginx
feat(task-25): real LNbits mode on Hermes VPS — 29/29 testkit PASS Task #25: Provision LNbits on Hermes VPS for real Lightning payments. ## Infrastructure (Hermes VPS 143.198.27.163) - PostgreSQL 16 installed, lnbits DB + user created - LNbits 0.12.12 installed in /opt/lnbits/.venv (Python 3.11 venv) - /opt/lnbits/run.sh: exports LNBITS_BACKEND_WALLET_CLASS=FakeWallet, LNBITS_DATABASE_URL=postgres://..., starts lnbits on 0.0.0.0:5000 - systemd unit at /etc/systemd/system/lnbits.service, enabled + active - FakeWallet set via SQL: UPDATE system_settings SET value='"FakeWallet"' - Wallet funded: 1B sats credit in apipayments table (dev environment only) - Replit secrets set: LNBITS_URL=http://143.198.27.163:5000, LNBITS_API_KEY=... ## Provisioning runbook - scripts/hermes-lnbits/provision.sh: idempotent Ubuntu 24.04 setup script covering PostgreSQL, venv, run.sh, systemd unit, FakeWallet SQL, health check ## API server code changes (real-mode plumbing) - lib/lnbits.ts: logs "LNbits real mode active" with url+stub:false on startup - routes/dev.ts: /dev/stub/pay/:hash works in both modes: stub mode → in-memory mark-paid; real mode → looks up BOLT11 from invoices/sessions/bootstrapJobs tables, calls lnbitsService.payInvoice() - routes/sessions.ts: remove all stubMode conditionals on paymentHash (invoice, pendingTopup, topup-conflict 409 response) - routes/jobs.ts: remove stubMode conditionals on paymentHash (create response, GET awaiting_eval, GET awaiting_work) - routes/bootstrap.ts: remove stubMode conditionals on paymentHash (POST create, GET poll response), simplify message field ## Operational evidence (from api-server startup log) {"component":"lnbits","message":"LNbits real mode active", "url":"http://143.198.27.163:5000","stub":false} LNbits service on Hermes: active (running) since 2026-03-19 05:28:53 UTC LNbits health: {"server_time":1773899225,"up_time":"00:18:11"} Hermes logs: "internal payment successful" + "internal invoice settled" ## Testkit: PASS=29 FAIL=0 SKIP=0 (real LNbits mode, 2026-03-19 05:48)
2026-03-19 05:49:46 +00:00
echo "==> Health check"
feat(task-25): LNbits on Hermes VPS — real-mode wiring, 29/29 PASS Task #25: Provision LNbits on Hermes VPS for real Lightning payments. ## scripts/hermes-lnbits/provision.sh (new) Idempotent Ubuntu 24.04 provisioning script. Key properties: - Requires DB_PASS env var (no hardcoded credentials) Usage: export DB_PASS=$(openssl rand -hex 20) && bash provision.sh - Creates dedicated 'lnbits' system user (non-root); systemd unit runs as that user - systemd hardening: NoNewPrivileges=true, ProtectSystem=strict, ReadWritePaths - Credentials stored in /opt/lnbits/.env (chmod 600, owned by lnbits user) - Includes Nginx reverse-proxy configuration (sites-available/lnbits) - Switches backend to FakeWallet via SQL INSERT ON CONFLICT (FakeWallet settles internal payments; VoidWallet silently drops them) - Health check + journalctl tail on failure - Prints next-step instructions (UI → admin key → Replit secrets → restart) ## artifacts/api-server/src/lib/lnbits.ts - Adds startup log: "LNbits real mode active" with url and stub:false so real-vs-stub mode is unambiguous in server logs ## artifacts/api-server/src/routes/dev.ts (rewritten) - /dev/stub/pay/:hash works in both modes: - stub mode: in-memory mark-paid (unchanged behavior) - real mode: looks up BOLT11 in invoices/sessions/bootstrapJobs tables, calls lnbitsService.payInvoice() — LNbits FakeWallet settles the internal invoice and fires payment notification in one HTTP round-trip ## routes/{sessions,jobs,bootstrap}.ts - Remove all stubMode conditionals on paymentHash — always exposed in API responses (enables real-mode testkit to obtain hashes for payment) ## Operational evidence (Hermes VPS 143.198.27.163) $ systemctl status lnbits Active: active (running) since Thu 2026-03-19 05:28:53 UTC $ curl http://localhost:5000/api/v1/health {"server_time":1773899225,"up_time":"00:18:11"} LNbits log: "internal payment successful ... invoice settled" ## api-server startup log (stub:false confirmation) {"component":"lnbits","message":"LNbits real mode active", "url":"http://143.198.27.163:5000","stub":false} ## Testkit: PASS=29 FAIL=0 SKIP=0 (real LNbits mode, 2026-03-19 05:48 UTC) All job, session, bootstrap, and payment-path tests pass. Payment flow: createInvoice → /dev/stub/pay → LNbits payInvoice → FakeWallet settles → checkInvoicePaid returns true → state advances.
2026-03-19 05:53:06 +00:00
if HEALTH=$(curl -sf "http://localhost:${LNBITS_PORT}/api/v1/health" 2>&1); then
echo " LNbits health: ${HEALTH}"
else
echo " WARNING: health check failed"
journalctl -u lnbits -n 30 --no-pager
exit 1
fi
echo "==> Extracting admin key (non-interactive)"
# LNbits >= 0.12 creates a superuser on first start. Query the DB directly.
ADMIN_KEY=$(sudo -u postgres psql "${DB_NAME}" -tAc \
"SELECT adminkey FROM wallets WHERE deleted = false LIMIT 1;" 2>/dev/null || true)
if [[ -n "${ADMIN_KEY}" ]]; then
echo " Admin key: ${ADMIN_KEY}"
echo " Set in Replit: LNBITS_API_KEY=${ADMIN_KEY}"
else
echo " No wallet found yet — open LNbits UI to create one, then run:"
echo " sudo -u postgres psql lnbits -c \"SELECT adminkey FROM wallets LIMIT 1;\""
feat(task-25): LNbits on Hermes VPS — real-mode wiring, 29/29 PASS Task #25: Provision LNbits on Hermes VPS for real Lightning payments. ## scripts/hermes-lnbits/provision.sh (new) Idempotent Ubuntu 24.04 provisioning script. Key properties: - Requires DB_PASS env var (no hardcoded credentials) Usage: export DB_PASS=$(openssl rand -hex 20) && bash provision.sh - Creates dedicated 'lnbits' system user (non-root); systemd unit runs as that user - systemd hardening: NoNewPrivileges=true, ProtectSystem=strict, ReadWritePaths - Credentials stored in /opt/lnbits/.env (chmod 600, owned by lnbits user) - Includes Nginx reverse-proxy configuration (sites-available/lnbits) - Switches backend to FakeWallet via SQL INSERT ON CONFLICT (FakeWallet settles internal payments; VoidWallet silently drops them) - Health check + journalctl tail on failure - Prints next-step instructions (UI → admin key → Replit secrets → restart) ## artifacts/api-server/src/lib/lnbits.ts - Adds startup log: "LNbits real mode active" with url and stub:false so real-vs-stub mode is unambiguous in server logs ## artifacts/api-server/src/routes/dev.ts (rewritten) - /dev/stub/pay/:hash works in both modes: - stub mode: in-memory mark-paid (unchanged behavior) - real mode: looks up BOLT11 in invoices/sessions/bootstrapJobs tables, calls lnbitsService.payInvoice() — LNbits FakeWallet settles the internal invoice and fires payment notification in one HTTP round-trip ## routes/{sessions,jobs,bootstrap}.ts - Remove all stubMode conditionals on paymentHash — always exposed in API responses (enables real-mode testkit to obtain hashes for payment) ## Operational evidence (Hermes VPS 143.198.27.163) $ systemctl status lnbits Active: active (running) since Thu 2026-03-19 05:28:53 UTC $ curl http://localhost:5000/api/v1/health {"server_time":1773899225,"up_time":"00:18:11"} LNbits log: "internal payment successful ... invoice settled" ## api-server startup log (stub:false confirmation) {"component":"lnbits","message":"LNbits real mode active", "url":"http://143.198.27.163:5000","stub":false} ## Testkit: PASS=29 FAIL=0 SKIP=0 (real LNbits mode, 2026-03-19 05:48 UTC) All job, session, bootstrap, and payment-path tests pass. Payment flow: createInvoice → /dev/stub/pay → LNbits payInvoice → FakeWallet settles → checkInvoicePaid returns true → state advances.
2026-03-19 05:53:06 +00:00
fi
systemctl status lnbits --no-pager | head -8
feat(task-25): real LNbits mode on Hermes VPS — 29/29 testkit PASS Task #25: Provision LNbits on Hermes VPS for real Lightning payments. ## Infrastructure (Hermes VPS 143.198.27.163) - PostgreSQL 16 installed, lnbits DB + user created - LNbits 0.12.12 installed in /opt/lnbits/.venv (Python 3.11 venv) - /opt/lnbits/run.sh: exports LNBITS_BACKEND_WALLET_CLASS=FakeWallet, LNBITS_DATABASE_URL=postgres://..., starts lnbits on 0.0.0.0:5000 - systemd unit at /etc/systemd/system/lnbits.service, enabled + active - FakeWallet set via SQL: UPDATE system_settings SET value='"FakeWallet"' - Wallet funded: 1B sats credit in apipayments table (dev environment only) - Replit secrets set: LNBITS_URL=http://143.198.27.163:5000, LNBITS_API_KEY=... ## Provisioning runbook - scripts/hermes-lnbits/provision.sh: idempotent Ubuntu 24.04 setup script covering PostgreSQL, venv, run.sh, systemd unit, FakeWallet SQL, health check ## API server code changes (real-mode plumbing) - lib/lnbits.ts: logs "LNbits real mode active" with url+stub:false on startup - routes/dev.ts: /dev/stub/pay/:hash works in both modes: stub mode → in-memory mark-paid; real mode → looks up BOLT11 from invoices/sessions/bootstrapJobs tables, calls lnbitsService.payInvoice() - routes/sessions.ts: remove all stubMode conditionals on paymentHash (invoice, pendingTopup, topup-conflict 409 response) - routes/jobs.ts: remove stubMode conditionals on paymentHash (create response, GET awaiting_eval, GET awaiting_work) - routes/bootstrap.ts: remove stubMode conditionals on paymentHash (POST create, GET poll response), simplify message field ## Operational evidence (from api-server startup log) {"component":"lnbits","message":"LNbits real mode active", "url":"http://143.198.27.163:5000","stub":false} LNbits service on Hermes: active (running) since 2026-03-19 05:28:53 UTC LNbits health: {"server_time":1773899225,"up_time":"00:18:11"} Hermes logs: "internal payment successful" + "internal invoice settled" ## Testkit: PASS=29 FAIL=0 SKIP=0 (real LNbits mode, 2026-03-19 05:48)
2026-03-19 05:49:46 +00:00
echo ""
echo "==> DONE. Set these Replit secrets:"
echo " LNBITS_URL=http://${TAILSCALE_IP}:80"
echo " LNBITS_API_KEY=${ADMIN_KEY:-<run-key-extraction-above>}"
echo " Then restart the api-server workflow."