# # Capistrano 3 deployment configuration # # http://www.capistranorb.com/ # https://semaphoreapp.com/blog/2013/11/26/capistrano-3-upgrade-guide.html # defaults that can be updated from the environment set :branch, ENV["REVISION"] || ENV["BRANCH_NAME"] || "master" # you probably want to change these set :application, 'foodsoft' # application name (whatever you like) set :domain, 'order.foodcoop.test' # host set :user, 'deploy' # ssh deploy user set :default_stage, 'staging' # default environment, see config/deploy/ set :keep_releases, 10 set :repo_url, 'git://github.com/foodcoops/foodsoft.git' set :unique_app_name, fetch(:application) # for more complex setups, this can be customised # XXX how to get rails environment in here? set :deploy_to, "/www/apps/#{fetch :unique_app_name}" # more settings which are probably ok set :log_level, :info set :linked_files, %w{config/database.yml config/app_config.yml config/initializers/secret_token.rb} set :linked_dirs, %w{bin log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system} # assuming one server for everything, with one user for deploy and one for resque server fetch(:domain), user: fetch(:user), roles: [:web, :app, :resque, :db] # if you use RVM, uncomment the line in Capfile, and optionally uncomment rvm settings # set :rvm_ruby_string, :local # task hooks namespace :deploy do desc 'Restart application' task :restart do on roles(:app), in: :sequence, wait: 5 do # tell mod_passenger to reload the application execute :touch, release_path.join('tmp/restart.txt') end end after :restart, 'resque:restart' after :restart, :clear_cache do on roles(:web), in: :groups, limit: 3, wait: 10 do within release_path do execute :rake, 'cache:clear' end end end after :finishing, 'deploy:cleanup' end