end
node[:taginfo][:sites].each do |site|
- name = site[:name]
- directory = site[:directory] || "/srv/#{name}"
+ site_name = site[:name]
+ directory = site[:directory] || "/srv/#{site_name}"
description = site[:description]
about = site[:about]
icon = site[:icon]
contact = site[:contact]
- directory "/var/log/taginfo/#{name}" do
+ directory "/var/log/taginfo/#{site_name}" do
owner "taginfo"
group "taginfo"
mode 0o755
settings = Chef::DelayedEvaluator.new do
settings = JSON.parse(IO.read("#{directory}/taginfo/taginfo-config-example.json"))
- settings["instance"]["url"] = "http://#{name}/"
+ settings["instance"]["url"] = "http://#{site_name}/"
settings["instance"]["description"] = description
settings["instance"]["about"] = about
settings["instance"]["icon"] = "/img/logo/#{icon}.png"
settings["instance"]["contact"] = contact
settings["instance"]["access_control_allow_origin"] = ""
- settings["logging"]["directory"] = "/var/log/taginfo/#{name}"
+ settings["logging"]["directory"] = "/var/log/taginfo/#{site_name}"
settings["opensearch"]["shortname"] = "Taginfo"
settings["opensearch"]["contact"] = "webmaster@openstreetmap.org"
settings["sources"]["download"] = ""
owner "taginfo"
group "taginfo"
mode 0o755
- variables :name => name, :directory => directory
+ variables :name => site_name, :directory => directory
end
- apache_site name do
+ ssl_certificate site_name do
+ domains site_name
+ fallback_certificate "openstreetmap"
+ notifies :reload, "service[apache2]"
+ end
+
+ apache_site site_name do
template "apache.erb"
directory "#{directory}/taginfo/web/public"
end
# DO NOT EDIT - This file is being maintained by Chef
-<% [80, 443].each do |port| -%>
-
-<VirtualHost *:<%= port %>>
+<VirtualHost *:443>
ServerName <%= @name %>
ServerAdmin webmaster@openstreetmap.org
-<% if port == 443 -%>
SSLEngine on
-<% end -%>
+ 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
Header setifempty Access-Control-Allow-Origin *
</Location>
</VirtualHost>
-<% end -%>
+
+<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/
+ RedirectPermanent / https://<%= @name %>/
+</VirtualHost>
<Directory <%= @directory %>>
Require all granted