fix(thelounge): handle reverse proxy
Signed-off-by: Matej Focko <me@mfocko.xyz>
This commit is contained in:
parent
e0f3fbe22b
commit
4fa3f26d43
4 changed files with 39 additions and 1 deletions
10
roles/thelounge/defaults/main.yml
Normal file
10
roles/thelounge/defaults/main.yml
Normal 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
|
|
@ -9,6 +9,16 @@
|
||||||
- thelounge.container
|
- thelounge.container
|
||||||
- thelounge.volume
|
- 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
|
- name: Enable the TheLounge quadlet
|
||||||
ansible.builtin.systemd_service:
|
ansible.builtin.systemd_service:
|
||||||
daemon_reload: true
|
daemon_reload: true
|
||||||
|
|
18
roles/thelounge/templates/nginx.conf
Normal file
18
roles/thelounge/templates/nginx.conf
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
|
@ -7,7 +7,7 @@ Description=The Lounge
|
||||||
ContainerName=thelounge
|
ContainerName=thelounge
|
||||||
Image=ghcr.io/thelounge/thelounge:latest
|
Image=ghcr.io/thelounge/thelounge:latest
|
||||||
|
|
||||||
PublishPort=9000:9000
|
PublishPort={{ thelounge_http_port }}:9000
|
||||||
|
|
||||||
Volume=thelounge-data:/var/opt/thelounge
|
Volume=thelounge-data:/var/opt/thelounge
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue