Skip to content

Instantly share code, notes, and snippets.

@mrinterweb
Created July 25, 2012 02:46
Show Gist options
  • Save mrinterweb/3174085 to your computer and use it in GitHub Desktop.
Save mrinterweb/3174085 to your computer and use it in GitHub Desktop.
Wordpress site deployment using capistrano
set :application, 'www.mysite.com'
set :deploy_to, "/srv/www.mysite.com"
set :domain, "www.mysite.com"
set :user, "deploymentuser"
set :scm, :git
set :repository, "git@github.com:myusername/myproject.git"
set :branch, :master
set :deploy_via, :remote_cache
set :copy_exclude, ['.git']
ssh_options[:forward_agent] = true
ssh_options[:keys] = %w(~/.ssh/id_rsa)
set :use_sudo, false
role :web, "www.mysite.com" # Your HTTP server, Apache/etc
role :app, "www.mysite.com" # This may be the same as your `Web` server
set :copy_exclude, [".git", ".DS_Store", ".gitignore", ".gitmodules", "wp-content/uploads", "sitemap.xml", "sitemap.xml.gz"]
after "deploy:update_code" do
run "ln -nfs #{release_path}/wp-config.php.production #{release_path}/wp-config.php"
run "ln -nfs #{release_path}/.htaccess.production #{release_path}/.htaccess"
[
['uploads', 'wp-content/uploads'],
['plugins', 'wp-content/plugins'],
['upgrade', 'wp-content/upgrade'],
['w3tc', 'wp-content/w3tc'],
['w3-total-cache-config.php', 'wp-content/w3-total-cache-config.php'],
['plugins/w3-total-cache/wp-content/advanced-cache.php', 'wp-content/advanced-cache.php'],
['sitemap.xml', 'sitemap.xml'],
['sitemap.xml.gz', 'sitemap.xml.gz']
].each do |arr|
run "ln -nfs #{shared_path}/#{arr.first} #{release_path}/#{arr.last}"
run "chmod g-w #{release_path}/wp-content"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment