create-pm2-ecosystem
Skill: Create PM2 Ecosystem
Mit Codex oder Claude installieren Kopieren Sie diesen Prompt, fügen Sie ihn in Codex, Claude oder einen anderen Assistant ein und lassen Sie die Skill-Seite prüfen und installieren.
Menü
Skill: Create PM2 Ecosystem
Mit Codex oder Claude installieren Kopieren Sie diesen Prompt, fügen Sie ihn in Codex, Claude oder einen anderen Assistant ein und lassen Sie die Skill-Seite prüfen und installieren.
Basierend auf der SOC-Berufsklassifikation
Never run Docker containers as root. Enforce USER directive in Dockerfiles and user: in compose files. Database images are the only exception.
Handle packages migrating between pnpm workspaces. Clean stale root copies, update workspace configs, fix broken workspace:* references.
Recover lost source files from pi session history when files were deleted but never committed to git.
Improve the Hormuz clock model through new signal classes, schema changes, uncertainty modeling, and better rendering or branch logic
Revise fork-tax protocols so they assume concurrent agents by default in shared workspaces, forbid destructive repo-wide cleanup of unrelated dirt, and require path-scoped staging plus explicit blocker recording.
Persist the full working state into git (commit + tag + push + manifest artifacts) as a deterministic handoff snapshot. Use when the user requests Π / fork tax / full dump.
| name | create-pm2-ecosystem |
| description | Skill: Create PM2 Ecosystem |
Create new PM2 ecosystem configuration files for the clobber-based system.
defapp for PM2 process managementpm2-process-management skill)render-pm2-clj-config skill)The workspace uses a modular ecosystem system where each service is defined in its own .cljs file:
ecosystems/
├── index.cljs # Entry point - requires all ecosystem files
├── ecosystem.cljs # Core services (opencode, duck-ui)
└── cephalon.cljs # Cephalon services (cephalon, openskull-cephalon)
Build Pipeline:
ecosystems/*.cljs → shadow-cljs release clobber → .clobber/index.cjs → ecosystem.config.cjs → PM2
Create a new file at ecosystems/<service-name>.cljs:
(ns <service-name>
(:require [clobber.macro]))
;; Service description
;; Purpose: What this service does
(clobber.macro/defapp "<service-name>"
{:script "node"
:args ["dist/main.js"]
:cwd "/path/to/service"
:env {:NODE_ENV "production"}
:autorestart true
:max-restarts 5
:min-uptime "10s"
:log-date-format "YYYY-MM-DD HH:mm:ss Z"
:error-file "./logs/error.log"
:out-file "./logs/out.log"
:merge-logs true
:kill-timeout 5000})
;; End with ecosystem-output
(clobber.macro/ecosystem-output)
Edit ecosystems/index.cljs to require your new service:
(ns index
(:require [clobber.macro]
[ecosystem] ;; existing
[cephalon] ;; existing
[<service-name>])) ;; ADD THIS
;; Export ecosystem
(set! (.-exports js/module)
(clj->js (clobber.macro/ecosystem)))
# Using pnpm (preferred)
pnpm generate-ecosystem
# Or directly
npx shadow-cljs release clobber
pm2 start ecosystem.config.cjs
| Option | Description |
|---|---|
:name | Unique service name (used in PM2 commands) |
:script | Executable to run (node, bun, clojure, etc.) |
| Option | Description | Default |
|---|---|---|
:args | Arguments passed to script | [] |
:cwd | Working directory for the process | . |
:env | Environment variables | {} |
:autorestart | Auto-restart on crash | true |
:max-restarts | Max restart attempts before failure | 5 |
:min-uptime | Min uptime before considering stable | "5s" |
:instances | Number of instances | 1 |
:interpreter | Script interpreter | none |
| Option | Description |
|---|---|
:log-date-format | Date format for logs |
:error-file | Path to error log |
:out-file | Path to stdout log |
:log-file | Combined log path |
:merge-logs | Merge stdout/stderr |
| Option | Description |
|---|---|
:watch | Files to watch for auto-restart |
:ignore_watch | Files to ignore in watch |
:watch_delay | Delay after file change |
:kill_timeout | Time to wait before SIGKILL |
:restart_delay | Delay between restarts |
(ns my-service
(:require [clobber.macro]))
(clobber.macro/defapp "my-service"
{:script "node"
:args ["dist/index.js"]
:cwd "/home/err/devel/services/my-service"
:env {:NODE_ENV "production"
:PORT "3000"}
:autorestart true
:max-restarts 3
:min-uptime "10s"
:error-file "./logs/error.log"
:out-file "./logs/out.log"})
(clobber.macro/ecosystem-output)
(ns my-clj-service
(:require [clobber.macro]))
(clobber.macro/defapp "my-clj-service"
{:script "clojure"
:args ["-M" "-m" "my.namespace.main"]
:cwd "/home/err/devel/services/clj-service"
:env {:MY_VAR "value"}
:interpreter "none"
:error-file "./logs/error.log"
:out-file "./logs/out.log"})
(clobber.macro/ecosystem-output)
(ns my-bun-service
(:require [clobber.macro]))
(clobber.macro/defapp "my-bun-service"
{:script "bunx"
:args ["my-service@latest" "start"]
:cwd "."
:env {:NODE_ENV "production"}
:instances 1
:autorestart true
:error-file "./logs/error.log"
:out-file "./logs/out.log"})
(clobber.macro/ecosystem-output)
Create a dev profile for development:
(clobber.macro/defprofile :dev
{:apps [
{:name "<service-name>-dev"
:cwd "/path/to/service"
:script "node"
:args ["--watch" "dist"]
:env {:NODE_ENV "development"}
:watch ["src"]
:ignore_watch ["node_modules" "logs"]}]})
(clobber.macro/ecosystem-output):interpreter "none" for scripts that don't need shell interpretation:cwd and log files for reliabilityecosystems/<service-name>.cljsecosystems/index.cljs.clobber/index.cjspm2-process-management - Start/stop/restart servicesrender-pm2-clj-config - Validate configs without startingworkspace-navigation - Locate existing ecosystem files