@fabioplunser/epd 0.5.14 → 0.5.15

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.
package/docs/ci-cd.md CHANGED
@@ -98,7 +98,7 @@ image: ghcr.io/${{ github.repository }}/app
98
98
  registry:
99
99
  server: ghcr.io
100
100
  username: ${{ github.actor }}
101
- password_env: GITHUB_TOKEN
101
+ password: GITHUB_TOKEN
102
102
  ```
103
103
 
104
104
  In `.github/workflows/deploy.yml`:
@@ -8,7 +8,7 @@ Everything you need to prepare your development environment and target servers f
8
8
 
9
9
  `epd` runs on your local development machine or inside a CI runner (such as GitHub Actions).
10
10
 
11
- - **Operating System**: Linux or macOS (or Windows via WSL2).
11
+ - **Operating System**: Linux, macOS, or Windows x64. Windows shell steps require Git Bash from Git for Windows; WSL2 is also an option.
12
12
  - **Standalone Binary**: No local runtimes (Node.js, Bun, Python) are required when using the standalone installer.
13
13
  - **Tools**:
14
14
  - OpenSSH client (`ssh`).
@@ -51,6 +51,17 @@ Installs the pre-compiled, self-contained standalone executable directly for Lin
51
51
  curl -fsSL https://raw.githubusercontent.com/FabioPlunser/epd/main/install.sh | bash
52
52
  ```
53
53
 
54
+ For Windows x64, run in PowerShell (no administrator access needed):
55
+
56
+ ```powershell
57
+ irm https://raw.githubusercontent.com/FabioPlunser/epd/main/install.ps1 | iex
58
+ epd --help
59
+ ```
60
+
61
+ The installer checks the release SHA256 checksum and adds `%LOCALAPPDATA%\epd\bin` to your user PATH. Install Git for Windows and the Windows OpenSSH client. Use Docker Desktop with Linux containers for Docker deployments. Process deployments require `rsync`; use WSL2 if you do not have a Windows-compatible installation. Remote servers and the self-hosted dashboard stack require Linux.
62
+
63
+ To select a version or directory, download `install.ps1` and run `./install.ps1 -Version v0.5.14 -InstallDir C:\Tools\epd`. Pass `-NoPath` to skip PATH changes.
64
+
54
65
  ### Option 2: Bun
55
66
 
56
67
  ```bash
@@ -42,15 +42,38 @@ When you run `epd deploy`:
42
42
  - Your local shell environment (`export DATABASE_URL=...`)
43
43
  - `.env` or `.env.local` in your project root
44
44
  - Destination-specific files like `.env.staging` (when using `-d staging`)
45
- 2. `epd` securely uploads these key-value pairs to `/var/lib/epd/apps/<app>/env` on the remote server with `chmod 0600`.
45
+ 2. `epd` uploads these key-value pairs to the remote server as `0600` files under `/var/lib/epd/apps/<app>/`.
46
46
  3. During startup:
47
- - **Docker Mode**: Mounted securely into containers via `--env-file`.
48
- - **Process Mode**: Loaded into PM2 process environments.
47
+ - **Docker Mode**: Written to a `0600` file and passed to `docker run` via `--env-file`. The file is removed right after the containers start. Docker keeps the values in the container config.
48
+ - **Process Mode**: Written to a `0600` file and handed to PM2 when the processes start. The file is removed right after `pm2 start`. PM2 keeps the environment it was started with, and saves it to its dump.
49
49
 
50
50
  ::: warning Missing Secrets
51
51
  If a variable listed in `env.secret` is not found in your environment or `.env` file, `epd` halts deployment with a helpful error before modifying any remote state.
52
52
  :::
53
53
 
54
+ ### Where secrets live on the server
55
+
56
+ epd writes secret values to files under `/var/lib/epd/apps/<app>/`. Every such file is `0600`, and each one is removed as soon as the step that reads it is done, including when that step fails. Nothing is kept for later use:
57
+
58
+ | File (under `/var/lib/epd/apps/<app>/`) | Mode | Written | Removed |
59
+ | --- | --- | --- | --- |
60
+ | `env.<service>` | docker | every service start (deploy, rollback) | right after `docker run`, also when it fails |
61
+ | `env.acc.<name>` | docker, accessories | every accessory start | right after `docker run`, also when it fails |
62
+ | `exec-env.<random>` | docker, process | every `epd exec` (docker: not with `--accessory` or `--reuse`) and `epd shell` in process mode | after the command, also when it fails |
63
+ | `env` | process | every build that has an install or build step | after the build, also when it fails |
64
+ | `pm2.<service>.<slot>.json` | process | every start | right after `pm2 start`, also when it fails |
65
+
66
+ The proxy keeps its DNS-challenge tokens in the same way, under `/var/lib/epd/proxy/`: `env` for docker mode and `pm2.json` for process mode, when `proxy.dns_env` is set. Each one is written right before the proxy starts and removed right after.
67
+
68
+ Older epd versions kept some of these files on the server. The next deploy deletes them: every `env.*` file (service and accessory files) under docker, and `pm2.*.json` and `env` under process mode.
69
+
70
+ After a deploy, two copies of the secret values remain on the server, and both need protecting:
71
+
72
+ - **The container config** (`docker inspect`): anyone who can run `docker inspect` on the server can read the values of every container, including the proxy.
73
+ - **The pm2 dump** (`~/.pm2/dump.pm2` of the SSH user): `pm2 save` records each process's environment there, so the values of every process started by pm2, including the proxy in process mode.
74
+
75
+ Restrict access to the server, not only to the files above.
76
+
54
77
  ---
55
78
 
56
79
  ## 3. Service-Specific Environments
@@ -41,17 +41,21 @@ The new version was booted in the idle slot, but requests to `healthcheck.path`
41
41
  ```
42
42
 
43
43
  ### Explanation:
44
- `epd` uses an atomic lock file (`/var/lib/epd/locks/<app>.lock`) to prevent concurrent deployments from colliding. If your computer lost internet connection or was killed with `kill -9` mid-deployment, the lock might remain active.
44
+ `epd` takes a lock on every server before deploying: a directory at `<remote_root>/apps/<app>/lock` (`/var/lib/epd/apps/<app>/lock` by default), created with `mkdir`, which is atomic. It holds who took it, the machine and process ID, the time, and what the deploy was doing. On Ctrl-C or SIGTERM, `epd` releases the locks it holds, including one it was in the middle of taking, but only where the lock still records this deploy as its holder. That release waits up to about 25 seconds for slow servers. A second Ctrl-C exits at once, which can leave the lock; `epd lock release` clears it. If your computer lost its connection, or the deploy was killed with `kill -9` mid-deployment, the lock stays until someone releases it.
45
+
46
+ `epd lock status` flags a lock as probably stale when its process is no longer running on the same machine, or when it has been held for more than 6 hours.
45
47
 
46
48
  ### Solution:
47
49
  ```bash
48
- # Check lock details:
50
+ # Check lock details and whether it looks stale:
49
51
  epd lock status
50
52
 
51
- # Forcefully clear the lock:
53
+ # Clear the lock once you have confirmed no deploy is running:
52
54
  epd lock release
53
55
  ```
54
56
 
57
+ Only release a lock you are sure is stale. Releasing a live deploy's lock lets a second deploy run at the same time.
58
+
55
59
  ---
56
60
 
57
61
  ## 3. Investigating the Shared Traefik Proxy
@@ -386,10 +386,12 @@ epd sevalla deploy <id> # Trigger deployment of a Sevalla application
386
386
  Manage atomic deployment locks.
387
387
 
388
388
  ```bash
389
- epd lock status # Check who currently holds the deploy lock
390
- epd lock release # Forcefully release the deploy lock
389
+ epd lock status # Who holds the deploy lock on each server; flags locks that look stale
390
+ epd lock release # Release the deploy lock on every server (use when no deploy is running)
391
391
  ```
392
392
 
393
+ 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.
394
+
393
395
  ---
394
396
 
395
397
  ## `epd remove`
@@ -10,7 +10,7 @@ Complete annotated schema for `epd.yml`.
10
10
  # ==============================================================================
11
11
  # Global Application Settings
12
12
  # ==============================================================================
13
- name: myapp # App name (alphanumeric, dashes, underscores)
13
+ name: myapp # App name (see Names below)
14
14
  mode: docker # Runtime mode: "docker" | "process"
15
15
 
16
16
  # ==============================================================================
@@ -20,7 +20,7 @@ image: ghcr.io/org/myapp # Docker image repository
20
20
  registry: # Optional: Container registry credentials
21
21
  server: ghcr.io
22
22
  username: deployer
23
- password: ${GITHUB_TOKEN} # Resolved from local environment variable
23
+ password: GITHUB_TOKEN # Name of the env var holding the token (${GITHUB_TOKEN} and [GITHUB_TOKEN] also work); a literal token is rejected
24
24
 
25
25
  build:
26
26
  dockerfile: Dockerfile # Relative path to Dockerfile (default: Dockerfile)
@@ -71,7 +71,7 @@ servers:
71
71
  - deploy@203.0.113.11 # Per-host ssh login, overrides ssh.user
72
72
  - hetzner:prod-web-1 # Dynamic Hetzner query by server name
73
73
  - hetzner:label:app=web # Dynamic Hetzner query by label selector
74
- replicas: 2 # Number of container replicas per host
74
+ replicas: 2 # Container replicas per host (1-256; see Limits)
75
75
  port: 3000 # Internal port the app listens on
76
76
  domains: [myapp.com] # Public domains (automatic SSL)
77
77
  cpus: "2.0" # Docker CPU limit
@@ -178,6 +178,46 @@ hooks:
178
178
  # General Strategy & Retention
179
179
  # ==============================================================================
180
180
  strategy: rolling # Rollout strategy: "rolling" | "parallel"
181
- keep_releases: 5 # Number of past images / releases to retain
181
+ keep_releases: 5 # Past images / releases to retain (1-1000)
182
182
  remote_root: /var/lib/epd # Root directory on remote hosts
183
183
  ```
184
+
185
+ ---
186
+
187
+ ## Limits and Rules
188
+
189
+ epd checks these when it loads `epd.yml`. An error names the file that sets the
190
+ offending key and the key path, for example `epd.staging.yml: servers.web.replicas`.
191
+ Overlay files (`epd.<destination>.yml`) are checked the same way.
192
+
193
+ **Names.** App, service and accessory names are 1-63 characters: lowercase letters,
194
+ digits, dashes and underscores, starting with a letter or digit. Upper-case names are
195
+ rejected. The name becomes container and state names on the server, so renaming an
196
+ app creates a new app there.
197
+
198
+ **Host names.** A route host is a DNS name, optionally `*.` wildcard, optionally with
199
+ one trailing dot (`example.com.`), or an IPv4 address, or a bracketed IPv6 literal
200
+ such as `"[2001:db8::1]"`. A route host may add `:port` (1-65535). Server hosts take
201
+ IPv4 or plain IPv6 addresses, and may take a `user@` prefix.
202
+
203
+ **Ports.** Service, route, health check, accessory, `ssh.port` and proxy entrypoint
204
+ ports are whole numbers from 1 to 65535. `host_port` is 1 to 65504, which leaves room
205
+ for the replica ports after it. `port_base` is 1 to 65280, because each app reserves
206
+ 256 consecutive ports from it.
207
+
208
+ **Replicas.** `replicas` is a whole number from 1 to 256 per server. When host ports
209
+ are published (`mode: process`, `proxy.cross_host: true`, or `proxy.enabled: false`),
210
+ a service may have at most 16 replicas per server.
211
+
212
+ **Retention.** `keep_releases` is a whole number from 1 to 1000.
213
+
214
+ **Paths.** A route `path` and a health check `path` start with `/`. They must not
215
+ contain spaces, quotes, backticks, backslashes, control characters or `..` segments.
216
+ `remote_root` is an absolute path with no `..` segments or control characters.
217
+
218
+ **Environment variables.** Variable names are letters, digits and underscores, and do
219
+ not start with a digit. This applies to `env.clear` and `env.secret` keys, accessory
220
+ `env`, `proxy.dns_env`, `build.args` keys and `build.secrets` values. Values in
221
+ `env.clear` must not contain newlines, because each variable is one line in the env
222
+ file. Wherever a mapping is accepted for `env`, a list of `KEY=value` strings is also
223
+ accepted, and the same checks apply.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fabioplunser/epd",
3
- "version": "0.5.14",
3
+ "version": "0.5.15",
4
4
  "description": "Easy Project Deployer — deploy any project to one or many servers with Docker or PM2, fronted by Traefik.",
5
5
  "type": "module",
6
6
  "author": "Fabio Plünser",