Skip to content

Instantly share code, notes, and snippets.

@aaronrussell
Created May 19, 2010 12:31
Show Gist options
  • Save aaronrussell/406258 to your computer and use it in GitHub Desktop.
Save aaronrussell/406258 to your computer and use it in GitHub Desktop.
# Taken from http://frst.in/~8r
# Configuration
set :application, "your.domain.com"
set :deploy_to, "/var/www/app"
set :repository, "git@github.com:username/project.git"
set :branch, "master"
set :user, "username"
# Additional SCM settings
set :scm, :git
set :ssh_options, { :forward_agent => true }
set :deploy_via, :remote_cache
set :copy_strategy, :checkout
set :keep_releases, 3
set :use_sudo, false
set :copy_compression, :bz2
# Roles
role :app, "#{application}"
role :web, "#{application}"
role :db, "#{application}", :primary => true
# Deployment process
after "deploy:update", "deploy:cleanup"
# Deployment process
after "deploy:update", "deploy:cleanup"
after "deploy", "deploy:sort_files_and_directories"
# Custom deployment tasks
namespace :deploy do
desc "This is here to overide the original :restart"
task :restart, :roles => :app do
# do nothing but overide the default
end
task :finalize_update, :roles => :app do
run "chmod -R g+w #{latest_release}" if fetch(:group_writable, true)
# overide the rest of the default method
end
desc "Create additional directories and update permissions"
task :sort_files_and_directories, :roles => :app do
# create upload and cache directories
run "mkdir #{latest_release}/system/cache"
run "mkdir #{latest_release}/uploads/"
# move config files
run "mv #{previous_release}/system/application/config/config.php #{latest_release}/system/application/config/config.php"
run "mv #{previous_release}/system/application/config/database.php #{latest_release}/system/application/config/database.php"
# move log files
run "mv #{previous_release}/system/logs #{latest_release}/system/logs"
# set permissions
run "chmod 777 #{latest_release}/system/cache"
run "chmod 777 #{latest_release}/system/logs"
run "chmod 777 #{latest_release}/uploads/"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment