]> git.openstreetmap.org Git - chef.git/commitdiff
Add email handling and fixes
authorGrant Slater <git@firefishy.com>
Thu, 10 Mar 2022 03:36:56 +0000 (03:36 +0000)
committerGrant <github@firefishy.com>
Thu, 10 Mar 2022 14:09:24 +0000 (14:09 +0000)
cookbooks/community/recipes/default.rb
cookbooks/community/templates/default/mail-receiver.yml.erb [new file with mode: 0644]
cookbooks/community/templates/default/web_only.yml.erb
cookbooks/exim/files/default/noreply/community [new file with mode: 0644]
roles/mail.rb

index b70a1412dbd3df233abb36aa2b935e42d526882a..35dec91564189e9dd2f27a0f86342afc206c672f 100644 (file)
@@ -51,6 +51,7 @@ git "/srv/community.openstreetmap.org/docker" do
   group "root"
   notifies :run, "execute[discourse_container_data_rebuild]"
   notifies :run, "execute[discourse_container_web_only_rebuild]"
+  notifies :run, "execute[discourse_container_mail_receiver_rebuild]"
 end
 
 template "/srv/community.openstreetmap.org/docker/containers/data.yml" do
@@ -58,7 +59,7 @@ template "/srv/community.openstreetmap.org/docker/containers/data.yml" do
   owner "root"
   group "root"
   mode "644"
-  variables :license_keys => license_keys, :passwords => passwords
+  variables :passwords => passwords
   notifies :run, "execute[discourse_container_data_rebuild]"
 end
 
@@ -71,6 +72,15 @@ template "/srv/community.openstreetmap.org/docker/containers/web_only.yml" do
   notifies :run, "execute[discourse_container_web_only_rebuild]"
 end
 
+template "/srv/community.openstreetmap.org/docker/containers/mail-receiver.yml" do
+  source "mail-receiver.yml.erb"
+  owner "root"
+  group "root"
+  mode "644"
+  variables :passwords => passwords
+  notifies :run, "execute[discourse_container_mail_receiver_rebuild]"
+end
+
 execute "discourse_container_data_rebuild" do
   action :nothing
   command "./launcher rebuild data"
@@ -87,6 +97,14 @@ execute "discourse_container_web_only_rebuild" do
   group "root"
 end
 
+execute "discourse_container_mail_receiver_rebuild" do
+  action :nothing
+  command "./launcher rebuild mail-receiver"
+  cwd "/srv/community.openstreetmap.org/docker/"
+  user "root"
+  group "root"
+end
+
 ## FIXME
 # Backup the backups
 # Maybe use /srv/community.openstreetmap.org/shared/web-only/backups/
diff --git a/cookbooks/community/templates/default/mail-receiver.yml.erb b/cookbooks/community/templates/default/mail-receiver.yml.erb
new file mode 100644 (file)
index 0000000..91b21ce
--- /dev/null
@@ -0,0 +1,53 @@
+## this is the incoming mail receiver container template
+##
+## After making changes to this file, you MUST rebuild
+## /var/discourse/launcher rebuild mail-receiver
+##
+## BE *VERY* CAREFUL WHEN EDITING!
+## YAML FILES ARE SUPER SUPER SENSITIVE TO MISTAKES IN WHITESPACE OR ALIGNMENT!
+## visit http://www.yamllint.com/ to validate this file as needed
+
+base_image: discourse/mail-receiver:release
+update_pups: false
+
+expose:
+  - "25:25"   # SMTP
+
+env:
+  LC_ALL: en_US.UTF-8
+  LANG: en_US.UTF-8
+  LANGUAGE: en_US.UTF-8
+
+  ## Where e-mail to your forum should be sent.  In general, it's perfectly fine
+  ## to use the same domain as the forum itself here.
+  MAIL_DOMAIN: community.openstreetmap.org
+# uncomment these (and the volume below!) to support TLS
+#  POSTCONF_smtpd_tls_key_file:  /letsencrypt/discourse.example.com/discourse.example.com.key
+#  POSTCONF_smtpd_tls_cert_file:  /letsencrypt/discourse.example.com/fullchain.cer
+#  POSTCONF_smtpd_tls_security_level: may
+
+
+  ## The URL of the mail processing endpoint of your Discourse forum.
+  ## This is simply your forum's base URL, with `/admin/email/handle_mail`
+  ## appended.  Be careful if you're running a subfolder setup -- in that case,
+  ## the URL needs to have the subfolder included!
+  DISCOURSE_MAIL_ENDPOINT: 'https://community.openstreetmap.org/admin/email/handle_mail'
+
+  ## The master API key of your Discourse forum.  You can get this from
+  ## the "API" tab of your admin panel.
+  DISCOURSE_API_KEY: abcdefghijklmnop
+
+  ## The username to use for processing incoming e-mail.  Unless you have
+  ## renamed the `system` user, you should leave this as-is.
+  DISCOURSE_API_USERNAME: system
+
+volumes:
+  - volume:
+      host: /srv/community.openstreetmap.org/shared/mail-receiver/postfix-spool
+      guest: /var/spool/postfix
+# uncomment to support TLS
+#  - volume:
+#      host: /var/discourse/shared/standalone/letsencrypt
+#      guest: /letsencrypt
+
+
index a3f47dbbef353c9fe6614c631851252c0e4e2527..b129a06c0ba32a80c522b07822272be7c22b0c2f 100644 (file)
@@ -53,7 +53,7 @@ env:
   DISCOURSE_SMTP_PASSWORD:
   # DISCOURSE_SMTP_ENABLE_START_TLS: true           # (optional, default true)
   DISCOURSE_SMTP_DOMAIN: community.openstreetmap.org
-  DISCOURSE_NOTIFICATION_EMAIL: noreply@community.openstreetmap.org
+  DISCOURSE_NOTIFICATION_EMAIL: community@noreply.openstreetmap.org
 
   ## TODO: configure connectivity to the databases
   DISCOURSE_DB_SOCKET: ''
diff --git a/cookbooks/exim/files/default/noreply/community b/cookbooks/exim/files/default/noreply/community
new file mode 100644 (file)
index 0000000..83e124b
--- /dev/null
@@ -0,0 +1,10 @@
+This is an automated response to your email, which was sent to an
+unattended address.
+
+If you were trying to reply to a question, answer or comment on
+the community.openstreetmap.org web site then you should do so using
+the web site as it is not possible to reply by email.
+
+Thank you,
+
+OpenStreetMap Administrators
index ccf774328b9c746baa487bca4c3e514edebcd7e6..bb64e08145cdc862adc85083c87392134171b459 100644 (file)
@@ -46,6 +46,11 @@ default_attributes(
         :comment => "join.osmfoundation.org",
         :domains => ["join.osmfoundation.org"],
         :host => "ridley.ucl.openstreetmap.org"
+      },
+      :discourse => {
+        :comment => "community.osmfoundation.org",
+        :domains => ["community.osmfoundation.org"],
+        :host => "lockheed.ams.openstreetmap.org"
       }
     },
     :dkim_selectors => {