lucky_cli
lucky_cli copied to clipboard
Nox process manager fails to keep certain processes running
I'm pretty sure this must relate to exit codes and how yarn wraps different types of ongoing watch processes + how Nox traps exit codes, but haven't dug in deeply yet.
https://github.com/robcole/lucky_nox_bug has a repo that can repro this (this is just a one-off creation from @grepsedawk's https://github.com/grepsedawk/horseshoe template starter).
Steps to replicate:
1 - Clone the repo.
2 - Run script/setup.
3 - Run lucky dev
You'll note the following in the logs:
js_assets | Done in 0.30s.
js_assets | Done
css_assets | Done in 0.54s.
css_assets | Done
That alone isn't problematic, but any save events won't trigger a recompilation, as Nox seems to think the process has exited completely:
web | [Browsersync] Proxying: http://127.0.0.1:3000
web | [Browsersync] Access URLs:
web | ----------------------------
web | Local: http://localhost:3001
web | ----------------------------
web | [Browsersync] Watching files...
... file save in app.ts happens here ...
... nothing ...
... I exit with ^C ...
^Csystem_check | Attempting to interrupt...
web | Attempting to interrupt...
docker | Attempting to interrupt...
docker | Gracefully stopping... (press Ctrl+C again to force)
system_check | Done
docker | time="2022-04-24T08:22:25-07:00" level=error msg="got 3 SIGTERM/SIGINTs, forcing shutdown"
Compare this to overmind, and you'll note that overmind will continue to properly pick up on filesystem events and recompilation will be triggered in Lucky:
web | [Browsersync] Proxying: http://127.0.0.1:3000
web | [Browsersync] Access URLs:
web | ----------------------------
web | Local: http://localhost:3001
web | ----------------------------
web | [Browsersync] Watching files...
... file save in app.ts happens here ...
js_assets | [watch] build started (change: "src/js/app.ts")
js_assets | [watch] build finished
web | [Browsersync] Reloading Browsers...
... I exit with ^C ...
^Cjs_assets | Interrupting...
css_assets | Interrupting...
docker | Interrupting...
system_check | Interrupting...
web | Interrupting...
docker | Gracefully stopping... (press Ctrl+C again to force)
web | Exited
css_assets | Exited
system_check | Exited
js_assets | Exited
[+] Running 1/1
docker | ⠿ Container lucky_nox_bug-postgres-1 Stopped 0.1s
docker | canceled
docker | Exited
ps output seems helpful here as well:
# overmind
➜ lucky_nox_bug git:(main) ✗ ps aux | grep yarn
robcole 8431 4.3 0.1 35052572 79280 s003 S+ 8:29AM 0:00.15 node /Users/robcole/.n/bin/yarn run browser-sync start -c bs-config.js --port 3001 -p http://127.0.0.1:3000
robcole 8435 0.0 0.0 34253900 952 s000 S+ 8:29AM 0:00.00 grep --color=auto --exclude-dir=.bzr --exclude-dir=CVS --exclude-dir=.git --exclude-dir=.hg --exclude-dir=.svn --exclude-dir=.idea --exclude-dir=.tox yarn
robcole 8370 0.0 0.1 35115800 77196 s005 S+ 8:29AM 0:00.18 /Users/robcole/.n/bin/node /Users/robcole/.n/bin/yarn build:css --watch
robcole 8356 0.0 0.1 34994968 80756 s004 S+ 8:29AM 0:00.18 /Users/robcole/.n/bin/node /Users/robcole/.n/bin/yarn build:js --watch
robcole 8342 0.0 0.1 35361820 81072 s005 S+ 8:29AM 0:00.16 node /Users/robcole/.n/bin/yarn dev:css
robcole 8341 0.0 0.1 35324956 79840 s004 S+ 8:29AM 0:00.16 node /Users/robcole/.n/bin/yarn dev:js
# nox
➜ lucky_nox_bug git:(main) ✗ ps aux | grep yarn
robcole 8588 1.3 0.1 35043356 79460 s001 S+ 8:30AM 0:00.15 node /Users/robcole/.n/bin/yarn run browser-sync start -c bs-config.js --port 3001 -p http://127.0.0.1:3000
robcole 8592 0.0 0.0 34253900 952 s000 S+ 8:30AM 0:00.00 grep --color=auto --exclude-dir=.bzr --exclude-dir=CVS --exclude-dir=.git --exclude-dir=.hg --exclude-dir=.svn --exclude-dir=.idea --exclude-dir=.tox yarn
For context, horseshoe is a very vanilla lucky build, but the asset builder is using esbuild --watch