@fabioplunser/epd 0.3.1 → 0.5.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.
@@ -0,0 +1,10 @@
1
+ import DefaultTheme from "vitepress/theme";
2
+ import "./style.css";
3
+ import DeployAnimation from "./DeployAnimation.vue";
4
+
5
+ export default {
6
+ extends: DefaultTheme,
7
+ enhanceApp({ app }: { app: any }) {
8
+ app.component("DeployAnimation", DeployAnimation);
9
+ },
10
+ };
@@ -0,0 +1,109 @@
1
+ /**
2
+ * Custom styles & Brand theme for EPD Documentation
3
+ */
4
+
5
+ :root {
6
+ --vp-c-brand-1: #6366f1;
7
+ --vp-c-brand-2: #4f46e5;
8
+ --vp-c-brand-3: #4338ca;
9
+ --vp-c-brand-soft: rgba(99, 102, 241, 0.12);
10
+
11
+ --vp-home-hero-name-color: transparent;
12
+ --vp-home-hero-name-background: linear-gradient(135deg, #6366f1 10%, #a855f7 60%, #ec4899 100%);
13
+
14
+ --vp-home-hero-image-filter: drop-shadow(0 0 40px rgba(99, 102, 241, 0.3));
15
+ }
16
+
17
+ .dark {
18
+ --vp-c-brand-1: #818cf8;
19
+ --vp-c-brand-2: #6366f1;
20
+ --vp-c-brand-3: #4f46e5;
21
+ --vp-c-brand-soft: rgba(129, 140, 248, 0.16);
22
+
23
+ --vp-home-hero-name-background: linear-gradient(135deg, #a5b4fc 10%, #c084fc 60%, #f472b6 100%);
24
+ }
25
+
26
+ /* Feature cards styling */
27
+ .VPFeature {
28
+ transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease !important;
29
+ border-radius: 12px !important;
30
+ }
31
+
32
+ .VPFeature:hover {
33
+ transform: translateY(-2px);
34
+ border-color: var(--vp-c-brand-1) !important;
35
+ box-shadow: 0 8px 24px rgba(99, 102, 241, 0.12);
36
+ }
37
+
38
+ /* Custom Guide Navigation Grid */
39
+ .guide-grid {
40
+ display: grid;
41
+ grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
42
+ gap: 1.25rem;
43
+ margin: 1.5rem 0 2.5rem;
44
+ }
45
+
46
+ .guide-card {
47
+ display: flex;
48
+ flex-direction: column;
49
+ padding: 1.25rem 1.5rem;
50
+ background-color: var(--vp-c-bg-soft);
51
+ border: 1px solid var(--vp-c-border);
52
+ border-radius: 12px;
53
+ text-decoration: none !important;
54
+ color: var(--vp-c-text-1) !important;
55
+ transition: all 0.2s ease-in-out;
56
+ }
57
+
58
+ .guide-card:hover {
59
+ border-color: var(--vp-c-brand-1);
60
+ transform: translateY(-2px);
61
+ box-shadow: 0 6px 20px rgba(99, 102, 241, 0.1);
62
+ }
63
+
64
+ .guide-card-icon {
65
+ font-size: 1.75rem;
66
+ margin-bottom: 0.5rem;
67
+ }
68
+
69
+ .guide-card-title {
70
+ font-size: 1.1rem;
71
+ font-weight: 600;
72
+ margin-bottom: 0.35rem;
73
+ color: var(--vp-c-brand-1);
74
+ }
75
+
76
+ .guide-card-desc {
77
+ font-size: 0.9rem;
78
+ color: var(--vp-c-text-2);
79
+ line-height: 1.45;
80
+ margin: 0;
81
+ }
82
+
83
+ /* Code blocks polish */
84
+ .vp-doc [class*='language-'] {
85
+ border-radius: 10px;
86
+ }
87
+
88
+ /* Tables styling */
89
+ .vp-doc table {
90
+ display: table;
91
+ width: 100%;
92
+ border-collapse: collapse;
93
+ margin: 1.5rem 0;
94
+ }
95
+
96
+ .vp-doc th {
97
+ background-color: var(--vp-c-bg-soft);
98
+ font-weight: 600;
99
+ }
100
+
101
+ @media (max-width: 640px) {
102
+ .guide-grid {
103
+ grid-template-columns: 1fr;
104
+ gap: 0.85rem;
105
+ }
106
+ .guide-card {
107
+ padding: 1rem 1.15rem;
108
+ }
109
+ }
package/docs/ci-cd.md CHANGED
@@ -142,3 +142,11 @@ jobs:
142
142
  ```
143
143
 
144
144
  This applies `epd.staging.yml` over your base `epd.yml`.
145
+
146
+ ---
147
+
148
+ ## Related Documentation
149
+
150
+ - **[Getting Started Guide](/guide/getting-started)**: Step-by-step onboarding walkthrough.
151
+ - **[Hetzner Cloud & DNS](/hetzner-dns)**: Provision servers and sync DNS records automatically.
152
+ - **[CLI Commands Reference](/reference/cli)**: Command-line reference for `epd deploy`.
@@ -0,0 +1,244 @@
1
+ # Getting Started with EPD
2
+
3
+ Deploy any application to one server or a fleet of servers with zero downtime, automatic Let's Encrypt SSL, and a shared Traefik proxy.
4
+
5
+ This guide will take you from zero to a live production deployment in under 5 minutes.
6
+
7
+ ---
8
+
9
+ ## Prerequisites
10
+
11
+ Before starting, ensure you have:
12
+
13
+ 1. **A Linux Server (VPS)**:
14
+ - Any clean Linux VPS (Ubuntu 22.04/24.04, Debian 11/12, Fedora, Arch, etc.)
15
+ - An open SSH port (22) with root or passwordless `sudo` access.
16
+ - Public ports **80** (HTTP) and **443** (HTTPS) accessible from the internet.
17
+ - A DNS `A` record pointing your domain to the server's public IP address.
18
+
19
+ 2. **Local Machine**:
20
+ - [Bun](https://bun.sh) (v1.1+) or [Node.js](https://nodejs.org) (v18+).
21
+ - Standard `ssh` client.
22
+ - Docker installed locally (if deploying in Docker mode).
23
+
24
+ ::: tip No Server Yet?
25
+ If you don't have a server, you can provision one in 30 seconds using the built-in [Hetzner Cloud integration](/hetzner-dns):
26
+ ```bash
27
+ epd hetzner create my-server --setup
28
+ ```
29
+ :::
30
+
31
+ ---
32
+
33
+ ## 1. Install EPD
34
+
35
+ Install `epd` globally using your preferred package manager or download the standalone binary:
36
+
37
+ ::: code-group
38
+
39
+ ```bash [bun]
40
+ bun install -g @fabioplunser/epd
41
+ ```
42
+
43
+ ```bash [npm]
44
+ npm install -g @fabioplunser/epd
45
+ ```
46
+
47
+ ```bash [pnpm]
48
+ pnpm add -g @fabioplunser/epd
49
+ ```
50
+
51
+ ```bash [npx (no install)]
52
+ npx @fabioplunser/epd --help
53
+ ```
54
+
55
+ ```bash [Standalone Binary (Linux)]
56
+ curl -fsSL https://github.com/FabioPlunser/epd/releases/latest/download/epd-linux-x64 -o /usr/local/bin/epd
57
+ chmod +x /usr/local/bin/epd
58
+ ```
59
+
60
+ :::
61
+
62
+ Verify installation:
63
+ ```bash
64
+ epd --version
65
+ ```
66
+
67
+ ---
68
+
69
+ ## 2. Initialize Your Project
70
+
71
+ Navigate to your application's root directory:
72
+
73
+ ```bash
74
+ cd my-app
75
+ epd init
76
+ ```
77
+
78
+ `epd init` will inspect your project:
79
+ - Automatically detects your runtime (Node.js, Bun, Python, Go, Ruby, or static).
80
+ - Detects whether you already have a `Dockerfile`.
81
+ - Prompts for your server IP, domain name, and ACME SSL email.
82
+ - Generates a tailored `epd.yml` config file (and an optimized starter `Dockerfile` if needed).
83
+
84
+ ::: tip GitHub Actions Starter
85
+ Run `epd init --ci` to also generate a ready-to-run GitHub Actions workflow (`.github/workflows/deploy.yml`).
86
+ :::
87
+
88
+ ---
89
+
90
+ ## 3. Configure `epd.yml`
91
+
92
+ Open `epd.yml` in your editor. Here is a typical single-server configuration:
93
+
94
+ ::: code-group
95
+
96
+ ```yaml [Docker Mode (Default)]
97
+ # Application name (used for container naming and routing isolation)
98
+ name: my-app
99
+ mode: docker
100
+
101
+ # Docker image name (built locally, or pulled from registry)
102
+ image: my-app
103
+
104
+ # SSH connection details
105
+ ssh:
106
+ user: root
107
+
108
+ # Server & Routing
109
+ servers:
110
+ web:
111
+ hosts: [203.0.113.10]
112
+ port: 3000
113
+ domains: [app.example.com]
114
+
115
+ # Shared Traefik Proxy & Automatic SSL
116
+ proxy:
117
+ email: admin@example.com
118
+
119
+ # Health check probe before switching live traffic
120
+ healthcheck:
121
+ path: /health
122
+ timeout: 30
123
+
124
+ # Environment variables & secrets
125
+ env:
126
+ clear:
127
+ NODE_ENV: production
128
+ secret:
129
+ - DATABASE_URL
130
+ ```
131
+
132
+ ```yaml [Process Mode (No Docker on Server)]
133
+ # Run code directly under PM2 without Docker on the host
134
+ name: my-app
135
+ mode: process
136
+
137
+ process:
138
+ install: bun install --frozen-lockfile
139
+ build: bun run build
140
+ start: bun run start
141
+ exclude: [".git", "node_modules", ".env", "dist"]
142
+
143
+ ssh:
144
+ user: root
145
+
146
+ servers:
147
+ web:
148
+ hosts: [203.0.113.10]
149
+ replicas: 2
150
+ port: 3000
151
+ domains: [app.example.com]
152
+
153
+ proxy:
154
+ email: admin@example.com
155
+ ```
156
+
157
+ :::
158
+
159
+ ### Secrets Setup
160
+
161
+ Any secret declared under `env.secret` is resolved automatically from your local shell or `.env` file:
162
+
163
+ ```bash
164
+ # In your local .env or current shell:
165
+ export DATABASE_URL="postgres://user:password@host/dbname"
166
+ ```
167
+
168
+ When you deploy, `epd` securely uploads secrets into a root-owned `0600` file on the remote server without saving secrets in git or container image layers.
169
+
170
+ ---
171
+
172
+ ## 4. Run Server Setup
173
+
174
+ Run `epd setup` once for each new server:
175
+
176
+ ```bash
177
+ epd setup
178
+ ```
179
+
180
+ ### What `epd setup` does automatically:
181
+ 1. **Validates SSH Connectivity** to all configured servers.
182
+ 2. **Installs Host Prerequisites**: Installs Docker (or PM2 and Node/Bun in process mode) if not already present.
183
+ 3. **Provisions Shared Traefik Reverse Proxy**: Launches Traefik listening on ports 80 and 443 with Let's Encrypt automated ACME SSL certificate issuance.
184
+ 4. **Creates Network & Storage**: Configures the shared Docker bridge network (`epd`) and volume directories (`/var/lib/epd`).
185
+ 5. **Runs Your First Deployment**: Builds the app, starts the blue slot, verifies health checks, and registers the domain in Traefik.
186
+
187
+ ---
188
+
189
+ ## 5. Deploy Updates with Zero Downtime
190
+
191
+ Whenever you commit changes or want to deploy an update:
192
+
193
+ ```bash
194
+ epd deploy
195
+ ```
196
+
197
+ `epd deploy` executes a zero-downtime blue/green swap:
198
+ 1. Builds the latest container image (or syncs process code).
199
+ 2. Starts the new version in the **idle slot** (e.g., `green`).
200
+ 3. Probes the internal health check endpoint until healthy.
201
+ 4. Atomically updates Traefik's dynamic routing to direct incoming requests to the new slot.
202
+ 5. Drains in-flight connections to the previous slot (`blue`) before gracefully stopping it.
203
+
204
+ ::: tip Rollback Anytime
205
+ If an issue occurs after deployment, revert instantly to the previous version with:
206
+ ```bash
207
+ epd rollback
208
+ ```
209
+ This re-activates the previous slot in seconds without rebuilding or re-uploading!
210
+ :::
211
+
212
+ ---
213
+
214
+ ## 6. Inspect & Monitor
215
+
216
+ Use `epd` CLI commands to check your application's health:
217
+
218
+ ```bash
219
+ # Check running containers, active slots, and route status
220
+ epd status
221
+
222
+ # Stream live container logs
223
+ epd logs -f
224
+
225
+ # Follow logs specifically from your web service
226
+ epd logs --service web -f --lines 100
227
+
228
+ # Open an interactive shell inside a running replica
229
+ epd shell
230
+ ```
231
+
232
+ ---
233
+
234
+ ## Next Steps
235
+
236
+ Now that your application is live, explore additional capabilities:
237
+
238
+ - **[Architecture & Concepts](/guide/architecture)**: How Traefik routing, blue/green slots, and failover work.
239
+ - **[Deployment Modes](/guide/deployment-modes)**: Compare Docker vs. Process (PM2) modes.
240
+ - **[Multi-Site Hosting](/guide/multi-site)**: Host 5, 10, or 20 distinct domains on a single VPS.
241
+ - **[Accessories & Databases](/guide/accessories)**: Spin up PostgreSQL, Redis, or MinIO alongside your app.
242
+ - **[GitHub Actions CI/CD](/ci-cd)**: Set up fully automated deployments on every `git push`.
243
+ - **[Hetzner Cloud & DNS](/hetzner-dns)**: Automate server provisioning and Cloudflare/Hetzner DNS sync.
244
+ - **[CLI Reference](/reference/cli)**: Complete list of all CLI commands and flags.
@@ -0,0 +1,103 @@
1
+ # Accessories (Databases, Caches & Dashboards)
2
+
3
+ Learn how to provision and manage stateful companion services like PostgreSQL, Redis, MinIO, and Adminer alongside your application.
4
+
5
+ ---
6
+
7
+ ## What Are Accessories?
8
+
9
+ Unlike application containers (which are replaced on every deploy to enable zero-downtime blue/green switches), **accessories** are long-lived, persistent containers:
10
+
11
+ - **Stateful Storage**: Data is preserved across deployments using Docker host volumes.
12
+ - **Dedicated Lifecycle**: Accessories are started once and remain running when you deploy code updates.
13
+ - **Optional Traefik Ingress**: Accessories can have their own public domains and SSL certificates (great for web-based DB managers like Adminer).
14
+
15
+ ---
16
+
17
+ ## Configuring Accessories in `epd.yml`
18
+
19
+ ```yaml
20
+ accessories:
21
+ # 1. PostgreSQL Database
22
+ db:
23
+ image: postgres:17-alpine
24
+ host: 203.0.113.10
25
+ env:
26
+ clear:
27
+ POSTGRES_DB: myapp
28
+ POSTGRES_USER: postgres
29
+ secret:
30
+ - POSTGRES_PASSWORD
31
+ volumes:
32
+ - /var/lib/epd/volumes/myapp-postgres:/var/lib/postgresql/data
33
+ ports:
34
+ - "127.0.0.1:5432:5432" # Bound strictly to localhost for safety
35
+
36
+ # 2. Redis Cache
37
+ redis:
38
+ image: redis:7-alpine
39
+ host: 203.0.113.10
40
+ volumes:
41
+ - /var/lib/epd/volumes/myapp-redis:/data
42
+ command: redis-server --appendonly yes
43
+
44
+ # 3. Database Management UI (Public HTTPS via Traefik)
45
+ db_ui:
46
+ image: adminer:latest
47
+ host: 203.0.113.10
48
+ port: 8080
49
+ domains: [db.myapp.example.com]
50
+ ```
51
+
52
+ ---
53
+
54
+ ## Inter-Container Networking
55
+
56
+ In Docker mode, application containers and accessory containers run on the shared `epd` Docker network.
57
+
58
+ Your application can reach accessories using their container name directly:
59
+ ```
60
+ postgres://postgres:${POSTGRES_PASSWORD}@epd-myapp-accessory-db:5432/myapp
61
+ redis://epd-myapp-accessory-redis:6379
62
+ ```
63
+
64
+ ---
65
+
66
+ ## Managing Accessories via CLI
67
+
68
+ `epd` includes specialized CLI commands for working with accessories:
69
+
70
+ ### Inspect Status
71
+ ```bash
72
+ epd status
73
+ ```
74
+ Shows running accessories, image tags, port mappings, and container health.
75
+
76
+ ### View Accessory Logs
77
+ ```bash
78
+ # Follow live logs from the postgres database
79
+ epd logs --accessory db -f
80
+ ```
81
+
82
+ ### Run Commands Inside an Accessory
83
+ ```bash
84
+ # Open an interactive psql session inside the database container
85
+ epd exec --accessory db -i -- psql -U postgres -d myapp
86
+
87
+ # Run a Redis CLI ping
88
+ epd exec --accessory redis -- redis-cli ping
89
+ ```
90
+
91
+ ### Recreate Accessories
92
+ If you update an accessory's image tag, environment variable, or volume configuration:
93
+ ```bash
94
+ epd deploy --recreate-accessories
95
+ ```
96
+
97
+ ---
98
+
99
+ ## Next Steps
100
+
101
+ - Explore **[Operations & Troubleshooting](/guide/troubleshooting)**
102
+ - Learn about **[Automating with GitHub Actions](/ci-cd)**
103
+ - View the full **[CLI Reference](/reference/cli)**
@@ -0,0 +1,94 @@
1
+ # Architecture & Concepts
2
+
3
+ Learn how `epd` routes incoming traffic, provides true zero-downtime blue/green switches, and enables multiple independent applications to peacefully share a single host.
4
+
5
+ ---
6
+
7
+ ## High-Level Request Flow
8
+
9
+ ```
10
+ Internet (HTTP: 80 / HTTPS: 443)
11
+ │
12
+ ▼
13
+ ┌─────────────────────────────────────────────────────────────────────────┐
14
+ │ HOST SERVER (e.g. 203.0.113.10) │
15
+ │ │
16
+ │ ┌─────────────────────────────────────────────────────────────────┐ │
17
+ │ │ Shared Traefik Proxy (:80 / :443) │ │
18
+ │ │ Dynamic Config Provider (/var/lib/epd/proxy/dynamic/*.yml) │ │
19
+ │ │ Let's Encrypt ACME Certificate Resolver │ │
20
+ │ └───────────────┬───────────────────────────────┬─────────────────┘ │
21
+ │ │ │ │
22
+ │ Host: blog.example.com Host: store.example.com │
23
+ │ ▼ ▼ │
24
+ │ ┌───────────────────────────────┐ ┌─────────────────────────────┐ │
25
+ │ │ App 1: Blog │ │ App 2: Store │ │
26
+ │ │ Slot: Green (Live) │ │ Slot: Blue (Live) │ │
27
+ │ │ 2 Replicas │ │ 1 Replica │ │
28
+ │ └───────────────┬───────────────┘ └─────────────────────────────┘ │
29
+ │ │ │
30
+ │ ▼ │
31
+ │ ┌───────────────────────────────┐ │
32
+ │ │ Accessory: Postgres │ │
33
+ │ │ /var/lib/epd/volumes/blog-db │ │
34
+ │ └───────────────────────────────┘ │
35
+ └─────────────────────────────────────────────────────────────────────────┘
36
+ ```
37
+
38
+ ---
39
+
40
+ ## Key Principles
41
+
42
+ ### 1. Zero Daemons or Control Planes
43
+ Traditional container orchestrators (like Kubernetes, Nomad, or Docker Swarm) require running complex background agents, control planes, and consensus databases.
44
+
45
+ `epd` uses **standard SSH**. When you run `epd deploy`, it connects over SSH, executes necessary Docker/PM2 commands, writes declarative Traefik configuration files, and disconnects. Your servers remain lightweight, predictable, and free of proprietary locks.
46
+
47
+ ### 2. The Shared Traefik Reverse Proxy
48
+ Traefik binds to ports 80 and 443 on the host server. Rather than restarting or modifying a master configuration file on every deployment:
49
+ - Traefik watches a dynamic configuration directory: `/var/lib/epd/proxy/dynamic/`.
50
+ - Each deployed app maintains its own file, e.g., `/var/lib/epd/proxy/dynamic/blog.yml`.
51
+ - Traefik hot-reloads routing tables in memory with **zero dropped requests** whenever a file changes.
52
+ - Adding, updating, or deleting one application has zero impact on any other app running on the same server.
53
+
54
+ ### 3. Server Filesystem Layout
55
+
56
+ On every server managed by `epd`, files are neatly arranged under `/var/lib/epd`:
57
+
58
+ ```
59
+ /var/lib/epd/
60
+ ├── proxy/
61
+ │ ├── traefik.yml # Static Traefik configuration
62
+ │ ├── acme.json # Let's Encrypt SSL certificates (0600)
63
+ │ └── dynamic/ # Traefik hot-reloaded routing directory
64
+ │ ├── app1.yml # App 1 dynamic routing rules
65
+ │ └── app2.yml # App 2 dynamic routing rules
66
+ ├── apps/
67
+ │ ├── my-app/
68
+ │ │ ├── env # Secret environment variables (0600)
69
+ │ │ ├── state.json # Active slot, version, and replica state
70
+ │ │ └── releases/ # (Process mode) Versioned releases
71
+ ├── volumes/ # Persistent accessory storage (Postgres, Redis)
72
+ └── locks/ # Atomic deployment concurrency locks
73
+ ```
74
+
75
+ ---
76
+
77
+ ## How epd Compares
78
+
79
+ | Feature | `epd` | Kamal | Kubernetes | Docker Swarm |
80
+ |---|:---:|:---:|:---:|:---:|
81
+ | **Zero-Downtime Blue/Green** | ✅ Built-in | ✅ Rolling | ✅ Complex | ✅ Rolling |
82
+ | **Multi-Site on Single VPS** | ✅ Native (Shared Traefik) | ❌ Port 80/443 conflict | ⚠️ Requires Ingress Controller | ⚠️ Requires Traefik/Nginx |
83
+ | **No-Docker Process Mode (PM2)**| ✅ Built-in | ❌ Docker only | ❌ Containers only | ❌ Containers only |
84
+ | **Hetzner & DNS Automation** | ✅ Built-in | ❌ Third-party | ❌ External operator | ❌ None |
85
+ | **Cross-Host Failover** | ✅ Built-in | ❌ Single host proxy | ✅ Ingress / Mesh | ✅ Ingress routing mesh |
86
+ | **Resource Overhead** | ~30MB (Traefik) | ~50MB | >1GB - 2GB RAM | ~250MB |
87
+
88
+ ---
89
+
90
+ ## Next Steps
91
+
92
+ - Explore the **[Blue/Green Deployment Lifecycle](/guide/blue-green)**
93
+ - Learn about **[Deployment Modes: Docker vs. Process](/guide/deployment-modes)**
94
+ - See how **[Multi-Site Hosting](/guide/multi-site)** works
@@ -0,0 +1,93 @@
1
+ # Zero-Downtime Blue/Green Deployments
2
+
3
+ Learn how `epd` ensures that zero live user requests are ever dropped during a deployment or rollback.
4
+
5
+ ---
6
+
7
+ ## The Blue/Green Lifecycle
8
+
9
+ Unlike standard container restarts which drop connections while waiting for a new process to boot, `epd` uses alternating **slots** (`blue` and `green`):
10
+
11
+ ```
12
+ [1. Build & Ship] Builds image locally or uploads process archive
13
+ │
14
+ ▼
15
+ [2. Start Idle Slot] Replicas boot up in the alternate slot (e.g., Green)
16
+ │
17
+ ▼
18
+ [3. Health Probe Loop] Probes /health inside the server on each replica
19
+ │ └─► If fails: Green killed, Blue remains untouched!
20
+ ▼
21
+ [4. Atomic Traefik Switch] Rewrites /var/lib/epd/proxy/dynamic/<app>.yml
22
+ │ └─► Traefik routes new traffic to Green instantly
23
+ ▼
24
+ [5. Connection Draining] Waits drain seconds for in-flight requests to complete
25
+ │
26
+ ▼
27
+ [6. Retire Previous Slot] Stops previous Blue slot replicas safely
28
+ ```
29
+
30
+ ---
31
+
32
+ ## 1. Health Probe Verification
33
+
34
+ Before Traefik receives instructions to route traffic to the new version, `epd` probes every replica locally on the host server.
35
+
36
+ ```yaml
37
+ healthcheck:
38
+ path: /health # HTTP endpoint to probe (default: "/")
39
+ status: 200-399 # Acceptable HTTP status codes (default: 200-399)
40
+ timeout: 45 # Maximum seconds to wait before failing (default: 60)
41
+ interval: 2 # Seconds between consecutive probe attempts
42
+ delay: 2 # Delay in seconds before starting probes
43
+ ```
44
+
45
+ ### Safety Guarantee:
46
+ If your new version crashes on boot, fails database migrations, or throws an unhandled exception:
47
+ 1. The health probe times out or encounters fatal errors.
48
+ 2. `epd` immediately cleans up the new slot.
49
+ 3. **The existing slot remains live and serving traffic without interruption.**
50
+ 4. No visitors experience an error or outage.
51
+
52
+ ---
53
+
54
+ ## 2. Connection Draining
55
+
56
+ When traffic is switched to the new slot, existing long-lived HTTP requests or WebSockets hitting the old slot need time to finish processing.
57
+
58
+ You can configure the drain period in `epd.yml`:
59
+
60
+ ```yaml
61
+ servers:
62
+ web:
63
+ hosts: [203.0.113.10]
64
+ drain: 15 # Seconds to wait before stopping the old slot (default: 10)
65
+ stop_timeout: 20 # SIGTERM to SIGKILL grace period for containers
66
+ ```
67
+
68
+ ---
69
+
70
+ ## 3. Instant Rollback
71
+
72
+ Because `epd` preserves previous image releases and dynamic configurations on the host server:
73
+
74
+ ```bash
75
+ # Roll back immediately to the previous slot
76
+ epd rollback
77
+
78
+ # Or list all historical versions on servers:
79
+ epd rollback --list
80
+
81
+ # Roll back to a specific past version:
82
+ epd rollback v1.4.2
83
+ ```
84
+
85
+ Rolling back does not require rebuilding or re-uploading your application code. `epd` spins up the previous version and performs an atomic route switch in under 3 seconds.
86
+
87
+ ---
88
+
89
+ ## Next Steps
90
+
91
+ - Explore **[Multi-Site Hosting on a Single VPS](/guide/multi-site)**
92
+ - Learn about **[High Availability & Clustering](/guide/high-availability)**
93
+ - Configure **[Advanced Routing & Traefik](/guide/routing)**