|
1 | 1 | <p align="center"> |
2 | | - <img src="icon_readme.png" alt="Project Logo" width="21%"> |
| 2 | + <img src="icon_readme.png" alt="LNbits Logo" width="21%"> |
3 | 3 | </p> |
4 | 4 |
|
5 | | -# LNbits for StartOS |
| 5 | +# LNbits on StartOS |
6 | 6 |
|
7 | | -This repo packages [LNbits](https://github.com/lnbits/lnbits) for StartOS. |
| 7 | +> **Upstream docs:** <https://docs.lnbits.org/> |
| 8 | +> |
| 9 | +> Everything not listed in this document should behave the same as upstream |
| 10 | +> LNbits v1.4.2. If a feature, setting, or behavior is not mentioned |
| 11 | +> here, the upstream documentation is accurate and fully applicable. |
| 12 | +
|
| 13 | +A free and open-source lightning-network wallet/accounts system. See the [upstream repo](https://github.com/lnbits/lnbits) for general LNbits documentation. |
| 14 | + |
| 15 | +--- |
| 16 | + |
| 17 | +## Table of Contents |
| 18 | + |
| 19 | +- [Image and Container Runtime](#image-and-container-runtime) |
| 20 | +- [Volume and Data Layout](#volume-and-data-layout) |
| 21 | +- [Installation and First-Run Flow](#installation-and-first-run-flow) |
| 22 | +- [Configuration Management](#configuration-management) |
| 23 | +- [Network Access and Interfaces](#network-access-and-interfaces) |
| 24 | +- [Actions](#actions-startos-ui) |
| 25 | +- [Backups and Restore](#backups-and-restore) |
| 26 | +- [Health Checks](#health-checks) |
| 27 | +- [Dependencies](#dependencies) |
| 28 | +- [Limitations and Differences](#limitations-and-differences) |
| 29 | +- [What Is Unchanged from Upstream](#what-is-unchanged-from-upstream) |
| 30 | +- [Contributing](#contributing) |
| 31 | +- [Quick Reference for AI Consumers](#quick-reference-for-ai-consumers) |
| 32 | + |
| 33 | +--- |
| 34 | + |
| 35 | +## Image and Container Runtime |
| 36 | + |
| 37 | +| Property | Value | |
| 38 | +|----------|-------| |
| 39 | +| Image | Custom Dockerfile based on `lnbits/lnbits:v1.4.2` | |
| 40 | +| Architectures | x86_64, aarch64 | |
| 41 | +| Entrypoint | `uv run lnbits` | |
| 42 | + |
| 43 | +The custom Dockerfile adds `sqlite3`, `tini`, `yq`, `xxd`, `curl`, `jq`, and `bcrypt` (Python) on top of the upstream image. These are used for the reset password action and other utilities. |
| 44 | + |
| 45 | +## Volume and Data Layout |
| 46 | + |
| 47 | +| Volume | Mount Point | Purpose | |
| 48 | +|--------|-------------|---------| |
| 49 | +| `main` | `/app/data` | All LNbits data (database, configuration) | |
| 50 | + |
| 51 | +StartOS-specific files on the `main` volume: |
| 52 | + |
| 53 | +| File | Purpose | |
| 54 | +|------|---------| |
| 55 | +| `.env` | LNbits environment configuration (managed by StartOS) | |
| 56 | +| `store.json` | Not used (no store.json in this package) | |
| 57 | + |
| 58 | +The Lightning node volume is mounted read-only depending on the configured backend: |
| 59 | + |
| 60 | +| Backend | Mount Point | Files Used | |
| 61 | +|---------|-------------|------------| |
| 62 | +| LND | `/mnt/lnd` | `tls.cert`, `data/chain/bitcoin/mainnet/admin.macaroon` | |
| 63 | +| CLN | `/mnt/cln` | `bitcoin/lightning-rpc` (Unix socket) | |
| 64 | + |
| 65 | +## Installation and First-Run Flow |
| 66 | + |
| 67 | +1. On install, StartOS creates a **critical task** prompting the user to select a Lightning implementation (LND or Core Lightning) |
| 68 | +2. The `.env` file is written with the selected backend configuration |
| 69 | +3. On first start, LNbits creates its SQLite database and presents a web UI for account creation |
| 70 | +4. The first user to register becomes the **super user** (admin) |
| 71 | + |
| 72 | +## Configuration Management |
| 73 | + |
| 74 | +LNbits is configured via environment variables in the `.env` file, managed by StartOS. |
| 75 | + |
| 76 | +| StartOS-Managed | Details | |
| 77 | +|-----------------|---------| |
| 78 | +| Lightning backend | LND (REST) or Core Lightning (Unix socket) | |
| 79 | + |
| 80 | +Most LNbits settings are configurable through the **Admin UI** within LNbits itself (`LNBITS_ADMIN_UI=true`). StartOS manages the backend connection; everything else is configured through the LNbits web interface. |
| 81 | + |
| 82 | +Settings **not** managed by StartOS (hardcoded): |
| 83 | + |
| 84 | +| Setting | Value | Reason | |
| 85 | +|---------|-------|--------| |
| 86 | +| `HOST` | `lnbits.startos` | StartOS service networking | |
| 87 | +| `PORT` | `5000` | Fixed internal port | |
| 88 | +| `FORWARDED_ALLOW_IPS` | `*` | Required for HTTPS behind StartOS proxy | |
| 89 | +| `LNBITS_DATA_FOLDER` | `./data` | Maps to the mounted volume | |
| 90 | +| `LND_REST_ENDPOINT` | `https://lnd.startos:8080/` | StartOS service networking | |
| 91 | +| `LND_REST_CERT` / `LND_REST_MACAROON` | Paths in `/mnt/lnd` | Mounted dependency volume | |
| 92 | +| `CLIGHTNING_RPC` | `/mnt/cln/bitcoin/lightning-rpc` | Mounted dependency volume | |
| 93 | +| `AUTH_ALLOWED_METHODS` | `username-password` | Only username/password auth | |
| 94 | +| `LNBITS_ALLOWED_FUNDING_SOURCES` | Matches selected backend | Restricted to configured implementation | |
| 95 | + |
| 96 | +## Network Access and Interfaces |
| 97 | + |
| 98 | +| Interface | Port | Protocol | Purpose | |
| 99 | +|-----------|------|----------|---------| |
| 100 | +| Web UI | 5000 | HTTP | LNbits web interface and API | |
| 101 | + |
| 102 | +## Actions (StartOS UI) |
| 103 | + |
| 104 | +| Action | Purpose | Availability | Inputs | |
| 105 | +|--------|---------|-------------|--------| |
| 106 | +| **Lightning Implementation** | Select LND or Core Lightning as the backend | Any | Select: LND or CLN | |
| 107 | +| **Reset Password** | Reset the super user password to a random value | Running only | None | |
| 108 | + |
| 109 | +**Warning:** Changing the Lightning implementation after initial use **deletes the LNbits database** (all accounts and wallets). Funds remain on the underlying Lightning node. |
| 110 | + |
| 111 | +## Backups and Restore |
| 112 | + |
| 113 | +**Backed up:** The entire `main` volume (database, `.env` configuration). |
| 114 | + |
| 115 | +**Restore behavior:** Standard restore — the database and configuration are restored as-is. The configured Lightning backend must be available. |
| 116 | + |
| 117 | +## Health Checks |
| 118 | + |
| 119 | +| Check | Method | Messages | |
| 120 | +|-------|--------|----------| |
| 121 | +| **Web Interface** | Port listening (5000), 75s grace period | Ready: "The web interface is ready" | |
| 122 | + |
| 123 | +## Dependencies |
| 124 | + |
| 125 | +| Dependency | Required | Version | Purpose | |
| 126 | +|------------|----------|---------|---------| |
| 127 | +| Core Lightning | Optional | `>=25.12:1-beta.1` | Lightning backend (if selected) | |
| 128 | +| LND | Optional | `>=0.20.0-beta:1-beta.2` | Lightning backend (if selected) | |
| 129 | + |
| 130 | +One of the two Lightning implementations must be selected and running. The dependency is determined at runtime based on the configured `LNBITS_BACKEND_WALLET_CLASS`. |
| 131 | + |
| 132 | +## Limitations and Differences |
| 133 | + |
| 134 | +1. **Only LND and Core Lightning backends supported** — upstream supports many funding sources (LNPayWallet, OpenNodeWallet, EclairWallet, etc.); StartOS restricts to `LndRestWallet` and `CoreLightningWallet` |
| 135 | +2. **SQLite only** — upstream supports PostgreSQL and CockroachDB; StartOS uses the embedded SQLite database |
| 136 | +3. **Username/password auth only** — `AUTH_ALLOWED_METHODS` is set to `username-password`; other methods (e.g., Google OAuth) are not available |
| 137 | +4. **Switching backends deletes the database** — changing from LND to CLN (or vice versa) removes the existing LNbits database |
| 138 | +5. **Custom Docker image** — adds sqlite3 CLI, bcrypt, and other tools not in the upstream image |
| 139 | + |
| 140 | +## What Is Unchanged from Upstream |
| 141 | + |
| 142 | +- All LNbits extensions and the extension marketplace |
| 143 | +- Wallet and account management |
| 144 | +- Admin UI functionality |
| 145 | +- API endpoints |
| 146 | +- Invoice and payment handling |
| 147 | +- LNURL support |
| 148 | +- Theme customization (via Admin UI) |
| 149 | + |
| 150 | +## Contributing |
| 151 | + |
| 152 | +See [CONTRIBUTING.md](CONTRIBUTING.md) for build instructions and development workflow. |
| 153 | + |
| 154 | +--- |
| 155 | + |
| 156 | +## Quick Reference for AI Consumers |
| 157 | + |
| 158 | +```yaml |
| 159 | +package_id: lnbits |
| 160 | +upstream_version: 1.4.2 |
| 161 | +image: custom Dockerfile (based on lnbits/lnbits:v1.4.2) |
| 162 | +architectures: [x86_64, aarch64] |
| 163 | +volumes: |
| 164 | + main: /app/data |
| 165 | +ports: |
| 166 | + ui: 5000 |
| 167 | +dependencies: |
| 168 | + - c-lightning (optional, >=25.12:1-beta.1) |
| 169 | + - lnd (optional, >=0.20.0-beta:1-beta.2) |
| 170 | +startos_managed_env_vars: |
| 171 | + - LNBITS_BACKEND_WALLET_CLASS |
| 172 | + - LNBITS_ALLOWED_FUNDING_SOURCES |
| 173 | +actions: |
| 174 | + - set-lightning-implementation |
| 175 | + - reset-password |
| 176 | +health_checks: |
| 177 | + - port_listening: 5000 |
| 178 | +backup_volumes: |
| 179 | + - main |
| 180 | +``` |
0 commit comments