Nov 15

Ubuntu 11.10 Node.js Heroku PG Install

Git + Heroku + Node.js + PostgreSQL + Ruby + Serious + Ubuntu

This post is more a personal memoir than a tutorial designed for public consumption but this worked for me installing a virtual machine from scratch on VirtualBox. The purpose is to develop Node.js applications that are deployed to Heroku.

Ubuntu

Download latest Ubuntu (11.10) and run through the installer (no gotchas)

 

Ruby

Need Ruby for Heroku.

Great post – http://blog.sudobits.com/2011/10/27/how-to-install-ruby-on-rails-in-ubuntu-11-10/

 

$ bash > >(curl -s https://rvm.beginrescueend.com/install/rvm)  # Get RVM
$ source ~/.bashrc   # Reboot the shell
$ sudo apt-get install build-essential openssl libreadline6 libreadline6-dev zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion  # Install Libraries
$ rvm install 1.9.3  # Install ruby v1.9.3
$ rvm use 1.9.3
$ gem install rails

 

Git

Need Git for Heroku as well.

$ sudo apt-get install git-core

 

PostgreSQL

Database of choice because Heroku uses it.
Decent post – https://help.ubuntu.com/community/PostgreSQL.

$ sudo apt-get install postgresql-9.1
$ sudo -u postgres createuser --superuser $USER
$ sudo -u postgres psql

Replace the $USER with username and $DATABASE with database name

postgres=# \password $USER
postgres=# createdb $DATABASE
$ psql

Excellent cheat sheet for psql commands – http://www.postgresonline.com/special_feature.php?sf_name=postgresql83_psql_cheatsheet&outputformat=html.

 

Node.js

Install Node.js and npm

$ sudo apt-get install nodejs
$ curl http://npmjs.org/install.sh | sudo sh

 

Heroku

Tying it all together.

$ gem install heroku
$ heroku login
$ heroku keys:add

 

Useful Bash_Aliases

alias hb='heroku pgbackups:capture --expire'
alias hbget='heroku pgbackups:url' # remember to add the .dump file (e.g. hbget b001)
alias hl='heroku logs --tail'
 
alias gp='git push'
alias ga='git add'
alias gaa='git add .'
alias gp='git push'
alias gpp='git push production'
 
alias gl='git log'
alias gs='git status'
alias gd='git diff'
alias gc='git commit -m'
alias gca='git commit -am'
alias gb='git branch'
alias gco='git checkout'
alias gra='git remote add'
alias grr='git remote rm'
alias gpu='git pull'
alias gcl='git clone'

Leave a comment

WTF is this?

This is my little space in which to play. I ramble about what it's like to...
· Run a 3:57 Mile | 3:39 1500m.
· Build sweet websites.
· Live in Wellington, NZ
  Charlottesville, VA
  Santa Cruz, CA
  Boulder, CO.
· be convicted of grammar crimes.
If you're intrigued...
This is what to expect.