Run Foundry as a daemon so it survives terminal close and restarts on crash.
pm2 start pnpm --name supervisor -- run cli -- start --redis-host localhost --redis-port 6499 --state-key supervisor:state --queue-name tasks --queue-db 2
(Use npm instead of pnpm if you use npm.)
npm
pnpm
pm2 logs supervisor
pm2 logs supervisor --nostream
pm2 list
pm2 stop supervisor
pm2 restart supervisor
pm2 delete supervisor
You can define the app in ecosystem.config.cjs and run pm2 start ecosystem.config.cjs. Set script to pnpm or npm, args to the run cli -- start ... arguments, and cwd to the project root.
ecosystem.config.cjs
pm2 start ecosystem.config.cjs
script
args
run cli -- start ...
cwd