14 comments

[ 1.6 ms ] story [ 42.1 ms ] thread
pm2 is by far the best node process manager. It is excellent.

Though I don't use pm2 for deployments. I create new servers (immutable infrastructure) on AWS every deploy, and use NGINX Plus dynamic upstream to add the new backends and remove the old ones. There is something pleasing about creating new servers and destroying old servers every deploy.

Also check out Drone (https://github.com/drone/drone) for all your CI and deployment needs. It uses Docker and written in go.

Launching new instances on a per deploy basis is one of the most absurd things I've ever heard.
I'm guessing you don't come from an ops background... Do a Google search for immutable infrastructure.
Serious question, why do you think that? I'm not that familiar with why this would be super wasteful and would love to learn more.
I wouldn't say it's super wasteful, but there is waste involved since he's on AWS. AWS bills EC2 usage hourly, and doesn't do fractional billing. If you deploy, then 5 minutes later deploy again (and provision a new instance and destroy the first) you'll still pay for the full hour of that first instance.

So every deploy incurs that usage rounding. Depending on the frequency of deploys and the number of servers being deployed to, that adds up.

For simpler projects, Elastic Beanstalk is also a pretty good option. It integrates nicely with auto-scaling, and any CI system can tie into the AWS CLI to dump a zip on S3, and then call Beanstalk "update-environment" to load that code onto an environment for a full CD pipeline.

If you have a more polygot stack, or rely on other non-node systems like RabbitMQ or whatever, standardizing on Docker containers is a no brainer though.

(comment deleted)
PM2 is under the AGPL. Could this be an issue on a non-AGPL project?
I just use Codeship's free plan for CI/CD. I embedded the deploy script in my repo and use Codeship to run it via SSH. Works great and costs $0.
looks good, I've been trying to find a free CI(never used one) but they're usually non-trivial to set up or cost money. This looks like a decent write up and semaphore seems pretty user friendly, just wish they had gitlab support.
Thank you for taking the time to write such a helpful, detailed article. With links/references, screenshots, and fool-proof instructions, it's been educational to follow along.

I'd used Jenkins before (that someone else had set up) and was familiar with much of the other parts (DigitalOcean, Node.js, PM2, etc.), but had never properly learned how to set up CI for myself. This article was a great introduction.

Now studying your Rapid MVP Standards document (https://github.com/niftylettuce/rapid-mvp-standards). I appreciate you sharing your experience and knowledge!

You are welcome. Thank you for the kind words. My email is niftylettuce@gmail.com if you'd like to get in touch or ask questions, or if I can help somehow.