Here are some useful files for making a rails app ready to delpoy via capistrano on a ubuntu/unicorn/nginx/postgresql stack.
Mostly based on:
- http://railscasts.com/episodes/293-nginx-unicorn
- http://railscasts.com/episodes/335-deploying-to-a-vps
- http://railscasts.com/episodes/133-capistrano-tasks-revised
Additional useful commands are:
capify .
cp config/database.yml config/database.example.yml
chmod +x config/unicorn_init.sh
mkdir .ssh
cat .ssh/id_dsa.pub | ssh bernhard@capivm -p 2222 "cat >> .ssh/authorized_keys"
apt-get install vim htop
apt-get install curl git-core python-software-properties
add-apt-repository ppa:chris-lea/node.js
apt-get install nodejs npm
mkdir -p gitsrv/depot.git && cd gitsrv/depot.git && git --bare init
git remote add origin ssh://bernhard@capivm/~/gitsrv/depot.git
apt-get install postgresql libpq-dev
apt-get install libsqlite3-dev
su postgres
\curl -L https://get.rvm.io | bash -s stable --rails
gem install activerecord-postgresql-adapter
rails console production
rm /etc/nginx/sites-enabled/default
vim shared/config/database.yml
bundle install
cap deploy:setup
cap deploy:cold
cap deploy
The files go here:
Gemfile
Capfile
config/deploy.rb
config/nginx.conf
config/unicorn.rb
config/unicorn_init.sh
~/apps/depot/shared/config/database.yml
The unicorn_init.sh
will be copied into /etc/init.d/
.