sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade
sudo apt-get autoremove
sudo reboot
sudo dpkg-reconfigure tzdata
sudo apt-get install ntp
sudo ntpdate ntp.ubuntu.com
date
Edit /etc/profile
export PATH=/opt/ruby/bin:/opt/nginx/sbin:/opt/ruby/gems/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
export RAILS_ENV=production
export GEM_HOME=/opt/ruby/gems
export LC_ALL=en_US.UTF-8
Edit /etc/environment
PATH=/opt/ruby/bin:/opt/nginx/sbin:/opt/ruby/gems/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
RAILS_ENV=production
GEM_HOME=/opt/ruby/gems
LC_ALL=en_US.UTF-8
Edit /etc/sudoers
Defaults secure_path="/opt/ruby/bin:/opt/nginx/sbin:/opt/ruby/gems/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
sudo apt-get install libmagickwand-dev libmysqlclient15-dev nodejs
sudo apt-get install libyaml-dev libssl-dev libreadline-dev libxml2-dev libxslt1-dev libffi-dev build-essential
wget http://cache.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p247.tar.gz
tar xvfz ruby-2.0.0-p247.tar.gz
cd ruby-2.0.0-p247/
./configure --prefix=/opt/ruby --disable-install-rdoc
make
sudo make install
sudo apt-get build-dep git-core
wget https://git-core.googlecode.com/files/git-1.8.4.2.tar.gz
tar xvfz git-1.8.4.2.tar.gz
cd git-1.8.4.2/
./configure
make
sudo make install
wget http://www.openssl.org/source/openssl-1.0.1e.tar.gz
tar xvfz openssl-1.0.1e.tar.gz
cd openssl-1.0.1e/
./config
make
sudo make install
See http://zduck.com/2012/syntax-highlighting-for-nginx-in-vim
Edit /etc/vim/vimrc and add the lines below
set number
set smartindent
set tabstop=4
set shiftwidth=4
set expandtab
wget http://nginx.org/download/nginx-1.4.1.tar.gz
tar xvfz nginx-1.4.1.tar.gz
cd nginx-1.4.1/
./configure --prefix=/opt/nginx --with-http_ssl_module --with-openssl=/home/ubuntu/src/openssl-1.0.1e/
make
sudo make install
cd /opt/nginx/conf
sudo rm nginx.conf
sudo wget https://gist.github.com/jtadeulopes/7237669/raw/0e009788386cc42c6919892f508feb2b72ea991d/nginx.conf
sudo mkdir sites-enabled
cd sites-enabled
sudo wget https://gist.github.com/jtadeulopes/7237731/raw/65ffd7a834c24f389ac06b96bd8492d80cc60259/localhost.conf
cd /etc/init
sudo wget https://gist.github.com/jtadeulopes/7237115/raw/594f0904b8e52c7001430727b6925d6298258432/nginx.conf
Now, you can run:
sudo (start|restart|stop) nginx
See https://help.github.com/articles/generating-ssh-keys#platform-linux
sudo adduser deploy
sudo mkdir /var/www
sudo chown deploy:deploy -c -R /var/www
Capfile
https://gist.github.com/jtadeulopes/7249948
deploy.rb
https://gist.github.com/jtadeulopes/7249921
For each project, you must create the puma upstart file
cd /etc/init
Download the gist https://gist.github.com/jtadeulopes/7254953#file-project-conf
With the upstart for each project, you can run:
sudo (start|restart|stop) project
cd my/project/path/config
wget https://gist.github.com/jtadeulopes/7265503/raw/25ce868f791fd0f79b7f4fe4be81fd4b31f46b69/puma.rb
sudo apt-get install monit
cd /etc/monit/conf.d
wget https://gist.github.com/jtadeulopes/7270279/raw/61f438b221250b5a38dda7d947af03040442349a/project.conf
Edit /etc/monitrc
set daemon 60
Restart monit
sudo /etc/init.d/monit restart