fix(thelounge): handle reverse proxy

Signed-off-by: Matej Focko <me@mfocko.xyz>
This commit is contained in:
Matej Focko 2024-11-18 15:35:55 +01:00
parent e0f3fbe22b
commit 4fa3f26d43
Signed by: mfocko
SSH key fingerprint: SHA256:icm0fIOSJUpy5+1x23sfr+hLtF9UhY8VpMC7H4WFJP8
4 changed files with 39 additions and 1 deletions

View file

@ -0,0 +1,10 @@
---
# Defines whether TheLounge is deployed behind a reverse proxy
# if so, installs the nginx config file
thelounge_reverse_proxy: true
# Subdomain to be used for the reverse proxy configuration
thelounge_subdomain: lounge
# HTTP port that's both exposed by container and used by the reverse proxy
thelounge_http_port: 9000

View file

@ -9,6 +9,16 @@
- thelounge.container
- thelounge.volume
- name: Install the reverse proxy config
ansible.builtin.template:
src: templates/nginx.conf
dest: "/etc/nginx/conf.d/thelounge.conf"
mode: 0644
owner: root
group: root
when: thelounge_reverse_proxy
notify: Restart nginx
- name: Enable the TheLounge quadlet
ansible.builtin.systemd_service:
daemon_reload: true

View file

@ -0,0 +1,18 @@
# {{ ansible_managed }}
upstream thelounge {
server 127.0.0.1:{{ thelounge_http_port }};
}
server {
listen 443 ssl http2; # managed by Certbot
listen [::]:443 ssl http2; # managed by Certbot
include ssl.conf;
server_name {{ thelounge_subdomain }}.{{ host_fqdn }};
location ~ / {
include proxy.conf;
proxy_pass http://thelounge;
}
}

View file

@ -7,7 +7,7 @@ Description=The Lounge
ContainerName=thelounge
Image=ghcr.io/thelounge/thelounge:latest
PublishPort=9000:9000
PublishPort={{ thelounge_http_port }}:9000
Volume=thelounge-data:/var/opt/thelounge