@fabioplunser/epd 0.5.17 → 0.5.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,510 +0,0 @@
1
- # CLI Commands Reference
2
-
3
- Complete reference for all commands and options provided by the `epd` CLI.
4
-
5
- ---
6
-
7
- ## Command Overview
8
-
9
- The `epd` command line is organized into five functional categories:
10
-
11
- ### Deploy & Lifecycle
12
- | Command | Usage | Description |
13
- |---|---|---|
14
- | [`epd init`](#epd-init) | `epd init [--ci]` | Initialize a new project with interactive runtime detection. |
15
- | [`epd setup`](#epd-setup) | `epd setup [--host <ip>]` | Provision server prerequisites, launch Traefik, install SSH keys, and run initial deploy. |
16
- | [`epd deploy`](#epd-deploy) | `epd deploy [-d <dest>] [--dry-run]` | Build and deploy with zero-downtime blue/green switching. |
17
- | [`epd redeploy`](#epd-redeploy) | `epd redeploy [--dry-run]` | Restart current running version without rebuilding or uploading. |
18
- | [`epd rollback`](#epd-rollback) | `epd rollback [version]` | Revert traffic to the previous version or a listed version. |
19
- | [`epd remove`](#epd-remove) | `epd remove [-y]` | Stop application, remove routes, and delete files from servers. |
20
-
21
- ### Observability & Metrics
22
- | Command | Usage | Description |
23
- |---|---|---|
24
- | [`epd status`](#epd-status) | `epd status [--json]` | Show live slots, running replicas, accessories, and route health. |
25
- | [`epd logs`](#epd-logs) | `epd logs [-f] [-n <num>]` | Stream and tail logs from services, accessories, or servers. |
26
- | [`epd top`](#epd-top) | `epd top [--once]` | Real-time multi-server CPU, memory, and container monitor (`epd stats`). |
27
- | [`epd ssl`](#epd-ssl) | `epd ssl [--host <ip>]` | Inspect and verify Let's Encrypt SSL/TLS certificates (`epd certs`). |
28
- | [`epd config`](#epd-config) | `epd config [--raw]` | Validate and display resolved `epd.yml` configuration. |
29
- | [`epd docker-command`](#epd-docker-command)| `epd docker-command` | Output copy-pasteable `docker run` commands for debugging. |
30
-
31
- ### Server Management
32
- | Command | Usage | Description |
33
- |---|---|---|
34
- | [`epd exec`](#epd-exec) | `epd exec -- <cmd>` | Execute a one-off command in the app's container environment. |
35
- | [`epd shell`](#epd-shell) | `epd shell` | Open an interactive terminal inside a live replica or accessory. |
36
- | [`epd lock`](#epd-lock) | `epd lock <action>` | Inspect or clear atomic deployment locks. |
37
- | [`epd proxy`](#epd-proxy) | `epd proxy <action>` | Inspect, view logs, view routes, or restart shared Traefik proxy. |
38
- | [`epd maintenance`](#epd-maintenance) | `epd maintenance <on\|off>` | Zero-downtime 503 maintenance mode toggle. |
39
- | [`epd backup`](#epd-backup) | `epd backup [accessory]` | Create compressed database and volume snapshot archives. |
40
- | [`epd restore`](#epd-restore) | `epd restore <file>` | Restore a database or volume snapshot into a live accessory. |
41
-
42
- ### Cloud & Automation
43
- | Command | Usage | Description |
44
- |---|---|---|
45
- | [`epd gh-action`](#epd-gh-action) | `epd gh-action` | Generate GitHub Actions CI/CD workflow (`epd ci`). |
46
- | [`epd auth`](#epd-auth) | `epd auth [subcommand]` | Manage linked Cloudflare & Hetzner credentials globally or per project. |
47
- | [`epd dns`](#epd-dns) | `epd dns <action>` | Check status or synchronize DNS records with Cloudflare or Hetzner. |
48
- | [`epd cloudflare`](#epd-cloudflare) | `epd cloudflare <action>` | Manage Cloudflare DNS records for application domains. |
49
- | [`epd hetzner`](#epd-hetzner) | `epd hetzner <action>` | List, create, provision, or delete Hetzner Cloud servers. |
50
- | [`epd sevalla`](#epd-sevalla) | `epd sevalla <action>` | Manage Sevalla applications and managed database clusters. |
51
-
52
- ### Diagnostics & Tools
53
- | Command | Usage | Description |
54
- |---|---|---|
55
- | [`epd doctor`](#epd-doctor) | `epd doctor [--local]` | Run pre-flight health, configuration, and server connectivity diagnostics. |
56
- | [`epd completion`](#epd-completion) | `epd completion <shell>` | Generate shell autocompletion script (bash, zsh, fish). |
57
- | [`epd update`](#epd-update) | `epd update` | Check for updates and upgrade to the latest version. |
58
-
59
- ---
60
-
61
- ## Global options
62
-
63
- | Option | Description |
64
- | --- | --- |
65
- | `-c, --config <file>` | Path to `epd.yml` |
66
- | `-d, --destination <d>` | Overlay `epd.<d>.yml` (staging, production, …) |
67
- | `-v, --verbose` | Print every command epd runs |
68
- | `--log-format <pretty\|json>` | Output format (also `EPD_LOG_FORMAT`). See below. |
69
-
70
- ### Run logs
71
-
72
- Every command writes a complete, timestamped log on the machine running epd,
73
- including the output of every build and remote command and the debug detail
74
- that `--verbose` would show. When a command fails, epd prints the path:
75
-
76
- ```
77
- Full log: ~/.local/state/epd/logs/2026-10-07_15-29-06-deploy-18749.log
78
- ```
79
-
80
- Logs live in `$XDG_STATE_HOME/epd/logs` (default `~/.local/state/epd/logs`), the
81
- newest 200 are kept. Set `EPD_LOG_DIR` to move them, or `EPD_LOG_DIR=off` to
82
- disable them.
83
-
84
- A command that produces no output for 20 seconds reports that it is still
85
- running (`… still running: docker buildx build (40s)`), so a slow step is never
86
- mistaken for a hung one. When a deploy fails on a host, epd prints the state,
87
- exit code and last log lines of the containers it started before rolling back.
88
-
89
- ### Machine-readable output
90
-
91
- With `--log-format json` every line on stdout is one JSON event, and the last
92
- line is always a `result` event, even for argument errors and interrupts:
93
-
94
- ```json
95
- {"ts":"…","t":12,"level":"step","msg":"Preparing servers","phase":"prepare"}
96
- {"ts":"…","t":840,"level":"output","msg":"#5 DONE 0.4s","stream":"stderr","label":"docker buildx build"}
97
- {"ts":"…","t":9120,"level":"host","host":"10.0.0.5","msg":"web: healthy","phase":"health"}
98
- {"ts":"…","t":9900,"level":"result","ok":true,"code":0,"msg":"ok","logFile":"/…/deploy.log"}
99
- ```
100
-
101
- | Field | Meaning |
102
- | --- | --- |
103
- | `level` | `step`, `info`, `ok`, `warn`, `error`, `debug`, `host`, `output`, `plain`, `result` |
104
- | `phase` | On `step`/`host` events: `plan`, `connect`, `build`, `push`, `hooks`, `prepare`, `accessories`, `proxy`, `deploy`, `health`, `routes`, `diagnose` |
105
- | `host` | The server the line concerns |
106
- | `stream`, `label` | For `output`: child stream and the command that produced it |
107
- | `ok`, `code`, `hint`, `logFile` | On the final `result` event |
108
-
109
- json mode never prompts. On SIGINT/SIGTERM epd releases the deploy lock, emits
110
- a `result` with code 130/143 and exits, so CI runners and the web control plane
111
- can cancel a deploy safely.
112
-
113
- ## `epd init`
114
-
115
- Interactively initializes `epd.yml` for the current project.
116
-
117
- ```bash
118
- epd init [options]
119
- ```
120
-
121
- ### Options:
122
- - `--name <name>`: Override project name (defaults to folder name or `package.json`).
123
- - `--mode <docker|process>`: Choose deployment runtime (`docker` or `process`).
124
- - `--host <ip>`: Server host IP address.
125
- - `--domain <domain>`: Public domain to configure.
126
- - `--port <port>`: Internal application port (default: 3000).
127
- - `--dockerfile`: Automatically generate a production-ready starter `Dockerfile`.
128
- - `--ci`: Automatically generate `.github/workflows/deploy.yml`.
129
-
130
- ---
131
-
132
- ## `epd doctor`
133
-
134
- Run comprehensive pre-flight diagnostics on your local tooling, project configuration, environment secrets, and remote servers before running a deployment.
135
-
136
- ```bash
137
- epd doctor [options]
138
- ```
139
-
140
- ### Options:
141
- - `-l, --local`: Only run local diagnostics (skips SSH connections to remote servers). Useful when working offline or in air-gapped environments.
142
-
143
- ### Diagnostics performed:
144
- - **Local environment**: Runtime version, Docker CLI and daemon response, clean git tree verification, SSH client and permissions on private keys (`0600`).
145
- - **Configuration & Secrets**: Validates `epd.yml` schema, verifies that all declared secrets exist in `.env` or system environment, and checks cloud DNS token availability.
146
- - **Remote servers**: Validates SSH ping latency, tests passwordless sudo status, queries remote Docker daemon health, checks available disk space (`df -h /`), and detects active deploy locks.
147
-
148
- ---
149
-
150
- ## `epd completion`
151
-
152
- Generate shell autocompletion scripts for Zsh, Bash, or Fish.
153
-
154
- ```bash
155
- epd completion <bash|zsh|fish>
156
- ```
157
-
158
- ### Setup Instructions:
159
-
160
- ::: code-group
161
-
162
- ```bash [Zsh]
163
- # Add to ~/.zshrc:
164
- eval "$(epd completion zsh)"
165
-
166
- # Or generate completion file:
167
- epd completion zsh > ~/.zsh/completion/_epd
168
- ```
169
-
170
- ```bash [Bash]
171
- # Add to ~/.bashrc:
172
- source <(epd completion bash)
173
-
174
- # Or save to system completions:
175
- epd completion bash | sudo tee /etc/bash_completion.d/epd > /dev/null
176
- ```
177
-
178
- ```bash [Fish]
179
- # Add to ~/.config/fish/config.fish:
180
- epd completion fish | source
181
-
182
- # Or generate completions file:
183
- epd completion fish > ~/.config/fish/completions/epd.fish
184
- ```
185
-
186
- :::
187
-
188
- ---
189
-
190
- ## `epd setup`
191
-
192
- Prepares fresh servers for deployment. Installs Docker (or rsync and pm2 in process mode), creates the shared bridge network, configures Let's Encrypt Traefik reverse proxy, and runs the initial deployment.
193
-
194
- ```bash
195
- epd setup [options]
196
- ```
197
-
198
- ### Interactive SSH Key Installation:
199
- When running `epd setup` against a brand new server where SSH keys have not yet been installed, EPD prompts for the account's initial password in the terminal. It then automatically installs your public SSH key (`~/.ssh/id_ed25519.pub`), verifies passwordless key authentication, and configures passwordless sudo in `/etc/sudoers.d/epd`. You only have to enter the server password once!
200
-
201
- ### Options:
202
- - `--host <ip>`: Run setup only on a specific host (repeatable).
203
- - `--skip-deploy`: Install prerequisites and start Traefik without executing the first deploy.
204
-
205
- ---
206
-
207
- ## `epd deploy`
208
-
209
- Executes a zero-downtime blue/green deployment. The new version starts alongside the existing live slot, passes its configured health checks, and only then does the reverse proxy seamlessly transition traffic.
210
-
211
- ```bash
212
- epd deploy [options]
213
- ```
214
-
215
- ### Options:
216
- - `--dry-run`: Simulate the deployment plan without building images, making SSH connections, or altering remote servers.
217
- - `-d, --destination <name>`: Deploy using overlay configuration (e.g. `epd.staging.yml`).
218
- - `--service <name>`: Deploy only a specific service group (e.g. `--service web`).
219
- - `--host <ip>`: Deploy only to a specific host (repeatable).
220
- - `--no-build`: Skip local image build (reuse an image already present on the servers).
221
- - `--version <tag>`: Explicit version or git tag to deploy instead of the current commit.
222
- - `--recreate-accessories`: Rebuild and restart accessory containers (PostgreSQL, Redis, etc.).
223
- - `--skip-health`: Skip healthcheck verification (not recommended for production).
224
- - `--skip-hooks`: Skip `pre_deploy` / `post_deploy` lifecycle scripts.
225
- - `--skip-lock`: Bypass atomic deployment concurrency lock.
226
-
227
- ---
228
-
229
- ## `epd redeploy`
230
-
231
- Restarts the currently running version across all servers without rebuilding or re-uploading container images.
232
-
233
- ```bash
234
- epd redeploy [options]
235
- ```
236
-
237
- ---
238
-
239
- ## `epd rollback`
240
-
241
- Instantly re-routes live traffic to the previously healthy slot without re-building.
242
-
243
- ```bash
244
- # Roll back to the immediately preceding version
245
- epd rollback
246
-
247
- # List all deployable versions stored on the server
248
- epd rollback --list
249
-
250
- # Roll back to a specific version
251
- epd rollback <version>
252
- ```
253
-
254
- ---
255
-
256
- ## `epd status`
257
-
258
- Displays the live deployment state across all configured hosts.
259
-
260
- ```bash
261
- epd status [options]
262
- ```
263
-
264
- ### Options:
265
- - `--json`: Output state as structured JSON (ideal for status dashboards or CI scripts).
266
-
267
- ---
268
-
269
- ## `epd logs`
270
-
271
- View or follow live container or PM2 logs across replicas and hosts.
272
-
273
- ```bash
274
- epd logs [options]
275
- ```
276
-
277
- ### Options:
278
- - `-f, --follow`: Follow / stream logs in real time.
279
- - `-n, --lines <number>`: Number of lines to show from the end of logs (default: 100).
280
- - `--service <name>`: Filter logs to a specific service (e.g. `web` or `worker`).
281
- - `--accessory <name>`: View logs from an accessory container (e.g. `db`).
282
- - `--host <ip>`: Filter logs to a specific server.
283
- - `--grep <pattern>`: Filter log lines matching a string or pattern.
284
- - `--since <time>`: Show logs since timestamp (e.g. `10m`, `1h`, `2026-09-08T15:00:00`).
285
-
286
- ---
287
-
288
- ## `epd exec`
289
-
290
- Run a one-off command inside the app's container environment on the server.
291
-
292
- ```bash
293
- # Run database migrations
294
- epd exec -- bun run db:migrate
295
-
296
- # Open an interactive shell inside Postgres accessory
297
- epd exec --accessory db -i -- psql -U postgres
298
- ```
299
-
300
- ---
301
-
302
- ## `epd shell`
303
-
304
- Opens an interactive shell inside a running replica container or accessory.
305
-
306
- ```bash
307
- epd shell
308
- epd shell --accessory db
309
- epd shell --host 203.0.113.10
310
- ```
311
-
312
- ---
313
-
314
- ## `epd top`
315
-
316
- Real-time multi-server metrics monitor (aliased as `epd stats`). Displays CPU %, memory consumption, container processes, network I/O, disk usage, and host load averages across all servers.
317
-
318
- ```bash
319
- epd top # Launch interactive streaming metrics dashboard (2s refresh)
320
- epd top --once # Print a single metrics snapshot and exit
321
- epd top --host 203.0.113.10 # Monitor a specific server
322
- ```
323
-
324
- ---
325
-
326
- ## `epd ssl`
327
-
328
- Inspect and verify Let's Encrypt SSL/TLS certificates managed by Traefik across your servers (aliased as `epd certs`).
329
-
330
- ```bash
331
- epd ssl # Display table of domains, SANs, issuers, and days remaining
332
- epd ssl --json # Output certificate metadata as JSON
333
- epd ssl --host 203.0.113.10 # Query a specific host
334
- ```
335
-
336
- ---
337
-
338
- ## `epd maintenance`
339
-
340
- Toggle or inspect zero-downtime maintenance mode for this application. Injects an instant Traefik routing override that presents a responsive 503 Maintenance page to all public visitors without stopping backend containers or dropping TLS certificates.
341
-
342
- ```bash
343
- epd maintenance status # Check if maintenance mode is active
344
- epd maintenance on # Enable maintenance mode
345
- epd maintenance on -m "Upgrading database. Back at 15:00 UTC."
346
- epd maintenance off # Disable maintenance mode and restore traffic
347
- ```
348
-
349
- ---
350
-
351
- ## `epd database`
352
-
353
- Provision and verify a self-hosted PostgreSQL accessory, or stream a logical database backup and restore. Docker must already be installed on the target. Provisioning publishes PostgreSQL to host loopback, retains a persistent Docker volume, refuses existing containers or volumes, and succeeds only after `SELECT 1` works.
354
-
355
- ```bash
356
- epd database provision --accessory database --port 5432 --memory 1024
357
- epd database check --accessory database
358
- epd database backup --accessory database --file ./database.sql.gz
359
- epd database restore --accessory database --file ./database.sql.gz --yes
360
- ```
361
-
362
- The accessory must use a supported PostgreSQL Alpine image and define `POSTGRES_DB`, `POSTGRES_USER`, and a password of at least 20 characters. Backups use `pg_dump --clean --if-exists`; restore runs SQL in a single transaction with `ON_ERROR_STOP`, then verifies a query. Restore replaces database objects, so create a protection backup first. External clients must forward the host loopback port through SSH.
363
-
364
- ---
365
-
366
- ## `epd archive`
367
-
368
- Archive a non-database Docker accessory's declared named volume. This is the supported project volume archive path used by the dashboard. Select a volume by its zero-based position in the accessory's `volumes` list.
369
-
370
- ```yaml
371
- accessories:
372
- uploads:
373
- image: alpine:3.22
374
- host: 203.0.113.10
375
- command: sleep 86400
376
- volumes:
377
- - uploads_data:/data
378
- ```
379
-
380
- ```bash
381
- epd archive backup --accessory uploads --volume-index 0 --file ./uploads.tar.gz --log-format json
382
- # Record the SHA256 target fingerprint in the ARCHIVE_TARGET log message.
383
- epd archive restore --accessory uploads --volume-index 0 --file ./uploads.tar.gz --expected-target <recorded-fingerprint> --yes
384
- ```
385
-
386
- Backup and restore stop the owning accessory while streaming and restore its original running state afterward. The configured named volume must be mounted by that accessory; another running container using it prevents the operation. Bind mounts, process-mode projects and database images are unsupported here. Use logical database backups for databases.
387
-
388
- Restore verifies that the host, accessory container, named volume and destination match the recorded target. It rejects traversal paths, links and special files, extracts into staging, and copies current contents before replacement. If rollback itself fails, `.epd-archive-old` retains recovery data. Existing `.epd-archive-*` entries block another operation until an operator inspects them. Leave enough free volume space for the archive, staged extraction and protection copy.
389
-
390
- The dashboard adds organization and role checks, pinned SSH credentials, uploaded archive SHA256 read-back verification, a verified protection backup before restore, explicit storage-object deletion and opt-in scheduled retention. Its restore form requires the exact project name. Direct CLI archives remain local files; keep and verify a separate protection backup before confirming replacement.
391
-
392
- ---
393
-
394
- ## `epd backup`
395
-
396
- Create compressed database and volume backups from running accessories (PostgreSQL, MySQL, MariaDB, MongoDB, or generic persistent volumes).
397
-
398
- ```bash
399
- epd backup # Back up all configured accessories
400
- epd backup db # Back up a specific database accessory
401
- epd backup db -o ./my-backup.sql.gz # Custom local output file path
402
- ```
403
-
404
- ---
405
-
406
- ## `epd restore`
407
-
408
- Restore a database or volume snapshot into a live running accessory.
409
-
410
- ```bash
411
- epd restore ./backups/myapp-db-2026-09-07.sql.gz
412
- epd restore ./backups/myapp-db.sql.gz --accessory db -y # Skip confirmation prompt
413
- ```
414
-
415
- ---
416
-
417
- ## `epd gh-action`
418
-
419
- Generate a production-ready GitHub Actions deployment workflow (aliased as `epd ci`).
420
-
421
- ```bash
422
- epd gh-action [options]
423
- ```
424
-
425
- Prompts for trigger events (`push`, `pull_request`, or both), target git branch, and destination overlay. Displays the exact repository secrets required (`SSH_PRIVATE_KEY`, DNS tokens, etc.).
426
-
427
- ---
428
-
429
- ## `epd auth`
430
-
431
- Manage linked Cloudflare and Hetzner accounts (aliased as `epd login`).
432
-
433
- ```bash
434
- epd auth [status|cloudflare|hetzner|logout]
435
- ```
436
-
437
- ---
438
-
439
- ## `epd dns`
440
-
441
- Manage automated DNS record synchronization with Cloudflare or Hetzner DNS.
442
-
443
- ```bash
444
- epd dns status # Compare live DNS records against server IPs
445
- epd dns sync # Synchronize A/AAAA records
446
- epd dns sync --dry-run # Preview changes without making API requests
447
- epd dns sync --no-proxied # Disable Cloudflare CDN orange-cloud proxy
448
- ```
449
-
450
- ---
451
-
452
- ## `epd hetzner`
453
-
454
- Manage Hetzner Cloud infrastructure directly.
455
-
456
- ```bash
457
- epd hetzner list # List all servers in your Hetzner Cloud project
458
- epd hetzner types # View server specs and prices (vCPU, RAM, EUR/mo)
459
- epd hetzner locations # List available datacenter locations
460
- epd hetzner create <name> # Create new VPS (e.g. --type cx22 --location fsn1)
461
- epd hetzner create <name> --setup # Create and immediately configure with epd setup
462
- epd hetzner delete <name> # Delete server
463
- ```
464
-
465
- ---
466
-
467
- ## `epd sevalla`
468
-
469
- Manage Sevalla cloud applications, deployments, and managed database clusters.
470
-
471
- ```bash
472
- epd sevalla list # List all Sevalla applications
473
- epd sevalla databases # List managed database clusters
474
- epd sevalla deploy <id> # Trigger deployment of a Sevalla application
475
- ```
476
-
477
- ---
478
-
479
- ## `epd lock`
480
-
481
- Manage atomic deployment locks.
482
-
483
- ```bash
484
- epd lock status # Who holds the deploy lock on each server; flags locks that look stale
485
- epd lock release # Release the deploy lock on every server (use when no deploy is running)
486
- ```
487
-
488
- A lock looks stale when the process that took it is gone (same machine) or it has been held for more than 6 hours. `epd lock release` is the override. `epd deploy --skip-lock` ignores the lock for a single deploy, and should be used only with the same care.
489
-
490
- ---
491
-
492
- ## `epd remove`
493
-
494
- Completely tear down an application from the servers.
495
-
496
- ```bash
497
- epd remove
498
- epd remove -y # Non-interactive confirmation
499
- epd remove --keep-data # Leave persistent volume data on disk
500
- ```
501
-
502
- ---
503
-
504
- ## `epd update`
505
-
506
- Check for new releases and upgrade EPD to the latest version.
507
-
508
- ```bash
509
- epd update
510
- ```