From 6ecd9e59dce57287c05c3b99c9b6cea893047541 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javi=20Mart=C3=ADn?= Date: Sat, 2 Nov 2019 13:26:32 +0100 Subject: [PATCH] Update secrets based on the previous release We were copying the current SMTP and SSL settings to the secrets file after overwriting them, but we need to copy them before overwriting them. The workaround I've found is to copy the tasks to the folder of the previous release and execute them there. --- config/deploy.rb | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/config/deploy.rb b/config/deploy.rb index 6dbbca2d4..f5c8c5ef7 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -133,9 +133,19 @@ end task :smtp_and_ssl_secrets do on roles(:app) do - within release_path do + within current_path do with rails_env: fetch(:rails_env) do - execute :rake, "secrets:smtp_and_ssl" + tasks_file_path = "lib/tasks/secrets.rake" + + unless test("[ -e #{current_path}/#{tasks_file_path} ]") + begin + execute "cp #{release_path}/#{tasks_file_path} #{current_path}/#{tasks_file_path}" + + execute :rake, "secrets:smtp_and_ssl" + ensure + execute "rm #{current_path}/#{tasks_file_path}" + end + end end end end