3 ms·
It may well be that I did not learn to use it properly, but - to provide a counter opinion - pm2 left a sour taste with me. Tried to use it few years back and b
by mynegation 3y ago
It may well be that I did not learn to use it properly, but - to provide a counter opinion - pm2 left a sour taste with me. Tried to use it few years back and by default it does not rotate the logs, did not handle machine reboots well, and at times I was confused what is running and what is not. I settled on docker for small projects and kubernetes for larger ones and these things made more sense to me. I admit it could be a matter of habit.
- sublinear 3y agoMy experience starting out with PM2 was the same. You need a plugin for the log rotation, saving the default environment variables is confusing, and stale processes cause weird behavior. You may already have your own in-app log rotation before adding PM2 so may want to avoid printing to stdout/stderr. For usage with docker you want pm2-runtime.
- zarzavat 3y agoI came to the opposite conclusion for the same reasons. Docker/kubernetes is fine for things that make money, but for small personal projects it is far too much complexity and I dumped it. pm2 gets the job done with less effort overall.
- dartos 3y agoI’ve found pm2 more complicated than docker-compose for local/self hosted small projects. Why did you prefer pm2?
- __s 3y agopm2 gets past involving containers I get to rsync my code up to a server, & pm2 restart it. The server process runs like any other, no container issues to consider, just a json file saying how I'd run it myself if I wanted to tbf I'd rather replace pm2 with systemd, since I'm using it to run a Rust program, but if I was using node their cluster mode looks neat
- zarzavat 3y agoHonestly, I hate using docker. It’s a pain to deal with in your dev environment, especially on a Mac. It’s not lightweight for your dev machine. It requires a good internet connection and it uses a lot of data. It’s all very “enterprise”. If you’re sat in an office, you’re on a work computer, you need reproducible dev environments, probably none of that bothers you. However, if I’m working by myself, I don’t want to deal with any of that Rube Goldberg shit. I use shell scripts, ssh, rsync and pretend it’s the 00s again, and oh my god I’m so much happier in that universe.
- dartos 3y agoMaybe it’s different on Mac, maybe I’m biased, but I’ve been using docker since it was a small project and I’ve never felt that enterprise cruft. It saved me from the Rube Goldberg esque pile of bash scripts and puppeteer configs of the 00s. Funny how perception changes.
- petre 3y agoIt uses a VM on Macs, it's usually slow and requires too much thinkering to get it to work decently. I gave up development with Linux tools on Macs, very annoying and not worth the hassle. I think it even works better in Windows since WSL. I'm using runit instead of pm2. Systemd should also do fine. It's over engineered.
- Kab1r 3y agoIronically WSL uses a VM as well
- petre 3y agoOf course it does, but at least it works quite decently. And you're running an actual distribution under it, so no hassles with MacPorts, Homebrew and other third party solutions for installing dependencies. If development on Snow Leopard was quite annoying, I can't imagine what it is now with the newer Apple sandboxes in place. https://learn.microsoft.com/en-us/windows/wsl/compare-versions https://learn.microsoft.com/en-us/windows/wsl/compare-versio...
- noizz 3y agoAs others mentioned - logrotate is available as an option, since the system one is more preferable for many. As per reboot handing - it's available via "pm2 startup" script.
- hosh 3y agoI'm with you. I think PM2 is half-baked software. It tries to do too much and none of them well. It has two source-of-truths, the dump file and the ecosystem files. It doesn't have a way to stagger restarts. For small projects, there is now a way to run docker containers or pods (through podman) via systemd units, so if you are using a systemd enabled distro, then that may be a better alternative than pm2, especially if you already have proficiency in docker and kubernetes.