Skip to content

Instantly share code, notes, and snippets.

View tanraya's full-sized avatar

Andrew Kozlov tanraya

  • Astana, Kazakhstan
View GitHub Profile

Configure server for deploy rails app

Objective

Prepare a server for a Rails app with MySQL (percona) + NGINX (passenger)
Deploy rails app in new server with Capistrano v3

For this example we need :

@tanraya
tanraya / deploy.rb
Created April 4, 2012 07:49 — forked from stympy/deploy.rb
Skip asset pre-compilation when deploying if the assets didn't change
namespace :deploy do
namespace :assets do
task :precompile, :roles => :web, :except => { :no_release => true } do
from = source.next_revision(current_revision)
if capture("cd #{latest_release} && #{source.local.log(from)} vendor/assets/ app/assets/ | wc -l").to_i > 0
run %Q{cd #{latest_release} && #{rake} RAILS_ENV=#{rails_env} #{asset_env} assets:precompile}
else
logger.info "Skipping asset pre-compilation because there were no asset changes"
end
end
@tanraya
tanraya / ubuntu_steps.sh
Created March 23, 2012 16:36 — forked from johnrees/_ubuntu_steps.sh
Standard Rails 3.* setup for Ubuntu 10.04 LTS 32
# As root user
# Update the OS
sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade
# Setup Hostname & TimeZone
echo "{{HOSTNAME}}" > /etc/hostname
hostname -F /etc/hostname
dpkg-reconfigure tzdata
@tanraya
tanraya / README.txt
Created March 15, 2012 06:11 — forked from rmm5t/README.md
Locale override examples for the timeago jQuery plugin (http://timeago.yarp.com)
You can represent time statements in most western languages where
a prefix and/or suffix is used.
The default case is to use suffix only (as in English), which you
do by providing the `suffixAgo` and `suffixFromNow` settings in
the strings hash (earlier versions of timeago used the deprecated
`ago` and `fromNow` options). If present, they are used.
2 minutes [suffixAgo]
2 minutes [suffixFromNow]