]> git.openstreetmap.org Git - chef.git/commitdiff
Add minimal ideditor cookbook for preview redirect
authorGrant Slater <github@firefishy.com>
Fri, 16 Sep 2022 11:39:20 +0000 (12:39 +0100)
committerGrant Slater <github@firefishy.com>
Fri, 16 Sep 2022 11:39:20 +0000 (12:39 +0100)
cookbooks/ideditor/recipes/default.rb [new file with mode: 0644]
cookbooks/ideditor/templates/default/apache.erb [new file with mode: 0644]
roles/ridley.rb

diff --git a/cookbooks/ideditor/recipes/default.rb b/cookbooks/ideditor/recipes/default.rb
new file mode 100644 (file)
index 0000000..fd38d43
--- /dev/null
@@ -0,0 +1,28 @@
+#
+# Cookbook:: ideditor
+# Recipe:: default
+#
+# Copyright:: 2022, OpenStreetMap Foundation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+include_recipe "apache"
+
+ssl_certificate "preview.ideditor.com" do
+  notifies :reload, "service[apache2]"
+end
+
+apache_site "preview.ideditor.com" do
+  template "apache.erb"
+end
diff --git a/cookbooks/ideditor/templates/default/apache.erb b/cookbooks/ideditor/templates/default/apache.erb
new file mode 100644 (file)
index 0000000..e1c2da6
--- /dev/null
@@ -0,0 +1,27 @@
+# DO NOT EDIT - This file is being maintained by Chef
+
+<VirtualHost *:80>
+  ServerName <%= @name %>
+  ServerAdmin webmaster@openstreetmap.org
+
+  CustomLog /var/log/apache2/<%= @name %>-access.log combined
+  ErrorLog /var/log/apache2/<%= @name %>-error.log
+
+  RedirectPermanent /.well-known/acme-challenge/ http://acme.openstreetmap.org/.well-known/acme-challenge/
+  Redirect permanent / https://<%= @name %>/
+</VirtualHost>
+<VirtualHost *:443>
+  ServerName <%= @name %>
+  ServerAdmin webmaster@openstreetmap.org
+
+  CustomLog /var/log/apache2/<%= @name %>-access.log combined
+  ErrorLog /var/log/apache2/<%= @name %>-error.log
+
+  SSLEngine on
+  SSLCertificateFile /etc/ssl/certs/<%= @name %>.pem
+  SSLCertificateKeyFile /etc/ssl/private/<%= @name %>.key
+
+  RewriteEngine on
+  RewriteRule ^release/?.* https://ideditor-release.netlify.app/ [QSD,L,R=307]
+  RewriteRule ^/?.* https://ideditor.netlify.app/ [QSD,L,R=307]
+</VirtualHost>
index ae27c20e2ac53f40557f27f3a7d89b1947f86e61..aee7655c99daf98c409cb0ff8be304a376145096 100644 (file)
@@ -49,5 +49,6 @@ run_list(
   "role[donate]",
   "recipe[hot]",
   "recipe[dmca]",
-  "recipe[dhcpd]"
+  "recipe[dhcpd]",
+  "recipe[ideditor]"
 )