
Show HN: How to Setup Node.js App Automated Deployment and CI with PM2 for MVP's - niftylettuce
http://niftylettuce.com/posts/automated-node-app-ci-graceful-zerodowntime-github-pm2/
======
nodesocket
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](https://github.com/drone/drone)) for all
your CI and deployment needs. It uses Docker and written in go.

~~~
smaili
Launching new instances on a per deploy basis is one of the most absurd things
I've ever heard.

~~~
adrianpike
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.

~~~
cosmie
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.

------
lioeters
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](https://github.com/niftylettuce/rapid-mvp-standards)). I appreciate
you sharing your experience and knowledge!

~~~
niftylettuce
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.

------
azurelogic
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.

------
vonklaus
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.

------
benatkin
PM2 is under the AGPL. Could this be an issue on a non-AGPL project?

