Skip to content

Instantly share code, notes, and snippets.

@jacobat
Created June 30, 2009 09:40
Show Gist options
  • Select an option

  • Save jacobat/138094 to your computer and use it in GitHub Desktop.

Select an option

Save jacobat/138094 to your computer and use it in GitHub Desktop.
set :application, "[application name here]"
set :repository, "."
set :deploy_to, "[where you want the code to go]"
set :scm, :git
set :branch, "master"
set :use_sudo, false
set :deploy_via, :copy
set :copy_cache, true
set :copy_exclude, [".git", "materials"]
set :www_user, "[name of the user the webserver runs as]"
role :app, "[servername]"
role :web, "[servername]"
role :db, "[servername]", :primary => true
namespace :deploy do
task :update do
transaction do
update_code
symlink
end
end
task :finalize_update do
transaction do
run "chmod -R g+w #{releases_path}/#{release_name}"
end
end
task :symlink do
transaction do
run "ln -nfs #{current_release} #{deploy_to}/#{current_dir}"
run "ln -nfs #{current_release}/config/apache.conf /usr/local/etc/apache22/sites/#{application}.conf"
run "rm -rf #{current_release}/public/wp-content/uploads"
run "ln -nfs #{shared_path}/uploads #{current_release}/public/wp-content/uploads"
run "ln -nfs #{shared_path}/htaccess #{current_release}/public/.htaccess"
end
end
task :migrate do
# nothing
end
task :restart do
# nothing
end
task :setup_upload_dir do
run "mkdir -p #{shared_path}/uploads"
sudo "chgrp #{www_user} #{shared_path}/uploads"
run "touch #{shared_path}/htaccess"
sudo "chgrp #{www_user} #{shared_path}/htaccess"
end
end
after "deploy:setup", "deploy:setup_upload_dir"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment