From 7960e8d7fafb651c781a0e643eb8675ddd4d3204 Mon Sep 17 00:00:00 2001 From: Danilo Filippelli Date: Wed, 14 Apr 2021 14:36:26 +0200 Subject: [PATCH 01/32] Revert version of ruby from amazon repository --- ruby/attributes/ruby.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ruby/attributes/ruby.rb b/ruby/attributes/ruby.rb index fa6c72a63..58c715f7f 100644 --- a/ruby/attributes/ruby.rb +++ b/ruby/attributes/ruby.rb @@ -30,7 +30,7 @@ when "2.3" default[:ruby][:major_version] = "2" default[:ruby][:minor_version] = "3" - default[:ruby][:patch_version] = "4" + default[:ruby][:patch_version] = "7" default[:ruby][:pkgrelease] = "1" default[:ruby][:full_version] = [node[:ruby][:major_version], node[:ruby][:minor_version]].join(".") @@ -39,7 +39,7 @@ when "2.2" default[:ruby][:major_version] = '2' default[:ruby][:minor_version] = '2' - default[:ruby][:patch_version] = "7" + default[:ruby][:patch_version] = "8" default[:ruby][:pkgrelease] = '1' default[:ruby][:full_version] = [node[:ruby][:major_version], node[:ruby][:minor_version]].join(".") @@ -83,4 +83,4 @@ default[:ruby][:version] = '' end -include_attribute "ruby::customize" +include_attribute "ruby::customize" \ No newline at end of file From ba1f27708d1ec861add6531760a85fedde30b9bd Mon Sep 17 00:00:00 2001 From: Danilo Filippelli Date: Thu, 15 Apr 2021 14:44:21 +0200 Subject: [PATCH 02/32] Add a little wrapper to converge confs --- deploy/recipes/hurricane-api.rb | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/deploy/recipes/hurricane-api.rb b/deploy/recipes/hurricane-api.rb index b3764b429..5f8b021da 100644 --- a/deploy/recipes/hurricane-api.rb +++ b/deploy/recipes/hurricane-api.rb @@ -5,6 +5,7 @@ node[:deploy].each do |application, deploy| rails_env = deploy[:rails_env] + rails_env_fixed = rails_env=='preprod' ? 'staging' : rails_env current_path = deploy[:current_path] active_job_with_resque = (node[:hurricane_api_settings][:active_job].present? && node[:hurricane_api_settings][:active_job][:adapter] == 'resque') @@ -61,7 +62,7 @@ group deploy[:group] variables( :hurricane_api_settings => node[:hurricane_api_settings], - :env => rails_env + :env => rails_env_fixed ) only_if do File.exists?("#{deploy[:deploy_to]}/shared/config") @@ -75,7 +76,7 @@ group deploy[:group] variables( :hurricane_api_settings => node[:hurricane_api_settings], - :env => rails_env + :env => rails_env_fixed ) only_if do File.exists?("#{deploy[:deploy_to]}/shared/config") @@ -89,7 +90,7 @@ group deploy[:group] variables( :hurricane_api_settings => node[:hurricane_api_settings], - :env => rails_env + :env => rails_env_fixed ) only_if do File.exists?("#{deploy[:deploy_to]}/shared/config") @@ -103,7 +104,7 @@ group deploy[:group] variables( :hurricane_api_settings => node[:hurricane_api_settings], - :env => rails_env + :env => rails_env_fixed ) only_if do File.exists?("#{deploy[:deploy_to]}/shared/config") @@ -117,7 +118,7 @@ group deploy[:group] variables( :hurricane_api_settings => node[:hurricane_api_settings], - :env => rails_env + :env => rails_env_fixed ) only_if do File.exists?("#{deploy[:deploy_to]}/shared/config") @@ -142,7 +143,7 @@ group deploy[:group] variables( :hurricane_api_settings => node[:hurricane_api_settings], - :env => rails_env + :env => rails_env_fixed ) only_if do File.exists?("#{deploy[:deploy_to]}/shared/config") @@ -157,7 +158,7 @@ group deploy[:group] variables( :hurricane_api_settings => node[:hurricane_api_settings], - :env => rails_env + :env => rails_env_fixed ) only_if do File.exists?("#{deploy[:deploy_to]}/shared/config") @@ -171,7 +172,7 @@ group deploy[:group] variables( :hurricane_api_settings => node[:hurricane_api_settings], - :env => rails_env + :env => rails_env_fixed ) only_if do File.exists?("#{deploy[:deploy_to]}/shared/config") @@ -185,14 +186,14 @@ group deploy[:group] variables( :hurricane_api_settings => node[:hurricane_api_settings], - :env => rails_env + :env => rails_env_fixed ) only_if do File.exists?("#{deploy[:deploy_to]}/shared/config") end end - template "#{deploy[:deploy_to]}/shared/config/environments/#{rails_env}.rb" do + template "#{deploy[:deploy_to]}/shared/config/environments/#{rails_env_fixed}.rb" do source "hurricane-api/environment_config.rb.erb" mode '0660' owner deploy[:user] @@ -236,7 +237,7 @@ group deploy[:group] variables( :hurricane_api_settings => node[:hurricane_api_settings], - :env => rails_env + :env => rails_env_fixed ) only_if do active_job_with_resque && File.exists?("#{deploy[:deploy_to]}/shared/config") @@ -249,7 +250,7 @@ action :restart end - queue_name = ['hurricane_api', rails_env, 'queue'].join('_') + queue_name = ['hurricane_api', rails_env_fixed, 'queue'].join('_') pid_file_name = ['resque_worker', queue_name, '.pid'].join log_file_name = ['resque_worker', queue_name, '.log'].join monit_resque_rc = File.join(node[:monit][:conf_dir], 'resque.monitrc') @@ -265,7 +266,7 @@ :working_dir => deploy[:current_path], :log_file => File.join(deploy[:deploy_to], 'shared', 'log', log_file_name), :queue_name => queue_name, - :env => rails_env, + :env => rails_env_fixed, :home => deploy[:home], :user => deploy[:user] ) From e2790935e70c4e1fdd0998ffe205f1ca059d86b4 Mon Sep 17 00:00:00 2001 From: Danilo Filippelli Date: Thu, 15 Apr 2021 16:06:39 +0200 Subject: [PATCH 03/32] Put ruby back to 2.3.4 --- ruby/attributes/ruby.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ruby/attributes/ruby.rb b/ruby/attributes/ruby.rb index 58c715f7f..0c31d44b5 100644 --- a/ruby/attributes/ruby.rb +++ b/ruby/attributes/ruby.rb @@ -30,7 +30,7 @@ when "2.3" default[:ruby][:major_version] = "2" default[:ruby][:minor_version] = "3" - default[:ruby][:patch_version] = "7" + default[:ruby][:patch_version] = "4" default[:ruby][:pkgrelease] = "1" default[:ruby][:full_version] = [node[:ruby][:major_version], node[:ruby][:minor_version]].join(".") From b7b6cc0b2b96be2e0569c0eafafb4e4654580a8b Mon Sep 17 00:00:00 2001 From: Danilo Filippelli Date: Fri, 16 Apr 2021 09:30:00 +0200 Subject: [PATCH 04/32] Fix env creation --- deploy/recipes/hurricane-api.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deploy/recipes/hurricane-api.rb b/deploy/recipes/hurricane-api.rb index 5f8b021da..bf86a2546 100644 --- a/deploy/recipes/hurricane-api.rb +++ b/deploy/recipes/hurricane-api.rb @@ -193,7 +193,7 @@ end end - template "#{deploy[:deploy_to]}/shared/config/environments/#{rails_env_fixed}.rb" do + template "#{deploy[:deploy_to]}/shared/config/environments/#{rails_env}.rb" do source "hurricane-api/environment_config.rb.erb" mode '0660' owner deploy[:user] From 85d2a8269a65ae92d040f77dfb62e901dbd2eaca Mon Sep 17 00:00:00 2001 From: Danilo Filippelli Date: Fri, 16 Apr 2021 15:41:07 +0200 Subject: [PATCH 05/32] Set link creation if possible --- deploy/recipes/hurricane-api.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/deploy/recipes/hurricane-api.rb b/deploy/recipes/hurricane-api.rb index bf86a2546..bef19d73f 100644 --- a/deploy/recipes/hurricane-api.rb +++ b/deploy/recipes/hurricane-api.rb @@ -205,6 +205,13 @@ File.exists?("#{deploy[:deploy_to]}/shared/config/environments") end end + # hotfix, create preprod symlink on yet created template, so + link "#{current_path}/config/environments/#{rails_env}.rb" + to "#{deploy[:deploy_to]}/shared/config/environments/#{rails_env}.rb" + mode '0660' + owner deploy[:user] + group deploy[:group] + end template "#{deploy[:deploy_to]}/shared/config/initializers/rollbar.rb" do source 'hurricane-api/rollbar.rb.erb' From 8827eb0eed0611a0aae81a99a19bd9f00c7edf9a Mon Sep 17 00:00:00 2001 From: Danilo Filippelli Date: Fri, 16 Apr 2021 15:47:48 +0200 Subject: [PATCH 06/32] Add missing do --- deploy/recipes/hurricane-api.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deploy/recipes/hurricane-api.rb b/deploy/recipes/hurricane-api.rb index bef19d73f..dee7b6a60 100644 --- a/deploy/recipes/hurricane-api.rb +++ b/deploy/recipes/hurricane-api.rb @@ -206,7 +206,7 @@ end end # hotfix, create preprod symlink on yet created template, so - link "#{current_path}/config/environments/#{rails_env}.rb" + link "#{current_path}/config/environments/#{rails_env}.rb" do to "#{deploy[:deploy_to]}/shared/config/environments/#{rails_env}.rb" mode '0660' owner deploy[:user] From d238cd9e7c40ea5845455bb9414c55aaee4fd696 Mon Sep 17 00:00:00 2001 From: Danilo Filippelli Date: Fri, 16 Apr 2021 16:14:57 +0200 Subject: [PATCH 07/32] remove env wrapping --- deploy/recipes/hurricane-api.rb | 28 +++++++++---------- .../default/hurricane-api/secrets.yml.erb | 5 +--- 2 files changed, 15 insertions(+), 18 deletions(-) diff --git a/deploy/recipes/hurricane-api.rb b/deploy/recipes/hurricane-api.rb index dee7b6a60..69b731e04 100644 --- a/deploy/recipes/hurricane-api.rb +++ b/deploy/recipes/hurricane-api.rb @@ -5,7 +5,6 @@ node[:deploy].each do |application, deploy| rails_env = deploy[:rails_env] - rails_env_fixed = rails_env=='preprod' ? 'staging' : rails_env current_path = deploy[:current_path] active_job_with_resque = (node[:hurricane_api_settings][:active_job].present? && node[:hurricane_api_settings][:active_job][:adapter] == 'resque') @@ -48,7 +47,8 @@ owner deploy[:user] group deploy[:group] variables( - :hurricane_api_settings => node[:hurricane_api_settings] + :hurricane_api_settings => node[:hurricane_api_settings], + :env => rails_env ) only_if do File.exists?("#{deploy[:deploy_to]}/shared/config") @@ -62,7 +62,7 @@ group deploy[:group] variables( :hurricane_api_settings => node[:hurricane_api_settings], - :env => rails_env_fixed + :env => rails_env ) only_if do File.exists?("#{deploy[:deploy_to]}/shared/config") @@ -76,7 +76,7 @@ group deploy[:group] variables( :hurricane_api_settings => node[:hurricane_api_settings], - :env => rails_env_fixed + :env => rails_env ) only_if do File.exists?("#{deploy[:deploy_to]}/shared/config") @@ -90,7 +90,7 @@ group deploy[:group] variables( :hurricane_api_settings => node[:hurricane_api_settings], - :env => rails_env_fixed + :env => rails_env ) only_if do File.exists?("#{deploy[:deploy_to]}/shared/config") @@ -104,7 +104,7 @@ group deploy[:group] variables( :hurricane_api_settings => node[:hurricane_api_settings], - :env => rails_env_fixed + :env => rails_env ) only_if do File.exists?("#{deploy[:deploy_to]}/shared/config") @@ -118,7 +118,7 @@ group deploy[:group] variables( :hurricane_api_settings => node[:hurricane_api_settings], - :env => rails_env_fixed + :env => rails_env ) only_if do File.exists?("#{deploy[:deploy_to]}/shared/config") @@ -143,7 +143,7 @@ group deploy[:group] variables( :hurricane_api_settings => node[:hurricane_api_settings], - :env => rails_env_fixed + :env => rails_env ) only_if do File.exists?("#{deploy[:deploy_to]}/shared/config") @@ -158,7 +158,7 @@ group deploy[:group] variables( :hurricane_api_settings => node[:hurricane_api_settings], - :env => rails_env_fixed + :env => rails_env ) only_if do File.exists?("#{deploy[:deploy_to]}/shared/config") @@ -172,7 +172,7 @@ group deploy[:group] variables( :hurricane_api_settings => node[:hurricane_api_settings], - :env => rails_env_fixed + :env => rails_env ) only_if do File.exists?("#{deploy[:deploy_to]}/shared/config") @@ -186,7 +186,7 @@ group deploy[:group] variables( :hurricane_api_settings => node[:hurricane_api_settings], - :env => rails_env_fixed + :env => rails_env ) only_if do File.exists?("#{deploy[:deploy_to]}/shared/config") @@ -244,7 +244,7 @@ group deploy[:group] variables( :hurricane_api_settings => node[:hurricane_api_settings], - :env => rails_env_fixed + :env => rails_env ) only_if do active_job_with_resque && File.exists?("#{deploy[:deploy_to]}/shared/config") @@ -257,7 +257,7 @@ action :restart end - queue_name = ['hurricane_api', rails_env_fixed, 'queue'].join('_') + queue_name = ['hurricane_api', rails_env, 'queue'].join('_') pid_file_name = ['resque_worker', queue_name, '.pid'].join log_file_name = ['resque_worker', queue_name, '.log'].join monit_resque_rc = File.join(node[:monit][:conf_dir], 'resque.monitrc') @@ -273,7 +273,7 @@ :working_dir => deploy[:current_path], :log_file => File.join(deploy[:deploy_to], 'shared', 'log', log_file_name), :queue_name => queue_name, - :env => rails_env_fixed, + :env => rails_env, :home => deploy[:home], :user => deploy[:user] ) diff --git a/deploy/templates/default/hurricane-api/secrets.yml.erb b/deploy/templates/default/hurricane-api/secrets.yml.erb index f6f5f62e3..ed1eac016 100644 --- a/deploy/templates/default/hurricane-api/secrets.yml.erb +++ b/deploy/templates/default/hurricane-api/secrets.yml.erb @@ -1,5 +1,2 @@ -staging: - secret_key_base: <%= @hurricane_api_settings[:secret_key_base] %> - -production: +<%= @env %>: secret_key_base: <%= @hurricane_api_settings[:secret_key_base] %> From 55b93170fbf5c7d1af1a95f09d92023ec316facf Mon Sep 17 00:00:00 2001 From: Danilo Filippelli Date: Fri, 16 Apr 2021 16:34:54 +0200 Subject: [PATCH 08/32] Add preprod rule to hurricane database copy --- deploy/recipes/hurricane-copy-from-production-db.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/deploy/recipes/hurricane-copy-from-production-db.rb b/deploy/recipes/hurricane-copy-from-production-db.rb index 868c9f12c..3d3bafcaa 100644 --- a/deploy/recipes/hurricane-copy-from-production-db.rb +++ b/deploy/recipes/hurricane-copy-from-production-db.rb @@ -5,7 +5,7 @@ production_database = node[:hurricane_api_settings][:production_database] - if deploy[:rails_env] == 'staging' + if deploy[:rails_env] == 'staging' || deploy[:rails_env] == 'preprod' dump_dir = "#{deploy[:deploy_to]}/shared/dump" @@ -164,7 +164,7 @@ end else - Chef::Log.debug('Recipe available only in staging environment') + Chef::Log.debug('Recipe available only in staging/preprod environment') end end From c23940b78bbc1e3db1ab8e38ff76c7c8e16f6ac6 Mon Sep 17 00:00:00 2001 From: Danilo Filippelli Date: Tue, 20 Apr 2021 09:23:12 +0200 Subject: [PATCH 09/32] Externalize to default recipe symlink creation --- deploy/recipes/default.rb | 10 ++++++++++ deploy/recipes/hurricane-api.rb | 7 ------- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/deploy/recipes/default.rb b/deploy/recipes/default.rb index 1c4322755..06b75a9b6 100644 --- a/deploy/recipes/default.rb +++ b/deploy/recipes/default.rb @@ -6,4 +6,14 @@ deploy_data deploy end + rails_env = deploy[:rails_env] + current_path = deploy[:current_path] + # hotfix, create preprod symlink on yet created template, so + link "#{current_path}/config/environments/#{rails_env}.rb" do + to "#{deploy[:deploy_to]}/shared/config/environments/#{rails_env}.rb" + mode '0660' + owner deploy[:user] + group deploy[:group] + end + end diff --git a/deploy/recipes/hurricane-api.rb b/deploy/recipes/hurricane-api.rb index 69b731e04..4aa4ec42e 100644 --- a/deploy/recipes/hurricane-api.rb +++ b/deploy/recipes/hurricane-api.rb @@ -205,13 +205,6 @@ File.exists?("#{deploy[:deploy_to]}/shared/config/environments") end end - # hotfix, create preprod symlink on yet created template, so - link "#{current_path}/config/environments/#{rails_env}.rb" do - to "#{deploy[:deploy_to]}/shared/config/environments/#{rails_env}.rb" - mode '0660' - owner deploy[:user] - group deploy[:group] - end template "#{deploy[:deploy_to]}/shared/config/initializers/rollbar.rb" do source 'hurricane-api/rollbar.rb.erb' From 7d5c9cc9c1284d34ec07c74e1c90f3c66fdb5f1a Mon Sep 17 00:00:00 2001 From: Danilo Filippelli Date: Tue, 20 Apr 2021 09:34:37 +0200 Subject: [PATCH 10/32] move declarations --- deploy/recipes/default.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/deploy/recipes/default.rb b/deploy/recipes/default.rb index 06b75a9b6..67bcdfc23 100644 --- a/deploy/recipes/default.rb +++ b/deploy/recipes/default.rb @@ -2,12 +2,13 @@ node[:deploy].each do |application, deploy| + rails_env = deploy[:rails_env] + current_path = deploy[:current_path] + opsworks_deploy_user do deploy_data deploy end - rails_env = deploy[:rails_env] - current_path = deploy[:current_path] # hotfix, create preprod symlink on yet created template, so link "#{current_path}/config/environments/#{rails_env}.rb" do to "#{deploy[:deploy_to]}/shared/config/environments/#{rails_env}.rb" From 84827280e231199a0c8e7adf80c8679b98e372a4 Mon Sep 17 00:00:00 2001 From: Danilo Filippelli Date: Tue, 20 Apr 2021 10:09:16 +0200 Subject: [PATCH 11/32] Refactor preprod creator --- deploy/recipes/default.rb | 11 ----------- deploy/recipes/hurricane-api.rb | 1 + deploy/recipes/hurricane-print.rb | 1 + 3 files changed, 2 insertions(+), 11 deletions(-) diff --git a/deploy/recipes/default.rb b/deploy/recipes/default.rb index 67bcdfc23..1c4322755 100644 --- a/deploy/recipes/default.rb +++ b/deploy/recipes/default.rb @@ -2,19 +2,8 @@ node[:deploy].each do |application, deploy| - rails_env = deploy[:rails_env] - current_path = deploy[:current_path] - opsworks_deploy_user do deploy_data deploy end - # hotfix, create preprod symlink on yet created template, so - link "#{current_path}/config/environments/#{rails_env}.rb" do - to "#{deploy[:deploy_to]}/shared/config/environments/#{rails_env}.rb" - mode '0660' - owner deploy[:user] - group deploy[:group] - end - end diff --git a/deploy/recipes/hurricane-api.rb b/deploy/recipes/hurricane-api.rb index 4aa4ec42e..e98f44c6a 100644 --- a/deploy/recipes/hurricane-api.rb +++ b/deploy/recipes/hurricane-api.rb @@ -1,4 +1,5 @@ include_recipe 'deploy' +include_recipe 'deploy::prerod-environment' Chef::Log.level = :debug diff --git a/deploy/recipes/hurricane-print.rb b/deploy/recipes/hurricane-print.rb index e2adcfd56..651170fa5 100644 --- a/deploy/recipes/hurricane-print.rb +++ b/deploy/recipes/hurricane-print.rb @@ -1,4 +1,5 @@ include_recipe 'deploy' +include_recipe 'deploy::prerod-environment' Chef::Log.level = :debug node[:deploy].each do |application, deploy| From 32134574a7d752e844858a92b191d4fe497f38bf Mon Sep 17 00:00:00 2001 From: Danilo Filippelli Date: Tue, 20 Apr 2021 10:09:42 +0200 Subject: [PATCH 12/32] Add missing file --- deploy/recipes/preprod-environment.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 deploy/recipes/preprod-environment.rb diff --git a/deploy/recipes/preprod-environment.rb b/deploy/recipes/preprod-environment.rb new file mode 100644 index 000000000..ad1a196cb --- /dev/null +++ b/deploy/recipes/preprod-environment.rb @@ -0,0 +1,14 @@ +node[:deploy].each do |application, deploy| + + rails_env = deploy[:rails_env] + current_path = deploy[:current_path] + + # hotfix, create preprod symlink on yet created template, so + link "#{current_path}/config/environments/#{rails_env}.rb" do + to "#{deploy[:deploy_to]}/shared/config/environments/#{rails_env}.rb" + mode '0660' + owner deploy[:user] + group deploy[:group] + end + +end \ No newline at end of file From 8f447498582b1e960368dc189e436bda35eb9903 Mon Sep 17 00:00:00 2001 From: Danilo Filippelli Date: Tue, 20 Apr 2021 10:12:22 +0200 Subject: [PATCH 13/32] Fix naming --- deploy/recipes/hurricane-api.rb | 2 +- deploy/recipes/hurricane-print.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/deploy/recipes/hurricane-api.rb b/deploy/recipes/hurricane-api.rb index e98f44c6a..2fe9e1db1 100644 --- a/deploy/recipes/hurricane-api.rb +++ b/deploy/recipes/hurricane-api.rb @@ -1,5 +1,5 @@ include_recipe 'deploy' -include_recipe 'deploy::prerod-environment' +include_recipe 'deploy::preprod-environment' Chef::Log.level = :debug diff --git a/deploy/recipes/hurricane-print.rb b/deploy/recipes/hurricane-print.rb index 651170fa5..922787b9f 100644 --- a/deploy/recipes/hurricane-print.rb +++ b/deploy/recipes/hurricane-print.rb @@ -1,5 +1,5 @@ include_recipe 'deploy' -include_recipe 'deploy::prerod-environment' +include_recipe 'deploy::preprod-environment' Chef::Log.level = :debug node[:deploy].each do |application, deploy| From 439e056b760989130b60ddbc1f06de7b9ce91bf4 Mon Sep 17 00:00:00 2001 From: Danilo Filippelli Date: Tue, 20 Apr 2021 14:15:15 +0200 Subject: [PATCH 14/32] Add preprod conf for lumen --- deploy/recipes/lumen.rb | 1 + deploy/templates/default/lumen/config/aws.yml.erb | 3 +++ deploy/templates/default/lumen/config/mailer.yml.erb | 3 +++ deploy/templates/default/lumen/config/secrets.yml.erb | 3 +++ 4 files changed, 10 insertions(+) diff --git a/deploy/recipes/lumen.rb b/deploy/recipes/lumen.rb index 37a7c24ab..c6630fd14 100644 --- a/deploy/recipes/lumen.rb +++ b/deploy/recipes/lumen.rb @@ -1,4 +1,5 @@ include_recipe 'deploy' +include_recipe 'deploy::preprod-environment' Chef::Log.level = :debug node[:deploy].each do |application, deploy| diff --git a/deploy/templates/default/lumen/config/aws.yml.erb b/deploy/templates/default/lumen/config/aws.yml.erb index 97bb6d931..5288efe29 100644 --- a/deploy/templates/default/lumen/config/aws.yml.erb +++ b/deploy/templates/default/lumen/config/aws.yml.erb @@ -9,5 +9,8 @@ default: &default staging: <<: *default +preprod: + <<: *default + production: <<: *default \ No newline at end of file diff --git a/deploy/templates/default/lumen/config/mailer.yml.erb b/deploy/templates/default/lumen/config/mailer.yml.erb index 03991e214..f4fb7d928 100644 --- a/deploy/templates/default/lumen/config/mailer.yml.erb +++ b/deploy/templates/default/lumen/config/mailer.yml.erb @@ -8,5 +8,8 @@ default: &default staging: <<: *default +preprod: + <<: *default + production: <<: *default \ No newline at end of file diff --git a/deploy/templates/default/lumen/config/secrets.yml.erb b/deploy/templates/default/lumen/config/secrets.yml.erb index cd024e6b8..631c39962 100644 --- a/deploy/templates/default/lumen/config/secrets.yml.erb +++ b/deploy/templates/default/lumen/config/secrets.yml.erb @@ -1,5 +1,8 @@ staging: secret_key_base: <%= @lumen_settings[:secret_key_base] %> +preprod: + secret_key_base: <%= @lumen_settings[:secret_key_base] %> + production: secret_key_base: <%= @lumen_settings[:secret_key_base] %> From 8dd17757e51431bfc797f35b4f0fff48f648365d Mon Sep 17 00:00:00 2001 From: Danilo Filippelli Date: Fri, 23 Apr 2021 09:23:51 +0200 Subject: [PATCH 15/32] Test fix --- rails/templates/default/database.yml.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rails/templates/default/database.yml.erb b/rails/templates/default/database.yml.erb index c975627aa..f02c012f2 100644 --- a/rails/templates/default/database.yml.erb +++ b/rails/templates/default/database.yml.erb @@ -1,4 +1,4 @@ -<% (['development', 'production'] + [@environment]).uniq.each do |env| -%> +<% (['development', 'staging', 'preprod', 'production'] + [@environment]).uniq.each do |env| -%> <%= env %>: adapter: <%= @database[:adapter].to_s.inspect %> database: <%= @database[:database].to_s.inspect %> From cce920cfe1c79bc7e053e64026d16793eb2d6d8b Mon Sep 17 00:00:00 2001 From: Danilo Filippelli Date: Fri, 23 Apr 2021 09:30:51 +0200 Subject: [PATCH 16/32] Revert fix --- rails/templates/default/database.yml.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rails/templates/default/database.yml.erb b/rails/templates/default/database.yml.erb index f02c012f2..c975627aa 100644 --- a/rails/templates/default/database.yml.erb +++ b/rails/templates/default/database.yml.erb @@ -1,4 +1,4 @@ -<% (['development', 'staging', 'preprod', 'production'] + [@environment]).uniq.each do |env| -%> +<% (['development', 'production'] + [@environment]).uniq.each do |env| -%> <%= env %>: adapter: <%= @database[:adapter].to_s.inspect %> database: <%= @database[:database].to_s.inspect %> From 9f6b126e1c9c73b3a711150c619e2447522e9bac Mon Sep 17 00:00:00 2001 From: Danilo Filippelli Date: Fri, 23 Apr 2021 09:44:17 +0200 Subject: [PATCH 17/32] Change exec order --- deploy/recipes/hurricane-api.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/deploy/recipes/hurricane-api.rb b/deploy/recipes/hurricane-api.rb index 2fe9e1db1..02e125f57 100644 --- a/deploy/recipes/hurricane-api.rb +++ b/deploy/recipes/hurricane-api.rb @@ -1,4 +1,3 @@ -include_recipe 'deploy' include_recipe 'deploy::preprod-environment' Chef::Log.level = :debug @@ -245,6 +244,8 @@ end end + include_recipe 'deploy' + if active_job_with_resque service 'monit' do From d7fd86f759ecf21bb8e30a0283874ddc66c1a372 Mon Sep 17 00:00:00 2001 From: Danilo Filippelli Date: Fri, 23 Apr 2021 10:26:43 +0200 Subject: [PATCH 18/32] add config for print preprod --- .../templates/default/hurricane-print/config/secrets.yml.erb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/deploy/templates/default/hurricane-print/config/secrets.yml.erb b/deploy/templates/default/hurricane-print/config/secrets.yml.erb index 0d387d175..c3eb32591 100644 --- a/deploy/templates/default/hurricane-print/config/secrets.yml.erb +++ b/deploy/templates/default/hurricane-print/config/secrets.yml.erb @@ -1,5 +1,8 @@ staging: secret_key_base: <%= @hurricane_print_settings[:secret_key_base] %> +preprod: + secret_key_base: <%= @hurricane_print_settings[:secret_key_base] %> + production: secret_key_base: <%= @hurricane_print_settings[:secret_key_base] %> From e6d3fee904f8766a027a3ecdb516281b59837e18 Mon Sep 17 00:00:00 2001 From: Danilo Filippelli Date: Fri, 23 Apr 2021 14:51:06 +0200 Subject: [PATCH 19/32] Add env --- deploy/templates/default/hurricane/secrets.yml.erb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/deploy/templates/default/hurricane/secrets.yml.erb b/deploy/templates/default/hurricane/secrets.yml.erb index cc6e88cba..c8449d01c 100644 --- a/deploy/templates/default/hurricane/secrets.yml.erb +++ b/deploy/templates/default/hurricane/secrets.yml.erb @@ -1,5 +1,8 @@ staging: secret_key_base: <%= @hurricane_settings[:secret_key_base] %> +preprod: + secret_key_base: <%= @hurricane_settings[:secret_key_base] %> + production: secret_key_base: <%= @hurricane_settings[:secret_key_base] %> From 3393524864bf81dfd17071b1e4281e8443f583f0 Mon Sep 17 00:00:00 2001 From: Danilo Filippelli Date: Fri, 23 Apr 2021 15:14:01 +0200 Subject: [PATCH 20/32] Add debugging --- deploy/definitions/opsworks_deploy.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/deploy/definitions/opsworks_deploy.rb b/deploy/definitions/opsworks_deploy.rb index ceb170ae7..41de37e86 100644 --- a/deploy/definitions/opsworks_deploy.rb +++ b/deploy/definitions/opsworks_deploy.rb @@ -64,6 +64,7 @@ # setup deployment & checkout if deploy[:scm] && deploy[:scm][:scm_type] != 'other' Chef::Log.debug("Checking out source code of application #{application} with type #{deploy[:application_type]}") + Chef::Log.debug("Migration control variables: running #{deploy[:migrate_command]} with env #{deploy[:environment]} and rails_env #{deploy[:rails_env]}") deploy deploy[:deploy_to] do provider Chef::Provider::Deploy.const_get(deploy[:chef_provider]) keep_releases deploy[:keep_releases] From 94710d8d79e24a1784eefbafc5581618ff807fc9 Mon Sep 17 00:00:00 2001 From: Danilo Filippelli Date: Fri, 23 Apr 2021 15:52:09 +0200 Subject: [PATCH 21/32] Remove preprod symlink --- deploy/recipes/hurricane-api.rb | 4 +--- deploy/recipes/preprod-environment.rb | 14 -------------- 2 files changed, 1 insertion(+), 17 deletions(-) delete mode 100644 deploy/recipes/preprod-environment.rb diff --git a/deploy/recipes/hurricane-api.rb b/deploy/recipes/hurricane-api.rb index 02e125f57..4aa4ec42e 100644 --- a/deploy/recipes/hurricane-api.rb +++ b/deploy/recipes/hurricane-api.rb @@ -1,4 +1,4 @@ -include_recipe 'deploy::preprod-environment' +include_recipe 'deploy' Chef::Log.level = :debug @@ -244,8 +244,6 @@ end end - include_recipe 'deploy' - if active_job_with_resque service 'monit' do diff --git a/deploy/recipes/preprod-environment.rb b/deploy/recipes/preprod-environment.rb deleted file mode 100644 index ad1a196cb..000000000 --- a/deploy/recipes/preprod-environment.rb +++ /dev/null @@ -1,14 +0,0 @@ -node[:deploy].each do |application, deploy| - - rails_env = deploy[:rails_env] - current_path = deploy[:current_path] - - # hotfix, create preprod symlink on yet created template, so - link "#{current_path}/config/environments/#{rails_env}.rb" do - to "#{deploy[:deploy_to]}/shared/config/environments/#{rails_env}.rb" - mode '0660' - owner deploy[:user] - group deploy[:group] - end - -end \ No newline at end of file From b583a3389aef6bc139c25208b1c84c35d31bdb76 Mon Sep 17 00:00:00 2001 From: Danilo Filippelli Date: Tue, 27 Apr 2021 12:31:50 +0200 Subject: [PATCH 22/32] Remove preprod symlink direct creation --- deploy/recipes/hurricane-print.rb | 1 - deploy/recipes/lumen.rb | 1 - 2 files changed, 2 deletions(-) diff --git a/deploy/recipes/hurricane-print.rb b/deploy/recipes/hurricane-print.rb index 922787b9f..e2adcfd56 100644 --- a/deploy/recipes/hurricane-print.rb +++ b/deploy/recipes/hurricane-print.rb @@ -1,5 +1,4 @@ include_recipe 'deploy' -include_recipe 'deploy::preprod-environment' Chef::Log.level = :debug node[:deploy].each do |application, deploy| diff --git a/deploy/recipes/lumen.rb b/deploy/recipes/lumen.rb index c6630fd14..37a7c24ab 100644 --- a/deploy/recipes/lumen.rb +++ b/deploy/recipes/lumen.rb @@ -1,5 +1,4 @@ include_recipe 'deploy' -include_recipe 'deploy::preprod-environment' Chef::Log.level = :debug node[:deploy].each do |application, deploy| From b185075e93f84872e9858cbffd8b1ad11582900e Mon Sep 17 00:00:00 2001 From: Danilo Filippelli Date: Thu, 6 May 2021 14:59:03 +0200 Subject: [PATCH 23/32] Change patch version to 6 --- ruby/attributes/ruby.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ruby/attributes/ruby.rb b/ruby/attributes/ruby.rb index fa6c72a63..9dbef986e 100644 --- a/ruby/attributes/ruby.rb +++ b/ruby/attributes/ruby.rb @@ -30,7 +30,7 @@ when "2.3" default[:ruby][:major_version] = "2" default[:ruby][:minor_version] = "3" - default[:ruby][:patch_version] = "4" + default[:ruby][:patch_version] = "6" default[:ruby][:pkgrelease] = "1" default[:ruby][:full_version] = [node[:ruby][:major_version], node[:ruby][:minor_version]].join(".") From f452b45137b5801b550c541026dc2f5dfc074180 Mon Sep 17 00:00:00 2001 From: Danilo Filippelli Date: Thu, 13 May 2021 10:37:09 +0200 Subject: [PATCH 24/32] Add iubenda fallback configuration --- .../templates/default/hurricane-api/environment_config.rb.erb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/deploy/templates/default/hurricane-api/environment_config.rb.erb b/deploy/templates/default/hurricane-api/environment_config.rb.erb index 8e4812a9f..50bd0d7d5 100644 --- a/deploy/templates/default/hurricane-api/environment_config.rb.erb +++ b/deploy/templates/default/hurricane-api/environment_config.rb.erb @@ -116,4 +116,7 @@ Rails.application.configure do <% when 'resque' %> config.active_job.queue_adapter = :resque <% end %> + + #Iubenda fallback + config.iubenda_enabled = <%= @hurricane_api_settings[:iubenda_enabled] %> end From 93dc0b162221658387d4a5b2d3128118939f8886 Mon Sep 17 00:00:00 2001 From: Danilo Filippelli Date: Fri, 4 Jun 2021 10:36:33 +0200 Subject: [PATCH 25/32] add extended timeout to avoid 504 --- nginx/attributes/nginx.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nginx/attributes/nginx.rb b/nginx/attributes/nginx.rb index ac4ff2c2a..6aa9f0107 100644 --- a/nginx/attributes/nginx.rb +++ b/nginx/attributes/nginx.rb @@ -64,7 +64,7 @@ default[:nginx][:worker_connections] = 1024 default[:nginx][:server_names_hash_bucket_size] = 64 -default[:nginx][:proxy_read_timeout] = 60 -default[:nginx][:proxy_send_timeout] = 60 +default[:nginx][:proxy_read_timeout] = 120 +default[:nginx][:proxy_send_timeout] = 120 include_attribute "nginx::customize" From 9e4f11e4990287f64436f7ede91c046a4b0b9b1f Mon Sep 17 00:00:00 2001 From: Danilo Filippelli Date: Mon, 21 Jun 2021 12:25:19 +0200 Subject: [PATCH 26/32] Change hostname based on public dns variable --- deploy/recipes/hurricane-print.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/deploy/recipes/hurricane-print.rb b/deploy/recipes/hurricane-print.rb index e2adcfd56..ac910bb30 100644 --- a/deploy/recipes/hurricane-print.rb +++ b/deploy/recipes/hurricane-print.rb @@ -3,6 +3,10 @@ node[:deploy].each do |application, deploy| + execute 'hostname "'+node["opsworks"]["instance"]["public_dns_name"]+'"' do + not_if 'hostname -eq "'+node["opsworks"]["instance"]["public_dns_name"]+'"' + end + rails_env = deploy[:rails_env] current_path = deploy[:current_path] From c40e63687649173595eb144fc268b93186f30aba Mon Sep 17 00:00:00 2001 From: Danilo Filippelli Date: Wed, 23 Jun 2021 17:22:45 +0200 Subject: [PATCH 27/32] Externalize aviva bucket --- deploy/templates/default/hurricane-api/aviva.yml.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deploy/templates/default/hurricane-api/aviva.yml.erb b/deploy/templates/default/hurricane-api/aviva.yml.erb index 3869a08fe..84cdf55bb 100644 --- a/deploy/templates/default/hurricane-api/aviva.yml.erb +++ b/deploy/templates/default/hurricane-api/aviva.yml.erb @@ -13,7 +13,7 @@ pdf: storages: s3: - bucket_name: 'fit2you-rca-<%= @env %>' + bucket_name: '<%= @hurricane_api_settings[:aviva_rca][:bucket_name] %>' folder: 'aviva' codice: convenzione: '00980' From bc84f0e8922d4ce0105b557c868fd9f10fcd0f17 Mon Sep 17 00:00:00 2001 From: Ivan Lasorsa Date: Tue, 6 Jul 2021 13:15:03 +0200 Subject: [PATCH 28/32] Rca config --- deploy/recipes/hurricane-api.rb | 14 ++++++++++++++ .../templates/default/hurricane-api/rca.yml.erb | 16 ++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 deploy/templates/default/hurricane-api/rca.yml.erb diff --git a/deploy/recipes/hurricane-api.rb b/deploy/recipes/hurricane-api.rb index badcd0a76..422879bd8 100644 --- a/deploy/recipes/hurricane-api.rb +++ b/deploy/recipes/hurricane-api.rb @@ -105,6 +105,20 @@ end end + template "#{deploy[:deploy_to]}/shared/config/rca.yml" do + source 'hurricane-api/rca.yml.erb' + mode '0660' + owner deploy[:user] + group deploy[:group] + variables( + :companies_enabled => node[:hurricane_api_settings][:offers_search][:companies_enabled] || [], + :env => rails_env + ) + only_if do + File.exists?("#{deploy[:deploy_to]}/shared/config") + end + end + template "#{deploy[:deploy_to]}/shared/config/air_api.yml" do source 'hurricane-api/air_api.yml.erb' mode '0660' diff --git a/deploy/templates/default/hurricane-api/rca.yml.erb b/deploy/templates/default/hurricane-api/rca.yml.erb new file mode 100644 index 000000000..3cded60b4 --- /dev/null +++ b/deploy/templates/default/hurricane-api/rca.yml.erb @@ -0,0 +1,16 @@ +default: &default + offers_search: + companies_enabled: + <% if @companies_enabled.empty? %> + [] + <% else %> + <% @companies_enabled.each do |insurance_company| %> + - <%= insurance_company %> + <% end %> + <% end %> + +<%= @env %>: + <<: *default + +test: + <<: *default From cd4c6a28a8c9719d437a8a798b52633e6ac1bf7d Mon Sep 17 00:00:00 2001 From: Ivan Lasorsa Date: Tue, 6 Jul 2021 13:28:14 +0200 Subject: [PATCH 29/32] Rca config --- deploy/recipes/hurricane-api.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deploy/recipes/hurricane-api.rb b/deploy/recipes/hurricane-api.rb index 422879bd8..d42a9f23d 100644 --- a/deploy/recipes/hurricane-api.rb +++ b/deploy/recipes/hurricane-api.rb @@ -111,7 +111,7 @@ owner deploy[:user] group deploy[:group] variables( - :companies_enabled => node[:hurricane_api_settings][:offers_search][:companies_enabled] || [], + :companies_enabled => node[:hurricane_api_settings][:rca][:offers_search][:companies_enabled] || [], :env => rails_env ) only_if do From b2cfa8b8bfe7f5f9bd7f07a53b58a143c38b139e Mon Sep 17 00:00:00 2001 From: Ivan Lasorsa Date: Mon, 21 Feb 2022 15:35:11 +0100 Subject: [PATCH 30/32] Add a previnet property for hurricane print --- .../default/hurricane-print/config/previnet.yml.erb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/deploy/templates/default/hurricane-print/config/previnet.yml.erb b/deploy/templates/default/hurricane-print/config/previnet.yml.erb index d52020d09..a7f841a03 100644 --- a/deploy/templates/default/hurricane-print/config/previnet.yml.erb +++ b/deploy/templates/default/hurricane-print/config/previnet.yml.erb @@ -1,2 +1,10 @@ <%= @hurricane_print_env %>: extra_documentation_email: <%= @hurricane_print_settings[:previnet][:extra_documentation_email] %> + <% if @hurricane_print_settings[:previnet][:extra_documentation_email_bcc].empty? %> + extra_documentation_email_bcc: [] + <% else %> + extra_documentation_email_bcc: + <% @hurricane_print_settings[:previnet][:extra_documentation_email_bcc].each do |email| %> + - <%= email %> + <% end %> + <% end %> From 352a5308966da213991e366e5794b034365bc254 Mon Sep 17 00:00:00 2001 From: Danilo Filippelli Date: Thu, 16 Jun 2022 17:15:08 +0200 Subject: [PATCH 31/32] test new smtp confs --- .../config/environments/environment_config.rb.erb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/deploy/templates/default/hurricane-print/config/environments/environment_config.rb.erb b/deploy/templates/default/hurricane-print/config/environments/environment_config.rb.erb index 1d53817d6..2e301f49b 100644 --- a/deploy/templates/default/hurricane-print/config/environments/environment_config.rb.erb +++ b/deploy/templates/default/hurricane-print/config/environments/environment_config.rb.erb @@ -91,7 +91,14 @@ Rails.application.configure do <% end %> config.action_mailer.default_options = { from: "Fit2You Broker <<%= @hurricane_print_settings[:mailer][:from] %>>" } config.action_mailer.delivery_method = :smtp - config.action_mailer.smtp_settings = <%= @hurricane_print_settings[:mailer][:configuration].to_s %> + config.action_mailer.smtp_settings ={ + address: "<%= @hurricane_api_settings[:mailer][:configuration][:address] %>", + port: "<%= @hurricane_api_settings[:mailer][:configuration][:port] %>", + domain: "<%= @hurricane_api_settings[:mailer][:configuration][:domain] %>", + user_name: "<%= @hurricane_api_settings[:mailer][:configuration][:user_name] %>", + password: "<%= @hurricane_api_settings[:mailer][:configuration][:password] %>", + authentication: "<%= @hurricane_api_settings[:mailer][:configuration][:authentication] %>" + } config.action_mailer.raise_delivery_errors = true config.action_controller.asset_host = '<%= @hurricane_print_settings[:asset_host] %>' From aaf033fccd78c177eda7f6e19d7fea2189ad8ea9 Mon Sep 17 00:00:00 2001 From: Danilo Filippelli Date: Thu, 16 Jun 2022 17:20:05 +0200 Subject: [PATCH 32/32] test new smtp confs --- .../config/environments/environment_config.rb.erb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/deploy/templates/default/hurricane-print/config/environments/environment_config.rb.erb b/deploy/templates/default/hurricane-print/config/environments/environment_config.rb.erb index 2e301f49b..37358e098 100644 --- a/deploy/templates/default/hurricane-print/config/environments/environment_config.rb.erb +++ b/deploy/templates/default/hurricane-print/config/environments/environment_config.rb.erb @@ -92,12 +92,12 @@ Rails.application.configure do config.action_mailer.default_options = { from: "Fit2You Broker <<%= @hurricane_print_settings[:mailer][:from] %>>" } config.action_mailer.delivery_method = :smtp config.action_mailer.smtp_settings ={ - address: "<%= @hurricane_api_settings[:mailer][:configuration][:address] %>", - port: "<%= @hurricane_api_settings[:mailer][:configuration][:port] %>", - domain: "<%= @hurricane_api_settings[:mailer][:configuration][:domain] %>", - user_name: "<%= @hurricane_api_settings[:mailer][:configuration][:user_name] %>", - password: "<%= @hurricane_api_settings[:mailer][:configuration][:password] %>", - authentication: "<%= @hurricane_api_settings[:mailer][:configuration][:authentication] %>" + address: "<%= @hurricane_print_settings[:mailer][:configuration][:address] %>", + port: "<%= @hurricane_print_settings[:mailer][:configuration][:port] %>", + domain: "<%= @hurricane_print_settings[:mailer][:configuration][:domain] %>", + user_name: "<%= @hurricane_print_settings[:mailer][:configuration][:user_name] %>", + password: "<%= @hurricane_print_settings[:mailer][:configuration][:password] %>", + authentication: "<%= @hurricane_print_settings[:mailer][:configuration][:authentication] %>" } config.action_mailer.raise_delivery_errors = true