fix: pretalx deployment

This commit is contained in:
s3lph 2025-03-09 14:37:10 +01:00
parent 69fa136834
commit d36c6e6401
Signed by: s3lph
GPG key ID: 0AA29A52FB33CFB5
5 changed files with 79 additions and 5 deletions
roles/pretalx

View file

@ -182,3 +182,10 @@ argument_specs:
- Pretalx uses this and the following two database indices.
type: int
default: 0
# Cronjob
pretalx_cron:
description:
- The cron expression of when to execute Pretalx jobs.
type: str
default: "*/15 * * * *"

View file

@ -15,7 +15,7 @@
- name: Create pretalx user
ansible.builtin.user:
name: "{{ pretalx_system_user }}"
group: "{{ ptrealx_system_group }}"
group: "{{ pretalx_system_group }}"
home: "{{ pretalx_system_home }}"
password: '!'
shell: /usr/sbin/nologin
@ -105,11 +105,20 @@
ansible.builtin.template:
src: etc/pretalx/pretalx.cfg.j2
dest: /etc/pretalx/pretalx.cfg
owner: "{{ pretalx_system_user }}"
group: "{{ pretalx_system_group }}"
owner: "{{ pretalx_subuid_begin + pretalx_container_uid }}"
group: "{{ pretalx_subgid_begin + pretalx_container_gid }}"
mode: "0700"
notify: Restart Pretalx
- name: Render Pretalx supervisord config
ansible.builtin.template:
src: etc/pretalx/supervisord.conf.j2
dest: /etc/pretalx/supervisord.conf
owner: "{{ pretalx_subuid_begin }}"
group: "{{ pretalx_subgid_begin }}"
mode: "0644"
notify: Restart Pretalx
- name: Create pretalx network
containers.podman.podman_network:
name: pretalx
@ -135,15 +144,17 @@
network:
- pretalx
ports:
- "{{ pretalx_http_hostaddr }}:{{ pretalx_http_hostport }}:80"
- "{{ pretalx_http_hostaddr }}:{{ pretalx_http_hostport }}:8080"
volumes:
- "/etc/pretalx:/etc/pretalx:ro"
- "/etc/pretalx/pretalx.cfg:/etc/pretalx/pretalx.cfg:ro"
- "/etc/pretalx/supervisord.conf:/etc/supervisord.conf:ro"
- "{{ pretalx_system_home }}/data:/data"
- "{{ pretalx_system_home }}/public:/public"
- "/run/postgresql:/run/postgresql"
env:
PRETALX_FILESYSTEM_MEDIA: /public/media
PRETALX_FILESYSTEM_STATIC: /public/static
GUNICORN_BIND_ADDR: "[::]:8080"
labels:
com.centurylinklabs.watchtower.enable: "{{ pretalx_watchtower_enabled | ternary('true', 'false') }}"
subuidname: "{{ pretalx_system_user }}"
@ -151,6 +162,16 @@
generate_systemd:
path: /etc/systemd/system
- name: Run pretalx migrate
containers.podman.podman_container_exec:
name: pretalx
command: pretalx migrate
- name: Run pretalx rebuild
containers.podman.podman_container_exec:
name: pretalx
command: pretalx rebuild
# TODO: Replace with Quadlets on Debian 13
- name: Start and enable systemd-managed podman containers
ansible.builtin.systemd_service:
@ -161,3 +182,11 @@
loop:
- pretalx-cache
- pretalx
- name: Render Pretalx cronjob
ansible.builtin.template:
src: etc/cron.d/pretalx.j2
dest: /etc/cron.d/pretalx
owner: root
group: root
mode: "0644"

View file

@ -0,0 +1,3 @@
{{ ansible_managed | comment }}
{{ pretalx_cron }} root podman exec pretalx pretalx runperiodic

View file

@ -5,6 +5,7 @@ debug=false
url={{ pretalx_url }}
[locale]
language_code={{ pretalx_language }}
time_zone={{ pretalx_timezone }}
[database]

View file

@ -0,0 +1,34 @@
{{ ansible_managed | comment }}
[unix_http_server]
file=/tmp/supervisor.sock
[supervisord]
logfile=/tmp/supervisord.log
logfile_maxbytes=50MB
logfile_backups=10
loglevel=info
pidfile=/tmp/supervisord.pid
nodaemon=false
minfds=1024
minprocs=200
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl=unix:///tmp/supervisor.sock
[program:pretalxweb]
command=/usr/local/bin/pretalx webworker
autostart=true
autorestart=true
priority=5
user=pretalxuser
environment=HOME=/pretalx,GUNICORN_BIND_ADDR="[::]:8080"
[program:pretalxtask]
command=/usr/local/bin/pretalx taskworker
autostart=true
autorestart=true
priority=5
user=pretalxuser