[claude] Connect API to real Lightning node (#12) #64

Merged
Rockachopa merged 2 commits from claude/issue-12 into main 2026-03-23 20:54:49 +00:00
Collaborator

Fixes #12

What this does

The infrastructure scripts (setup.sh, lnd-init.sh, sweep.sh, ops.sh, docker-compose.yml) already cover the full node provisioning flow. This PR closes the API-side configuration gap:

Changes

  • .env.example — New file documenting every required environment variable, with focus on LNBITS_URL and LNBITS_API_KEY. Operators run infrastructure/lnd-init.sh which prints these two values at the end; they then set them in Replit/their deployment env.

  • GET /api/healthz — Now includes lnbits_stub: boolean and lnbits_url: string | null. Operators can hit this endpoint to immediately verify whether the API is connected to a real Lightning node or still running in simulated stub mode.

  • Production startup log — When NODE_ENV=production and LNBITS_URL/LNBITS_API_KEY are absent, the server emits a WARN log at startup pointing to infrastructure/lnd-init.sh.

Operator runbook (unchanged — infrastructure already existed)

  1. bash infrastructure/setup.sh on a 4GB+ DO droplet (starts Bitcoin IBD)
  2. Wait for Bitcoin sync (verificationprogress → 1.0, ~2-3 days)
  3. bash /opt/timmy-node/lnd-init.sh — creates LND wallet, starts LNbits, prints LNBITS_URL + LNBITS_API_KEY
  4. Set those two env vars in the API deployment
  5. Verify: curl https://<your-domain>/api/healthzlnbits_stub: false
  6. Cold storage sweep configured interactively during lnd-init.sh
Fixes #12 ## What this does The infrastructure scripts (`setup.sh`, `lnd-init.sh`, `sweep.sh`, `ops.sh`, `docker-compose.yml`) already cover the full node provisioning flow. This PR closes the API-side configuration gap: ### Changes - **`.env.example`** — New file documenting every required environment variable, with focus on `LNBITS_URL` and `LNBITS_API_KEY`. Operators run `infrastructure/lnd-init.sh` which prints these two values at the end; they then set them in Replit/their deployment env. - **`GET /api/healthz`** — Now includes `lnbits_stub: boolean` and `lnbits_url: string | null`. Operators can hit this endpoint to immediately verify whether the API is connected to a real Lightning node or still running in simulated stub mode. - **Production startup log** — When `NODE_ENV=production` and `LNBITS_URL`/`LNBITS_API_KEY` are absent, the server emits a `WARN` log at startup pointing to `infrastructure/lnd-init.sh`. ## Operator runbook (unchanged — infrastructure already existed) 1. `bash infrastructure/setup.sh` on a 4GB+ DO droplet (starts Bitcoin IBD) 2. Wait for Bitcoin sync (`verificationprogress → 1.0`, ~2-3 days) 3. `bash /opt/timmy-node/lnd-init.sh` — creates LND wallet, starts LNbits, prints `LNBITS_URL` + `LNBITS_API_KEY` 4. Set those two env vars in the API deployment 5. Verify: `curl https://<your-domain>/api/healthz` → `lnbits_stub: false` 6. Cold storage sweep configured interactively during `lnd-init.sh`
claude added 1 commit 2026-03-23 20:49:26 +00:00
feat: connect API to real Lightning node (env vars, healthz, startup warning)
Some checks failed
CI / Typecheck & Lint (pull_request) Failing after 0s
cd3bbda690
- Add .env.example documenting LNBITS_URL and LNBITS_API_KEY (and all
  other required env vars) so operators know exactly what to set after
  running infrastructure/lnd-init.sh on the droplet.
- Expose lnbits_stub and lnbits_url in GET /api/healthz so operators
  can immediately verify whether the API is connected to a real Lightning
  node or running in simulated stub mode.
- Emit a loud WARN log at production startup when LNBITS_URL /
  LNBITS_API_KEY are absent, pointing to lnd-init.sh for setup.

Infrastructure scripts (setup.sh, lnd-init.sh, sweep.sh, ops.sh,
docker-compose.yml) already cover the full provisioning flow; this
change closes the API-side configuration gap.

Fixes #12

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
claude added 1 commit 2026-03-23 20:52:17 +00:00
WIP: Claude Code progress on #12
Some checks failed
CI / Typecheck & Lint (pull_request) Failing after 0s
6be35c6cd2
Automated salvage commit — agent session ended (exit 0).
Work in progress, may need continuation.
Rockachopa merged commit 5b935a83e3 into main 2026-03-23 20:54:49 +00:00
This repo is archived. You cannot comment on pull requests.