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:
parent
c7e918d0a6
commit
d030d65dfc
9 changed files with 132 additions and 1 deletions
|
@ -15,6 +15,11 @@ pretix__db_user: 'pretix'
|
||||||
pretix__db_password: ''
|
pretix__db_password: ''
|
||||||
pretix__db_host: 'localhost'
|
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
|
# Optional perform simple Versionscheck
|
||||||
submodules_versioncheck: false
|
submodules_versioncheck: false
|
||||||
|
|
16
roles/pretix/handlers/main.yml
Normal file
16
roles/pretix/handlers/main.yml
Normal 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
|
|
@ -19,3 +19,7 @@
|
||||||
- name: Install pretix
|
- name: Install pretix
|
||||||
ansible.builtin.include_tasks:
|
ansible.builtin.include_tasks:
|
||||||
file: 'install.yml'
|
file: 'install.yml'
|
||||||
|
|
||||||
|
- name: Create systemd service
|
||||||
|
ansible.builtin.include_tasks:
|
||||||
|
file: 'systemd.yml'
|
||||||
|
|
42
roles/pretix/tasks/systemd.yml
Normal file
42
roles/pretix/tasks/systemd.yml
Normal 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'
|
17
roles/pretix/templates/pretix-cron.service.j2
Normal file
17
roles/pretix/templates/pretix-cron.service.j2
Normal 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
|
11
roles/pretix/templates/pretix-cron.timer.j2
Normal file
11
roles/pretix/templates/pretix-cron.timer.j2
Normal 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
|
20
roles/pretix/templates/pretix-web.service.j2
Normal file
20
roles/pretix/templates/pretix-web.service.j2
Normal 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
|
16
roles/pretix/templates/pretix-worker.service.j2
Normal file
16
roles/pretix/templates/pretix-worker.service.j2
Normal 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
|
|
@ -21,5 +21,5 @@ pretix__pip_packages:
|
||||||
- 'pretix'
|
- 'pretix'
|
||||||
- 'gunicorn'
|
- 'gunicorn'
|
||||||
|
|
||||||
packages__playbook_version_number: 4
|
packages__playbook_version_number: 5
|
||||||
packages__playbook_version_path: 'l3d.pretix.pretix.version'
|
packages__playbook_version_path: 'l3d.pretix.pretix.version'
|
||||||
|
|
Loading…
Reference in a new issue