No description, website, or topics provided.
Shell Ruby
Switch branches/tags
Nothing to show
Pull request Compare This branch is 4 commits behind davidebettio:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


enter sudo shell

sudo -s

upgrade system

apt-get update
apt-get -y upgrade
apt-get -y install python-software-properties language-pack-en curl git-core build-essential

install sqlite3 if you want to use it

apt-get -y install libsqlite3-dev

set language for system

echo "LC_ALL=en_US.utf8" >> /etc/environment

add repository

add-apt-repository -y ppa:nginx/stable
add-apt-repository -y ppa:chris-lea/node.js
apt-get update


apt-get -y install nginx


apt-get -y install nodejs npm

reboot system


now stay in the deploy user


curl -L | bash

put lines from

wget -O -

in your .bashrc before

# If not running interactively, don't do anything
[ -z "$PS1" ] && return

and reload bash

source .bashrc

install and set ruby version

rbenv bootstrap-ubuntu-12-04
rbenv install 1.9.3-p194
rbenv global 1.9.3-p194
wget -O ~/.gemrc
gem install bundler --no-ri --no-rdoc
rbenv rehash


gem install rails


gem install unicorn

enter sudo shell

sudo -s

backup original nginx.conf and mime.types

mv /etc/nginx/nginx.conf /etc/nginx/nginx.conf.orig
mv /etc/nginx/mime.types /etc/nginx/mime.types.orig

get conf files for nginx

wget -O /etc/nginx/mime.types
wget -O /etc/nginx/nginx.conf

remove default site

rm /etc/nginx/sites-enabled/default

restart nginx

service nginx restart

add ubuntu user to www-data group

usermod -a -G www-data ubuntu

create www folder

mkdir /var/www

change owner of www folder

chown ubuntu:www-data /var/www

create a test app

sudo apt-get install libsqlite3-dev
wget -O /etc/nginx/sites-available/
ln -s /etc/nginx/sites-available/ /etc/nginx/sites-enabled/
service nginx restart

exit and return to deploy user

cd /var/www
rails new example
wget -O /var/www/example/config/unicorn.rb
wget -O /var/www/example/config/
cd example
echo "gem 'unicorn'" >> Gemfile
echo "gem 'capistrano'" >> Gemfile
rm public/index.html

chmod +x config/
mkdir tmp/pids


config nginx from

cd /etc/nginx wget nginx.conf

enable example site

cd /etc/nginx/sites-available wget cd /etc/nginx sudo ln -s /etc/nginx/sites-available/ sites-enabled/ cd mkdir www cd www sudo apt-get install libsqlite3-dev rails new example cd example echo "gem 'unicorn'" >> Gemfile echo "gem 'capistrano'" >> Gemfile bundle

wget extra conf

sudo mv /etc/nginx/conf.d /etc/nginx/conf cd /etc/nginx/conf sudo wget sudo wget sudo wget sudo wget sudo wget sudo wget sudo wget sudo wget

remove default nginx site

sudo rm /etc/nginx/sites-enabled/default

restart nginx

sudo service nginx restart