Skip to content

Instantly share code, notes, and snippets.

@edwardhotchkiss
Created January 14, 2012 17:32
Show Gist options
  • Save edwardhotchkiss/1612199 to your computer and use it in GitHub Desktop.
Save edwardhotchkiss/1612199 to your computer and use it in GitHub Desktop.
Node.JS on RackSpace (Nginx, Jenkins, Git post-receive hooks)

Node.JS on RackSpace (Nginx, Jenkins, Git post-receive hooks)


Node.JS

# install node
apt-get update
apt-get install git-core build-essential libssl-dev
cd /usr/src
git clone http://github.com/joyent/node.git
git checkout v0.6.7
cd node
./configure
make
make install

nginx

# install nginx
apt-get install nginx
vim /etc/nginx/sites-available/yourdomain

Setup nginx config

server {
  listen 80;
  server_name yourdomain.com;

  location / {
       proxy_set_header X-Real-IP $remote_addr;
       proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
       proxy_set_header Host $http_host;
       proxy_set_header X-NginX-Proxy true;
       proxy_pass http://127.0.0.1:8000/;
       proxy_redirect off;
  }
}

Use Config

cd /etc/nginx/sites-enabled/ 
ln -s /etc/nginx/sites-available/yourdomain yourdomain
sudo /etc/init.d/nginx restart

Remote Git

ssh [email protected]
mkdir app.git
cd app.git
git init --bare
vim hooks/post-receive

Hook:

#!/bin/sh
GIT_WORK_TREE=/home/www/app git checkout -f

Setup

chmod +x hooks/post-receive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment