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.
This commit is contained in:
Javi Martín
2019-11-02 13:26:32 +01:00
parent d6130cf6e2
commit 6ecd9e59dc

View File

@@ -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
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