If your using Grunt/GitHub another option would be 
https://www.npmjs.org/package/releasebot
The next release will have option to bundle dependencies in released assets.

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Sam 
Roberts
Sent: Thursday, June 12, 2014 6:40 PM
To: [email protected]
Subject: Re: [nodejs] Deployment techniques

There's a bit of a rough consensus on how to deploy, see some of these info 
sources:

- [The npm Debacle Was Partly Your
Fault](http://www.letscodejavascript.com/v3/blog/2014/03/the_npm_debacle)
- [Heroku Buildpack
README](https://github.com/heroku/heroku-buildpack-nodejs/blob/master/README.md)
 Good even if you don't use heroku.
- [10 steps to nodejs nirvana in
production](http://qzaidi.github.io/2013/05/14/node-in-production/)
- <http://addyosmani.com/blog/checking-in-front-end-dependencies/>
-  <http://www.futurealoof.com/posts/nodemodules-in-git.html>


Basically, it comes down to bundling as much as possible during build, so you 
have no deploy-time dependencies on external resources, and you deploy the same 
thing, every time.

There is some debate on compiled dependencies, building them means no need for 
a compiler on your deploy servers... but you need same build env as deploy. 
Pros and cons both ways.

Where it gets heated is how do you transport your app? tarball works ok for 
some, in which case bundling your dependencies and doing an npm pack works OK, 
but you have to get the .npmignore file correct, as well.

Also, lots of the above suggest commiting your build deps to git... I did that 
for fun for a loopback app that had an angular front-end, used bower, your 
basic full-stack node app. Over a million lines went into the git commit... 
craziness. And then there are all the command line shannanigans to keep it up 
to date, and modify your .gitignore.
Doing this on a development tree doesn't make any sense to me.

And, its unnecessary with git, you can use git commit-tree to keep an exact 
source copy of your development HEAD in a deploy branch, and THEN add the build 
products. This allows robust git push to PaaS deployment, but it also allows 
you to do an npm pack from completely git controlled state, to tag, to 
rollback, etc. All the good things you get with git, minus the pain of your 
dependencies in your dev tree.

One problem with all this advice is it takes a pretty ad-hoc set of tools to do 
it all. Lots of steps are manual or script-it-yourself, or when scripted, are a 
bit creeky (bundle-deps doesn't bundle optional dependencies, for example).

Anyhow, I've been working a tool to do the client-side build part of this, 
encapsulating what I think is the mostly-consensus best way to do these things, 
and some extras like git commit-tree. Its in pre-release, which means get it 
from https://github.com/strongloop/strong-build until its npm published.

When you run it, you'll find the steps can be run one-by-one, or all together, 
are reasonably customizable, and log all the git, npm, and shell commands they 
execute to make it as transparent as possible about what its actually doing to 
your source.

I'd love to have some feedback if you give it a whirl.

Cheers,
Sam

--
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
---
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/CACmrRmQtVO%3DBw5oNmTdooHJcNmyExqV%2BcJp4uVTuE7ok%2ByCJFw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/539afa0a.0743ec0a.641b.5166%40mx.google.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to