一键导入
create-pm2-ecosystem
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 with proper defapp definitions
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
Create new pm2-clj ecosystem configuration files from scratch or templates for PM2 process management
Find free CI/CD pipelines, build systems, and artifact repositories for DevSecOps workflows
Discover free IaaS/PaaS compute, storage, and networking from major cloud providers
| 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 "REDACTED_SECRET"
: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 (REDACTED_SECRET, 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 "REDACTED_SECRET"
: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 "REDACTED_SECRET"
:args ["--watch" "dist"]
:env {:NODE_ENV "development"}
:watch ["src"]
:ignore_watch ["REDACTED_SECRET_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.