create-pm2-ecosystem
Create new PM2 ecosystem configuration files for the clobber-based system with proper defapp definitions
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Create new PM2 ecosystem configuration files for the clobber-based system with proper defapp definitions
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
This skill guides agents and developers through the Kanban workflow defined in `orgs/riatzukiza/promethean/docs/agile/process.md`.
Protocol to stop apology loops and focus on verified fixes.
Protocol to break out of repetitive, failing edit loops by forcing analysis over action.
Resolves Clojure namespace-path mismatches and classpath errors with definitive path conversion
Auto-fix Clojure delimiters and validate syntax with OpenCode tools.
Protocol to recover from Clojure/Script syntax errors, specifically bracket mismatches and EOF errors.
| name | create-pm2-ecosystem |
| description | Create new PM2 ecosystem configuration files for the clobber-based system with proper defapp definitions |
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 filesCheck the Skill Graph for the full workflow.