From a4b54ecbcb6238430c1aab5fe4dc7ed3541e6453 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Sat, 16 Jun 2018 17:26:46 +0100 Subject: [PATCH] Add support for taginfo.osm.org --- cookbooks/taginfo/attributes/default.rb | 2 +- cookbooks/taginfo/recipes/default.rb | 4 +++- .../taginfo/templates/default/apache.erb | 22 +++++++++++++++++++ roles/taginfo.rb | 1 + 4 files changed, 27 insertions(+), 2 deletions(-) diff --git a/cookbooks/taginfo/attributes/default.rb b/cookbooks/taginfo/attributes/default.rb index 487e6d378..c7098b77b 100644 --- a/cookbooks/taginfo/attributes/default.rb +++ b/cookbooks/taginfo/attributes/default.rb @@ -1 +1 @@ -default[:osqa][:sites] = [] +default[:taginfo][:sites] = [] diff --git a/cookbooks/taginfo/recipes/default.rb b/cookbooks/taginfo/recipes/default.rb index 2fbbc96af..e6a4dadf7 100644 --- a/cookbooks/taginfo/recipes/default.rb +++ b/cookbooks/taginfo/recipes/default.rb @@ -85,6 +85,7 @@ end node[:taginfo][:sites].each do |site| site_name = site[:name] + site_aliases = Array(site[:aliases]) directory = site[:directory] || "/srv/#{site_name}" description = site[:description] about = site[:about] @@ -238,12 +239,13 @@ node[:taginfo][:sites].each do |site| end ssl_certificate site_name do - domains site_name + domains [site_name] + site_aliases notifies :reload, "service[apache2]" end apache_site site_name do template "apache.erb" directory "#{directory}/taginfo/web/public" + variables :aliases => site_aliases end end diff --git a/cookbooks/taginfo/templates/default/apache.erb b/cookbooks/taginfo/templates/default/apache.erb index 3ae9fed71..82fef8b37 100644 --- a/cookbooks/taginfo/templates/default/apache.erb +++ b/cookbooks/taginfo/templates/default/apache.erb @@ -24,9 +24,31 @@ Header setifempty Access-Control-Allow-Origin * +<% unless @aliases.empty? -%> + + + ServerName <%= @aliases.first %> +<% @aliases.drop(1).each do |alias_name| -%> + ServerAlias <%= alias_name %> +<% end -%> + ServerAdmin webmaster@openstreetmap.org + + SSLEngine on + SSLCertificateFile /etc/ssl/certs/<%= @name %>.pem + SSLCertificateKeyFile /etc/ssl/private/<%= @name %>.key + + CustomLog /var/log/apache2/<%= @name %>-access.log combined + ErrorLog /var/log/apache2/<%= @name %>-error.log + + RedirectPermanent / https://<%= @name %>/ + +<% end -%> ServerName <%= @name %> +<% @aliases.each do |alias_name| -%> + ServerAlias <%= alias_name %> +<% end -%> ServerAdmin webmaster@openstreetmap.org CustomLog /var/log/apache2/<%= @name %>-access.log combined diff --git a/roles/taginfo.rb b/roles/taginfo.rb index 5697e2df5..d5ba812a9 100644 --- a/roles/taginfo.rb +++ b/roles/taginfo.rb @@ -28,6 +28,7 @@ default_attributes( :sites => [ { :name => "taginfo.openstreetmap.org", + :aliases => ["taginfo.osm.org"], :description => "This is the main taginfo site. It contains OSM data for the whole planet and is updated daily.", :about => "

This site is run by the OSMF and maintained by Jochen Topf and the Sysadmin team.

Several other taginfo sites are operated by different people for different areas of the world.

", :icon => "world", -- 2.43.2