Created
February 28, 2009 21:45
-
-
Save altamic/72121 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# deploy.rb | |
require 'yaml' | |
APP_CONFIG = YAML.load(File.read(RAILS_ROOT + "/config/app_config.yml")) | |
default_run_options[:pty] = true | |
set :user, APP_CONFIG['user'] | |
set :domain, APP_CONFIG['domain'] | |
set :application, APP_CONFIG['application'] | |
set :scm, 'git' | |
set :repository, "#{user}@#{domain}:#{application}.git" | |
set :deploy_to, "/home/#{user}/#{domain}" | |
set :deploy_via, :remote_cache | |
set :branch, 'master' | |
set :git_shallow_clone, 1 | |
set :scm_verbose, true | |
set :use_sudo, false | |
server domain, :app, :web | |
role :db, domain, :primary => true | |
namespace :deploy do | |
desc "Ask Passenger to restart the web server." | |
task :restart do | |
run "touch #{current_path}/tmp/restart.txt" | |
end | |
desc "Symlink shared configuration and folders on each release." | |
task :symlink_shared do | |
run "ln -nfs #{shared_path}/config/database.yml #{release_path}/config/database.yml" | |
run "ln -nfs #{shared_path}/assets #{release_path}/public/assets" | |
end | |
desc "Sync the public/asset directory." | |
task :assets do | |
system "rsync -vr --exclude='.DS_Store' public/assets #{user}@#{domain}:#{shared_path}/" | |
end | |
end | |
after 'deploy:update_code', 'deploy:symlink_shared' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment