From 4f1fb347a8ff9da7e61885969f1eb476f162fbb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Greg=20Kar=C3=A9kinian?= Date: Fri, 24 Mar 2023 16:55:11 +0100 Subject: [PATCH 1/4] Add new SMTP config for akkounts This is not running on akkounts-1 closes #479 refs kosmos/akkounts#107 --- environments/production.json | 6 ++++++ .../kosmos-akkounts/attributes/default.rb | 5 +++++ .../kosmos-akkounts/recipes/default.rb | 21 ++++++++++++++----- 3 files changed, 27 insertions(+), 5 deletions(-) diff --git a/environments/production.json b/environments/production.json index 6c44e15..7d15290 100644 --- a/environments/production.json +++ b/environments/production.json @@ -2,6 +2,12 @@ "name": "production", "override_attributes": { "akkounts": { + "smtp": { + "from_address": "accounts ", + "domain": "kosmos.org", + "auth_method": "plain", + "enable_starttls": "auto" + }, "lndhub": { "public_url": "https://lndhub.kosmos.org", "public_key": "024cd3be18617f39cf645851e3ba63f51fc13f0bb09e3bb25e6fd4de556486d946" diff --git a/site-cookbooks/kosmos-akkounts/attributes/default.rb b/site-cookbooks/kosmos-akkounts/attributes/default.rb index 64fde27..cc9cd0c 100644 --- a/site-cookbooks/kosmos-akkounts/attributes/default.rb +++ b/site-cookbooks/kosmos-akkounts/attributes/default.rb @@ -10,4 +10,9 @@ node.default['akkounts']['lndhub']['public_url'] = nil node.default['akkounts']['lndhub']['public_key'] = nil node.default['akkounts']['lndhub']['postgres_db'] = 'lndhub' +node.default['akkounts']['smtp']['from_address'] = 'accounts ' +node.default['akkounts']['smtp']['domain'] = 'kosmos.org' +node.default['akkounts']['smtp']['auth_method'] = 'plain' +node.default['akkounts']['smtp']['enable_starttls'] = 'auto' + node.override["redisio"]["version"] = "6.2.6" diff --git a/site-cookbooks/kosmos-akkounts/recipes/default.rb b/site-cookbooks/kosmos-akkounts/recipes/default.rb index 2daf6bf..24df181 100644 --- a/site-cookbooks/kosmos-akkounts/recipes/default.rb +++ b/site-cookbooks/kosmos-akkounts/recipes/default.rb @@ -4,11 +4,12 @@ # require 'ipaddr' -app_name = "akkounts" -deploy_user = "deploy" -deploy_group = "deploy" -deploy_path = "/opt/#{app_name}" -credentials = Chef::EncryptedDataBagItem.load('credentials', app_name) +app_name = "akkounts" +deploy_user = "deploy" +deploy_group = "deploy" +deploy_path = "/opt/#{app_name}" +credentials = Chef::EncryptedDataBagItem.load('credentials', app_name) +smtp_credentials = Chef::EncryptedDataBagItem.load('credentials', 'smtp') group deploy_group @@ -40,6 +41,16 @@ env = {} env[:rails_serve_static_files] = "true" +smtp_server, smtp_port = smtp_credentials[:relayhost].split(":") +env[:smtp_server] = smtp_server +env[:smtp_port] = smtp_port +env[:smtp_login] = smtp_credentials[:user_name] +env[:smtp_password] = smtp_credentials[:password] +env[:smtp_from_address] = node['akkounts']['smtp']['from_address'] +env[:smtp_domain] = node['akkounts']['smtp']['domain'] +env[:smtp_auth_method] = node['akkounts']['smtp']['auth_method'] +env[:smtp_enable_starttls] = node['akkounts']['smtp']['enable_starttls'] + if webhooks_allowed_ips.length > 0 env[:webhooks_allowed_ips] = webhooks_allowed_ips end -- 2.25.1 From 3873ebaac2f1f97db65e5eb00bef13f250446a14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Greg=20Kar=C3=A9kinian?= Date: Mon, 27 Mar 2023 10:45:02 +0200 Subject: [PATCH 2/4] Don't override the SMTP config with the same values --- environments/production.json | 6 ------ 1 file changed, 6 deletions(-) diff --git a/environments/production.json b/environments/production.json index 7d15290..6c44e15 100644 --- a/environments/production.json +++ b/environments/production.json @@ -2,12 +2,6 @@ "name": "production", "override_attributes": { "akkounts": { - "smtp": { - "from_address": "accounts ", - "domain": "kosmos.org", - "auth_method": "plain", - "enable_starttls": "auto" - }, "lndhub": { "public_url": "https://lndhub.kosmos.org", "public_key": "024cd3be18617f39cf645851e3ba63f51fc13f0bb09e3bb25e6fd4de556486d946" -- 2.25.1 From 34970fe3cff9d8e9051c4810f3662946bc30b393 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Greg=20Kar=C3=A9kinian?= Date: Mon, 27 Mar 2023 10:48:56 +0200 Subject: [PATCH 3/4] Set a better name for the from address --- site-cookbooks/kosmos-akkounts/attributes/default.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/site-cookbooks/kosmos-akkounts/attributes/default.rb b/site-cookbooks/kosmos-akkounts/attributes/default.rb index cc9cd0c..b0997e9 100644 --- a/site-cookbooks/kosmos-akkounts/attributes/default.rb +++ b/site-cookbooks/kosmos-akkounts/attributes/default.rb @@ -10,7 +10,7 @@ node.default['akkounts']['lndhub']['public_url'] = nil node.default['akkounts']['lndhub']['public_key'] = nil node.default['akkounts']['lndhub']['postgres_db'] = 'lndhub' -node.default['akkounts']['smtp']['from_address'] = 'accounts ' +node.default['akkounts']['smtp']['from_address'] = 'Kosmos Accounts ' node.default['akkounts']['smtp']['domain'] = 'kosmos.org' node.default['akkounts']['smtp']['auth_method'] = 'plain' node.default['akkounts']['smtp']['enable_starttls'] = 'auto' -- 2.25.1 From 0c4466b04058469fecdb0264c52ed9d9da9b0143 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Greg=20Kar=C3=A9kinian?= Date: Mon, 27 Mar 2023 10:49:12 +0200 Subject: [PATCH 4/4] Namespace the smtp attributes --- .../kosmos-akkounts/recipes/default.rb | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/site-cookbooks/kosmos-akkounts/recipes/default.rb b/site-cookbooks/kosmos-akkounts/recipes/default.rb index 24df181..c555f63 100644 --- a/site-cookbooks/kosmos-akkounts/recipes/default.rb +++ b/site-cookbooks/kosmos-akkounts/recipes/default.rb @@ -42,14 +42,16 @@ env = {} env[:rails_serve_static_files] = "true" smtp_server, smtp_port = smtp_credentials[:relayhost].split(":") -env[:smtp_server] = smtp_server -env[:smtp_port] = smtp_port -env[:smtp_login] = smtp_credentials[:user_name] -env[:smtp_password] = smtp_credentials[:password] -env[:smtp_from_address] = node['akkounts']['smtp']['from_address'] -env[:smtp_domain] = node['akkounts']['smtp']['domain'] -env[:smtp_auth_method] = node['akkounts']['smtp']['auth_method'] -env[:smtp_enable_starttls] = node['akkounts']['smtp']['enable_starttls'] +env[:smtp] = { + server: smtp_server, + port: smtp_port, + login: smtp_credentials[:user_name], + password: smtp_credentials[:password], + from_address: node['akkounts']['smtp']['from_address'], + domain: node['akkounts']['smtp']['domain'], + auth_method: node['akkounts']['smtp']['auth_method'], + enable_starttls: node['akkounts']['smtp']['enable_starttls'] +} if webhooks_allowed_ips.length > 0 env[:webhooks_allowed_ips] = webhooks_allowed_ips -- 2.25.1