Skip to content

Instantly share code, notes, and snippets.

@RainerBlessing
Created February 25, 2012 20:10
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RainerBlessing/1910380 to your computer and use it in GitHub Desktop.
Save RainerBlessing/1910380 to your computer and use it in GitHub Desktop.
Capistrano deploy file for git, nginx, thin and sqlite
require 'bundler/capistrano'
set :application, "videonight"
set :repository, "git://github.com/RainerBlessing/Videonight.git"
set :scm, :git
# Prevents error if not parameter passed, assumes that default 'cap deploy' command
# and should deploy the master branch to the production server
set(:env, 'production') unless exists?(:env)
set(:branch, 'master') unless exists?(:branch)
set :use_sudo, false
set :user, "deploy"
set :group, "www-data"
set :deploy_to, "/var/www/#{application}"
set :deploy_via, :remote_cache
set :deploy_env, 'production'
role :web, "stxvmwebdev" # Your HTTP server, Apache/etc
role :app, "stxvmwebdev" # This may be the same as your `Web` server
role :db, "stxvmwebdev", :primary => true # This is where Rails migrations will run
role :db, "stxvmwebdev"
namespace :deploy do
[:start, :stop, :restart].each do |t|
desc "#{t} server"
task t, :roles => :app do
sudo "/etc/init.d/nginx #{t}"
sudo "/etc/init.d/thin #{t}"
end
end
desc "relink db directory"
#if you use sqlite
task :resymlink, :roles => :app do
run "rm -rf #{current_path}/db && ln -s #{shared_path}/db #{current_path}/db"
end
end
after 'deploy:update', 'deploy:resymlink'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment