]> git.openstreetmap.org Git - chef.git/commitdiff
civicrm: move aliases out to redirect to avoid session issues
authorGrant Slater <github@firefishy.com>
Fri, 11 Aug 2023 14:32:22 +0000 (15:32 +0100)
committerGrant Slater <github@firefishy.com>
Fri, 11 Aug 2023 14:32:54 +0000 (15:32 +0100)
cookbooks/civicrm/recipes/default.rb
cookbooks/civicrm/templates/default/apache.erb [new file with mode: 0644]
cookbooks/donate/templates/default/apache.erb

index 8858217b7c24049af41f0077ef5a811453f1c2d6..0a7ae17b8254336b38164d38030f2593f49b6560 100644 (file)
@@ -47,12 +47,20 @@ mysql_database "civicrm" do
   permissions "civicrm@localhost" => :all
 end
 
+ssl_certificate "join.osmfoundation.org" do
+  domains [ "join.osmfoundation.org", "crm.osmfoundation.org",
+            "supporting.osmfoundation.org", "support.osmfoundation.org",
+            "support.openstreetmap.org", "supporting.osm.org",
+            "support.osm.org"]
+  notifies :reload, "service[apache2]"
+end
+
 apache_site "join.osmfoundation.org" do
-  action :disable
+  template "apache.erb"
 end
 
 wordpress_site "supporting.openstreetmap.org" do
-  aliases ["join.osmfoundation.org", "crm.osmfoundation.org", "supporting.osmfoundation.org", "support.osmfoundation.org", "support.openstreetmap.org", "supporting.osm.org", "support.osm.org"]
+  # Do not add aliases as this causes issues with civicrm PHP sessions
   database_name "civicrm"
   database_user "civicrm"
   database_password database_password
diff --git a/cookbooks/civicrm/templates/default/apache.erb b/cookbooks/civicrm/templates/default/apache.erb
new file mode 100644 (file)
index 0000000..dd6112f
--- /dev/null
@@ -0,0 +1,33 @@
+# DO NOT EDIT - This file is being maintained by Chef
+
+<% [80, 443].each do |port| -%>
+<VirtualHost *:<%= port %>>
+
+  ServerName join.osmfoundation.org
+  ServerAlias crm.osmfoundation.org
+  ServerAlias supporting.osmfoundation.org
+  ServerAlias support.osmfoundation.org
+  ServerAlias support.openstreetmap.org
+  ServerAlias supporting.osm.org
+  ServerAlias support.osm.org
+
+  ServerAdmin webmaster@openstreetmap.org
+
+<% if port == 80 -%>
+  RedirectPermanent /.well-known/acme-challenge/ http://acme.openstreetmap.org/.well-known/acme-challenge/
+  RedirectPermanent / https://supporting.openstreetmap.org/
+<% end -%>
+<% if port == 443 -%>
+  SSLEngine on
+  SSLCertificateFile /etc/ssl/certs/join.osmfoundation.org.pem
+  SSLCertificateKeyFile /etc/ssl/private/join.osmfoundation.org.key
+
+  RedirectMatch . https://supporting.openstreetmap.org/
+  <% end -%>
+
+  CustomLog /var/log/apache2/join.osmfoundation.org-access.log combined
+  ErrorLog /var/log/apache2/join.osmfoundation.org-error.log
+
+</VirtualHost>
+
+<% end -%>
index 93630328578ebafcda234d1ecd684cde4547e500..8cb886e91d126eb0beb51f173acb05cd637a5146 100644 (file)
@@ -12,7 +12,7 @@
 
 <% if port == 80 -%>
   RedirectPermanent /.well-known/acme-challenge/ http://acme.openstreetmap.org/.well-known/acme-challenge/
-  RedirectPermanent / https://donate.openstreetmap.org/
+  RedirectPermanent / https://supporting.openstreetmap.org/
 <% end -%>
 <% if port == 443 -%>
   SSLEngine on