Skip to content

Commit bf54951

Browse files
committed
Add multi-node federation docs and fleet env vars to README
Documents master/child setup, join token generation, monitor-only mode, and all federation-related environment variables.
1 parent 2eda950 commit bf54951

1 file changed

Lines changed: 92 additions & 0 deletions

File tree

README.md

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,98 @@ cashpilot/
160160
| `CASHPILOT_SECRET_KEY` | *(auto-generated)* | Encryption key for stored credentials |
161161
| `CASHPILOT_COLLECTION_INTERVAL` | `3600` | Seconds between earnings collection cycles |
162162
| `CASHPILOT_PORT` | `8080` | Web UI port inside the container |
163+
| `CASHPILOT_ROLE` | `master` | Instance role: `master` (fleet aggregation) or `child` (reports to master) |
164+
| `CASHPILOT_NODE_NAME` | *(hostname)* | Display name for this node in the fleet dashboard |
165+
| `CASHPILOT_MASTER_URL` | -- | WebSocket URL of the master instance (child only), e.g. `ws://master-ip:8080/ws/federation` |
166+
| `CASHPILOT_JOIN_TOKEN` | -- | Join token issued by the master (child only) |
167+
168+
## Multi-Node Fleet Management
169+
170+
For power users running services across multiple servers, CashPilot supports a federated master/child architecture. Every node runs a **full CashPilot instance** with its own dashboard. One instance is the **master** that aggregates everything into a unified fleet view; the rest are **children** that report upstream via outbound WebSocket.
171+
172+
```
173+
Master CashPilot (fleet view + local management)
174+
^ ^ ^
175+
| WSS | WSS | WSS
176+
Child CashPilot Child CashPilot Child CashPilot
177+
(server-1) (server-2) (server-N)
178+
```
179+
180+
### Setting up the master
181+
182+
The first CashPilot instance you deploy is the master by default. No extra configuration needed -- just deploy normally:
183+
184+
```yaml
185+
services:
186+
cashpilot:
187+
image: drumsergio/cashpilot:latest
188+
ports:
189+
- "8085:8080"
190+
volumes:
191+
- /var/run/docker.sock:/var/run/docker.sock
192+
- cashpilot_data:/data
193+
environment:
194+
- CASHPILOT_SECRET_KEY=your-secret-key
195+
- CASHPILOT_ROLE=master
196+
- CASHPILOT_NODE_NAME=main-server
197+
- TZ=Europe/Madrid
198+
restart: unless-stopped
199+
security_opt:
200+
- no-new-privileges:true
201+
202+
volumes:
203+
cashpilot_data:
204+
```
205+
206+
### Adding child nodes
207+
208+
1. **Generate a join token** from the master's fleet dashboard or via the API:
209+
210+
```bash
211+
curl -b cookies.txt http://master-ip:8085/api/federation/token \
212+
-X POST -H "Content-Type: application/json" \
213+
-d '{"node_name": "server-2", "expires_hours": 720}'
214+
```
215+
216+
2. **Deploy the child** on the remote server with the token:
217+
218+
```yaml
219+
services:
220+
cashpilot:
221+
image: drumsergio/cashpilot:latest
222+
ports:
223+
- "8085:8080"
224+
volumes:
225+
- /var/run/docker.sock:/var/run/docker.sock
226+
- cashpilot_data:/data
227+
environment:
228+
- CASHPILOT_SECRET_KEY=child-secret-key
229+
- CASHPILOT_ROLE=child
230+
- CASHPILOT_NODE_NAME=server-2
231+
- CASHPILOT_MASTER_URL=ws://master-ip:8085/ws/federation
232+
- CASHPILOT_JOIN_TOKEN=<token-from-step-1>
233+
- TZ=Europe/Madrid
234+
restart: unless-stopped
235+
security_opt:
236+
- no-new-privileges:true
237+
238+
volumes:
239+
cashpilot_data:
240+
```
241+
242+
The child connects outbound to the master via WebSocket -- no port forwarding or VPN needed on the child side. It works behind any NAT or firewall. The master's fleet dashboard shows all connected nodes, their services, and live status. The master can also push commands (deploy, stop, restart) to any child remotely.
243+
244+
### Monitor-only mode (external services)
245+
246+
If you manage containers yourself (via Portainer, manual compose, etc.) and don't want CashPilot to deploy or control containers, run it **without mounting the Docker socket**:
247+
248+
```yaml
249+
volumes:
250+
# - /var/run/docker.sock:/var/run/docker.sock # omit this
251+
- cashpilot_data:/data
252+
```
253+
254+
In monitor-only mode, CashPilot still provides the service catalog, compose file export, earnings dashboard, and credential storage. You can combine this with the child role to report earnings and status to a master while managing containers externally. Use the **Export Compose** button in the UI to get ready-to-use `docker-compose.yml` files for any service.
163255

164256
## FAQ
165257

0 commit comments

Comments
 (0)