-
-
Save Big-Shark/c69a2b0bcbbf94dd0517 to your computer and use it in GitHub Desktop.
deploy.rb
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 :application, "App" | |
set :repository, "https://github.com/.../..." | |
set :host, "ip" | |
set :user, "user" | |
set :admin_runner, "runner" | |
set :use_sudo, false | |
set :deploy_to, "/var/www/app/www/" | |
set :normalize_asset_timestamps, false | |
set :deploy_via, :remote_cache | |
ssh_options[:forward_agent] = true | |
set :scm, :git | |
namespace :deploy do | |
task :post_symlink, :except => { :no_release => true } do | |
["app/config/production", "app/storage/sessions", "app/storage/logs"].each do |path| | |
run "ln -fs #{shared_path}/#{path} #{release_path}/#{path}" | |
end | |
end | |
end | |
# set :scm, :git # You can set :scm explicitly or Capistrano will make an intelligent guess based on known version control directory names | |
# Or: `accurev`, `bzr`, `cvs`, `darcs`, `git`, `mercurial`, `perforce`, `subversion` or `none` | |
role :web, "user@ip" # Your HTTP server, Apache/etc | |
after "deploy:update_code", "composer:install" | |
after "deploy:update_code", "deploy:post_symlink" | |
before "composer:install", "composer:copy_vendors" | |
after "deploy:update_code", "artisan:migration" | |
after "deploy:update_code", "artisan:optimize" | |
namespace :composer do | |
desc "Copy vendors from previous release" | |
task :copy_vendors, :except => { :no_release => true } do | |
run "if [ -d #{previous_release}/vendor ]; then cp -a #{previous_release}/vendor #{latest_release}/vendor; fi" | |
end | |
task :install do | |
run "sh -c 'cd #{release_path} && composer install'" | |
end | |
end | |
namespace :artisan do | |
task :migration do | |
run "sh -c 'cd #{release_path} && php artisan migrate'" | |
end | |
task :optimize do | |
run "sh -c 'cd #{release_path} && php artisan optimize'" | |
end | |
end | |
# if you want to clean up old releases on each deploy uncomment this: | |
# after "deploy:restart", "deploy:cleanup" | |
# if you're still using the script/reaper helper you will need | |
# these http://github.com/rails/irs_process_scripts | |
# If you are using Passenger mod_rails uncomment this: | |
# namespace :deploy do | |
# task :start do ; end | |
# task :stop do ; end | |
# task :restart, :roles => :app, :except => { :no_release => true } do | |
# run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}" | |
# end | |
# end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment