Skip to content

Instantly share code, notes, and snippets.

@JCook21
Created November 11, 2012 18:29
Show Gist options
  • Star 15 You must be signed in to star a gist
  • Fork 6 You must be signed in to fork a gist
  • Save JCook21/4055797 to your computer and use it in GitHub Desktop.
Save JCook21/4055797 to your computer and use it in GitHub Desktop.
Sample Capifony Deployment script
# Deployment server info
set :application, "APP NAME"
set :domain, "APP DOMAIN NAME"
set :deploy_to, "/path/on/live/server"
set :app_path, "app"
set :web_path, "web"
set :maintenance_basename, "maintenance"
# SCM info
set :repository, "GIT REMOTE REPO URL"
set :scm, :git
set :deploy_via, :remote_cache
set :model_manager, "doctrine"
# Role info. I don't think this is particularly important for Capifony...
role :web, domain # Your HTTP server, Apache/etc
role :app, domain # This may be the same as your `Web` server
role :db, domain, :primary => true # This is where Symfony2 migrations will run
# General config stuff
set :keep_releases, 10
set :shared_files, ["app/config/parameters.yml"] # This stops us from having to recreate the parameters file on every deploy.
set :shared_children, [app_path + "/logs", web_path + "/uploads", "vendor"]
set :permission_method, :acl
set :use_composer, true
# Confirmations will not be requested from the command line.
set :interactive_mode, false
# The following line tells Capifony to deploy the last Git tag.
# Since Jenkins creates and pushes a tag following a successful build this should always be the last tested version of the code.
set :branch, `git tag`.split("\n").last
# User details for the production server
set :user, "deploy"
set :use_sudo, false
ssh_options[:forward_agent] = true
ssh_options[:keys] = [File.join(ENV["HOME"], ".ssh", "KEY FILE NAME")]
# Uncomment this if you need more verbose output from Capifony
#logger.level = Logger::MAX_LEVEL
# Run migrations before warming the cache
before "symfony:cache:warmup", "symfony:doctrine:migrations:migrate"
# Custom(ised) tasks
namespace :deploy do
# Apache needs to be restarted to make sure that the APC cache is cleared.
# This overwrites the :restart task in the parent config which is empty.
desc "Restart Apache"
task :restart, :except => { :no_release => true }, :roles => :app do
run "sudo service apache2 restart"
puts "--> Apache successfully restarted".green
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment