Skip to content

Instantly share code, notes, and snippets.

@rachid
Created December 6, 2010 14:18
Show Gist options
  • Save rachid/730331 to your computer and use it in GitHub Desktop.
Save rachid/730331 to your computer and use it in GitHub Desktop.
simple-capistrano-file
# install rails3 with passenger gem
require 'bundler/capistrano'
# first setup your user on your vps, adjust the recipe and do the following commands
# cap deploy:setup
# cap deploy:cold
# cap deploy
set :application, "app-name" #will be used to for you git repository appname
set :domain, 'your.slicehost.com'
set :gitdomain, 'git.somewhere.com'
set :user, 'someuser'
set :repository, "ssh://gitrepos@#{gitdomain}/~/#{application}.git"
set :scm, :git
set :deploy_via, :remote_cache
# set :deploy_via, :copy
# set :copy_strategy, :export
# set :copy_compression, :zip
set :deploy_to, "/home/#{someuser}/websites/#{domain}"
# Or: `accurev`, `bzr`, `cvs`, `darcs`, `git`, `mercurial`, `perforce`, `subversion` or `none`
set :ssh_options, { :paranoid => true}
default_run_options[:pty] = true
set :spinner, false
set :use_sudo, true
role :web, domain # Your HTTP server, Apache/etc
role :app, domain # This may be the same as your `Web` server
role :db, domain, :primary => true # This is where Rails migrations will run
namespace :mod_rails do
desc "Restart Application"
task :restart, :roles => :app do
run "touch #{current_path}/tmp/restart.txt"
end
end
namespace :deploy do
desc "Symlink shared configs and folders on each release."
task :symlink_shared do
run "ln -nfs #{shared_path}/assets #{release_path}/public/assets"
end
end
namespace :deploy do
%w(start restart).each { |name| task name, :roles => :app do mod_rails.restart end }
end
after 'deploy:update_code', 'deploy:symlink_shared'
after 'deploy:symlink_shared', 'deploy:update_crontab'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment