@fabioplunser/epd 0.3.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.
- package/README.md +50 -1
- package/dist/cli.js +250 -6
- package/docs/.vitepress/config.mts +50 -0
- package/docs/ci-cd.md +144 -0
- package/docs/hetzner-dns.md +87 -0
- package/docs/index.md +76 -0
- package/package.json +6 -2
package/README.md
CHANGED
|
@@ -25,7 +25,8 @@ Multiple machines, load balancing and failover are first-class: replicas are
|
|
|
25
25
|
balanced by Traefik, and with `cross_host: true` every server's proxy balances
|
|
26
26
|
across every server's replicas, so one machine can serve while another is down.
|
|
27
27
|
|
|
28
|
-
π **
|
|
28
|
+
π **Documentation Site:** [fabioplunser.github.io/epd](https://fabioplunser.github.io/epd/)
|
|
29
|
+
π **User Manual & Full Reference:** [Complete Guide](docs/guide.md)
|
|
29
30
|
|
|
30
31
|
---
|
|
31
32
|
|
|
@@ -439,6 +440,53 @@ they need Docker on their host.
|
|
|
439
440
|
|
|
440
441
|
---
|
|
441
442
|
|
|
443
|
+
## Automated Deployments with GitHub Actions (CI/CD)
|
|
444
|
+
|
|
445
|
+
`epd` can be run directly inside GitHub Actions on push to `main`. Because your entire deployment configuration (services, replicas, ports, health probes, zero-downtime blue/green slots, accessories, domains, and DNS sync) lives in `epd.yml`, you only need a single minimal step in GitHub Actions:
|
|
446
|
+
|
|
447
|
+
```yaml
|
|
448
|
+
# .github/workflows/deploy.yml
|
|
449
|
+
name: Deploy
|
|
450
|
+
|
|
451
|
+
on:
|
|
452
|
+
push:
|
|
453
|
+
branches: [main]
|
|
454
|
+
|
|
455
|
+
concurrency:
|
|
456
|
+
group: deploy-${{ github.ref }}
|
|
457
|
+
cancel-in-progress: false
|
|
458
|
+
|
|
459
|
+
jobs:
|
|
460
|
+
deploy:
|
|
461
|
+
runs-on: ubuntu-latest
|
|
462
|
+
steps:
|
|
463
|
+
- uses: actions/checkout@v4
|
|
464
|
+
|
|
465
|
+
- name: Configure SSH Key
|
|
466
|
+
uses: webfactory/ssh-agent@v0.9.0
|
|
467
|
+
with:
|
|
468
|
+
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
|
|
469
|
+
|
|
470
|
+
- name: Deploy with EPD
|
|
471
|
+
run: npx @fabioplunser/epd deploy
|
|
472
|
+
env:
|
|
473
|
+
# Optional DNS and Cloud Provider Tokens
|
|
474
|
+
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
|
475
|
+
HETZNER_API_TOKEN: ${{ secrets.HETZNER_API_TOKEN }}
|
|
476
|
+
HETZNER_DNS_API_TOKEN: ${{ secrets.HETZNER_DNS_API_TOKEN }}
|
|
477
|
+
# App secrets referenced in epd.yml
|
|
478
|
+
DATABASE_URL: ${{ secrets.DATABASE_URL }}
|
|
479
|
+
```
|
|
480
|
+
|
|
481
|
+
Generate this workflow file automatically when creating your project:
|
|
482
|
+
```bash
|
|
483
|
+
epd init --ci
|
|
484
|
+
```
|
|
485
|
+
|
|
486
|
+
For detailed guides on setting up SSH deploy keys, using GitHub Container Registry (`ghcr.io`), or multi-environment deployments, see the [GitHub Actions CI/CD Guide](https://fabioplunser.github.io/epd/ci-cd).
|
|
487
|
+
|
|
488
|
+
---
|
|
489
|
+
|
|
442
490
|
## Commands
|
|
443
491
|
|
|
444
492
|
| Command | What it does |
|
|
@@ -458,6 +506,7 @@ they need Docker on their host.
|
|
|
458
506
|
| `epd lock status\|release` | The deploy lock |
|
|
459
507
|
| `epd dns [sync\|status]` | Unified DNS automation (Cloudflare & Hetzner DNS) |
|
|
460
508
|
| `epd hetzner list\|create\|delete` | Manage and provision Hetzner Cloud servers |
|
|
509
|
+
| `epd update [--check]` | Check for updates and upgrade epd to the latest version |
|
|
461
510
|
| `epd cloudflare dns [sync\|status]` | Cloudflare DNS record management (alias for `epd dns`) |
|
|
462
511
|
| `epd remove` | Stop this app and delete its files from the servers |
|
|
463
512
|
|
package/dist/cli.js
CHANGED
|
@@ -849,7 +849,7 @@ function validateCrossReferences(cfg) {
|
|
|
849
849
|
}
|
|
850
850
|
|
|
851
851
|
// src/commands/init.ts
|
|
852
|
-
import { existsSync as existsSync2, readFileSync as readFileSync2, writeFileSync } from "fs";
|
|
852
|
+
import { existsSync as existsSync2, mkdirSync, readFileSync as readFileSync2, writeFileSync } from "fs";
|
|
853
853
|
import { basename, join as join2 } from "path";
|
|
854
854
|
|
|
855
855
|
// src/util/prompt.ts
|
|
@@ -1087,7 +1087,8 @@ var init = {
|
|
|
1087
1087
|
email: { type: "string" },
|
|
1088
1088
|
replicas: { type: "string" },
|
|
1089
1089
|
force: { type: "boolean" },
|
|
1090
|
-
dockerfile: { type: "boolean" }
|
|
1090
|
+
dockerfile: { type: "boolean" },
|
|
1091
|
+
ci: { type: "boolean" }
|
|
1091
1092
|
},
|
|
1092
1093
|
help: () => `${c.bold("epd init")} \u2014 create an epd.yml for this project
|
|
1093
1094
|
|
|
@@ -1100,6 +1101,7 @@ Options
|
|
|
1100
1101
|
--email <email> Contact address for Let's Encrypt
|
|
1101
1102
|
--replicas <n> Replicas per host (default 1)
|
|
1102
1103
|
--dockerfile Also write a starter Dockerfile
|
|
1104
|
+
--ci Also generate a GitHub Actions deploy workflow (.github/workflows/deploy.yml)
|
|
1103
1105
|
--force Overwrite an existing epd.yml`,
|
|
1104
1106
|
async run(ctx) {
|
|
1105
1107
|
const root = process.cwd();
|
|
@@ -1141,6 +1143,42 @@ Options
|
|
|
1141
1143
|
log.warn(`no Dockerfile template for ${detected.runtime}; write one yourself or use \`mode: process\``);
|
|
1142
1144
|
}
|
|
1143
1145
|
}
|
|
1146
|
+
const wantCi = Boolean(ctx.values.ci) || interactive() && await confirm("Generate GitHub Actions deploy workflow (.github/workflows/deploy.yml)?", false);
|
|
1147
|
+
if (wantCi) {
|
|
1148
|
+
const workflowDir = join2(root, ".github", "workflows");
|
|
1149
|
+
mkdirSync(workflowDir, { recursive: true });
|
|
1150
|
+
const ciYaml = `name: Deploy
|
|
1151
|
+
|
|
1152
|
+
on:
|
|
1153
|
+
push:
|
|
1154
|
+
branches: [main]
|
|
1155
|
+
|
|
1156
|
+
concurrency:
|
|
1157
|
+
group: deploy-\${{ github.ref }}
|
|
1158
|
+
cancel-in-progress: false
|
|
1159
|
+
|
|
1160
|
+
jobs:
|
|
1161
|
+
deploy:
|
|
1162
|
+
runs-on: ubuntu-latest
|
|
1163
|
+
steps:
|
|
1164
|
+
- name: Checkout code
|
|
1165
|
+
uses: actions/checkout@v4
|
|
1166
|
+
|
|
1167
|
+
- name: Setup SSH Agent
|
|
1168
|
+
uses: webfactory/ssh-agent@v0.9.0
|
|
1169
|
+
with:
|
|
1170
|
+
ssh-private-key: \${{ secrets.SSH_PRIVATE_KEY }}
|
|
1171
|
+
|
|
1172
|
+
- name: Deploy with EPD
|
|
1173
|
+
run: npx @fabioplunser/epd deploy
|
|
1174
|
+
env:
|
|
1175
|
+
CLOUDFLARE_API_TOKEN: \${{ secrets.CLOUDFLARE_API_TOKEN }}
|
|
1176
|
+
HETZNER_API_TOKEN: \${{ secrets.HETZNER_API_TOKEN }}
|
|
1177
|
+
HETZNER_DNS_API_TOKEN: \${{ secrets.HETZNER_DNS_API_TOKEN }}
|
|
1178
|
+
`;
|
|
1179
|
+
writeFileSync(join2(workflowDir, "deploy.yml"), ciYaml);
|
|
1180
|
+
log.ok(`wrote ${c.bold(".github/workflows/deploy.yml")}`);
|
|
1181
|
+
}
|
|
1144
1182
|
console.log(`
|
|
1145
1183
|
${c.bold("Next")}
|
|
1146
1184
|
1. Edit ${c.cyan("epd.yml")} \u2014 servers, domains, env.
|
|
@@ -1423,11 +1461,11 @@ true`, { allowFailure: true, stream: true, label: `${host.name}: install package
|
|
|
1423
1461
|
}
|
|
1424
1462
|
|
|
1425
1463
|
// src/core/ssh.ts
|
|
1426
|
-
import { mkdirSync } from "fs";
|
|
1464
|
+
import { mkdirSync as mkdirSync2 } from "fs";
|
|
1427
1465
|
import { tmpdir } from "os";
|
|
1428
1466
|
import { join as join3 } from "path";
|
|
1429
1467
|
var controlDir = join3(tmpdir(), `epd-${process.getuid?.() ?? 0}`);
|
|
1430
|
-
|
|
1468
|
+
mkdirSync2(controlDir, { recursive: true, mode: 448 });
|
|
1431
1469
|
|
|
1432
1470
|
class Host {
|
|
1433
1471
|
name;
|
|
@@ -5077,6 +5115,209 @@ ${c.bold("HETZNER DATACENTER LOCATIONS")}
|
|
|
5077
5115
|
}
|
|
5078
5116
|
};
|
|
5079
5117
|
|
|
5118
|
+
// src/core/update.ts
|
|
5119
|
+
import { chmodSync, existsSync as existsSync5, mkdirSync as mkdirSync3, readFileSync as readFileSync3, renameSync, writeFileSync as writeFileSync2 } from "fs";
|
|
5120
|
+
import { homedir as homedir2 } from "os";
|
|
5121
|
+
import { dirname as dirname2, join as join6 } from "path";
|
|
5122
|
+
function parseSemver(v) {
|
|
5123
|
+
const clean = v.replace(/^v/, "").trim();
|
|
5124
|
+
const parts = clean.split("-")[0].split(".").map((n) => Number(n) || 0);
|
|
5125
|
+
return [parts[0] || 0, parts[1] || 0, parts[2] || 0];
|
|
5126
|
+
}
|
|
5127
|
+
function isNewer(current, latest) {
|
|
5128
|
+
const [cMaj, cMin, cPatch] = parseSemver(current);
|
|
5129
|
+
const [lMaj, lMin, lPatch] = parseSemver(latest);
|
|
5130
|
+
if (lMaj > cMaj)
|
|
5131
|
+
return true;
|
|
5132
|
+
if (lMaj < cMaj)
|
|
5133
|
+
return false;
|
|
5134
|
+
if (lMin > cMin)
|
|
5135
|
+
return true;
|
|
5136
|
+
if (lMin < cMin)
|
|
5137
|
+
return false;
|
|
5138
|
+
return lPatch > cPatch;
|
|
5139
|
+
}
|
|
5140
|
+
function getCachePath() {
|
|
5141
|
+
return join6(homedir2(), ".epd", "update-check.json");
|
|
5142
|
+
}
|
|
5143
|
+
function readCache() {
|
|
5144
|
+
try {
|
|
5145
|
+
const p = getCachePath();
|
|
5146
|
+
if (existsSync5(p)) {
|
|
5147
|
+
return JSON.parse(readFileSync3(p, "utf8"));
|
|
5148
|
+
}
|
|
5149
|
+
} catch {}
|
|
5150
|
+
return null;
|
|
5151
|
+
}
|
|
5152
|
+
function writeCache(latestVersion) {
|
|
5153
|
+
try {
|
|
5154
|
+
const p = getCachePath();
|
|
5155
|
+
mkdirSync3(dirname2(p), { recursive: true });
|
|
5156
|
+
const data = { lastChecked: Date.now(), latestVersion };
|
|
5157
|
+
writeFileSync2(p, JSON.stringify(data));
|
|
5158
|
+
} catch {}
|
|
5159
|
+
}
|
|
5160
|
+
async function fetchLatestNpmVersion() {
|
|
5161
|
+
try {
|
|
5162
|
+
const res = await fetch("https://registry.npmjs.org/@fabioplunser/epd/latest", {
|
|
5163
|
+
headers: { Accept: "application/json" },
|
|
5164
|
+
signal: AbortSignal.timeout(2500)
|
|
5165
|
+
});
|
|
5166
|
+
if (!res.ok)
|
|
5167
|
+
return null;
|
|
5168
|
+
const data = await res.json();
|
|
5169
|
+
return typeof data?.version === "string" ? data.version : null;
|
|
5170
|
+
} catch {
|
|
5171
|
+
return null;
|
|
5172
|
+
}
|
|
5173
|
+
}
|
|
5174
|
+
async function checkForUpdate(currentVersion, options = {}) {
|
|
5175
|
+
const cache = readCache();
|
|
5176
|
+
const cacheTtlMs = 4 * 60 * 60 * 1000;
|
|
5177
|
+
if (!options.force && cache && Date.now() - cache.lastChecked < cacheTtlMs) {
|
|
5178
|
+
const hasUpdate = isNewer(currentVersion, cache.latestVersion);
|
|
5179
|
+
return { hasUpdate, latestVersion: cache.latestVersion };
|
|
5180
|
+
}
|
|
5181
|
+
const remote = await fetchLatestNpmVersion();
|
|
5182
|
+
if (remote) {
|
|
5183
|
+
writeCache(remote);
|
|
5184
|
+
return {
|
|
5185
|
+
hasUpdate: isNewer(currentVersion, remote),
|
|
5186
|
+
latestVersion: remote
|
|
5187
|
+
};
|
|
5188
|
+
}
|
|
5189
|
+
if (cache) {
|
|
5190
|
+
return {
|
|
5191
|
+
hasUpdate: isNewer(currentVersion, cache.latestVersion),
|
|
5192
|
+
latestVersion: cache.latestVersion
|
|
5193
|
+
};
|
|
5194
|
+
}
|
|
5195
|
+
return { hasUpdate: false, latestVersion: currentVersion };
|
|
5196
|
+
}
|
|
5197
|
+
async function performUpdate(targetVersion) {
|
|
5198
|
+
const isBun = typeof process.isBun !== "undefined";
|
|
5199
|
+
const execPath = process.execPath || "";
|
|
5200
|
+
const isCompiledBinary = isBun && !execPath.endsWith("bun");
|
|
5201
|
+
if (isCompiledBinary) {
|
|
5202
|
+
try {
|
|
5203
|
+
const platform = process.platform;
|
|
5204
|
+
const arch = process.arch;
|
|
5205
|
+
let binaryName = "";
|
|
5206
|
+
if (platform === "linux" && arch === "x64")
|
|
5207
|
+
binaryName = "epd-linux-x64";
|
|
5208
|
+
else if (platform === "linux" && arch === "arm64")
|
|
5209
|
+
binaryName = "epd-linux-arm64";
|
|
5210
|
+
else if (platform === "darwin" && arch === "x64")
|
|
5211
|
+
binaryName = "epd-darwin-x64";
|
|
5212
|
+
else if (platform === "darwin" && arch === "arm64")
|
|
5213
|
+
binaryName = "epd-darwin-arm64";
|
|
5214
|
+
else if (platform === "win32" && arch === "x64")
|
|
5215
|
+
binaryName = "epd-windows-x64.exe";
|
|
5216
|
+
if (binaryName) {
|
|
5217
|
+
log.step(`Downloading ${binaryName} from GitHub Releases...`);
|
|
5218
|
+
const url = `https://github.com/FabioPlunser/epd/releases/latest/download/${binaryName}`;
|
|
5219
|
+
const res = await fetch(url);
|
|
5220
|
+
if (!res.ok)
|
|
5221
|
+
throw new Error(`HTTP ${res.status} ${res.statusText}`);
|
|
5222
|
+
const buf = await res.arrayBuffer();
|
|
5223
|
+
const tmpPath = `${execPath}.tmp.${Date.now()}`;
|
|
5224
|
+
writeFileSync2(tmpPath, Buffer.from(buf));
|
|
5225
|
+
chmodSync(tmpPath, 493);
|
|
5226
|
+
renameSync(tmpPath, execPath);
|
|
5227
|
+
return true;
|
|
5228
|
+
}
|
|
5229
|
+
} catch (e) {
|
|
5230
|
+
log.debug(`Binary self-update failed, falling back to package manager: ${e}`);
|
|
5231
|
+
}
|
|
5232
|
+
}
|
|
5233
|
+
const isBunGlobal = (process.argv[1] || "").includes(".bun");
|
|
5234
|
+
const pkgMgr = isBunGlobal ? "bun" : "npm";
|
|
5235
|
+
const pkgSpec = targetVersion ? `@fabioplunser/epd@${targetVersion}` : "@fabioplunser/epd@latest";
|
|
5236
|
+
try {
|
|
5237
|
+
log.step(`Updating via ${pkgMgr}...`);
|
|
5238
|
+
const res = await runShell(`${pkgMgr} install -g ${pkgSpec}`, { stream: true, allowFailure: true });
|
|
5239
|
+
return res.code === 0;
|
|
5240
|
+
} catch {
|
|
5241
|
+
const fallback = pkgMgr === "bun" ? "npm" : "bun";
|
|
5242
|
+
try {
|
|
5243
|
+
log.step(`Trying ${fallback}...`);
|
|
5244
|
+
const res = await runShell(`${fallback} install -g ${pkgSpec}`, { stream: true, allowFailure: true });
|
|
5245
|
+
return res.code === 0;
|
|
5246
|
+
} catch {
|
|
5247
|
+
return false;
|
|
5248
|
+
}
|
|
5249
|
+
}
|
|
5250
|
+
}
|
|
5251
|
+
async function promptAutoUpdate(currentVersion) {
|
|
5252
|
+
if (!interactive() || process.env.CI || process.env.EPD_NO_UPDATE_CHECK === "1" || process.env.EPD_NO_UPDATE_CHECK === "true") {
|
|
5253
|
+
return false;
|
|
5254
|
+
}
|
|
5255
|
+
const { hasUpdate, latestVersion } = await checkForUpdate(currentVersion);
|
|
5256
|
+
if (!hasUpdate)
|
|
5257
|
+
return false;
|
|
5258
|
+
console.log("");
|
|
5259
|
+
log.info(`A new version of ${c.bold("epd")} is available: ${c.yellow(currentVersion)} \u2192 ${c.green(c.bold(latestVersion))}`);
|
|
5260
|
+
const shouldUpdate = await confirm("Would you like to update now?", false);
|
|
5261
|
+
if (!shouldUpdate) {
|
|
5262
|
+
console.log("");
|
|
5263
|
+
return false;
|
|
5264
|
+
}
|
|
5265
|
+
log.step(`Updating epd to v${latestVersion}...`);
|
|
5266
|
+
const success = await performUpdate(latestVersion);
|
|
5267
|
+
if (success) {
|
|
5268
|
+
log.ok(`Successfully updated epd to ${c.bold(`v${latestVersion}`)}!`);
|
|
5269
|
+
console.log("");
|
|
5270
|
+
return true;
|
|
5271
|
+
} else {
|
|
5272
|
+
log.warn(`Auto-update failed. You can update manually with:
|
|
5273
|
+
${c.cyan(`npm install -g @fabioplunser/epd@latest`)}
|
|
5274
|
+
`);
|
|
5275
|
+
return false;
|
|
5276
|
+
}
|
|
5277
|
+
}
|
|
5278
|
+
|
|
5279
|
+
// src/version.ts
|
|
5280
|
+
var VERSION = "0.3.1";
|
|
5281
|
+
|
|
5282
|
+
// src/commands/update.ts
|
|
5283
|
+
var update = {
|
|
5284
|
+
name: "update",
|
|
5285
|
+
aliases: ["upgrade"],
|
|
5286
|
+
summary: "Check for updates and upgrade epd to the latest version",
|
|
5287
|
+
options: {
|
|
5288
|
+
check: { type: "boolean" },
|
|
5289
|
+
yes: { type: "boolean", short: "y" }
|
|
5290
|
+
},
|
|
5291
|
+
help: () => `${c.bold("epd update")} \u2014 update epd to the latest release
|
|
5292
|
+
|
|
5293
|
+
Options
|
|
5294
|
+
--check Check for updates without installing
|
|
5295
|
+
-y, --yes Install update without prompting`,
|
|
5296
|
+
async run(ctx) {
|
|
5297
|
+
const currentVersion = VERSION;
|
|
5298
|
+
log.step(`Checking for epd updates (current: v${currentVersion})...`);
|
|
5299
|
+
const { hasUpdate, latestVersion } = await checkForUpdate(currentVersion, { force: true });
|
|
5300
|
+
if (!hasUpdate) {
|
|
5301
|
+
log.ok(`epd is up to date (${c.green(`v${currentVersion}`)}).`);
|
|
5302
|
+
return;
|
|
5303
|
+
}
|
|
5304
|
+
log.info(`A newer version is available: ${c.yellow(`v${currentVersion}`)} \u2192 ${c.green(c.bold(`v${latestVersion}`))}`);
|
|
5305
|
+
if (ctx.values.check) {
|
|
5306
|
+
log.info(`Run ${c.cyan("epd update")} to upgrade.`);
|
|
5307
|
+
return;
|
|
5308
|
+
}
|
|
5309
|
+
log.step(`Upgrading epd to v${latestVersion}...`);
|
|
5310
|
+
const success = await performUpdate(latestVersion);
|
|
5311
|
+
if (success) {
|
|
5312
|
+
log.ok(`epd updated successfully to ${c.bold(`v${latestVersion}`)}!`);
|
|
5313
|
+
} else {
|
|
5314
|
+
log.error(`Update failed. You can update manually with:`);
|
|
5315
|
+
console.log(` ${c.cyan("npm install -g @fabioplunser/epd@latest")}
|
|
5316
|
+
`);
|
|
5317
|
+
}
|
|
5318
|
+
}
|
|
5319
|
+
};
|
|
5320
|
+
|
|
5080
5321
|
// src/commands/index.ts
|
|
5081
5322
|
var commands = [
|
|
5082
5323
|
init,
|
|
@@ -5095,11 +5336,11 @@ var commands = [
|
|
|
5095
5336
|
dockerCommand,
|
|
5096
5337
|
cloudflare,
|
|
5097
5338
|
dns3,
|
|
5098
|
-
hetzner
|
|
5339
|
+
hetzner,
|
|
5340
|
+
update
|
|
5099
5341
|
];
|
|
5100
5342
|
|
|
5101
5343
|
// src/cli.ts
|
|
5102
|
-
var VERSION = "0.3.0";
|
|
5103
5344
|
var USAGE = `${c.bold("epd")} \u2014 Easy Project Deployer ${c.gray(`v${VERSION}`)}
|
|
5104
5345
|
|
|
5105
5346
|
${c.bold("Usage")}
|
|
@@ -5179,6 +5420,9 @@ ${command.help()}`);
|
|
|
5179
5420
|
loadOptions,
|
|
5180
5421
|
load: () => loadConfig(loadOptions)
|
|
5181
5422
|
};
|
|
5423
|
+
if (command.name !== "update") {
|
|
5424
|
+
await promptAutoUpdate(VERSION);
|
|
5425
|
+
}
|
|
5182
5426
|
await command.run(ctx);
|
|
5183
5427
|
return 0;
|
|
5184
5428
|
}
|
|
@@ -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`.
|
|
@@ -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.3.
|
|
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
|
}
|