From: Grant Slater Date: Mon, 13 Feb 2023 22:06:45 +0000 (+0000) Subject: stateofthemap: Move Chooser to container X-Git-Url: https://git.openstreetmap.org./chef.git/commitdiff_plain/6ea6b971998fa1e2eff2c737c7de9092613ecc7e stateofthemap: Move Chooser to container Signed-off-by: Grant Slater --- diff --git a/.github/workflows/test-kitchen.yml b/.github/workflows/test-kitchen.yml index 2469ab522..69995287d 100644 --- a/.github/workflows/test-kitchen.yml +++ b/.github/workflows/test-kitchen.yml @@ -96,7 +96,6 @@ jobs: - snmpd - spamassassin - ssl - - stateofthemap - stateofthemap-container - stateofthemap-wordpress - subversion diff --git a/.kitchen.yml b/.kitchen.yml index c867618c0..b298b8f60 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -337,9 +337,6 @@ suites: - name: ssl run_list: - recipe[ssl::default] - - name: stateofthemap - run_list: - - recipe[stateofthemap::default] - name: stateofthemap-container run_list: - recipe[stateofthemap::container] diff --git a/cookbooks/stateofthemap/metadata.rb b/cookbooks/stateofthemap/metadata.rb index 4844cef30..139ba825e 100644 --- a/cookbooks/stateofthemap/metadata.rb +++ b/cookbooks/stateofthemap/metadata.rb @@ -7,6 +7,5 @@ description "Installs and configures State of the Map services" version "1.0.0" supports "ubuntu" depends "apache" -depends "git" depends "podman" depends "wordpress" diff --git a/cookbooks/stateofthemap/recipes/container.rb b/cookbooks/stateofthemap/recipes/container.rb index 6320e81ee..5a7de8d52 100644 --- a/cookbooks/stateofthemap/recipes/container.rb +++ b/cookbooks/stateofthemap/recipes/container.rb @@ -22,6 +22,26 @@ include_recipe "podman" apache_module "proxy_http" +docker_external_port = 8096 + +podman_service "www.stateofthemap.org" do + description "Container service for www.stateofthemap.org" + image "ghcr.io/openstreetmap/stateofthemap-website:latest" + ports docker_external_port => "8080" +end + +ssl_certificate "stateofthemap.org" do + domains ["stateofthemap.org", "www.stateofthemap.org", + "stateofthemap.com", "www.stateofthemap.com", + "sotm.org", "www.sotm.org"] + notifies :reload, "service[apache2]" +end + +apache_site "stateofthemap.org" do + template "apache.container.erb" + variables :docker_external_port => docker_external_port, :aliases => ["www.stateofthemap.org", "stateofthemap.com", "www.stateofthemap.com", "sotm.org", "www.sotm.org"] +end + %w[2013 2016 2017 2018 2019 2020 2021 2022].each do |year| docker_external_port = 6180 + year.to_i # 8193+ diff --git a/cookbooks/stateofthemap/recipes/default.rb b/cookbooks/stateofthemap/recipes/default.rb index aa98e5bc5..3047f77a8 100644 --- a/cookbooks/stateofthemap/recipes/default.rb +++ b/cookbooks/stateofthemap/recipes/default.rb @@ -16,29 +16,3 @@ # See the License for the specific language governing permissions and # limitations under the License. # - -include_recipe "apache" -include_recipe "git" - -apache_module "expires" - -git "/srv/stateofthemap.org" do - action :sync - repository "https://git.openstreetmap.org/public/stateofthemap.git" - revision "chooser" - depth 1 - user "root" - group "root" -end - -ssl_certificate "stateofthemap.org" do - domains ["stateofthemap.org", "www.stateofthemap.org", - "stateofthemap.com", "www.stateofthemap.com", - "sotm.org", "www.sotm.org"] - notifies :reload, "service[apache2]" -end - -apache_site "stateofthemap.org" do - template "apache.erb" - directory "/srv/stateofthemap.org" -end diff --git a/cookbooks/stateofthemap/templates/default/apache.erb b/cookbooks/stateofthemap/templates/default/apache.erb deleted file mode 100644 index 7cca3c5a1..000000000 --- a/cookbooks/stateofthemap/templates/default/apache.erb +++ /dev/null @@ -1,58 +0,0 @@ -# DO NOT EDIT - This file is being maintained by Chef - - - ServerName stateofthemap.org - ServerAlias stateofthemap.com - ServerAlias sotm.org - ServerAlias www.stateofthemap.org - ServerAlias www.stateofthemap.com - ServerAlias www.sotm.org - ServerAdmin webmaster@openstreetmap.org - - CustomLog /var/log/apache2/stateofthemap.org-access.log combined - ErrorLog /var/log/apache2/stateofthemap.org-error.log - - RedirectPermanent /.well-known/acme-challenge/ http://acme.openstreetmap.org/.well-known/acme-challenge/ - RedirectPermanent / https://stateofthemap.org/ - - - - ServerName stateofthemap.com - ServerAlias sotm.org - ServerAlias www.stateofthemap.org - ServerAlias www.stateofthemap.com - ServerAlias www.sotm.org - ServerAdmin webmaster@openstreetmap.org - - CustomLog /var/log/apache2/stateofthemap.org-access.log combined - ErrorLog /var/log/apache2/stateofthemap.org-error.log - - SSLEngine on - SSLCertificateFile /etc/ssl/certs/stateofthemap.org.pem - SSLCertificateKeyFile /etc/ssl/private/stateofthemap.org.key - - RedirectPermanent / https://stateofthemap.org/ - - - - ServerName stateofthemap.org - ServerAdmin webmaster@openstreetmap.org - - CustomLog /var/log/apache2/stateofthemap.org-access.log combined - ErrorLog /var/log/apache2/stateofthemap.org-error.log - - SSLEngine on - SSLCertificateFile /etc/ssl/certs/stateofthemap.org.pem - SSLCertificateKeyFile /etc/ssl/private/stateofthemap.org.key - - DocumentRoot /srv/stateofthemap.org/html - - ErrorDocument 404 /404.html - - ExpiresActive On - ExpiresDefault "access plus 12 hours" - - - - Require all granted - diff --git a/test/integration/stateofthemap/serverspec/apache_spec.rb b/test/integration/stateofthemap/serverspec/apache_spec.rb deleted file mode 100644 index 446d3b915..000000000 --- a/test/integration/stateofthemap/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