Skip to content

Instantly share code, notes, and snippets.

@mattfordham
Created February 27, 2013 17:05
Show Gist options
  • Save mattfordham/5049581 to your computer and use it in GitHub Desktop.
Save mattfordham/5049581 to your computer and use it in GitHub Desktop.
ExpressionEngine Capistrano deploy.rb
set :application, "example.com"
server "SERVER_ADDRESS_GOES_HERE", :app, :web, :db, :primary => true
set :address, "SERVER_ADDRESS_GOES_HERE"
set :deploy_to, "/var/www/vhosts/domain.com/#{application}"
set :user, "user_name"
set :use_sudo, false
default_run_options[:pty] = true
set :repository, ""
set :scm, :git
set :branch, "master"
set :deploy_via, :remote_cache
set :copy_strategy, :checkout
set :keep_releases, 5
# Deployment process
before "deploy", "deploy:check_revision"
after "deploy", "deploy:create_symlinks", "deploy:set_permissions"
after "deploy:setup", "deploy:create_ee_images"
# 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
desc "Create symlinks to shared data such as config files and uploaded images"
task :create_symlinks, :roles => :app do
run "ln -s #{deploy_to}/#{shared_dir}/ee_images #{current_release}/public/static/ee_images"
end
desc "Create ee_images directory"
task :create_ee_images, roles: :app do
run "mkdir #{deploy_to}/#{shared_dir}/ee_images"
end
desc "Set the correct permissions for the config files and cache folder"
task :set_permissions, :roles => :app do
run "chmod 666 #{current_release}/public/index.php"
run "chmod 777 #{current_release}/ee_system/expressionengine/cache/"
run "chmod 666 #{current_release}/ee_system/expressionengine/config/config.php"
run "chmod 666 #{current_release}/ee_system/expressionengine/config/database.php"
end
desc "Make sure local git is in sync with remote."
task :check_revision, roles: :app do
unless `git rev-parse HEAD` == `git rev-parse origin/master`
puts "WARNING: HEAD is not the same as origin/master"
puts "Run `git push` to sync changes."
exit
end
end
desc "Upload development images to production"
task :upload_images, roles: :app do
system "rsync -r -u -v public/static/ee_images/ #{user}@#{address}:#{shared_path}/ee_images"
end
end
@paynecodes
Copy link

Actually, I'm realizing that your doing this for other Cap tasks you have created. This is all new to me, and Sublime is highlighting these lines like there is a problem. Perhaps this is the intended syntax?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment