Skip to content

Instantly share code, notes, and snippets.

@matteosister
Last active December 16, 2015 02:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matteosister/5364880 to your computer and use it in GitHub Desktop.
Save matteosister/5364880 to your computer and use it in GitHub Desktop.
deploy@facile.it
set :application, "Facile"
set :domain, "prod1"
set :deploy_to, "/home/www"
set :repository, "git@localhost/facile.git"
set :scm, :git
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 symfony migrations will run
set :keep_releases, 1
set :use_sudo, false
set :use_orm, false # disabilita il rebuild delle classi
set :deploy_via, :rsync_with_remote_cache
set :git_enable_submodules, 1
set :rsync_options, "-az --delete --exclude '.git'"
#set :shared_files, %w(:shared_files config/databases.yml)
# front controllers
shared_files << "web/index.php"
shared_files << "web/accounts/index.php"
shared_files << "web/report/index.php"
shared_files << "web/sharkleague/index.php"
shared_files << "web/sharkmeal/index.php"
shared_files << "web/ws/index.php"
shared_children << "web/uploads"
shared_children << "web/accounts/uploads"
shared_children << "data/private/uploads"
shared_children << "data/lucene"
namespace :symfony do
namespace :project do
task :clear_controllers do
#run "#{try_sudo} sh -c 'cd #{latest_release} && #{php_bin} ./symfony project:clear-controllers'"
end
end
end
namespace :deploy do
task :update_code, :except => { :no_release => true } do
on_rollback { run "rm -rf #{release_path}; true" }
#strategy.deploy!
logger.info "custom strategy deploy (pretty cool, uh!)"
strategy.update_local_cache
shark.composer
shark.propel
strategy.update_remote_cache
strategy.copy_remote_cache
#
finalize_update
end
end
namespace :shark do
task :composer do
Dir.chdir ".rsync_cache"
system("curl -s https://getcomposer.org/installer | php && php composer.phar -q install")
Dir.chdir "../"
end
task :propel do
Dir.chdir ".rsync_cache"
system("php symfony -q propel:build --all-classes")
Dir.chdir "../"
end
task :clear_apc_cache do
system("php symfony deploy:clear-apc-cache")
end
end
#namespace :sk do
# desc "copia i front controller"
# task :copy_front_controllers do
# upload("web/index.php", "#{latest_release}/web/index.php", :via => :scp)
# end
#end
after "deploy", "deploy:cleanup"
after "deploy:create_symlink", "shark:clear_apc_cache"
#!/bin/bash
ssh-agent bash -c 'ssh-add ~/.ssh/id_rsa && cap HOSTS="prod1,prod2,prod3,prod4,prod5" deploy'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment