Skip to content

Instantly share code, notes, and snippets.

@mrofi
Created April 6, 2016 05:15
Show Gist options
  • Save mrofi/5bb92fe2563d8149c7d6d4f9e1fdecc6 to your computer and use it in GitHub Desktop.
Save mrofi/5bb92fe2563d8149c7d6d4f9e1fdecc6 to your computer and use it in GitHub Desktop.
Caps deploy File
# config valid only for Capistrano 3.1
lock '3.4.0'
set :application, 'fooobar'
set :repo_url, '[email protected]:foo/bar.git'
# Default branch is :master
# ask :branch, proc { `git rev-parse --abbrev-ref HEAD`.chomp }.call
# Default deploy_to directory is /var/www/my_app
set :deploy_to, '/home/foobar/foobar-dev'
# Default value for :scm is :git
# set :scm, :git
# Default value for :format is :pretty
# set :format, :pretty
# Default value for :log_level is :debug
# set :log_level, :debug
# Default value for :pty is false
# set :pty, true
# Default value for :linked_files is []
set :linked_files, fetch(:linked_files, []).push('.env')
# Default value for linked_dirs is []
set :linked_dirs, fetch(:linked_dirs, []).push('public/uploads', 'public/rawuploads')
# Default value for default_env is {}
# set :default_env, { path: "/opt/ruby/bin:$PATH" }
# Default value for keep_releases is 5
# set :keep_releases, 5
namespace :deploy do
desc 'Restart application'
task :restart do
on roles(:app), in: :sequence, wait: 5 do
execute "chmod o+w #{release_path.join('storage')} -R"
execute "cd '#{release_path}'; composer update"
execute "cd '#{release_path}'; composer dump-autoload"
execute "cd '#{release_path}'; php artisan clear-compiled"
execute "cd '#{release_path}'; php artisan optimize"
execute "cd '#{release_path}'; php artisan elfinder:publish"
# execute "cd '#{release_path}'; php artisan migrate"
end
end
before :publishing, :restart
after :restart, :clear_cache do
on roles(:web), in: :groups, limit: 3, wait: 10 do
# Here we can do anything such as:
# within release_path do
# execute :rake, 'cache:clear'
# end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment