diff options
author | Harald Eilertsen <haraldei@anduin.net> | 2018-09-18 20:46:42 +0200 |
---|---|---|
committer | Harald Eilertsen <haraldei@anduin.net> | 2018-09-18 20:46:42 +0200 |
commit | 1f412e21e5bfd09ac9717a1fb09b329ba54c2fc2 (patch) | |
tree | e649e7d8c59ae6116e3c5b6816bbc2251d657e14 /config | |
parent | 6f58dfae95befeeb4b654c7cb43389255dcb41cc (diff) | |
download | norsk-urskog-registrations-1f412e21e5bfd09ac9717a1fb09b329ba54c2fc2.tar.gz norsk-urskog-registrations-1f412e21e5bfd09ac9717a1fb09b329ba54c2fc2.tar.bz2 norsk-urskog-registrations-1f412e21e5bfd09ac9717a1fb09b329ba54c2fc2.zip |
Fix deploy scripts.
+ Ask for branch to deploy for staging (default is current branch)
+ Fix shared path in deploy script
+ Fix uploading of config and env files if they don't exist
Diffstat (limited to 'config')
-rw-r--r-- | config/deploy.rb | 7 | ||||
-rw-r--r-- | config/deploy/staging.rb | 4 |
2 files changed, 7 insertions, 4 deletions
diff --git a/config/deploy.rb b/config/deploy.rb index bd5965c..8240df3 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -4,6 +4,7 @@ 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' @@ -25,11 +26,11 @@ namespace :deploy do + "accept_registrations:\n" + " start: YYYY.MM.DD\n" + " stop: YYYY.MM.DD\n" - IO.write(t.name, template) + IO.write(f.name, template) end file '.env' do |f| - IO.write(t.name, "NUREG_BASE=/\n") + IO.write(f.name, "export NUREG_BASE=/\n") end before 'check:linked_files', :upload_config => ['config.yml', '.env'] do |t| @@ -37,7 +38,7 @@ namespace :deploy do t.prerequisites.each do |r| target_file = File.join(fetch(:shared_directory), r) unless test("[ -f #{target_file} ]") - upload!(t.prerequisites.first, target_file) + upload!(r, target_file) end end end diff --git a/config/deploy/staging.rb b/config/deploy/staging.rb index 469e3e0..20732be 100644 --- a/config/deploy/staging.rb +++ b/config/deploy/staging.rb @@ -1,2 +1,4 @@ server 'volse.local', user: 'norskurskog', roles: %w{app db web} -set :branch, 'staging' + +# Ask for which branch to deploy, default is current branch. +ask :branch, proc { `git rev-parse --abbrev-ref HEAD`.chomp }.call |