1
0
Fork 0
mirror of https://github.com/roles-ansible/ansible_collection_pretix.git synced 2024-10-28 22:01:03 +01:00

Update pretix services

This commit is contained in:
L3D 2024-10-14 12:06:26 +02:00
parent c7e918d0a6
commit d030d65dfc
Signed by: l3d
GPG key ID: CD08445BFF4313D1
9 changed files with 132 additions and 1 deletions

View file

@ -15,6 +15,11 @@ pretix__db_user: 'pretix'
pretix__db_password: ''
pretix__db_host: 'localhost'
pretix__web_workers: 5
pretix__web_loglevel: 'info'
pretix__web_bind: '127.0.0.1:8345'
pretix__web_oncalendar: '*-*-* */6:00:00'
pretix__web_timer_delay: '1800'
# Optional perform simple Versionscheck
submodules_versioncheck: false

View file

@ -0,0 +1,16 @@
---
- name: Restart pretix worker
listen: 'systemctl restart pretix-web.service'
become: true
ansible.builtin.systemd_service:
name: 'pretix-web'
state: 'restarted'
enabled: true
- name: Restart pretix worker
listen: 'systemctl restart pretix-worker.service'
become: true
ansible.builtin.systemd_service:
name: 'pretix-worker'
state: 'restarted'
enabled: true

View file

@ -19,3 +19,7 @@
- name: Install pretix
ansible.builtin.include_tasks:
file: 'install.yml'
- name: Create systemd service
ansible.builtin.include_tasks:
file: 'systemd.yml'

View file

@ -0,0 +1,42 @@
---
- name: Create pretix-web service unit
become: true
ansible.builtin.template:
src: 'templates/pretix-web.service.j2'
dest: '/etc/systemd/system/pretix-web.service'
owner: 'root'
group: 'root'
mode: '0644'
notify: 'systemctl restart pretix-web.service'
- name: Create pretix-worker service unit
become: true
ansible.builtin.template:
src: 'templates/pretix-worker.service.j2'
dest: '/etc/systemd/system/pretix-worker.service'
owner: 'root'
group: 'root'
mode: '0644'
notify: 'systemctl restart pretix-worker.service'
- name: Create pretix-cron service unit
become: true
ansible.builtin.template:
src: 'templates/pretix-cron.timer.j2'
dest: '/etc/systemd/system/pretix-cron.service'
owner: 'root'
group: 'root'
mode: '0644'
notify: 'systemctl restart pretix-cron.service'
- name: Make sure services are started
become: true
ansible.builtin.systemd_service:
name: "{{ item }}"
state: 'restarted'
daemon_reload: true
enabled: true
with_items:
- 'pretix-web'
- 'pretix-worker'
- 'pretix-cron'

View file

@ -0,0 +1,17 @@
{{ ansible_managed | comment }}
[Unit]
Description=pretix runperiodic service
After=network.target
[Service]
User={{ pretix__user }}
Group={{ pretix__group }}
Environment="VIRTUAL_ENV={{ pretix__data }}/venv"
Environment="PATH={{ pretix__data }}/venv/bin:/usr/local/bin:/usr/bin:/bin"
ExecStart={{ pretix__data }}/venv/bin/python3 -m pretix runperiodic
WorkingDirectory={{ pretix__data }}
Restart=on-failure
[Install]
WantedBy=multi-user.target

View file

@ -0,0 +1,11 @@
{{ ansible_managed | comment }}
[Unit]
Description=Run pretix runperiodic service
[Timer]
OnCalendar={{ pretix__web_oncalendar }}
RandomizedDelaySec={{ pretix__web_timer_delay }}
Persistent=true
[Install]
WantedBy=timers.target

View file

@ -0,0 +1,20 @@
{{ ansible_managed | comment }}
[Unit]
Description=pretix web service
After=network.target
[Service]
User={{ pretix__user }}
Group={{ pretix__group }}
Environment="VIRTUAL_ENV={{ pretix__data }}/venv"
Environment="PATH={{ pretix__data }}/venv/bin:/usr/local/bin:/usr/bin:/bin"
ExecStart={{ pretix__data }}/venv/bin/gunicorn pretix.wsgi \
--name pretix --workers {{ pretix__web_workers }} \
--max-requests 1200 --max-requests-jitter 50 \
--log-level={{ pretix__web_loglevel }} --bind={{ pretix__web_bind }}
WorkingDirectory={{ pretix__data }}
Restart=on-failure
[Install]
WantedBy=multi-user.target

View file

@ -0,0 +1,16 @@
{{ ansible_managed | comment }}
[Unit]
Description=pretix background worker
After=network.target
[Service]
User={{ pretix__user }}
Group={{ pretix__group }}
Environment="VIRTUAL_ENV={{ pretix__data }}/venv"
Environment="PATH={{ pretix__data }}/venv/bin:/usr/local/bin:/usr/bin:/bin"
ExecStart={{ pretix__data }}/venv/bin/celery -A pretix.celery_app worker -l {{ pretix__web_loglevel }}
WorkingDirectory={{ pretix__data }}
Restart=on-failure
[Install]
WantedBy=multi-user.target

View file

@ -21,5 +21,5 @@ pretix__pip_packages:
- 'pretix'
- 'gunicorn'
packages__playbook_version_number: 4
packages__playbook_version_number: 5
packages__playbook_version_path: 'l3d.pretix.pretix.version'