3 ms·
Ask HN: How do you deploy your Node.js back end?
I have been looking for a way to deploy every commit to its own URL. Vercel (Now.sh) did this quite well, but they focus on serverless now.
The problems I always find are:
- slow builds - CI platforms not caching docker images
- black box - hard to understand or debug when something goes wrong
- unreliable - crashes or times out for no reason
- hard to debug deploy configuration without making many git commits and doing entire redeploys
If I run an EC2 box, and rsync my code to it, and I can deploy in 5 seconds. Every automated solution I find takes minutes of spinning things up. I wonder if there is a PaaS service that can be this fast?
But curious to know how people are deploying their Node.js backends in 2020.
- madamelic 6y agorsync, like you said. What do you find bad about keeping it simple? Your logging is `tail`, your deploy is `rsync`, your rollback is `git revert` or SSH-ing in and checking out a commit. Not really enterprise-grade but by then you'll have time and people to do it right.
- mjgs 6y agoRsync in a bash script is a pretty good way to go as far as simplicity, plus you can just ship the built files rather than the entire repo. Things do get a bit complex if you try to make your home made solution more robust. But on the other hand if you manage to do it then you have a solution you can deploy to any standard cloud server. Here is a good writeup of such a home made solution to give you an idea of what that might look like: https://dev.to/justincy/blue-green-node-js-deploys-with-nginx-bkc https://dev.to/justincy/blue-green-node-js-deploys-with-ngin...
- tedmiston 6y agoAWS ECS on Fargate is pretty nice and fast. At a high level, you basically just build a small Docker image for your Node app, push it, and then restart your ECS service / or update it to use the new tag if different.
- siquick 6y agoAWS Elastic Beanstalk is pretty straight forward. Any changes can be deployed with `eb deploy` and builds are quick in my experience. https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/create_deploy_nodejs.html https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/creat...
- pattu777 6y agoWe use pm2 to deploy Node.js code. I like this mostly due to it's capistrano style process. Also rollback is much easier. https://pm2.io/docs/runtime/guide/easy-deploy-with-ssh/ https://pm2.io/docs/runtime/guide/easy-deploy-with-ssh/
- hatboxreappoint 6y ago`ibmcloud cf push`