Created
November 19, 2013 23:56
-
-
Save shanaver/7554827 to your computer and use it in GitHub Desktop.
sample capistrano deploy (for a php/wordpress site)
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
#set :deploy_location, "production" | |
set :deploy_location, Proc.new { deploy_location = Capistrano::CLI.ui.ask "------------\nEnter deploy location:\n'admin' (default) --> admin.kony2012.com\n'production' --> www.kony2012.com" } | |
if "#{deploy_location}" == "production" | |
set :application, "xxxx.us" | |
set :ip_address, "154.225.148.112" | |
set :branch, "master" | |
set :location, "production" | |
else | |
set :deploy_location, "staging" | |
set :application, "xxxx.us" | |
set :ip_address, "154.225.148.112" | |
set :branch, "master" | |
set :location, "staging" | |
end | |
role :app, "#{ip_address}" | |
role :web, "#{ip_address}" | |
role :db, "#{ip_address}", :primary => true | |
set :deploy_to, "/sites/#{application}" | |
set :deploy_via, :remote_cache | |
set :checkout, "export" | |
set :scm, "git" | |
set :repository, "git@github.com:xxx/xxxxxx.us.git" | |
default_run_options[:pty] = true | |
set :ssh_options, { :forward_agent => true} | |
set :user, "bshanaver" | |
#set :password, 'xxxxx' | |
set :use_sudo, "false" | |
after 'deploy:update', 'deploy:move_config_files' | |
after "deploy:restart", "deploy:cleanup" | |
namespace :deploy do | |
desc "Put the enviroment config files in place" | |
task :move_config_files, :roles => :app do | |
run "#{ try_sudo } mv #{current_path}/config/wp-config.#{deploy_location}.php #{current_path}/wp-config.php" | |
run "#{ try_sudo } mv #{current_path}/config/.htaccess.#{deploy_location} #{current_path}/.htaccess" | |
end | |
desc "Restart Apache" | |
task :restart, :roles => :app do | |
invoke_command "apache2ctl graceful", :via => run_method | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment