# config valid only for current version of Capistrano lock '3.11.2' set :application, 'SmartsalesSX' set :deploy_user, 'deploy' set :deploy_to, '/home/deploy/apps/SmartsalesSX' # setup repo details #set :scm, :git set :repo_url, 'git@gitlab.com:code2lab/SXRestaurant.git' # setup rbenv. set :rbenv_prefix, "RBENV_ROOT=#{fetch(:rbenv_path)} RBENV_VERSION=#{fetch(:rbenv_ruby)} #{fetch(:rbenv_path)}/bin/rbenv exec" set :rbenv_map_bins, %w{rake gem bundle ruby rails} # how many old releases do we want to keep, not much set :keep_releases, 5 # files we want symlinking to specific entries in shared set :linked_files, %w{config/database.yml config/secrets.yml} # dirs we want symlinking to shared set :linked_dirs, %w{log tmp/pids tmp/puma tmp/cache tmp/sockets vendor/bundle public/system} # what specs should be run before deployment is allowed to # continue, see lib/capistrano/tasks/run_tests.cap set :tests, [] set :pty, true #set :puma_state, "#{shared_path}/tmp/pids/puma.state" #set :puma_pid, "#{shared_path}/tmp/pids/puma.pid" set :puma_bind, %w(tcp://0.0.0.0:9393) #set :puma_conf, "#{shared_path}/puma.rb" #set :puma_access_log, "#{shared_path}/log/puma_access.log" #set :puma_error_log, "#{shared_path}/log/puma_error.log" #set :puma_role, :app set :puma_env, fetch(:rack_env, fetch(:rails_env, 'production')) set :puma_threads, [0, 16] set :puma_workers, 2 #set :puma_worker_timeout, nil #set :puma_init_active_record, false #set :puma_preload_app, false #set :puma_daemonize, false #set :puma_plugins, [] #accept array of plugins #set :puma_tag, fetch(:application) #set :puma_restart_command, 'bundle exec puma' #set :enable_ssl, true # which config files should be copied by deploy:setup_config # see documentation in lib/capistrano/tasks/setup_config.cap # for details of operations set(:config_files, %w( database.yml log_rotation monit.conf sidekiq_init.sh sidekiq.yml )) # which config files should be made executable after copying # by deploy:setup_config set(:executable_config_files, %w( sidekiq_init.sh )) # files which need to be symlinked to other parts of the # filesystem. For example nginx virtualhosts, log rotation # init scripts etc. The full_app_name variable isn't # available at this point so we use a custom template {{}} # tag and then add it at run time. set(:symlinks, [ { source: "sidekiq_init.sh", link: "/etc/init.d/sidekiq_{{full_app_name}}" }, { source: "log_rotation", link: "/etc/logrotate.d/{{full_app_name}}" }, { source: "monit", link: "/etc/monit/conf.d/{{full_app_name}}.conf" } ]) # this: # http://www.capistranorb.com/documentation/getting-started/flow/ # is worth reading for a quick overview of what tasks are called # and when for `cap stage deploy` namespace :deploy do # make sure we're deploying what we think we're deploying before :deploy, "deploy:check_revision" # only allow a deploy with passing tests to deployed before :deploy, "deploy:run_tests" # compile assets locally then rsync after 'deploy:symlink:shared', 'deploy:compile_assets_locally' Rake::Task["deploy:assets:precompile"].clear_actions after :finishing, 'deploy:cleanup' #nginx will be install in the Load Balancer - No need to deploy there # remove the default nginx configuration as it will tend # to conflict with our configs. #before 'deploy:setup_config', 'nginx:remove_default_vhost' # reload nginx to it will pick up any modified vhosts from # setup_config #after 'deploy:setup_config', 'nginx:reload' # Restart monit so it will pick up any monit configurations # we've added #after 'deploy:setup_config', 'monit:restart' # As of Capistrano 3.1, the `deploy:restart` task is not called # automatically. after 'finishing', 'puma:jungle:restart' end