@fabioplunser/epd 0.3.0 → 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 +50 -1
- package/dist/cli.js +1248 -486
- package/docs/.vitepress/config.mts +83 -0
- 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 +152 -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 +95 -0
- package/docs/index.md +71 -0
- 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 +6 -2
|
@@ -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
ADDED
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
# Automated Deployments with GitHub Actions (CI/CD)
|
|
2
|
+
|
|
3
|
+
`epd` is designed to be executed directly inside GitHub Actions. Because your entire deployment configuration (services, replicas, ports, health probes, zero-downtime blue/green slots, accessories, domains, and DNS sync) is declared in `epd.yml`, your CI/CD workflow is concise and maintainable.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## 1. Quick Setup
|
|
8
|
+
|
|
9
|
+
Generate a preconfigured workflow automatically with:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
epd init --ci
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
This creates `.github/workflows/deploy.yml` in your repository.
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## 2. Complete Workflow Example
|
|
20
|
+
|
|
21
|
+
Create `.github/workflows/deploy.yml`:
|
|
22
|
+
|
|
23
|
+
```yaml
|
|
24
|
+
name: Deploy
|
|
25
|
+
|
|
26
|
+
on:
|
|
27
|
+
push:
|
|
28
|
+
branches: [main]
|
|
29
|
+
|
|
30
|
+
concurrency:
|
|
31
|
+
group: deploy-${{ github.ref }}
|
|
32
|
+
cancel-in-progress: false # Do not cancel in-flight deployments
|
|
33
|
+
|
|
34
|
+
jobs:
|
|
35
|
+
deploy:
|
|
36
|
+
runs-on: ubuntu-latest
|
|
37
|
+
steps:
|
|
38
|
+
- name: Checkout repository
|
|
39
|
+
uses: actions/checkout@v4
|
|
40
|
+
|
|
41
|
+
- name: Configure SSH Agent
|
|
42
|
+
uses: webfactory/ssh-agent@v0.9.0
|
|
43
|
+
with:
|
|
44
|
+
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
|
|
45
|
+
|
|
46
|
+
- name: Deploy with EPD
|
|
47
|
+
run: npx @fabioplunser/epd deploy
|
|
48
|
+
env:
|
|
49
|
+
# DNS & Cloud Provider Tokens (if used in epd.yml)
|
|
50
|
+
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
|
51
|
+
HETZNER_API_TOKEN: ${{ secrets.HETZNER_API_TOKEN }}
|
|
52
|
+
HETZNER_DNS_API_TOKEN: ${{ secrets.HETZNER_DNS_API_TOKEN }}
|
|
53
|
+
# Application Secrets referenced in epd.yml
|
|
54
|
+
DATABASE_URL: ${{ secrets.DATABASE_URL }}
|
|
55
|
+
SESSION_SECRET: ${{ secrets.SESSION_SECRET }}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## 3. Configuring SSH Deploy Keys
|
|
61
|
+
|
|
62
|
+
To allow GitHub Actions to securely communicate with your server(s):
|
|
63
|
+
|
|
64
|
+
### 1. Generate an SSH Key Pair
|
|
65
|
+
Run on your local machine:
|
|
66
|
+
```bash
|
|
67
|
+
ssh-keygen -t ed25519 -C "github-actions-epd" -f /tmp/epd_deploy_key
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### 2. Add the Public Key to Your Server
|
|
71
|
+
Copy the contents of `/tmp/epd_deploy_key.pub` to `/root/.ssh/authorized_keys` on each server configured in `epd.yml`.
|
|
72
|
+
|
|
73
|
+
### 3. Add the Private Key to GitHub Secrets
|
|
74
|
+
In your GitHub repository:
|
|
75
|
+
1. Go to **Settings** → **Secrets and variables** → **Actions**.
|
|
76
|
+
2. Click **New repository secret**.
|
|
77
|
+
3. Name: `SSH_PRIVATE_KEY`
|
|
78
|
+
4. Secret: Paste the entire contents of `/tmp/epd_deploy_key` (including `-----BEGIN OPENSSH PRIVATE KEY-----` and `-----END OPENSSH PRIVATE KEY-----`).
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## 4. Docker Image Strategies in CI/CD
|
|
83
|
+
|
|
84
|
+
`epd` gives you three flexible approaches for handling Docker container images in GitHub Actions:
|
|
85
|
+
|
|
86
|
+
### Strategy A: Zero Registry (Easiest)
|
|
87
|
+
If you do not specify a `registry:` in `epd.yml`:
|
|
88
|
+
- The image is built on GitHub's runner.
|
|
89
|
+
- It is saved and streamed directly over SSH to the target server (`docker save | ssh docker load`).
|
|
90
|
+
- **No container registry account or setup required.**
|
|
91
|
+
|
|
92
|
+
### Strategy B: GitHub Container Registry (`ghcr.io`)
|
|
93
|
+
If deploying to multiple servers or wanting fast image caching:
|
|
94
|
+
|
|
95
|
+
In `epd.yml`:
|
|
96
|
+
```yaml
|
|
97
|
+
image: ghcr.io/${{ github.repository }}/app
|
|
98
|
+
registry:
|
|
99
|
+
server: ghcr.io
|
|
100
|
+
username: ${{ github.actor }}
|
|
101
|
+
password_env: GITHUB_TOKEN
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
In `.github/workflows/deploy.yml`:
|
|
105
|
+
```yaml
|
|
106
|
+
- name: Deploy with EPD
|
|
107
|
+
run: npx @fabioplunser/epd deploy
|
|
108
|
+
env:
|
|
109
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### Strategy C: Remote Server Build
|
|
113
|
+
Build the image directly on the remote server using host CPU/memory and local layer cache:
|
|
114
|
+
|
|
115
|
+
```yaml
|
|
116
|
+
# epd.yml
|
|
117
|
+
build:
|
|
118
|
+
remote: true
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
## 5. Multi-Environment Deployments (Staging vs. Production)
|
|
124
|
+
|
|
125
|
+
Use `epd` destination overlays:
|
|
126
|
+
|
|
127
|
+
```yaml
|
|
128
|
+
# .github/workflows/deploy-staging.yml
|
|
129
|
+
on:
|
|
130
|
+
push:
|
|
131
|
+
branches: [develop]
|
|
132
|
+
|
|
133
|
+
jobs:
|
|
134
|
+
deploy:
|
|
135
|
+
runs-on: ubuntu-latest
|
|
136
|
+
steps:
|
|
137
|
+
- uses: actions/checkout@v4
|
|
138
|
+
- uses: webfactory/ssh-agent@v0.9.0
|
|
139
|
+
with:
|
|
140
|
+
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY_STAGING }}
|
|
141
|
+
- run: npx @fabioplunser/epd deploy -d staging
|
|
142
|
+
```
|
|
143
|
+
|
|
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)**
|