# Band registration form for Norsk Urskog Metal Sampler # Copyright (C) 2015-2018 Harald Eilersen # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Affero General Public License for more details. # # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see . # config valid only for current version of Capistrano lock '3.11.0' set :application, 'registration' set :repo_url, 'https://code.volse.no/norsk-urskog-registrations.git' set :deploy_to, '/usr/home/norskurskog/www/registration' set :shared_directory, File.join(fetch(:deploy_to), 'shared') append :linked_files, 'config.yml', '.env' append :linked_dirs, 'public/uploads', 'bin', 'log', 'tmp' set :bundle_binstubs, -> { shared_path.join('bin') } # 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 file 'config.yml' do |f| template = "---\n" + "contact_email: contact@example.com\n" + "smtp:\n" + " address: localhost\n" + " port: 25\n" + "accept_registrations:\n" + " start: YYYY.MM.DD\n" + " stop: YYYY.MM.DD\n" IO.write(f.name, template) end file '.env' do |f| IO.write(f.name, "export NUREG_BASE=/\n") end before 'check:linked_files', :upload_config => ['config.yml', '.env'] do |t| on roles(:app) do t.prerequisites.each do |r| target_file = File.join(fetch(:shared_directory), r) unless test("[ -f #{target_file} ]") upload!(r, target_file) end end end end 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