7 ms·
Show HN: How to Setup Node.js App Automated Deployment and CI with PM2 for MVP's
- niftylettuce 11y agoAlso on Twitter https://twitter.com/niftylettuce/status/720719987531517954 https://twitter.com/niftylettuce/status/720719987531517954
- nodesocket 11y agopm2 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 11y agoLaunching new instances on a per deploy basis is one of the most absurd things I've ever heard.
- nodesocket 11y agoI'm guessing you don't come from an ops background... Do a Google search for immutable infrastructure.
- adrianpike 11y agoSerious 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 11y agoI 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.
- bschwindHN 11y agoWhat do you do for deployments?
- seabrookmx 11y agoFor 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.
- deleted 11y ago[deleted]
- benatkin 11y agoPM2 is under the AGPL. Could this be an issue on a non-AGPL project?
- azurelogic 11y agoI 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 11y agolooks 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.
- lioeters 11y agoThank 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 11y agoYou 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.