@fabioplunser/epd 0.2.0 → 0.3.1

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,50 @@
1
+ import { defineConfig } from "vitepress";
2
+
3
+ export default defineConfig({
4
+ title: "EPD",
5
+ description: "Easy Project Deployer — Zero-downtime blue/green deployments for one server or ten.",
6
+ base: "/epd/",
7
+ cleanUrls: true,
8
+ lastUpdated: true,
9
+ themeConfig: {
10
+ logo: { text: "🚀 EPD" },
11
+ siteTitle: "EPD",
12
+ nav: [
13
+ { text: "Guide", link: "/guide" },
14
+ { text: "GitHub Actions (CI/CD)", link: "/ci-cd" },
15
+ { text: "Hetzner & DNS", link: "/hetzner-dns" },
16
+ { text: "NPM", link: "https://www.npmjs.com/package/@fabioplunser/epd" },
17
+ ],
18
+ sidebar: [
19
+ {
20
+ text: "Getting Started",
21
+ items: [
22
+ { text: "Overview & Features", link: "/" },
23
+ { text: "Complete Guide", link: "/guide" },
24
+ ],
25
+ },
26
+ {
27
+ text: "Automation & Cloud",
28
+ items: [
29
+ { text: "GitHub Actions (CI/CD)", link: "/ci-cd" },
30
+ { text: "Hetzner Cloud & DNS", link: "/hetzner-dns" },
31
+ ],
32
+ },
33
+ ],
34
+ socialLinks: [
35
+ { icon: "github", link: "https://github.com/FabioPlunser/epd" },
36
+ { icon: "npm", link: "https://www.npmjs.com/package/@fabioplunser/epd" },
37
+ ],
38
+ search: {
39
+ provider: "local",
40
+ },
41
+ footer: {
42
+ message: "Released under the MIT License.",
43
+ copyright: "Copyright © 2026 Fabio Plünser",
44
+ },
45
+ editLink: {
46
+ pattern: "https://github.com/FabioPlunser/epd/edit/main/docs/:path",
47
+ text: "Edit this page on GitHub",
48
+ },
49
+ },
50
+ });
package/docs/ci-cd.md ADDED
@@ -0,0 +1,144 @@
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`.
package/docs/guide.md CHANGED
@@ -328,32 +328,80 @@ proxy:
328
328
  dns_env: [CF_DNS_API_TOKEN]
329
329
  ```
330
330
 
331
- ### Cloudflare Automations & DNS Auto-Sync
332
- `epd` can automatically keep Cloudflare DNS records in sync with your servers on every deploy and setup:
331
+ ### Multi-Provider DNS Automations (Cloudflare & Hetzner DNS)
332
+ `epd` can automatically keep DNS records in sync with your servers on every deploy and setup across multiple DNS providers:
333
333
 
334
334
  ```yaml
335
- cloudflare:
336
- api_token: ${CLOUDFLARE_API_TOKEN}
335
+ dns:
336
+ provider: cloudflare # or hetzner
337
+ api_token: ${DNS_API_TOKEN}
337
338
  # zone_id is optional; auto-detected from domain if omitted
338
- proxied: true # default: true (orange cloud CDN/DDoS), or false (gray cloud / DNS-only)
339
- ttl: 1 # default: 1 (auto)
340
- auto_sync: true # default: true (auto sync on deploy and setup)
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)
341
342
  # domains: [custom.com] # optional; defaults to all domains in routes
342
343
  ```
343
344
 
345
+ *(Legacy `cloudflare:` block is also supported).*
346
+
344
347
  CLI commands:
345
348
  ```bash
346
349
  # Check status vs servers without modifying
347
- epd cloudflare dns status
350
+ epd dns status
348
351
 
349
352
  # Synchronize DNS records
350
- epd cloudflare dns sync
351
- epd cloudflare dns sync --dry-run
352
- epd cloudflare dns sync --no-proxied
353
+ epd dns sync
354
+ epd dns sync --dry-run
355
+ epd dns sync --no-proxied
353
356
  ```
354
357
 
355
358
  ---
356
359
 
360
+ ### Hetzner Cloud Server Provisioning & Dynamic Targets
361
+
362
+ `epd` includes built-in integration with Hetzner Cloud (`hcloud`).
363
+
364
+ #### CLI Commands
365
+ ```bash
366
+ # List all servers in the Hetzner project
367
+ 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
383
+ ```
384
+
385
+ #### Dynamic Server Hosts in `epd.yml`
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.
402
+
403
+ ---
404
+
357
405
  ## 9. Secrets & Environment Management
358
406
 
359
407
  `epd` ensures secrets are never checked into git, never printed in `docker inspect`, and never written to shell histories.
@@ -0,0 +1,87 @@
1
+ # Hetzner Cloud & Multi-Provider DNS
2
+
3
+ `epd` includes native integrations with **Hetzner Cloud** and automated DNS synchronization across **Cloudflare** and **Hetzner DNS**.
4
+
5
+ ---
6
+
7
+ ## 1. Multi-Provider DNS Automation
8
+
9
+ `epd` can automatically manage and synchronize `A` and `AAAA` records for all configured service routes.
10
+
11
+ ### Configuration (`epd.yml`)
12
+
13
+ ```yaml
14
+ # Unified DNS configuration
15
+ dns:
16
+ provider: cloudflare # or "hetzner"
17
+ api_token: ${DNS_API_TOKEN}
18
+ # zone_id: ... # Optional; auto-discovered from domain name
19
+ proxied: true # Cloudflare CDN/proxy (default: true)
20
+ ttl: 300 # Hetzner default: 300; Cloudflare: 1 (auto)
21
+ auto_sync: true # Sync records automatically on setup and deploy
22
+ ```
23
+
24
+ *(Legacy `cloudflare:` configuration is also supported).*
25
+
26
+ ### CLI Commands
27
+
28
+ ```bash
29
+ # Check status of domains vs server IPs
30
+ epd dns status
31
+
32
+ # Synchronize DNS records
33
+ epd dns sync
34
+
35
+ # Preview changes without modifying records
36
+ epd dns sync --dry-run
37
+
38
+ # Disable Cloudflare CDN proxy (DNS-only)
39
+ epd dns sync --no-proxied
40
+ ```
41
+
42
+ ---
43
+
44
+ ## 2. Hetzner Cloud Integration
45
+
46
+ Manage and provision Hetzner Cloud servers directly with `epd hetzner`:
47
+
48
+ ### CLI Commands
49
+
50
+ ```bash
51
+ # List all Hetzner servers in your project
52
+ epd hetzner list
53
+
54
+ # Inspect available server types, vCPUs, RAM, and pricing (EUR/mo)
55
+ epd hetzner types
56
+
57
+ # Inspect available datacenter locations
58
+ epd hetzner locations
59
+
60
+ # Create a new server (default: cx22 in fsn1 with ubuntu-24.04)
61
+ epd hetzner create prod-web-1 --type cx22 --location fsn1
62
+
63
+ # Create and automatically prepare with Docker, PM2, and Traefik:
64
+ epd hetzner create prod-web-1 --setup
65
+
66
+ # Delete a server
67
+ epd hetzner delete prod-web-1
68
+ ```
69
+
70
+ ### Dynamic Target Servers in `epd.yml`
71
+
72
+ Instead of static IP addresses, you can target servers by **name** or **label selector**:
73
+
74
+ ```yaml
75
+ hetzner:
76
+ api_token: ${HETZNER_API_TOKEN}
77
+
78
+ servers:
79
+ web:
80
+ hosts:
81
+ - hetzner:prod-web-1 # Target single server by name
82
+ - hetzner:label:app=web,env=prod # Target all servers matching labels
83
+ port: 3000
84
+ domains: [example.com]
85
+ ```
86
+
87
+ When deploying (`epd deploy` or `epd setup`), `epd` dynamically queries the Hetzner Cloud API to resolve targets to their live public IP addresses.
package/docs/index.md ADDED
@@ -0,0 +1,76 @@
1
+ ---
2
+ layout: home
3
+
4
+ hero:
5
+ name: "EPD"
6
+ text: "Easy Project Deployer"
7
+ tagline: "Deploy any project to one server or ten with zero downtime from a single command or GitHub Action."
8
+ actions:
9
+ - theme: brand
10
+ text: Get Started
11
+ link: /guide
12
+ - theme: alt
13
+ text: GitHub Actions CI/CD
14
+ link: /ci-cd
15
+ - theme: alt
16
+ text: View on GitHub
17
+ link: https://github.com/FabioPlunser/epd
18
+
19
+ features:
20
+ - icon: 🔄
21
+ title: Zero-Downtime Blue/Green
22
+ details: New versions are started in an idle slot, probed until healthy, and atomically switched in Traefik before the old slot is drained.
23
+ - icon: 🌐
24
+ title: Shared Traefik Multi-Site
25
+ details: Multiple apps peacefully share a single Traefik proxy on the host without port collisions or competing for ports 80/443.
26
+ - icon: 📦
27
+ title: Docker OR Process Mode (PM2)
28
+ details: Run containers with Docker, or deploy plain Node/Bun/Python code directly under PM2 without requiring Docker on the server.
29
+ - icon: 🤖
30
+ title: GitHub Actions Automated CI/CD
31
+ details: Abstract your entire deployment into epd.yml. Run automated zero-downtime deploys on git push with a clean 20-line workflow.
32
+ - icon: ☁️
33
+ title: Hetzner Cloud Integration
34
+ details: Provision servers directly with CLI commands and target servers by name or label selector dynamically in epd.yml.
35
+ - icon: 🛡️
36
+ title: Multi-Provider DNS Automation
37
+ details: Automatically synchronize A/AAAA records for your service domains across Cloudflare (with CDN proxy) or Hetzner DNS.
38
+ ---
39
+
40
+ ## Quick Install
41
+
42
+ ::: code-group
43
+
44
+ ```bash [npm]
45
+ npm install -g @fabioplunser/epd
46
+ ```
47
+
48
+ ```bash [bun]
49
+ bun install -g @fabioplunser/epd
50
+ ```
51
+
52
+ ```bash [npx (no install)]
53
+ npx @fabioplunser/epd deploy
54
+ ```
55
+
56
+ ```bash [Standalone Binary (Linux)]
57
+ curl -fsSL https://github.com/FabioPlunser/epd/releases/latest/download/epd-linux-x64 -o /usr/local/bin/epd
58
+ chmod +x /usr/local/bin/epd
59
+ ```
60
+
61
+ :::
62
+
63
+ ## 30-Second Quickstart
64
+
65
+ ```bash
66
+ cd my-project
67
+
68
+ # 1. Initialize epd.yml (and starter Dockerfile / GitHub Action)
69
+ epd init --ci
70
+
71
+ # 2. Setup your servers (Docker/PM2, Traefik, networks) and run first deploy
72
+ epd setup
73
+
74
+ # 3. Deploy updates anytime with zero downtime
75
+ epd deploy
76
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fabioplunser/epd",
3
- "version": "0.2.0",
3
+ "version": "0.3.1",
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",
@@ -44,6 +44,9 @@
44
44
  "build:binaries": "bun run scripts/build-all.ts",
45
45
  "typecheck": "tsc --noEmit",
46
46
  "test": "bun test",
47
+ "docs:dev": "vitepress dev docs",
48
+ "docs:build": "vitepress build docs",
49
+ "docs:preview": "vitepress preview docs",
47
50
  "prepublishOnly": "bun run typecheck && bun test && bun run build:bundle"
48
51
  },
49
52
  "engines": {
@@ -51,6 +54,7 @@
51
54
  },
52
55
  "devDependencies": {
53
56
  "@types/bun": "latest",
54
- "typescript": "^5.6.0"
57
+ "typescript": "^5.6.0",
58
+ "vitepress": "^1.6.4"
55
59
  }
56
60
  }