@fabioplunser/epd 0.5.12 → 0.5.14

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,344 @@
1
+ # EPD (Easy Project Deployer) — Full LLM & AI Agent Context Reference
2
+ Version: 0.5.12
3
+ Website: https://epd.peppi.dev
4
+ Repository: https://github.com/FabioPlunser/epd
5
+
6
+ ---
7
+
8
+ ## 1. Overview & Core Architecture
9
+
10
+ EPD is an agentless, zero-dependency deployment CLI that turns any clean Linux VPS (Ubuntu, Debian) into a production-ready PaaS in 60 seconds over SSH.
11
+
12
+ ### Architecture Highlights:
13
+ - **Agentless over SSH**: No persistent background agent or daemon on the remote server. EPD orchestrates everything via standard SSH commands and Docker Engine API.
14
+ - **Zero-Downtime Blue/Green**: Uses two alternating container slots (`blue` and `green`). EPD builds/starts the new slot, runs pre-flight health probes, hot-swaps Traefik routing dynamically, and shuts down the old slot only when the new container is verified 200 OK.
15
+ - **Fronted by Traefik**: A single lightweight Traefik container manages Let's Encrypt TLS certificates (HTTP-01 / TLS-ALPN-01 / DNS-01) and routes requests to running application slots using dynamic file providers (`/etc/traefik/dynamic/`).
16
+ - **Security by Default**: Auto-provisions CrowdSec IPS/IDS with Traefik bouncers to automatically block malicious scans, brute-force attacks, and DDoS patterns.
17
+ - **Accessories**: Automated containerized databases (PostgreSQL, MySQL, Redis, MinIO) with automated backups to local disk or S3/Wasabi/R2.
18
+
19
+ ---
20
+
21
+ ## 2. Installation Methods
22
+
23
+ ```bash
24
+ # Method 1: Zero-Dependency Standalone Binary (Recommended for CI and AI Agents)
25
+ curl -fsSL https://epd.peppi.dev/install.sh | bash
26
+
27
+ # Method 2: Global Install with Bun
28
+ bun add -g @fabioplunser/epd
29
+
30
+ # Method 3: Global Install with NPM / PNPM
31
+ npm install -g @fabioplunser/epd
32
+ pnpm add -g @fabioplunser/epd
33
+ ```
34
+
35
+ Verify installation:
36
+ ```bash
37
+ epd --version
38
+ ```
39
+
40
+ ---
41
+
42
+ ## 3. CLI Command Reference for AI Agents
43
+
44
+ All commands are non-interactive friendly when provided with flags.
45
+
46
+ ### Core Lifecycle Commands
47
+
48
+ #### `epd init`
49
+ Initializes `epd.yml` in the current project repository.
50
+ - Options:
51
+ - `--name <name>`: Override project name (defaults to folder name or `package.json`).
52
+ - `--mode <docker|process>`: Runtime deployment mode (default: `docker`).
53
+ - `--host <ip>`: Server host IPv4/IPv6 address.
54
+ - `--domain <domain>`: Public domain (e.g. `api.example.com`).
55
+ - `--port <port>`: Internal container port the app listens on (default: `3000`).
56
+ - `--dockerfile`: Automatically generate an optimized multi-stage `Dockerfile`.
57
+ - `--ci`: Automatically generate `.github/workflows/deploy.yml`.
58
+ - Example for AI Agent:
59
+ ```bash
60
+ epd init --name my-app --host 159.69.120.45 --domain app.example.com --port 3000 --dockerfile
61
+ ```
62
+
63
+ #### `epd setup`
64
+ Bootstraps a fresh, clean Linux VPS (Ubuntu 22.04/24.04, Debian 11/12).
65
+ - What it does:
66
+ 1. Installs Docker Engine, Docker Compose plugin, and Git if missing.
67
+ 2. Creates dedicated deploy user or sets up authorized SSH keys.
68
+ 3. Deploys shared Traefik proxy with automated Let's Encrypt SSL.
69
+ 4. Deploys CrowdSec IPS/IDS security engine and registers Traefik bouncer.
70
+ 5. Deploys any configured accessories (Postgres, Redis).
71
+ 6. Executes initial zero-downtime application deployment.
72
+ - Options:
73
+ - `--host <ip>`: Target host IP (overrides `epd.yml`).
74
+ - `--user <user>`: SSH user (default: `root`).
75
+ - Example:
76
+ ```bash
77
+ epd setup --host 159.69.120.45
78
+ ```
79
+
80
+ #### `epd deploy`
81
+ Performs a zero-downtime blue/green deployment.
82
+ - Process:
83
+ 1. Acquires atomic deployment lock on remote server.
84
+ 2. Determines inactive slot (e.g., if `green` is live, deploy to `blue`).
85
+ 3. Builds container image on remote server or pulls from registry.
86
+ 4. Starts new container on private internal port.
87
+ 5. Runs HTTP health check probe on `healthCheckPath` (e.g. `http://127.0.0.1:<slot-port>/health`) until 200 OK.
88
+ 6. Atomically updates Traefik routing configuration to point domain to new slot.
89
+ 7. Gracefully stops and cleans up old container slot after configurable drain period.
90
+ 8. Releases deployment lock.
91
+ - Options:
92
+ - `-d, --dest <destination>`: Target server alias from `epd.yml`.
93
+ - `--dry-run`: Simulate build and configuration generation without executing on server.
94
+ - Example:
95
+ ```bash
96
+ epd deploy
97
+ ```
98
+
99
+ #### `epd rollback`
100
+ Instantly reverts traffic to the previous slot or version without rebuilding.
101
+ - Options:
102
+ - `[version]`: Optional specific semver or slot to revert to.
103
+ - Example:
104
+ ```bash
105
+ epd rollback
106
+ ```
107
+
108
+ #### `epd redeploy`
109
+ Restarts currently active slot without re-uploading code or rebuilding.
110
+ - Example:
111
+ ```bash
112
+ epd redeploy
113
+ ```
114
+
115
+ #### `epd remove`
116
+ Stops the application, removes Traefik routes, and deletes associated container volumes.
117
+ - Options:
118
+ - `-y, --yes`: Skip interactive confirmation prompt.
119
+ - Example:
120
+ ```bash
121
+ epd remove -y
122
+ ```
123
+
124
+ ---
125
+
126
+ ### Observability & Health Commands
127
+
128
+ #### `epd status`
129
+ Shows running slots, replicas, active slot indicator, accessory statuses, and memory usage.
130
+ - Options:
131
+ - `--json`: Outputs machine-readable JSON structure. Perfect for AI agents to parse and verify deployment state!
132
+ - Example:
133
+ ```bash
134
+ epd status --json
135
+ ```
136
+
137
+ #### `epd doctor`
138
+ Runs comprehensive pre-flight diagnostics across local tooling, `epd.yml`, SSH connectivity, Docker engine, port availability, and DNS resolution.
139
+ - Options:
140
+ - `-l, --local`: Skip SSH connectivity test and validate only local files and configurations.
141
+ - Example:
142
+ ```bash
143
+ epd doctor --local
144
+ epd doctor
145
+ ```
146
+
147
+ #### `epd logs`
148
+ Streams real-time container logs.
149
+ - Options:
150
+ - `-f, --follow`: Follow log output.
151
+ - `-n, --tail <lines>`: Number of lines to show (default: 100).
152
+ - `--slot <blue|green>`: View specific slot logs.
153
+ - `--accessory <name>`: View logs of an accessory (e.g. `postgres`, `redis`).
154
+ - Example:
155
+ ```bash
156
+ epd logs -n 50
157
+ ```
158
+
159
+ #### `epd top`
160
+ Displays real-time CPU, RAM, and network metrics across remote servers.
161
+ - Options:
162
+ - `--once`: Output single snapshot and exit (ideal for automated scripting).
163
+ - Example:
164
+ ```bash
165
+ epd top --once
166
+ ```
167
+
168
+ #### `epd ssl`
169
+ Inspects Let's Encrypt certificate status, issuer, and expiration date.
170
+ - Example:
171
+ ```bash
172
+ epd ssl
173
+ ```
174
+
175
+ ---
176
+
177
+ ### Remote Execution & Maintenance Commands
178
+
179
+ #### `epd exec`
180
+ Executes an arbitrary command inside the live application container.
181
+ - Example:
182
+ ```bash
183
+ epd exec -- bun run migrate
184
+ epd exec -- npx prisma migrate deploy
185
+ ```
186
+
187
+ #### `epd maintenance`
188
+ Instantly toggles zero-downtime maintenance mode (HTTP 503 with custom HTML maintenance screen via Traefik middleware).
189
+ - Example:
190
+ ```bash
191
+ epd maintenance on
192
+ epd maintenance off
193
+ ```
194
+
195
+ #### `epd backup`
196
+ Creates compressed database snapshot archives.
197
+ - Example:
198
+ ```bash
199
+ epd backup postgres
200
+ ```
201
+
202
+ #### `epd restore`
203
+ Restores a snapshot archive into a live accessory.
204
+ - Example:
205
+ ```bash
206
+ epd restore backups/postgres-2026-09-10.dump.zst
207
+ ```
208
+
209
+ ---
210
+
211
+ ## 4. `epd.yml` Configuration Specification
212
+
213
+ Here is a full, production-ready `epd.yml` template:
214
+
215
+ ```yaml
216
+ version: "1"
217
+ name: my-app
218
+ mode: docker
219
+
220
+ # Remote target servers
221
+ servers:
222
+ production:
223
+ host: 159.69.120.45
224
+ user: root
225
+ sshKey: ~/.ssh/id_ed25519
226
+ port: 22
227
+
228
+ # Routing & SSL
229
+ routing:
230
+ domain: app.example.com
231
+ ssl: true
232
+ acmeEmail: admin@example.com
233
+ redirectWww: true
234
+ traefik:
235
+ enabled: true
236
+ dashboard: false
237
+
238
+ # Container Runtime Specification
239
+ docker:
240
+ dockerfile: Dockerfile
241
+ port: 3000
242
+ replicas: 2
243
+ healthCheck:
244
+ path: /health
245
+ interval: 5s
246
+ timeout: 3s
247
+ retries: 5
248
+ startPeriod: 10s
249
+ drainSeconds: 15
250
+ stopTimeout: 10s
251
+ restart: unless-stopped
252
+ resources:
253
+ memory: 1024m
254
+ cpus: "1.5"
255
+
256
+ # Environment Variables & Secrets
257
+ env:
258
+ NODE_ENV: production
259
+ PORT: 3000
260
+ # Secrets are loaded securely from .env or server environment
261
+ secrets:
262
+ - DATABASE_URL
263
+ - API_SECRET_KEY
264
+
265
+ # Optional Accessories (Databases, Redis, etc.)
266
+ accessories:
267
+ postgres:
268
+ image: postgres:16-alpine
269
+ port: 5432
270
+ env:
271
+ POSTGRES_DB: myapp_prod
272
+ POSTGRES_USER: myapp
273
+ secrets:
274
+ - POSTGRES_PASSWORD
275
+ volumes:
276
+ - /var/lib/epd/accessories/postgres:/var/lib/postgresql/data
277
+ backup:
278
+ schedule: "0 3 * * *"
279
+ retentionDays: 14
280
+
281
+ # Automated Security Engine
282
+ security:
283
+ crowdsec:
284
+ enabled: true
285
+ remediation: ban
286
+ scenarios:
287
+ - http-crawl-non_statics
288
+ - ssh-bf
289
+ - http-probing
290
+ ```
291
+
292
+ ---
293
+
294
+ ## 5. Autonomous AI Agent Deployment Playbook
295
+
296
+ When an AI coding assistant (Cursor, Windsurf, Claude Code, Cline, T3 Code) is asked to deploy a project with EPD, it should follow this 5-step loop:
297
+
298
+ ### Step 1: Inspect Repository & Generate Dockerfile
299
+ Ensure the repo has an entrypoint and an internal HTTP port (e.g. 3000). If no `Dockerfile` exists:
300
+ ```bash
301
+ epd init --name <app-name> --host <server-ip> --domain <domain> --port 3000 --dockerfile
302
+ ```
303
+
304
+ ### Step 2: Local Pre-flight Verification
305
+ Run local linting and configuration validation without attempting remote SSH connections:
306
+ ```bash
307
+ epd doctor --local
308
+ epd config
309
+ ```
310
+
311
+ ### Step 3: Server Bootstrap (Clean VPS)
312
+ If the server has not been initialized yet:
313
+ ```bash
314
+ epd setup --host <server-ip>
315
+ ```
316
+
317
+ ### Step 4: Execute Zero-Downtime Deploy
318
+ Deploy application:
319
+ ```bash
320
+ epd deploy
321
+ ```
322
+
323
+ ### Step 5: Verify Deployment via JSON Status
324
+ Confirm that the new slot is active, healthy, and traffic is routed:
325
+ ```bash
326
+ epd status --json
327
+ ```
328
+ If the status shows errors, inspect logs:
329
+ ```bash
330
+ epd logs -n 50
331
+ ```
332
+ If fatal, perform instant rollback:
333
+ ```bash
334
+ epd rollback
335
+ ```
336
+
337
+ ---
338
+
339
+ ## 6. Exit Codes & Predictability
340
+ - `0`: Command succeeded.
341
+ - `1`: Pre-flight check failed (e.g., config syntax, missing secret, or Dockerfile not found).
342
+ - `2`: Network or SSH connectivity error.
343
+ - `3`: Health check probe timed out / returned non-200. Slot rollbacked automatically.
344
+ - `4`: Locked by another running deployment (`epd lock status`).
@@ -0,0 +1,43 @@
1
+ # EPD (Easy Project Deployer) — Documentation for LLMs & AI Agents
2
+
3
+ > Zero-downtime blue/green deployments over SSH for one server or ten. Docker, PM2, Traefik, Let's Encrypt, CrowdSec.
4
+
5
+ EPD is an agentless, zero-dependency deployment CLI designed for developers and autonomous AI agents (Cursor, Windsurf, Claude Code, Cline, Roo, Antigravity, T3 Code). Instead of requiring heavy server-side agents or fragile MCP bridges, EPD is controlled directly via CLI commands or curl.
6
+
7
+ ## Fast AI Agent Context
8
+ - [Full LLM Context Document](https://epd.peppi.dev/llms-full.txt): Complete, consolidated single-file markdown reference covering all CLI commands, schema, and flags.
9
+ - [AI Agents Integration Guide](https://epd.peppi.dev/agents): Rules, prompts, and best practices for AI agents automating deployments.
10
+
11
+ ## CLI & Core Documentation
12
+ - [CLI Reference](https://epd.peppi.dev/reference/cli): Complete manual for all commands (`epd setup`, `epd deploy`, `epd rollback`, `epd doctor`, `epd status`, etc.)
13
+ - [epd.yml Configuration Specification](https://epd.peppi.dev/reference/config): Full schema reference for `epd.yml`
14
+ - [Quickstart Guide](https://epd.peppi.dev/guide/getting-started): 5-minute setup walkthrough
15
+ - [Architecture & Blue/Green Routing](https://epd.peppi.dev/guide/blue-green): How zero-downtime slot switching works with Traefik
16
+ - [Accessories (Databases & Redis)](https://epd.peppi.dev/guide/accessories): Managing Postgres, MySQL, Redis, and MinIO with automated backups
17
+ - [Secrets & Environment Management](https://epd.peppi.dev/guide/secrets): Secure environment variables and `.env` handling
18
+ - [CI/CD with GitHub Actions](https://epd.peppi.dev/ci-cd): Setting up automated zero-downtime pipelines in GitHub Actions
19
+ - [Troubleshooting & Diagnostics](https://epd.peppi.dev/guide/troubleshooting): Resolving failed healthchecks, port conflicts, and SSL issues
20
+
21
+ ## Agent Quick Commands
22
+ ```bash
23
+ # Install EPD (Zero dependencies, standalone binary)
24
+ curl -fsSL https://epd.peppi.dev/install.sh | bash
25
+
26
+ # Non-interactive project initialization
27
+ epd init --name my-app --host 159.69.120.45 --domain app.example.com --port 3000 --dockerfile
28
+
29
+ # Validate config & local setup without SSH
30
+ epd doctor --local
31
+
32
+ # Server bootstrap & Traefik/Docker installation
33
+ epd setup --host 159.69.120.45
34
+
35
+ # Zero-downtime deployment
36
+ epd deploy
37
+
38
+ # Inspect live cluster status in JSON (for agent parsing)
39
+ epd status --json
40
+
41
+ # Instant rollback to previous slot
42
+ epd rollback
43
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fabioplunser/epd",
3
- "version": "0.5.12",
3
+ "version": "0.5.14",
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",