Skip to content

Instantly share code, notes, and snippets.

@khoa-le
Created June 6, 2016 15:38
Show Gist options
  • Select an option

  • Save khoa-le/0ce7d2a46f7245ef4b16d14cdfc33b00 to your computer and use it in GitHub Desktop.

Select an option

Save khoa-le/0ce7d2a46f7245ef4b16d14cdfc33b00 to your computer and use it in GitHub Desktop.
Deploy symfony application config with Capifony
# Deployment server info
set :application, "Your Project"
set :domain, "your-domain"
set :deploy_to, "/www/deploy/your-domain"
set :app_path, "app"
set :web_path, "web"
set :maintenance_basename, "maintenance"
set :scm, :git
set :repository, "git@github.com:username/repos.git"
set :deploy_via, :remote_cache
role :web, domain
role :app, domain, :primary => true
set :user, "root"
set :use_sudo, false
ssh_options[:forward_agent] = true
ssh_options[:keys] = [File.join(ENV["HOME"], ".ssh", "ssh-key")]
# General config stuff
set :keep_releases, 3
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, 'master'
# Run migrations before warming the cache
#before "symfony:cache:warmup", "symfony:doctrine:migrations:migrate"
# Custom(ised) tasks
namespace :deploy do
# PHP-FPM 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 PHP-FPM"
task :restart, :except => { :no_release => true }, :roles => :app do
run "sudo service php5-fpm restart"
puts "--> PHP-FPM successfully restarted".green
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment