@fabioplunser/epd 0.3.1 → 0.4.0
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/README.md +2 -2
- package/dist/cli.js +925 -407
- package/docs/.vitepress/config.mts +49 -16
- package/docs/.vitepress/theme/DeployAnimation.vue +1259 -0
- package/docs/.vitepress/theme/index.ts +10 -0
- package/docs/.vitepress/theme/style.css +109 -0
- package/docs/ci-cd.md +8 -0
- package/docs/getting-started.md +244 -0
- package/docs/guide/accessories.md +103 -0
- package/docs/guide/architecture.md +94 -0
- package/docs/guide/blue-green.md +93 -0
- package/docs/guide/deployment-modes.md +135 -0
- package/docs/guide/getting-started.md +244 -0
- package/docs/guide/high-availability.md +89 -0
- package/docs/guide/installation.md +127 -0
- package/docs/guide/multi-site.md +101 -0
- package/docs/guide/routing.md +129 -0
- package/docs/guide/secrets.md +109 -0
- package/docs/guide/troubleshooting.md +109 -0
- package/docs/guide.md +172 -535
- package/docs/hetzner-dns.md +8 -0
- package/docs/index.md +20 -25
- package/docs/public/CNAME +1 -0
- package/docs/public/favicon.svg +52 -0
- package/docs/reference/cli.md +238 -0
- package/docs/reference/config.md +177 -0
- package/package.json +1 -1
package/docs/guide.md
CHANGED
|
@@ -1,28 +1,113 @@
|
|
|
1
|
-
# Complete Guide to
|
|
1
|
+
# Complete Guide to EPD (Easy Project Deployer)
|
|
2
2
|
|
|
3
3
|
`epd` is a zero-downtime deployment tool designed to deploy any application to one server or a fleet of servers over standard SSH. It combines zero-downtime blue/green deployments, automatic Let's Encrypt SSL, a shared reverse proxy (Traefik), and multi-host load balancing without requiring Kubernetes or complex container orchestration.
|
|
4
4
|
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
##
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
7
|
+
## Documentation Hub
|
|
8
|
+
|
|
9
|
+
Explore the topics below for in-depth documentation and examples:
|
|
10
|
+
|
|
11
|
+
<div class="guide-grid">
|
|
12
|
+
|
|
13
|
+
<a href="/epd/guide/getting-started" class="guide-card">
|
|
14
|
+
<div class="guide-card-icon">🚀</div>
|
|
15
|
+
<div class="guide-card-title">Getting Started (5 Min)</div>
|
|
16
|
+
<div class="guide-card-desc">Step-by-step tutorial: initialize, configure, setup, and deploy your first application.</div>
|
|
17
|
+
</a>
|
|
18
|
+
|
|
19
|
+
<a href="/epd/guide/installation" class="guide-card">
|
|
20
|
+
<div class="guide-card-icon">📦</div>
|
|
21
|
+
<div class="guide-card-title">Prerequisites & Installation</div>
|
|
22
|
+
<div class="guide-card-desc">Local and remote server requirements, package manager commands, and SSH setup.</div>
|
|
23
|
+
</a>
|
|
24
|
+
|
|
25
|
+
<a href="/epd/guide/architecture" class="guide-card">
|
|
26
|
+
<div class="guide-card-icon">🏗️</div>
|
|
27
|
+
<div class="guide-card-title">Architecture & Request Flow</div>
|
|
28
|
+
<div class="guide-card-desc">How Traefik routes incoming traffic, filesystem layouts, and zero-daemon design.</div>
|
|
29
|
+
</a>
|
|
30
|
+
|
|
31
|
+
<a href="/epd/guide/blue-green" class="guide-card">
|
|
32
|
+
<div class="guide-card-icon">🔄</div>
|
|
33
|
+
<div class="guide-card-title">Zero-Downtime Blue/Green</div>
|
|
34
|
+
<div class="guide-card-desc">The deployment lifecycle: idle slot booting, health checks, atomic route switching, and draining.</div>
|
|
35
|
+
</a>
|
|
36
|
+
|
|
37
|
+
<a href="/epd/guide/deployment-modes" class="guide-card">
|
|
38
|
+
<div class="guide-card-icon">🐳</div>
|
|
39
|
+
<div class="guide-card-title">Docker vs. Process Mode</div>
|
|
40
|
+
<div class="guide-card-desc">Run containerized apps with Docker, or deploy plain Bun/Node/Python code via PM2.</div>
|
|
41
|
+
</a>
|
|
42
|
+
|
|
43
|
+
<a href="/epd/guide/multi-site" class="guide-card">
|
|
44
|
+
<div class="guide-card-icon">🌐</div>
|
|
45
|
+
<div class="guide-card-title">Multi-Site on Single VPS</div>
|
|
46
|
+
<div class="guide-card-desc">Host dozens of independent domains on a single host without port collisions.</div>
|
|
47
|
+
</a>
|
|
48
|
+
|
|
49
|
+
<a href="/epd/guide/high-availability" class="guide-card">
|
|
50
|
+
<div class="guide-card-icon">⚡</div>
|
|
51
|
+
<div class="guide-card-title">High Availability & Clusters</div>
|
|
52
|
+
<div class="guide-card-desc">Cross-host load balancing, private VPC network routing, and rolling rollouts.</div>
|
|
53
|
+
</a>
|
|
54
|
+
|
|
55
|
+
<a href="/epd/guide/routing" class="guide-card">
|
|
56
|
+
<div class="guide-card-icon">🔀</div>
|
|
57
|
+
<div class="guide-card-title">Advanced Routing & Traefik</div>
|
|
58
|
+
<div class="guide-card-desc">Path stripping, subdomains, basic auth, redirects, sticky sessions, and wildcard SSL.</div>
|
|
59
|
+
</a>
|
|
60
|
+
|
|
61
|
+
<a href="/epd/guide/secrets" class="guide-card">
|
|
62
|
+
<div class="guide-card-icon">🔒</div>
|
|
63
|
+
<div class="guide-card-title">Secrets & Environments</div>
|
|
64
|
+
<div class="guide-card-desc">Safe secret resolution, destination overlays (staging vs production), and chmod 0600 storage.</div>
|
|
65
|
+
</a>
|
|
66
|
+
|
|
67
|
+
<a href="/epd/guide/accessories" class="guide-card">
|
|
68
|
+
<div class="guide-card-icon">🗄️</div>
|
|
69
|
+
<div class="guide-card-title">Accessories (Databases & Caches)</div>
|
|
70
|
+
<div class="guide-card-desc">Persistent Postgres, Redis, and MinIO containers with volume management and web UIs.</div>
|
|
71
|
+
</a>
|
|
72
|
+
|
|
73
|
+
<a href="/epd/ci-cd" class="guide-card">
|
|
74
|
+
<div class="guide-card-icon">🤖</div>
|
|
75
|
+
<div class="guide-card-title">GitHub Actions CI/CD</div>
|
|
76
|
+
<div class="guide-card-desc">Automated continuous deployment on every git push with a 20-line workflow file.</div>
|
|
77
|
+
</a>
|
|
78
|
+
|
|
79
|
+
<a href="/epd/hetzner-dns" class="guide-card">
|
|
80
|
+
<div class="guide-card-icon">☁️</div>
|
|
81
|
+
<div class="guide-card-title">Hetzner Cloud & DNS</div>
|
|
82
|
+
<div class="guide-card-desc">Dynamic server targets, CLI provisioning, and Cloudflare/Hetzner DNS auto-sync.</div>
|
|
83
|
+
</a>
|
|
84
|
+
|
|
85
|
+
<a href="/epd/reference/cli" class="guide-card">
|
|
86
|
+
<div class="guide-card-icon">💻</div>
|
|
87
|
+
<div class="guide-card-title">CLI Commands Reference</div>
|
|
88
|
+
<div class="guide-card-desc">Full documentation of commands, options, and flags from epd init to epd remove.</div>
|
|
89
|
+
</a>
|
|
90
|
+
|
|
91
|
+
<a href="/epd/reference/config" class="guide-card">
|
|
92
|
+
<div class="guide-card-icon">⚙️</div>
|
|
93
|
+
<div class="guide-card-title">Configuration Reference (epd.yml)</div>
|
|
94
|
+
<div class="guide-card-desc">Complete annotated YAML schema specification with every possible configuration key.</div>
|
|
95
|
+
</a>
|
|
96
|
+
|
|
97
|
+
<a href="/epd/guide/troubleshooting" class="guide-card">
|
|
98
|
+
<div class="guide-card-icon">🛠️</div>
|
|
99
|
+
<div class="guide-card-title">Troubleshooting & Operations</div>
|
|
100
|
+
<div class="guide-card-desc">Resolving deployment locks, diagnosing probe timeouts, and disaster recovery.</div>
|
|
101
|
+
</a>
|
|
102
|
+
|
|
103
|
+
</div>
|
|
22
104
|
|
|
23
105
|
---
|
|
24
106
|
|
|
25
|
-
##
|
|
107
|
+
## Guide Topics
|
|
108
|
+
|
|
109
|
+
### 1. Key Features & Architecture
|
|
110
|
+
`epd` routes incoming traffic on ports 80/443 through a shared Traefik proxy and isolates each app's configuration.
|
|
26
111
|
|
|
27
112
|
```
|
|
28
113
|
Internet (HTTP:80 / HTTPS:443)
|
|
@@ -42,236 +127,91 @@ Internet (HTTP:80 / HTTPS:443)
|
|
|
42
127
|
│ │ Blue/Green replicas │ │ Blue/Green replicas │ │
|
|
43
128
|
│ │ blog.example.com │ │ store.example.com │ │
|
|
44
129
|
│ └─────────────────────┘ └────────────────────────┘ │
|
|
45
|
-
│ │ │
|
|
46
|
-
│ ▼ │
|
|
47
|
-
│ ┌─────────────────────┐ │
|
|
48
|
-
│ │ Accessory: Postgres │ │
|
|
49
|
-
│ │ /var/lib/epd/... │ │
|
|
50
|
-
│ └─────────────────────┘ │
|
|
51
130
|
└─────────────────────────────────────────────────────────────┘
|
|
52
131
|
```
|
|
53
132
|
|
|
54
|
-
|
|
55
|
-
- **Many Sites on One Server**: Every app maintains its own isolated dynamic routing file under `/var/lib/epd/proxy/dynamic/<app>.yml`. They share one global Traefik instance. Adding or removing an application leaves other apps on the same machine completely untouched.
|
|
56
|
-
- **Docker Optional (`mode: process`)**: If you don't want containers, `epd` uploads your code via `rsync`, installs dependencies, and manages processes using `pm2` with the same blue/green slot switching, health checks, and rollbacks.
|
|
57
|
-
- **True Zero Downtime**: The existing version continues serving live traffic until the new version passes all health checks and Traefik switches traffic. Old replicas are drained gracefully before being stopped.
|
|
58
|
-
- **Cross-Host Failover (`proxy.cross_host: true`)**: With multi-server setups, each server's proxy can route requests across the entire fleet. If a server goes offline, the other nodes immediately absorb the traffic.
|
|
59
|
-
- **SSH Only**: No agent daemons, no control planes, no vendor lock-in.
|
|
133
|
+
👉 **[Read the complete Architecture Guide →](/guide/architecture)**
|
|
60
134
|
|
|
61
135
|
---
|
|
62
136
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
### Requirements
|
|
66
|
-
- **Local Machine**:
|
|
67
|
-
- [Bun](https://bun.sh) (v1.1+)
|
|
68
|
-
- `ssh` client
|
|
69
|
-
- `docker` (if using `mode: docker`)
|
|
70
|
-
- `rsync` (if using `mode: process`)
|
|
71
|
-
- **Remote Server(s)**:
|
|
72
|
-
- Any modern Linux machine (Ubuntu, Debian, Fedora, Arch, Alpine, etc.)
|
|
73
|
-
- Open SSH port with root or passwordless `sudo` access
|
|
137
|
+
### 2. Prerequisites & Installation
|
|
138
|
+
Install `epd` using Bun, NPM, or as a standalone Linux binary:
|
|
74
139
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
```bash
|
|
79
|
-
bun install -g epd
|
|
140
|
+
::: code-group
|
|
141
|
+
```bash [bun]
|
|
142
|
+
bun install -g @fabioplunser/epd
|
|
80
143
|
```
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
```bash
|
|
84
|
-
git clone https://github.com/FabioPlunser/EPD.git
|
|
85
|
-
cd EPD && bun install
|
|
86
|
-
bun run src/cli.ts --help
|
|
144
|
+
```bash [npm]
|
|
145
|
+
npm install -g @fabioplunser/epd
|
|
87
146
|
```
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
bun run build # Produces dist/epd
|
|
92
|
-
sudo cp dist/epd /usr/local/bin/epd
|
|
147
|
+
```bash [standalone binary]
|
|
148
|
+
curl -fsSL https://github.com/FabioPlunser/epd/releases/latest/download/epd-linux-x64 -o /usr/local/bin/epd
|
|
149
|
+
chmod +x /usr/local/bin/epd
|
|
93
150
|
```
|
|
151
|
+
:::
|
|
152
|
+
|
|
153
|
+
👉 **[Read the full Installation Guide →](/guide/installation)**
|
|
94
154
|
|
|
95
155
|
---
|
|
96
156
|
|
|
97
|
-
|
|
157
|
+
### 3. Quick Start (5 Minutes)
|
|
158
|
+
Get an app up and running in 4 simple commands:
|
|
98
159
|
|
|
99
|
-
### Step 1: Initialize Your Project
|
|
100
|
-
From inside your application directory:
|
|
101
160
|
```bash
|
|
102
|
-
|
|
103
|
-
```
|
|
104
|
-
This interactive command detects your runtime (Node, Bun, Python, Go, Ruby, etc.), suggests sensible defaults, creates `epd.yml`, and optionally generates a starter `Dockerfile`.
|
|
105
|
-
|
|
106
|
-
### Step 2: Configure Your Servers
|
|
107
|
-
Edit `epd.yml`:
|
|
108
|
-
```yaml
|
|
109
|
-
name: my-app
|
|
110
|
-
mode: docker
|
|
111
|
-
image: my-app
|
|
112
|
-
|
|
113
|
-
ssh:
|
|
114
|
-
user: root
|
|
161
|
+
cd my-project
|
|
115
162
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
hosts: [203.0.113.10]
|
|
119
|
-
port: 3000
|
|
120
|
-
domains: [myapp.example.com]
|
|
121
|
-
|
|
122
|
-
proxy:
|
|
123
|
-
email: admin@example.com
|
|
124
|
-
```
|
|
163
|
+
# 1. Initialize epd.yml
|
|
164
|
+
epd init
|
|
125
165
|
|
|
126
|
-
|
|
127
|
-
```bash
|
|
166
|
+
# 2. Setup your servers (Docker/PM2, Traefik, networks) and run first deploy
|
|
128
167
|
epd setup
|
|
129
|
-
```
|
|
130
|
-
`epd setup`:
|
|
131
|
-
1. Verifies SSH connectivity.
|
|
132
|
-
2. Installs Docker (or PM2 and Node/Bun for process mode) if not already installed.
|
|
133
|
-
3. Sets up the directory structure and reserved port blocks.
|
|
134
|
-
4. Starts the shared Traefik proxy.
|
|
135
|
-
5. Deploys your project.
|
|
136
|
-
|
|
137
|
-
### Step 4: Subsequent Deployments
|
|
138
|
-
For every change thereafter:
|
|
139
|
-
```bash
|
|
140
|
-
epd deploy
|
|
141
|
-
```
|
|
142
|
-
|
|
143
|
-
---
|
|
144
168
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
`epd` supports two distinct runtimes configured via the top-level `mode` field.
|
|
148
|
-
|
|
149
|
-
### Mode: `docker` (Default)
|
|
150
|
-
In Docker mode:
|
|
151
|
-
1. `epd` builds an image locally (using BuildKit / buildx if available) tagged with the commit SHA.
|
|
152
|
-
2. If a `registry:` is specified, the image is pushed and pulled by servers. If omitted, `epd` streams the image directly over SSH (`docker save | gzip | ssh ... docker load`).
|
|
153
|
-
3. Replicas run in containers on a shared Docker bridge network (`epd`).
|
|
154
|
-
4. Replicas communicate with Traefik using internal container DNS names (`http://epd-<app>-<service>-<slot>-<replica>:<port>`).
|
|
155
|
-
|
|
156
|
-
```yaml
|
|
157
|
-
mode: docker
|
|
158
|
-
image: ghcr.io/my-org/my-app
|
|
159
|
-
registry:
|
|
160
|
-
server: ghcr.io
|
|
161
|
-
username: my-user
|
|
162
|
-
password: ${GITHUB_TOKEN}
|
|
169
|
+
# 3. Deploy anytime with zero downtime
|
|
170
|
+
epd deploy
|
|
163
171
|
```
|
|
164
172
|
|
|
165
|
-
|
|
166
|
-
In process mode:
|
|
167
|
-
1. No Docker is needed on the remote host.
|
|
168
|
-
2. `epd` uploads your code via `rsync` (or clean `git archive`) into `/var/lib/epd/apps/<app>/releases/<version>`.
|
|
169
|
-
3. Runs your `install` and `build` commands on the host.
|
|
170
|
-
4. Starts each replica under `pm2` with unique assigned host ports and environment variables.
|
|
171
|
-
5. Traefik runs as a native binary managed by PM2, routing traffic to localhost ports.
|
|
173
|
+
👉 **[Follow the Step-by-Step Getting Started Walkthrough →](/guide/getting-started)**
|
|
172
174
|
|
|
173
|
-
|
|
174
|
-
mode: process
|
|
175
|
+
---
|
|
175
176
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
build: bun run build
|
|
179
|
-
start: bun run start
|
|
180
|
-
exclude: [".git", "node_modules", ".env", "dist"]
|
|
177
|
+
### 4. Deployment Modes: Docker vs. Process
|
|
178
|
+
Choose between containerized Docker builds and native PM2 process execution for ultra-low memory footprints:
|
|
181
179
|
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
hosts: [203.0.113.10]
|
|
185
|
-
replicas: 2
|
|
186
|
-
port: 3000
|
|
187
|
-
domains: [myapp.example.com]
|
|
180
|
+
- **`mode: docker`**: Containerized replicas, isolated bridge network, optional registry.
|
|
181
|
+
- **`mode: process`**: No Docker required on server. Uploads code via `rsync` and manages replicas with PM2.
|
|
188
182
|
|
|
189
|
-
|
|
190
|
-
ssl: false
|
|
191
|
-
```
|
|
183
|
+
👉 **[Read the Deployment Modes Guide →](/guide/deployment-modes)**
|
|
192
184
|
|
|
193
185
|
---
|
|
194
186
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
Every deploy follows an automated zero-downtime sequence:
|
|
187
|
+
### 5. The Blue/Green Zero-Downtime Lifecycle
|
|
188
|
+
Every deploy starts the new version in an alternate slot (`blue` vs `green`), verifies health probes, and performs an atomic route switch in Traefik before draining the old slot.
|
|
198
189
|
|
|
199
|
-
```
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
▼
|
|
203
|
-
[Start New Slot (e.g. Green)] ───► New replicas start on alternative slot
|
|
204
|
-
│
|
|
205
|
-
▼
|
|
206
|
-
[Health Probe Verification] ───► If probes fail: Green is removed, Blue stays live!
|
|
207
|
-
│
|
|
208
|
-
▼
|
|
209
|
-
[Atomic Route Switch] ───► Traefik dynamic config updated to point to Green
|
|
210
|
-
│
|
|
211
|
-
▼
|
|
212
|
-
[Drain & Retire Old Slot] ───► In-flight requests complete; Blue slot retired
|
|
190
|
+
```bash
|
|
191
|
+
# Instant rollback if needed
|
|
192
|
+
epd rollback
|
|
213
193
|
```
|
|
214
194
|
|
|
215
|
-
|
|
216
|
-
2. **Health Check**: Before any routing changes, `epd` executes an in-server probe against every new replica.
|
|
217
|
-
3. **Safety Fallback**: If health checks fail or timeout, the new slot is killed and the current slot remains in service. Zero traffic is dropped.
|
|
218
|
-
4. **Instant Rollback**: Because previous releases and images remain on the server, `epd rollback` can reactivate the previous version within seconds without rebuilding:
|
|
219
|
-
```bash
|
|
220
|
-
epd rollback
|
|
221
|
-
```
|
|
195
|
+
👉 **[Read the Zero-Downtime Blue/Green Guide →](/guide/blue-green)**
|
|
222
196
|
|
|
223
197
|
---
|
|
224
198
|
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
Kamal and other deploy tools often assume ownership of ports 80/443, making it painful to run multiple distinct web apps on a single machine.
|
|
199
|
+
### 6. Multi-Site Hosting on a Single VPS
|
|
200
|
+
Deploy multiple completely different applications to the same server. Each app maintains its own dynamic route file under `/var/lib/epd/proxy/dynamic/<app>.yml` with independent Let's Encrypt SSL certificates.
|
|
228
201
|
|
|
229
|
-
|
|
230
|
-
- Site A (`epd.yml` with `name: blog`): writes `/var/lib/epd/proxy/dynamic/blog.yml`
|
|
231
|
-
- Site B (`epd.yml` with `name: shop`): writes `/var/lib/epd/proxy/dynamic/shop.yml`
|
|
232
|
-
|
|
233
|
-
Both applications share the same server IP, the same Traefik instance, and automatic Let's Encrypt certificates without conflict. Removing Site B (`epd remove`) removes only `shop.yml`, leaving Site A operating seamlessly.
|
|
202
|
+
👉 **[Read the Multi-Site Hosting Guide →](/guide/multi-site)**
|
|
234
203
|
|
|
235
204
|
---
|
|
236
205
|
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
### Across-Host Load Balancing (`proxy.cross_host: true`)
|
|
240
|
-
|
|
241
|
-
By default, Traefik routes traffic to replicas located on its own server. When you have multiple servers behind round-robin DNS or a cloud load balancer, set `proxy.cross_host: true`:
|
|
242
|
-
|
|
243
|
-
```yaml
|
|
244
|
-
proxy:
|
|
245
|
-
cross_host: true
|
|
246
|
-
private_ips:
|
|
247
|
-
203.0.113.10: 10.0.0.10
|
|
248
|
-
203.0.113.11: 10.0.0.11
|
|
249
|
-
|
|
250
|
-
servers:
|
|
251
|
-
web:
|
|
252
|
-
hosts: [203.0.113.10, 203.0.113.11]
|
|
253
|
-
replicas: 2
|
|
254
|
-
port: 3000
|
|
255
|
-
domains: [example.com]
|
|
256
|
-
```
|
|
257
|
-
|
|
258
|
-
With `cross_host: true`:
|
|
259
|
-
- The application port is published on each host (bound to the private IP when specified).
|
|
260
|
-
- Traefik on Server A balances across all replicas on Server A **and** Server B.
|
|
261
|
-
- If Server B goes down, visitors hitting Server B's DNS address will still be routed to Server A by Server A's proxy, guaranteeing high availability.
|
|
206
|
+
### 7. High Availability & Multi-Server Clustering
|
|
207
|
+
Deploy across multiple servers with rolling updates (`strategy: rolling`) and enable cross-host routing (`proxy.cross_host: true`) so requests are balanced across the whole fleet.
|
|
262
208
|
|
|
263
|
-
|
|
264
|
-
Control rolling vs. parallel execution across multiple hosts:
|
|
265
|
-
```yaml
|
|
266
|
-
strategy: rolling # Default: rolls one host at a time, keeping the cluster serving
|
|
267
|
-
# strategy: parallel # Deploys to all hosts simultaneously
|
|
268
|
-
```
|
|
209
|
+
👉 **[Read the High Availability Guide →](/guide/high-availability)**
|
|
269
210
|
|
|
270
211
|
---
|
|
271
212
|
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
Use the `routes:` block under any server group for fine-grained routing control:
|
|
213
|
+
### 8. Advanced Routing & Traefik Features
|
|
214
|
+
Configure paths, subdomains, prefix stripping, HTTP basic auth, redirects (301/302), custom headers, and sticky sessions:
|
|
275
215
|
|
|
276
216
|
```yaml
|
|
277
217
|
servers:
|
|
@@ -279,370 +219,67 @@ servers:
|
|
|
279
219
|
hosts: [203.0.113.10]
|
|
280
220
|
port: 3000
|
|
281
221
|
routes:
|
|
282
|
-
# 1. Standard Domain
|
|
283
222
|
- host: example.com
|
|
284
|
-
|
|
285
|
-
# 2. Subdomain to different container port
|
|
286
223
|
- host: api.example.com
|
|
287
224
|
port: 8080
|
|
288
|
-
|
|
289
|
-
# 3. Path-based routing with prefix stripping and Basic Auth
|
|
290
225
|
- host: example.com
|
|
291
226
|
path: /admin
|
|
292
|
-
port: 4000
|
|
293
227
|
strip_path: true
|
|
294
|
-
basic_auth:
|
|
295
|
-
- "admin:$apr1$xyz$0123456789abcdefghijk."
|
|
296
|
-
|
|
297
|
-
# 4. Domain Redirect (HTTP 301)
|
|
298
|
-
- host: www.example.com
|
|
299
|
-
redirect: https://example.com
|
|
300
|
-
|
|
301
|
-
# 5. Temporary Redirect (HTTP 302)
|
|
302
|
-
- host: promo.example.com
|
|
303
|
-
redirect: https://example.com/special
|
|
304
|
-
permanent: false
|
|
305
|
-
|
|
306
|
-
# 6. Sticky Session Load Balancing (Cookie pinned)
|
|
307
|
-
- host: app.example.com
|
|
308
|
-
path: /socket
|
|
309
|
-
sticky: true
|
|
310
|
-
|
|
311
|
-
# 7. Custom Headers
|
|
312
|
-
- host: secure.example.com
|
|
313
|
-
headers:
|
|
314
|
-
X-Frame-Options: "DENY"
|
|
315
|
-
X-Content-Type-Options: "nosniff"
|
|
316
|
-
|
|
317
|
-
# 8. Wildcard Subdomains (requires DNS challenge)
|
|
318
|
-
- host: "*.example.com"
|
|
319
|
-
priority: 1
|
|
320
|
-
```
|
|
321
|
-
|
|
322
|
-
### Let's Encrypt DNS Challenge
|
|
323
|
-
For wildcard certificates (`*.example.com`) or multi-server setups:
|
|
324
|
-
```yaml
|
|
325
|
-
proxy:
|
|
326
|
-
challenge: dns
|
|
327
|
-
dns_provider: cloudflare
|
|
328
|
-
dns_env: [CF_DNS_API_TOKEN]
|
|
228
|
+
basic_auth: ["admin:$apr1$xyz..."]
|
|
329
229
|
```
|
|
330
230
|
|
|
331
|
-
|
|
332
|
-
`epd` can automatically keep DNS records in sync with your servers on every deploy and setup across multiple DNS providers:
|
|
231
|
+
👉 **[Read the Advanced Routing Guide →](/guide/routing)**
|
|
333
232
|
|
|
334
|
-
|
|
335
|
-
dns:
|
|
336
|
-
provider: cloudflare # or hetzner
|
|
337
|
-
api_token: ${DNS_API_TOKEN}
|
|
338
|
-
# zone_id is optional; auto-detected from domain if omitted
|
|
339
|
-
proxied: true # Cloudflare orange cloud CDN (default: true)
|
|
340
|
-
ttl: 300 # Hetzner default: 300; Cloudflare: 1 (auto)
|
|
341
|
-
auto_sync: true # default: true (auto sync on deploy and setup)
|
|
342
|
-
# domains: [custom.com] # optional; defaults to all domains in routes
|
|
343
|
-
```
|
|
233
|
+
---
|
|
344
234
|
|
|
345
|
-
|
|
235
|
+
### 9. Automated DNS & Hetzner Cloud
|
|
236
|
+
Automatically synchronize A/AAAA records with **Cloudflare** or **Hetzner DNS**, and provision servers dynamically with `epd hetzner`:
|
|
346
237
|
|
|
347
|
-
CLI commands:
|
|
348
238
|
```bash
|
|
349
|
-
#
|
|
239
|
+
# Inspect & sync DNS
|
|
350
240
|
epd dns status
|
|
351
|
-
|
|
352
|
-
# Synchronize DNS records
|
|
353
241
|
epd dns sync
|
|
354
|
-
epd dns sync --dry-run
|
|
355
|
-
epd dns sync --no-proxied
|
|
356
|
-
```
|
|
357
|
-
|
|
358
|
-
---
|
|
359
|
-
|
|
360
|
-
### Hetzner Cloud Server Provisioning & Dynamic Targets
|
|
361
242
|
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
#### CLI Commands
|
|
365
|
-
```bash
|
|
366
|
-
# List all servers in the Hetzner project
|
|
243
|
+
# Manage Hetzner Cloud servers
|
|
367
244
|
epd hetzner list
|
|
368
|
-
|
|
369
|
-
# Inspect available server types, vCPUs, RAM, and pricing
|
|
370
|
-
epd hetzner types
|
|
371
|
-
|
|
372
|
-
# Inspect available datacenter locations
|
|
373
|
-
epd hetzner locations
|
|
374
|
-
|
|
375
|
-
# Create and provision a server (defaults: cx22, fsn1, ubuntu-24.04)
|
|
376
|
-
epd hetzner create app-server-1 --type cx22 --location fsn1
|
|
377
|
-
|
|
378
|
-
# Create and immediately configure the server with Docker & Traefik
|
|
379
|
-
epd hetzner create app-server-1 --setup
|
|
380
|
-
|
|
381
|
-
# Delete a server
|
|
382
|
-
epd hetzner delete app-server-1
|
|
245
|
+
epd hetzner create prod-web-1 --setup
|
|
383
246
|
```
|
|
384
247
|
|
|
385
|
-
|
|
386
|
-
Instead of hardcoding static IP addresses, you can target servers by name or label selector:
|
|
387
|
-
|
|
388
|
-
```yaml
|
|
389
|
-
hetzner:
|
|
390
|
-
api_token: ${HETZNER_API_TOKEN}
|
|
391
|
-
|
|
392
|
-
servers:
|
|
393
|
-
web:
|
|
394
|
-
hosts:
|
|
395
|
-
- hetzner:app-server-1 # Query single server by name
|
|
396
|
-
- hetzner:label:app=web,env=prod # Query all servers matching label selector
|
|
397
|
-
port: 3000
|
|
398
|
-
domains: [example.com]
|
|
399
|
-
```
|
|
400
|
-
|
|
401
|
-
When deploying (`epd deploy` or `epd setup`), `epd` automatically resolves these targets into live public IP addresses via the Hetzner Cloud API.
|
|
248
|
+
👉 **[Read the Hetzner Cloud & DNS Guide →](/hetzner-dns)**
|
|
402
249
|
|
|
403
250
|
---
|
|
404
251
|
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
`epd` ensures secrets are never checked into git, never printed in `docker inspect`, and never written to shell histories.
|
|
252
|
+
### 10. Automated CI/CD with GitHub Actions
|
|
253
|
+
Abstract your entire deployment into `epd.yml` and deploy automatically on every `git push`:
|
|
408
254
|
|
|
409
|
-
### Environment Declarations
|
|
410
255
|
```yaml
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
secret:
|
|
416
|
-
- DATABASE_URL
|
|
417
|
-
- STRIPE_SECRET_KEY
|
|
256
|
+
- name: Deploy with EPD
|
|
257
|
+
run: npx @fabioplunser/epd deploy
|
|
258
|
+
env:
|
|
259
|
+
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
|
|
418
260
|
```
|
|
419
261
|
|
|
420
|
-
|
|
421
|
-
1. When you run `epd deploy`, variables in `env.secret` are read from:
|
|
422
|
-
- Your local environment (`export DATABASE_URL=...`)
|
|
423
|
-
- `.env` / `.env.local` in your project root
|
|
424
|
-
- `.env.<destination>` (when using `--destination`)
|
|
425
|
-
2. On the server, `epd` writes a `0600` root-owned environment file.
|
|
426
|
-
3. Containers read secrets via `--env-file`; process mode loads them into PM2 environments.
|
|
427
|
-
|
|
428
|
-
### Destination Overlays
|
|
429
|
-
Manage staging vs. production effortlessly:
|
|
430
|
-
```bash
|
|
431
|
-
epd deploy -d staging
|
|
432
|
-
```
|
|
433
|
-
Merges `epd.staging.yml` over `epd.yml` and loads `.env.staging`.
|
|
262
|
+
👉 **[Read the GitHub Actions CI/CD Guide →](/ci-cd)**
|
|
434
263
|
|
|
435
264
|
---
|
|
436
265
|
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
Accessories are persistent companion containers (like PostgreSQL, Redis, MinIO, or Adminer) that `epd` provisions and manages alongside your app. Unlike application containers, accessories are **not** replaced on every deploy.
|
|
440
|
-
|
|
441
|
-
```yaml
|
|
442
|
-
accessories:
|
|
443
|
-
db:
|
|
444
|
-
image: postgres:17
|
|
445
|
-
host: 203.0.113.10
|
|
446
|
-
env:
|
|
447
|
-
clear:
|
|
448
|
-
POSTGRES_DB: myapp
|
|
449
|
-
secret:
|
|
450
|
-
- POSTGRES_PASSWORD
|
|
451
|
-
volumes:
|
|
452
|
-
- /var/lib/epd/volumes/myapp-db:/var/lib/postgresql/data
|
|
453
|
-
ports:
|
|
454
|
-
- "127.0.0.1:5432:5432"
|
|
455
|
-
|
|
456
|
-
redis:
|
|
457
|
-
image: redis:7-alpine
|
|
458
|
-
host: 203.0.113.10
|
|
459
|
-
volumes:
|
|
460
|
-
- /var/lib/epd/volumes/myapp-redis:/data
|
|
461
|
-
|
|
462
|
-
# Accessory with public HTTP routing through Traefik
|
|
463
|
-
db_ui:
|
|
464
|
-
image: adminer:latest
|
|
465
|
-
host: 203.0.113.10
|
|
466
|
-
port: 8080
|
|
467
|
-
domains: [db.myapp.example.com]
|
|
468
|
-
```
|
|
469
|
-
|
|
470
|
-
### Managing Accessories
|
|
471
|
-
- **View accessory status**: `epd status` shows accessory state and ports.
|
|
472
|
-
- **View accessory logs**: `epd logs --accessory db -f`
|
|
473
|
-
- **Execute commands in an accessory**: `epd exec --accessory db -i -- psql -U myapp`
|
|
474
|
-
- **Recreate accessory container**: `epd deploy --recreate-accessories`
|
|
475
|
-
- **Inspect Docker run command**: `epd docker-command` prints the exact `docker run` command for each accessory.
|
|
476
|
-
|
|
477
|
-
---
|
|
266
|
+
### 11. Secrets & Environment Management
|
|
267
|
+
Keep secrets safe with `0600` root permissions on the host server and support multi-environment overlays (`epd deploy -d staging`).
|
|
478
268
|
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
| Command | Flags | Description |
|
|
482
|
-
|---|---|---|
|
|
483
|
-
| `epd init` | `--name`, `--mode`, `--host`, `--domain`, `--port`, `--dockerfile` | Initialize a new `epd.yml` for the current project. |
|
|
484
|
-
| `epd setup` | `--skip-deploy`, `--host` | Install prerequisites on servers, start the proxy, and deploy. |
|
|
485
|
-
| `epd deploy` | `--version`, `--no-build`, `--service`, `--host`, `--skip-health`, `--skip-hooks`, `--skip-lock`, `--recreate-accessories`, `-d` | Build and deploy with zero downtime. |
|
|
486
|
-
| `epd redeploy` | `--service`, `--host`, `--skip-health`, `--skip-lock` | Restart the current version without rebuilding or uploading. |
|
|
487
|
-
| `epd rollback [v]`| `--list`, `--service`, `--host` | Roll back to the previous version or a specified version. |
|
|
488
|
-
| `epd status` | `--json` | Show running replicas, slots, health status, and live routes. |
|
|
489
|
-
| `epd logs` | `-f/--follow`, `-n/--lines`, `--service`, `--accessory`, `--host`, `--grep`, `--since` | View or tail logs from servers, services, or accessories. |
|
|
490
|
-
| `epd exec -- <cmd>`| `--host`, `--service`, `--accessory`, `--reuse`, `-i` | Run a one-off command with the app's image and environment. |
|
|
491
|
-
| `epd shell` | `--host`, `--service`, `--accessory` | Open an interactive shell inside a running replica or accessory. |
|
|
492
|
-
| `epd proxy <cmd>` | `status`, `reboot`, `logs`, `routes`, `remove` (`--host`, `-f`, `-n`) | Inspect, follow logs, or restart the shared Traefik proxy. |
|
|
493
|
-
| `epd config` | `--json`, `--raw`, `--traefik` | Validate and print the resolved configuration or Traefik specs. |
|
|
494
|
-
| `epd docker-command`| `--host`, `--service`, `--slot`, `--version`, `--replica` | Output copy-pasteable `docker run` / `pm2` commands. |
|
|
495
|
-
| `epd lock <cmd>` | `status`, `release` | Inspect or clear the atomic deploy lock. |
|
|
496
|
-
| `epd remove` | `-y/--yes`, `--keep-data`, `--host` | Stop this app, remove its routes, and delete files from servers. |
|
|
269
|
+
👉 **[Read the Secrets & Environment Guide →](/guide/secrets)**
|
|
497
270
|
|
|
498
271
|
---
|
|
499
272
|
|
|
500
|
-
|
|
273
|
+
### 12. Persistent Accessories
|
|
274
|
+
Run stateful databases (Postgres, MySQL), caches (Redis), or storage (MinIO) alongside your apps with dedicated volumes and Traefik web routing.
|
|
501
275
|
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
```yaml
|
|
505
|
-
name: myapp # App name (alphanumeric, dashes, underscores)
|
|
506
|
-
mode: docker # docker | process
|
|
507
|
-
|
|
508
|
-
# Docker Build Settings
|
|
509
|
-
image: ghcr.io/org/myapp # Docker image repository (docker mode)
|
|
510
|
-
registry: # Optional: registry credentials
|
|
511
|
-
server: ghcr.io
|
|
512
|
-
username: deployer
|
|
513
|
-
password: ${GITHUB_TOKEN} # Interpolated from environment
|
|
514
|
-
build:
|
|
515
|
-
dockerfile: Dockerfile # Relative path to Dockerfile
|
|
516
|
-
context: . # Build context
|
|
517
|
-
platform: linux/amd64 # Target architecture
|
|
518
|
-
args: # Build arguments
|
|
519
|
-
COMMIT_SHA: ${GIT_SHA:-dev}
|
|
520
|
-
secrets: # BuildKit build secrets
|
|
521
|
-
npm_token: NPM_TOKEN
|
|
522
|
-
|
|
523
|
-
# Process Mode Settings
|
|
524
|
-
process:
|
|
525
|
-
install: bun install # Dependency install command
|
|
526
|
-
build: bun run build # Build command
|
|
527
|
-
start: bun run start # Start command (receives $PORT)
|
|
528
|
-
exclude: [".git", "node_modules"]
|
|
529
|
-
source: rsync # rsync | git
|
|
530
|
-
|
|
531
|
-
# SSH Configuration
|
|
532
|
-
ssh:
|
|
533
|
-
user: root # Remote SSH user
|
|
534
|
-
port: 22 # Remote SSH port
|
|
535
|
-
key: ~/.ssh/id_ed25519 # Optional explicit private key
|
|
536
|
-
proxy_jump: bastion.net # Optional Jump host / Bastion
|
|
537
|
-
options: # Extra SSH options
|
|
538
|
-
- ServerAliveInterval=30
|
|
539
|
-
|
|
540
|
-
# Server Definitions
|
|
541
|
-
servers:
|
|
542
|
-
web:
|
|
543
|
-
hosts: [203.0.113.10] # Server IPs or hostnames
|
|
544
|
-
replicas: 2 # Replicas per host
|
|
545
|
-
port: 3000 # Internal application port
|
|
546
|
-
domains: [myapp.com] # Domains to serve
|
|
547
|
-
cpus: "2.0" # CPU limit
|
|
548
|
-
memory: "1g" # Memory limit
|
|
549
|
-
drain: 10 # Seconds to drain old slot
|
|
550
|
-
stop_timeout: 15 # SIGTERM grace period in seconds
|
|
551
|
-
volumes:
|
|
552
|
-
- /var/lib/epd/volumes/uploads:/app/uploads
|
|
553
|
-
env:
|
|
554
|
-
clear:
|
|
555
|
-
APP_ENV: production
|
|
556
|
-
secret:
|
|
557
|
-
- APP_SECRET
|
|
558
|
-
|
|
559
|
-
worker: # Background worker (no exposed routes)
|
|
560
|
-
hosts: [203.0.113.10]
|
|
561
|
-
replicas: 1
|
|
562
|
-
command: bun run worker.ts
|
|
563
|
-
|
|
564
|
-
# Shared Reverse Proxy
|
|
565
|
-
proxy:
|
|
566
|
-
enabled: true
|
|
567
|
-
ssl: true # Automatically request Let's Encrypt certificates
|
|
568
|
-
email: admin@myapp.com # Registration email for ACME
|
|
569
|
-
challenge: http # http | dns | tlsalpn
|
|
570
|
-
entrypoints:
|
|
571
|
-
web: 80
|
|
572
|
-
websecure: 443
|
|
573
|
-
cross_host: false # Enable cross-server load balancing
|
|
574
|
-
reload_wait: 3 # Throttle duration for route changes
|
|
575
|
-
|
|
576
|
-
# Health Check Settings
|
|
577
|
-
healthcheck:
|
|
578
|
-
path: /health # HTTP path to probe (null for TCP-only check)
|
|
579
|
-
status: 200-399 # Acceptable status codes
|
|
580
|
-
timeout: 60 # Timeout in seconds
|
|
581
|
-
interval: 2 # Seconds between probe attempts
|
|
582
|
-
delay: 1 # Initial delay before probing
|
|
583
|
-
|
|
584
|
-
# Global Environment
|
|
585
|
-
env:
|
|
586
|
-
clear:
|
|
587
|
-
NODE_ENV: production
|
|
588
|
-
secret:
|
|
589
|
-
- DATABASE_URL
|
|
590
|
-
|
|
591
|
-
# Lifecycle Hooks
|
|
592
|
-
hooks:
|
|
593
|
-
pre_build: ./scripts/lint.sh
|
|
594
|
-
pre_deploy: ./scripts/db-migrate.sh
|
|
595
|
-
post_deploy: ./scripts/notify-slack.sh
|
|
596
|
-
on_failure: ./scripts/alert-ops.sh
|
|
597
|
-
|
|
598
|
-
# Deployment Strategy
|
|
599
|
-
strategy: rolling # rolling | parallel
|
|
600
|
-
keep_releases: 5 # Retain last N images / release directories
|
|
601
|
-
remote_root: /var/lib/epd # Root directory on remote hosts
|
|
602
|
-
```
|
|
276
|
+
👉 **[Read the Accessories Guide →](/guide/accessories)**
|
|
603
277
|
|
|
604
278
|
---
|
|
605
279
|
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
### Common Scenarios
|
|
609
|
-
|
|
610
|
-
#### 1. Deployment Fails on Health Check
|
|
611
|
-
- **What Happened**: New replicas started, but `/health` (or `/`) did not return `200-399` within the timeout.
|
|
612
|
-
- **Result**: The new replicas were automatically purged. The previous slot is still live. Zero downtime occurred.
|
|
613
|
-
- **Investigation**:
|
|
614
|
-
```bash
|
|
615
|
-
epd logs --service web --lines 50
|
|
616
|
-
```
|
|
617
|
-
- **Remedy**: Fix the issue, or adjust `healthcheck.timeout` / `healthcheck.path` in `epd.yml`.
|
|
618
|
-
|
|
619
|
-
#### 2. Deploy Lock Held
|
|
620
|
-
- **What Happened**: A previous deploy process was terminated abruptly (e.g. laptop closed or killed with `kill -9`).
|
|
621
|
-
- **Investigation**:
|
|
622
|
-
```bash
|
|
623
|
-
epd lock status
|
|
624
|
-
```
|
|
625
|
-
- **Remedy**:
|
|
626
|
-
```bash
|
|
627
|
-
epd lock release
|
|
628
|
-
```
|
|
629
|
-
|
|
630
|
-
#### 3. Inspecting Server Routes
|
|
631
|
-
To see the exact Traefik route file epd generated on the server:
|
|
632
|
-
```bash
|
|
633
|
-
epd proxy routes
|
|
634
|
-
```
|
|
635
|
-
|
|
636
|
-
#### 4. Checking Proxy Health & Restarting
|
|
637
|
-
If you updated global proxy options (such as adding an entrypoint or enabling the dashboard):
|
|
638
|
-
```bash
|
|
639
|
-
epd proxy status
|
|
640
|
-
epd proxy reboot
|
|
641
|
-
```
|
|
280
|
+
### 13. CLI Reference & Configuration Reference
|
|
281
|
+
Look up every command and configuration option:
|
|
642
282
|
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
epd remove
|
|
647
|
-
```
|
|
648
|
-
This cleans up all replicas, releases, and Traefik dynamic routes without touching any other epd applications sharing the machine.
|
|
283
|
+
👉 **[View CLI Commands Reference →](/reference/cli)**
|
|
284
|
+
👉 **[View Configuration Schema Reference (`epd.yml`) →](/reference/config)**
|
|
285
|
+
👉 **[View Operations & Troubleshooting Guide →](/guide/troubleshooting)**
|