]> git.openstreetmap.org Git - chef.git/commitdiff
irc: Use container
authorGrant Slater <github@firefishy.com>
Sun, 12 Feb 2023 16:24:29 +0000 (16:24 +0000)
committerGrant Slater <github@firefishy.com>
Sun, 12 Feb 2023 16:38:07 +0000 (16:38 +0000)
Signed-off-by: Grant Slater <github@firefishy.com>
cookbooks/irc/files/default/html/index.html [deleted file]
cookbooks/irc/files/default/html/style.css [deleted file]
cookbooks/irc/metadata.rb
cookbooks/irc/recipes/default.rb
cookbooks/irc/templates/default/apache.erb

diff --git a/cookbooks/irc/files/default/html/index.html b/cookbooks/irc/files/default/html/index.html
deleted file mode 100644 (file)
index 21e5668..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-<!DOCTYPE html>
-<html>
-  <head>
-    <title>irc.openstreetmap.org</title>
-    <link rel="stylesheet" href="style.css" />
-  </head>
-  <body>
-    <h1>irc.openstreetmap.org</h1>
-    <div>
-      <form method="get" action="https://webchat.oftc.net/">
-        <table>
-          <tr>
-            <th>Nickname</th>
-            <td><input name="nick" type="text" /></td>
-          </tr>
-          <tr>
-            <th>Channel</th>
-            <td>
-              <select name="channels">
-                <option value="#osm">#osm</option>
-                <option value="#osm-dev">#osm-dev</option>
-                <option value="#osm-ewg">#osm-ewg</option>
-                <option value="#osm-cwg">#osm-cwg</option>
-                <option value="#osm-ar">#osm-ar</option>
-                <option value="#osm-asia">#osm-asia</option>
-                <option value="#osm-au">#osm-au</option>
-                <option value="#osm-br">#osm-br</option>
-                <option value="#osm-bw">#osm-bw</option>
-                <option value="#osm-by">#osm-by</option>
-                <option value="#osm-ca">#osm-ca</option>
-                <option value="#osm-ch">#osm-ch</option>
-                <option value="#osm-cz">#osm-cz</option>
-                <option value="#osm-de">#osm-de</option>
-                <option value="#osm-dk">#osm-dk</option>
-                <option value="#osm-es">#osm-es</option>
-                <option value="#osm-fi">#osm-fi</option>
-                <option value="#osm-fr">#osm-fr</option>
-                <option value="#osm-gb">#osm-gb</option>
-                <option value="#osm-gr">#osm-gr</option>
-                <option value="#osm-gsoc">#osm-gsoc</option>
-                <option value="#osm-ht">#osm-ht</option>
-                <option value="#osm-ie">#osm-ie</option>
-                <option value="#osm-it">#osm-it</option>
-                <option value="#osm-ke">#osm-ke</option>
-                <option value="#osm-latam">#osm-latam</option>
-                <option value="#osm-local">#osm-local</option>
-                <option value="#osm-lv">#osm-lv</option>
-                <option value="#osm-nl">#osm-nl</option>
-                <option value="#osm-no">#osm-no</option>
-                <option value="#osm-nominatim">#osm-nominatim</option>
-                <option value="#osm-pl">#osm-pl</option>
-                <option value="#osm-pt">#osm-pt</option>
-                <option value="#osm-ru">#osm-ru</option>
-                <option value="#osm.se">#osm.se</option>
-                <option value="#osm-strategic">#osm-strategic</option>
-                <option value="#osm-ua">#osm-ua</option>
-                <option value="#osm-us">#osm-us</option>
-                <option value="#osm-za">#osm-za</option>
-                <option value="#osm-zh">#osm-zh</option>
-                <option value="#osmf-gm">#osmf-gm</option>
-                <option value="#osrm">#osrm</option>
-                <option value="#openrailwaymap">#openrailwaymap</option>
-                <option value="#hot">#hot</option>
-              </select>
-            </td>
-          </tr>
-          <tr>
-            <th></th>
-            <td><input type="submit" value="Connect" /></td>
-          </tr>
-        </table>
-      </form>
-    </div>
-  </body>
-</html>
diff --git a/cookbooks/irc/files/default/html/style.css b/cookbooks/irc/files/default/html/style.css
deleted file mode 100644 (file)
index 3a8dc02..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-h1 {
-  text-align: center;
-}
-
-div {
-  display: flex;
-}
-
-form {
-  margin: auto;
-}
index 6e745f6e6c2ef9c399190f602a6eb66f3486fe61..755e6f9c750c8e01b160ccd20ff0917a8c2cc731 100644 (file)
@@ -7,3 +7,4 @@ description       "Configures irc.openstreetmap.org"
 version           "1.0.0"
 supports          "ubuntu"
 depends           "apache"
