1

I want to automate my deployment of my node.js app from my machine to the cloud server?

It currently using expressjs.

Is there anything out there like this. Have tried googling but no luck

Cheers

1
  • You didn't mention you cloud provider, so I will assume it is a 'generic' IaaS provider more than a specific PaaS one. Many people automate this via their VCS tool, most often Github. You can simply clone your project on the remote machine, use npm to install the needed modules (which you oughtn't keep in VCS, but just record in your package.json) and you are good to go. Throw the steps in a script and you can trigger it remotely, via a cron to (e.g.) check for new code every day at 2AM, etc. Search S.O. or Bing around, and you'll find more elaboration on these approaches. Commented Mar 6, 2014 at 1:02

2 Answers 2

1

First of all, you need a private registry server. For example, this one, since it's easiest to install. You'll publish your node.js app there, so cloud servers will download it.

Secondly, you need to execute npm update on all your servers whenever you publish something there.

So my usual deployment process is this:

  1. run npm publish --reg http://my.private.registry:4873/ on local package
  2. run npm update --reg http://my.private.registry:4873/ on each of the remote servers (this can be automated using puppet)
  3. restart all instances on each of the remote servers (pm2 restart all in my case, but you can use different supervisor)

PS: 2 and 3 steps can even be automatic when this gets implemented, so it'll just be npm publish

Sign up to request clarification or add additional context in comments.

2 Comments

Can you please add some info about supervisors? Why pm2 and what alternatives are there (forever, upstart, etc.), and do you really need alternatives?
I use pm2 because of its built-in clustering. No idea what other people use.
0

I'm not sure this is what you're asking for, but companies like Heroku allow for automated deployment of apps from the desktop to the cloud. No relation, just a (free) customer.

Dave Winer has put together a very nicely documented how-to on this very subject:

http://scripting.com/2014/02/06/herokuForPoetsBeta.html

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.