wilsonpage
wilsonpage

Reputation: 17610

What are the basics of deploying/building/making a web app?

I am pretty comfortable with the producing web apps now. I am using a NodeJs stack on the back-end and usually have a fair amount of Javascript on the front end. Where I really lack understanding is the deployment process.

What is a typical deployment process?

From what I have gathered in my reading a deployment/build process can include several tasks:


This has all left me a little overwhelmed. I don't know whether I should be going into this level of detail for my own projects, it seems like a lot of work! I am using Sublime Text 2 IDE and it seems to have a Build Script process, is this suitable? How does one coordinate all these separate tasks? I'm imagining ideally they would all run at the flick of a switch.

Sorry so many questions, but I need to know how people learnt similar principles. Some of my requirements may be specific to NodeJS but I'm sure processes are similar no matter what choice of stack you are developing in.

Upvotes: 2

Views: 381

Answers (3)

masylum
masylum

Reputation: 22361

For the assets I use asereje https://github.com/masylum/asereje

I recently documented my nodejs deployment process in a blog post: http://pau.calepin.co/how-to-deploy-a-nodejs-application-with-monit-nginx-and-bouncy.html

Upvotes: 2

Morten Siebuhr
Morten Siebuhr

Reputation: 6108

First off, let's split the job in two: front-end and back-end stuff. For both, you really want some kind of bulid system, but their goals and scope are vastly different.

For the front-end, you want your source to be as small as possible; concatenate/minify JavaScript, CSS and images. A colleague of mine has written a "compiler", Assetgraph, to do this for you. It has a somewhat seep learning-curve, but it does wonders for your code (our dev-builds are usually ~20 megs, production ~500 k).

As to the back-end, you want contained, easily managed bundles of some sort. We re-package our stuff into debian-packages. As long as the makefile is wired up correctly, you get a lot of the boring build- and deploy-time stuff for free. Here's my (pre-NPM 1.0) Debianizing node programs. I've seen other ways to do this in NPM and on Github, but I haven't looked into them, so I can't speak on their quality.

For testing/pusing around/deploying, we use a rather convoluted combination of Debian package-archives, git-hooks, Jenkins-servers and what not. While I highly recommend using the platforms' native package-manager for rolling out stuff, it can be a bit too much. All in all, we usually deploy staging either automatically (on each git push), or semi-automatic for unstable codebases. Production deployments are always done explicitly.

Upvotes: 2

alessioalex
alessioalex

Reputation: 63653

A build script sounds like a good idea indeed.

What should that build script do?

  • make sure all the test pass, else exit immediately
  • concatenate your javascript and css files into one single js/css file and minify them also
  • increment the version number (unless you decide to set that up yourself manually)
  • push to the remote repo (which instructs the staging and production servers through a git hook)

This is at least my opinion.

Other resources:

http://howtonode.org/deploying-node-with-spark
http://howtonode.org/deploying-node-upstart-monit
http://dailyjs.com/2010/03/15/hosting-nodejs-apps/
How to deploy node app depencies

Upvotes: 1

Related Questions