From d5f632a79b3bab323f9af5b02940dcc75e618fa5 Mon Sep 17 00:00:00 2001 From: Grant Slater Date: Fri, 16 Sep 2022 12:39:20 +0100 Subject: [PATCH] Add minimal ideditor cookbook for preview redirect --- cookbooks/ideditor/recipes/default.rb | 28 +++++++++++++++++++ .../ideditor/templates/default/apache.erb | 27 ++++++++++++++++++ roles/ridley.rb | 3 +- 3 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 cookbooks/ideditor/recipes/default.rb create mode 100644 cookbooks/ideditor/templates/default/apache.erb diff --git a/cookbooks/ideditor/recipes/default.rb b/cookbooks/ideditor/recipes/default.rb new file mode 100644 index 000000000..fd38d43b8 --- /dev/null +++ b/cookbooks/ideditor/recipes/default.rb @@ -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 index 000000000..e1c2da655 --- /dev/null +++ b/cookbooks/ideditor/templates/default/apache.erb @@ -0,0 +1,27 @@ +# DO NOT EDIT - This file is being maintained by Chef + + + 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 %>/ + + + 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] + diff --git a/roles/ridley.rb b/roles/ridley.rb index ae27c20e2..aee7655c9 100644 --- a/roles/ridley.rb +++ b/roles/ridley.rb @@ -49,5 +49,6 @@ run_list( "role[donate]", "recipe[hot]", "recipe[dmca]", - "recipe[dhcpd]" + "recipe[dhcpd]", + "recipe[ideditor]" ) -- 2.39.5