First time post. Bought two Pixelblaze Pico boards to control LED strings for Christmas decorations, and didn’t want to take them down. They are still hanging and lit from 6 pm to 11 pm daily.
I’ve also been playing with Firestorm since the lights look better when synced. Got it first working on Windows then got it working on RPi, but in both cases I have to use PORT=3000 yarn server, which works but stops as soon as I close the terminal window.
Trying to learn Docker, I built an image on the NodeJS base image. After much tinkering, I got it to build and run, but as soon as it runs, it immediately stops with a REPL exit event (again using the yarn server command).
I believe PM2 is supposed to help with this, but I can’t get it to work. More specifically, the command line says the server is online, but a browser can’t connect to it. Further, a netstat doesn’t show any listening port associated with the PM2 PID (image attached below).
Server as in it listens on a port, not a service that runs in the background, that is what pm2 is for!
Yes, nohup, screen, etc would do the trick manually, but pm2 can restart it on boot or if it crashes, and will keep logs, etc. It also has tools for installing with various service frameworks like systemd. It’s a nice service wrapper overall.
It looks like you have something else running on port 80. In that case, try moving firestorm’s webserver to a different port.
For port 3000, try:
pm2 delete server
PORT=3000 pm2 start server.js
PM2 should pick up the environment variable as part of the service definition when it first makes the service (hence the delete first just to be sure).
You can verify that with:
#takes the numeric ID column you see in the list instead of the name
pm2 env 0
Now inside a docker instance, this would matter less, and you would probably run the server more or less directly.
Running yarn server is just a shortcut / web developer convention for node server.
Here’s a quick tutorial on dockerizing a node app:
As @basuraman had noted, pm2 was installed in /usr/local/bin. Refactoring the #run pm2 on boot command to match the correct location now has both pm2 and Firestorm running, and the browser connecting, even after the terminal is closed. This worked by using PORT=3000 pm2 start server.js.
I will look into getting the Docker running a bit later. I did notice that there is a pm2-docker command in the same /usr/local/bin folder as pm2, which might be worth looking into. But I will review that docker tutorial to try to understand what’s actually needed.