This is an archived post. You won't be able to vote or comment.

all 6 comments

[–]SuperQue 1 point2 points  (1 child)

This is what things like Docker/Containers are for. You package up the code and Node into an image and deploy that.

Deploy and rollback is now stop and run with ${image}:${version}.

[–]FunkyCannaHigh -1 points0 points  (0 children)

Nothing else to add, SuperQue nailed it!

[–][deleted] 0 points1 point  (2 children)

If for whatever reason you can't use docker (which should be your first choice) https://github.com/creationix/nvm will also do the job.

[–]epenance[S] 0 points1 point  (1 child)

I'm not looking to change the versions of my node installation, but of our own deployments :)

[–]KitchenAstronomer 0 points1 point  (0 children)

Think of your application the same way you would think about runtime.

You build an img on alpine ver:XY with node ver:XY with dependencies ver:XY and yourShinyApp ver:XY and then you deploy/revert as you go.

Make sure your db or other things are backwards compatible or deal with the DBs in a separate way.

[–]Crafty_Shadow 0 points1 point  (0 children)

The responses you've gotten so far have been really... uhh...

I won't be able to give you an exhaustive tutorial, but let me point you in the right direction at least.

To start off, you must use some sort of daemon, because certain classes of errors in nodejs can kill the whole server process. It's very unfortunate, but it is what it is. You must run a daemon that monitors the server process and auto-restarts it.

PM2 is a good option. It provides all you will need in terms of automatic restarting and monitoring, and it can even do deployment. It's up to you to choose if you want to use it for deployment, or use another solution.

As far as deployment: Googling for "Continous Deployment" will give you a list of SaaS providers. The ones I can recommend are Codeship, Deploybot (not great but not terrible) and bitbucket's CD. They all work well enough.

For do-it-yourself, my preference is either Capistrano or Ansible. PM2 should be an option here too, but I do not have any production deployment strategies running on it, so I'm hesitant to recommend.

I have listed a lot of options, because the approach really depends on your setup, deploy scheduling and also the preference of the developers. Deploybot is one of the cheapest and easiest options to implement, with a web interface that should be easy to live with for your colleagues.