Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

irc: Use container #577

Merged
merged 1 commit into from
Feb 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 0 additions & 75 deletions cookbooks/irc/files/default/html/index.html

This file was deleted.

11 changes: 0 additions & 11 deletions cookbooks/irc/files/default/html/style.css

This file was deleted.

1 change: 1 addition & 0 deletions cookbooks/irc/metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@
version "1.0.0"
supports "ubuntu"
depends "apache"
depends "podman"
28 changes: 11 additions & 17 deletions cookbooks/irc/recipes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,30 +18,24 @@
#

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
38 changes: 19 additions & 19 deletions cookbooks/irc/templates/default/apache.erb
Original file line number Diff line number Diff line change
@@ -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 [email protected]

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? -%>

Expand All @@ -22,31 +22,31 @@
<% end -%>
ServerAdmin [email protected]

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 [email protected]

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>