+depends           "podman"
index 7fbc7ff743d77754a8f405de5d5fa1d8b936aba8..ef6332dceeaea8c2e2b56201b3a8c42318dbc3c8 100644 (file)
 #
 
 include_recipe "apache"
+include_recipe "podman"
+
+docker_external_port = 8092
+
+podman_service "irc.openstreetmap.org" do
+  description "Container service for irc.openstreetmap.org"
+  image "ghcr.io/openstreetmap/irc:latest"
+  ports docker_external_port => "8080"
+end
 
 ssl_certificate "irc.openstreetmap.org" do
   domains ["irc.openstreetmap.org", "irc.osm.org"]
   notifies :reload, "service[apache2]"
 end
 
-directory "/srv/irc.openstreetmap.org" do
-  owner "root"
-  group "root"
-  mode "755"
-end
-
-remote_directory "/srv/irc.openstreetmap.org/html" do
-  source "html"
-  owner "root"
-  group "root"
-  mode "755"
-  files_owner "root"
-  files_group "root"
-  files_mode "644"
-end
+apache_module "proxy_http"
 
 apache_site "irc.openstreetmap.org" do
   template "apache.erb"
-  directory "/srv/irc.openstreetmap.org/html"
-  variables :aliases => ["irc.osm.org"]
+  variables :docker_external_port => docker_external_port, :aliases => ["irc.osm.org"]
 end
index ceb112e184fbbee3f9e15fa693f47c9648a28d2f..55dc39c18b1f37a6cb9448932af0b2bf18bc13ec 100644 (file)
@@ -1,17 +1,17 @@
 # DO NOT EDIT - This file is being maintained by Chef
 
-<VirtualHost *:443>
+<VirtualHost *:80>
   ServerName <%= @name %>
+<% @aliases.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
 
-  DocumentRoot <%= @directory %>
+  RedirectPermanent /.well-known/acme-challenge/ http://acme.openstreetmap.org/.well-known/acme-challenge/
+  RedirectPermanent / https://<%= @name %>/
 </VirtualHost>
 <% unless @aliases.empty? -%>
 
 <% end -%>
   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
 
-  CustomLog /var/log/apache2/<%= @name %>-access.log combined
-  ErrorLog /var/log/apache2/<%= @name %>-error.log
-
   RedirectPermanent / https://<%= @name %>/
 </VirtualHost>
 <% end -%>
 
-<VirtualHost *:80>
+<VirtualHost *:443>
   ServerName <%= @name %>
-<% @aliases.each do |alias_name| -%>
-  ServerAlias <%= alias_name %>
-<% end -%>
   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>
+  SSLEngine on
+  SSLCertificateFile /etc/ssl/certs/<%= @name %>.pem
+  SSLCertificateKeyFile /etc/ssl/private/<%= @name %>.key
+
+  RequestHeader set X-Forwarded-Proto "https"
+  RequestHeader set X-Forwarded-Port "443"
 
-<Directory <%= @directory %>>
-  Require all granted
-</Directory>
+  ProxyPass / http://localhost:<%= @docker_external_port %>/
+  ProxyPreserveHost on
+</VirtualHost>