|
| 1 | +# config valid only for Capistrano 3.1 |
| 2 | +lock '3.2.1' |
| 3 | + |
| 4 | +set :application, 'gas-api' |
| 5 | +set :repo_url, 'https://github.com/GeekSoc/gas-api.git' |
| 6 | + |
| 7 | +# Default branch is :master |
| 8 | +# ask :branch, proc { `git rev-parse --abbrev-ref HEAD`.chomp }.call |
| 9 | + |
| 10 | +# Default deploy_to directory is /var/www/my_app |
| 11 | +# set :deploy_to, '/home/asmillie/public_html/cap_test' |
| 12 | + |
| 13 | +# Default value for :scm is :git |
| 14 | +# set :scm, :git |
| 15 | + |
| 16 | +# Default value for :format is :pretty |
| 17 | +# set :format, :pretty |
| 18 | + |
| 19 | +# Default value for :log_level is :debug |
| 20 | +set :log_level, :info |
| 21 | + |
| 22 | +# Default value for :pty is false |
| 23 | +# set :pty, true |
| 24 | + |
| 25 | +# Default value for :linked_files is [] |
| 26 | +# set :linked_files, %w{config/database.yml} |
| 27 | +set :linked_files, %w{config.php} |
| 28 | + |
| 29 | +# Default value for linked_dirs is [] |
| 30 | +# set :linked_dirs, %w{bin log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system} |
| 31 | + |
| 32 | +# Default value for default_env is {} |
| 33 | +# set :default_env, { path: "/opt/ruby/bin:$PATH" } |
| 34 | + |
| 35 | +# Default value for keep_releases is 5 |
| 36 | +# set :keep_releases, 5 |
| 37 | + |
| 38 | + |
| 39 | + |
| 40 | +namespace :deploy do |
| 41 | + |
| 42 | + desc 'Restart application' |
| 43 | + task :restart do |
| 44 | + on roles(:app), in: :sequence, wait: 5 do |
| 45 | + # Your restart mechanism here, for example: |
| 46 | + # execute :touch, release_path.join('tmp/restart.txt') |
| 47 | + end |
| 48 | + end |
| 49 | + |
| 50 | + after :publishing, :restart |
| 51 | + |
| 52 | + after :restart, :clear_cache do |
| 53 | + on roles(:web), in: :groups, limit: 3, wait: 10 do |
| 54 | + # Here we can do anything such as: |
| 55 | + # within release_path do |
| 56 | + # execute :rake, 'cache:clear' |
| 57 | + # end |
| 58 | + end |
| 59 | + end |
| 60 | + |
| 61 | +end |
0 commit comments