From bc66e687bb39b7b463eb4c97b52b36e9fa44d003 Mon Sep 17 00:00:00 2001 From: Grant Slater Date: Sun, 12 Feb 2023 13:53:18 +0000 Subject: [PATCH] Use SotM 2013 container and rename jekyll recipe to container Signed-off-by: Grant Slater --- .github/workflows/test-kitchen.yml | 3 +- .kitchen.yml | 7 +-- .../recipes/{jekyll.rb => container.rb} | 8 +-- cookbooks/stateofthemap/recipes/static.rb | 42 --------------- ...apache.jekyll.erb => apache.container.erb} | 0 .../templates/default/apache.static.erb | 51 ------------------- roles/naga.rb | 2 +- roles/stateofthemap.rb | 1 - .../serverspec/apache_spec.rb | 0 .../serverspec/apache_spec.rb | 21 -------- 10 files changed, 8 insertions(+), 127 deletions(-) rename cookbooks/stateofthemap/recipes/{jekyll.rb => container.rb} (88%) delete mode 100644 cookbooks/stateofthemap/recipes/static.rb rename cookbooks/stateofthemap/templates/default/{apache.jekyll.erb => apache.container.erb} (100%) delete mode 100644 cookbooks/stateofthemap/templates/default/apache.static.erb rename test/integration/{stateofthemap-jekyll => stateofthemap-container}/serverspec/apache_spec.rb (100%) delete mode 100644 test/integration/stateofthemap-static/serverspec/apache_spec.rb diff --git a/.github/workflows/test-kitchen.yml b/.github/workflows/test-kitchen.yml index ca58e547e..2469ab522 100644 --- a/.github/workflows/test-kitchen.yml +++ b/.github/workflows/test-kitchen.yml @@ -97,8 +97,7 @@ jobs: - spamassassin - ssl - stateofthemap - - stateofthemap-jekyll - - stateofthemap-static + - stateofthemap-container - stateofthemap-wordpress - subversion - supybot diff --git a/.kitchen.yml b/.kitchen.yml index 2e7ae9638..c867618c0 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -340,12 +340,9 @@ suites: - name: stateofthemap run_list: - recipe[stateofthemap::default] - - name: stateofthemap-static + - name: stateofthemap-container run_list: - - recipe[stateofthemap::static] - - name: stateofthemap-jekyll - run_list: - - recipe[stateofthemap::jekyll] + - recipe[stateofthemap::container] - name: stateofthemap-wordpress run_list: - recipe[stateofthemap::wordpress] diff --git a/cookbooks/stateofthemap/recipes/jekyll.rb b/cookbooks/stateofthemap/recipes/container.rb similarity index 88% rename from cookbooks/stateofthemap/recipes/jekyll.rb rename to cookbooks/stateofthemap/recipes/container.rb index c4e008016..b5a7640ac 100644 --- a/cookbooks/stateofthemap/recipes/jekyll.rb +++ b/cookbooks/stateofthemap/recipes/container.rb @@ -1,6 +1,6 @@ # # Cookbook:: stateofthemap -# Recipe:: jekyll +# Recipe:: container # # Copyright:: 2022, OpenStreetMap Foundation # @@ -22,8 +22,8 @@ include_recipe "podman" apache_module "proxy_http" -%w[2016 2017 2018 2019 2020 2021 2022].each do |year| - docker_external_port = 6080 + year.to_i # 8096+ +%w[2013 2016 2017 2018 2019 2020 2021 2022].each do |year| + docker_external_port = 6080 + year.to_i # 8093+ podman_service "#{year}.stateofthemap.org" do description "Container service for #{year}.stateofthemap.org" @@ -37,7 +37,7 @@ apache_module "proxy_http" end apache_site "#{year}.stateofthemap.org" do - template "apache.jekyll.erb" + template "apache.container.erb" variables :docker_external_port => docker_external_port, :aliases => ["#{year}.stateofthemap.com", "#{year}.sotm.org"] end end diff --git a/cookbooks/stateofthemap/recipes/static.rb b/cookbooks/stateofthemap/recipes/static.rb deleted file mode 100644 index 2ed436158..000000000 --- a/cookbooks/stateofthemap/recipes/static.rb +++ /dev/null @@ -1,42 +0,0 @@ -# -# Cookbook:: stateofthemap -# Recipe:: static -# -# 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 "stateofthemap" - -%w[2013].each do |year| - git "/srv/#{year}.stateofthemap.org" do - action :sync - repository "https://git.openstreetmap.org/public/stateofthemap.git" - revision "site-#{year}" - depth 1 - user "root" - group "root" - end - - ssl_certificate "#{year}.stateofthemap.org" do - domains ["#{year}.stateofthemap.org", "#{year}.stateofthemap.com", "#{year}.sotm.org"] - notifies :reload, "service[apache2]" - end - - apache_site "#{year}.stateofthemap.org" do - template "apache.static.erb" - directory "/srv/#{year}.stateofthemap.org" - variables :year => year - end -end diff --git a/cookbooks/stateofthemap/templates/default/apache.jekyll.erb b/cookbooks/stateofthemap/templates/default/apache.container.erb similarity index 100% rename from cookbooks/stateofthemap/templates/default/apache.jekyll.erb rename to cookbooks/stateofthemap/templates/default/apache.container.erb diff --git a/cookbooks/stateofthemap/templates/default/apache.static.erb b/cookbooks/stateofthemap/templates/default/apache.static.erb deleted file mode 100644 index 07ec18cbe..000000000 --- a/cookbooks/stateofthemap/templates/default/apache.static.erb +++ /dev/null @@ -1,51 +0,0 @@ -# DO NOT EDIT - This file is being maintained by Chef - - - ServerName <%= @year %>.stateofthemap.org - ServerAlias <%= @year %>.stateofthemap.com <%= @year %>.sotm.org - ServerAdmin webmaster@openstreetmap.org - - CustomLog /var/log/apache2/<%= @year %>.stateofthemap.org-access.log combined - ErrorLog /var/log/apache2/<%= @year %>.stateofthemap.org-error.log - - RedirectPermanent /.well-known/acme-challenge/ http://acme.openstreetmap.org/.well-known/acme-challenge/ - RedirectPermanent / https://<%= @year %>.stateofthemap.org/ - - - - ServerName <%= @year %>.stateofthemap.com - ServerAlias <%= @year %>.sotm.org - ServerAdmin webmaster@openstreetmap.org - - CustomLog /var/log/apache2/<%= @year %>.stateofthemap.org-access.log combined - ErrorLog /var/log/apache2/<%= @year %>.stateofthemap.org-error.log - - SSLEngine on - SSLCertificateFile /etc/ssl/certs/<%= @year %>.stateofthemap.org.pem - SSLCertificateKeyFile /etc/ssl/private/<%= @year %>.stateofthemap.org.key - - RedirectPermanent / https://<%= @year %>.stateofthemap.org/ - - - - ServerName <%= @year %>.stateofthemap.org - ServerAdmin webmaster@openstreetmap.org - - CustomLog /var/log/apache2/<%= @year %>.stateofthemap.org-access.log combined - ErrorLog /var/log/apache2/<%= @year %>.stateofthemap.org-error.log - - SSLEngine on - SSLCertificateFile /etc/ssl/certs/<%= @year %>.stateofthemap.org.pem - SSLCertificateKeyFile /etc/ssl/private/<%= @year %>.stateofthemap.org.key - - DocumentRoot /srv/<%= @year %>.stateofthemap.org - - ErrorDocument 404 /404.html - - ExpiresActive On - ExpiresDefault "access plus 7 days" - - -.stateofthemap.org> - Require all granted - diff --git a/roles/naga.rb b/roles/naga.rb index 20ce1b557..9710563c4 100644 --- a/roles/naga.rb +++ b/roles/naga.rb @@ -41,5 +41,5 @@ run_list( "role[blogs]", "role[munin]", "recipe[foundation::welcome]", - "recipe[stateofthemap::jekyll]" + "recipe[stateofthemap::container]" ) diff --git a/roles/stateofthemap.rb b/roles/stateofthemap.rb index 6e1d9ab1b..512a038b4 100644 --- a/roles/stateofthemap.rb +++ b/roles/stateofthemap.rb @@ -3,6 +3,5 @@ description "Role applied to State of the Map servers" run_list( "recipe[stateofthemap]", - "recipe[stateofthemap::static]", "recipe[stateofthemap::wordpress]" ) diff --git a/test/integration/stateofthemap-jekyll/serverspec/apache_spec.rb b/test/integration/stateofthemap-container/serverspec/apache_spec.rb similarity index 100% rename from test/integration/stateofthemap-jekyll/serverspec/apache_spec.rb rename to test/integration/stateofthemap-container/serverspec/apache_spec.rb diff --git a/test/integration/stateofthemap-static/serverspec/apache_spec.rb b/test/integration/stateofthemap-static/serverspec/apache_spec.rb deleted file mode 100644 index 446d3b915..000000000 --- a/test/integration/stateofthemap-static/serverspec/apache_spec.rb +++ /dev/null @@ -1,21 +0,0 @@ -require "serverspec" - -# Required by serverspec -set :backend, :exec - -describe package("apache2") do - it { should be_installed } -end - -describe service("apache2") do - it { should be_enabled } - it { should be_running } -end - -describe port(80) do - it { should be_listening.with("tcp") } -end - -describe port(443) do - it { should be_listening.with("tcp") } -end -- 2.39.5