Created
December 22, 2009 18:54
-
-
Save danielvlopes/261939 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# simple capistrano task for wordpress deploy | |
# just replace the content to fit your app path and names | |
# and run cap deploy:setup && cap deploy | |
# you can also run a cap wordpress:upload_config to copy the local config-sample.php to remote shared folder | |
# warning: this recipe don't create the database | |
# APP SETTINGS | |
set :application, "your_app_name" | |
set :domain_name , "yourdomain.com.br" | |
# GIT SETTINGS | |
set :scm, :git | |
set :repository, "." | |
set :branch, "master" | |
set :deploy_via, :copy | |
set :copy_cache, true | |
# SSH SETTINGS | |
set :user , "your_ssh_user" | |
set :deploy_to, "/home/your/app/path/in/server/#{application}" | |
set :shared_directory, "#{deploy_to}/shared" | |
set :use_sudo, false | |
set :group_writable, false | |
default_run_options[:pty] = true | |
# ROLES | |
role :web, domain_name | |
set :shared_wordpress, "#{shared_path}/wordpress" | |
set :wp_content, ["wp-content/avatars", | |
"wp-content/uploads", | |
"wp-content/cache", | |
"wp-content/ads"] | |
after 'deploy:setup' , 'wordpress:setup' | |
after 'deploy:symlink' , 'wordpress:update' | |
namespace :deploy do | |
[:start, :stop, :restart].each do |t| | |
desc "#{t} task is a no-op with php" | |
task t, :roles => :app do ; end | |
end | |
end | |
namespace :wordpress do | |
desc "Setup application symlinks in the public" | |
task :setup, :roles => [:web] do | |
wp_content.each do |folder| | |
run "mkdir -p #{shared_wordpress}/#{folder}" | |
end | |
end | |
desc "Link wp-content to shared folder" | |
task :update, :roles => [:web] do | |
wp_content.each do |folder| | |
run "rm -rf #{current_path}/#{folder}" | |
run "ln -nfs #{shared_wordpress}/#{folder} #{current_path}/#{folder}" | |
end | |
run("rm -f #{current_path}/wp-config.php") | |
run("ln -nfs #{shared_wordpress}/wp-config.php #{current_path}/wp-config.php") | |
end | |
desc "upload wp-config.php" | |
task :upload_config do | |
upload File.join(File.dirname(__FILE__), "..", "wp-config-sample.php"), "#{shared_wordpress}/wp-config.php" | |
run "ln -nfs #{shared_wordpress}/wp-config.php #{current_path}/wp-config.php" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment