@kithinji/pod 1.0.22 → 1.0.23

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 CHANGED
@@ -15,6 +15,12 @@
15
15
  </a>
16
16
  </p>
17
17
 
18
+ <p align="center">
19
+ <a href="https://github.com/kithinjibrian/orca">
20
+ <img src="https://img.shields.io/badge/Orca framework-blue" alt="Orca on github" />
21
+ </a>
22
+ </p>
23
+
18
24
  <hr>
19
25
 
20
26
  ## What is Pod?
@@ -227,100 +233,108 @@ pod deploy ec2 --force-install
227
233
  name: my-app
228
234
  version: 1.0.0
229
235
 
236
+ vars:
237
+ deploy_path: &deploy_path "/home/ubuntu/app"
238
+ backup_path: &backup_path "/home/ubuntu/backups"
239
+
240
+ shared_operations:
241
+ install_docker: &install_docker
242
+ type: ensure
243
+ ensure:
244
+ docker:
245
+ version: "28.5.2"
246
+ addUserToGroup: true
247
+
248
+ stop_containers: &stop_containers
249
+ type: action
250
+ action:
251
+ command: docker compose down --remove-orphans 2>/dev/null || true
252
+
253
+ pull_images: &pull_images
254
+ type: action
255
+ action:
256
+ command: docker compose pull --quiet
257
+
258
+ build_and_start: &build_and_start
259
+ type: action
260
+ action:
261
+ command: docker compose up -d --build --remove-orphans --wait
262
+
263
+ cleanup_docker: &cleanup_docker
264
+ type: action
265
+ action:
266
+ command: docker system prune -f --volumes --filter "until=168h"
267
+
230
268
  targets:
269
+ localhost:
270
+ type: local
271
+ operations:
272
+ #- name: "Environment Setup"
273
+ # <<: *install_docker
274
+ - name: "Refresh Stack"
275
+ <<: *build_and_start
276
+
231
277
  ec2:
278
+ type: ssh
232
279
  host: ec2-xx-xx-xxx-xxx.xx-xxxx-x.compute.amazonaws.com
233
280
  user: ubuntu
234
281
  keyPath: ~/xxxx.pem
235
282
  port: 22
236
- deployPath: /home/\${user}/app
283
+ deployPath: *deploy_path
237
284
 
238
285
  operations:
239
- - name: "Setup swap space"
286
+ - name: "Provision Directories and Swap"
240
287
  type: ensure
241
288
  ensure:
242
289
  swap:
243
290
  size: 4G
244
291
 
245
292
  - name: "Install Docker"
246
- type: ensure
247
- ensure:
248
- docker:
249
- version: "28.5.2"
250
- addUserToGroup: true
251
-
252
- - name: "Create application directories"
253
- type: ensure
254
- ensure:
255
- directory:
256
- path: \${deployPath}
257
- owner: \${user}
258
-
259
- - name: "Create backup directory"
260
- type: ensure
261
- ensure:
262
- directory:
263
- path: /home/\${user}/backups
264
- owner: \${user}
265
-
266
- - name: "Stop running containers"
267
- type: action
268
- action:
269
- command: cd \${deployPath} && docker compose down 2>/dev/null || true
293
+ <<: *install_docker
270
294
 
271
- - name: "Sync application files"
295
+ - name: "Sync Source Files"
272
296
  type: action
273
297
  action:
274
298
  rsync:
275
299
  source: ./
276
- destination: \${deployPath}/
300
+ destination: *deploy_path
301
+ delete: true
277
302
  exclude:
278
- - node_modules/
279
303
  - .git/
280
- - "*.log"
304
+ - node_modules/
281
305
  - .env.local
282
- - dist/
283
- - public/
306
+ - "*.log"
284
307
 
285
- - name: "Pull Docker images"
308
+ - name: "Navigate to Deploy Path"
286
309
  type: action
287
310
  action:
288
- command: cd \${deployPath} && docker compose pull
311
+ command: cd *deploy_path
289
312
 
290
- - name: "Build and start containers"
313
+ - name: "Create Pre-deployment Backup"
291
314
  type: action
292
315
  action:
293
- command: cd \${deployPath} && docker compose up -d --build --remove-orphans
316
+ command: tar -czf *backup_path/backup-$(date +%Y%m%d-%H%M%S).tar.gz .
294
317
 
295
- - name: "Wait for services to start"
296
- type: action
297
- action:
298
- command: sleep 10
318
+ - name: "Pull Latest Images"
319
+ <<: *pull_images
299
320
 
300
- - name: "Show container status"
301
- type: action
302
- action:
303
- command: cd \${deployPath} && docker compose ps
321
+ - name: "Stop Existing Stack"
322
+ <<: *stop_containers
304
323
 
305
- - name: "Show recent logs"
306
- type: action
307
- action:
308
- command: cd \${deployPath} && docker compose logs --tail=30
324
+ - name: "Build and Launch"
325
+ <<: *build_and_start
309
326
 
310
- - name: "Cleanup old backups"
311
- type: action
312
- action:
313
- command: find /home/\${user}/backups -name "backup-*.tar.gz" -mtime +7 -delete
327
+ - name: "Verify Health Status"
328
+ type: verify
329
+ verify:
330
+ command: ! "[ $(docker compose ps --format json | grep -qv 'running\\|healthy') ]"
314
331
 
315
- - name: "Cleanup Docker resources"
332
+ - name: "Maintenance: Cleanup"
316
333
  type: action
317
334
  action:
318
- command: docker system prune -f --volumes
319
-
320
- - name: "Verify containers are running"
321
- type: verify
322
- verify:
323
- command: cd \${deployPath} && docker compose ps | grep -q "Up"
335
+ command: |
336
+ find *backup_path -name "backup-*.tar.gz" -mtime +7 -delete
337
+ docker image prune -af --filter "until=24h"
324
338
  ```
325
339
 
326
340
  **First-time setup:**
@@ -391,16 +405,16 @@ That's the Pod philosophy.
391
405
 
392
406
  ## Comparison with Other CLIs
393
407
 
394
- | Feature | Pod | Create-React-App | Angular CLI | Next.js CLI |
395
- |---------|-----|------------------|-------------|-------------|
396
- | Project scaffolding | ✅ | ✅ | ✅ | ✅ |
397
- | Component generation | ✅ | ❌ | ✅ | ❌ |
398
- | Service generation | ✅ | ❌ | ✅ | ❌ |
399
- | Module generation | ✅ | ❌ | ✅ | ❌ |
400
- | Dev server | ✅ | ✅ | ✅ | ✅ |
401
- | Built-in Docker support | ✅ | ❌ | ❌ | ❌ |
402
- | One-command deployment | ✅ | ❌ | ❌ | ❌ |
403
- | Full-stack architecture | ✅ | ❌ | ❌ | Partial |
408
+ | Feature | Pod | Create-React-App | Angular CLI | Next.js CLI |
409
+ | ----------------------- | --- | ---------------- | ----------- | ----------- |
410
+ | Project scaffolding | ✅ | ✅ | ✅ | ✅ |
411
+ | Component generation | ✅ | ❌ | ✅ | ❌ |
412
+ | Service generation | ✅ | ❌ | ✅ | ❌ |
413
+ | Module generation | ✅ | ❌ | ✅ | ❌ |
414
+ | Dev server | ✅ | ✅ | ✅ | ✅ |
415
+ | Built-in Docker support | ✅ | ❌ | ❌ | ❌ |
416
+ | One-command deployment | ✅ | ❌ | ❌ | ❌ |
417
+ | Full-stack architecture | ✅ | ❌ | ❌ | Partial |
404
418
 
405
419
  Pod doesn't just scaffold; it's your development companion from first line to first user.
406
420
 
@@ -436,4 +450,4 @@ MIT
436
450
 
437
451
  <p align="center">
438
452
  <strong>Pod: The CLI that never abandons you.</strong>
439
- </p>
453
+ </p>