Nuclear Rooster

18Jul/100

Capistrano Scripts for Node.js

Here are some basic capistrano scripts and a configuration script to get Node.js running on Ubuntu 10.0.4 Lucid on ec2 (or anywhere else). I pieced these together from different places, but it's kinda cool to have a 2-command deploy out-of-the-box. Here is a gist that should get you up and running with node.js on ec2. Clone the gist repo to you local box and follow along!

I also configured nginx to proxy to the example Node.js application, mostly so that it would be accessible on port 80, which is enabled by default for EC2 security groups.

EC2 Launch Script

If you have the ec2 tools installed (I'd recommend brew), and you have your credential environment variables in place, you can run this script to launch an ec2 instance. It's using Alestic's ubuntu 10.04 AMI

Ubuntu 10.04 Configure Script

This is the config script that the launch script uses.

Copy host to Capfile

If you're following along, you'll want to copy the public DNS name of your ec2 instance to the 'host' variable in the Capfile.

Capfile

You can break these out into ./config/deploy.rb or whatever you like, but it's all here for succinctness.

Run the capistrano scripts

cap deploy:setup
cap deploy

References

Filed under: Uncategorized No Comments