make the service work

This commit is contained in:
erebion 2023-09-04 16:47:31 +02:00
parent 653ad841cb
commit d72d431a1f
2 changed files with 16 additions and 4 deletions

View file

@ -10,15 +10,25 @@
ansible.builtin.file: ansible.builtin.file:
path: "{{ item }}" path: "{{ item }}"
state: directory state: directory
owner: 15371 #this is the ID Pretix uses owner: 15371
group: 15371 group: 15371
mode: '0750' mode: '0750'
recurse: true recurse: true
with_items: with_items:
- "{{ docker_volumes_dir }}/pretix/postgres-db"
- "{{ docker_volumes_dir }}/pretix/data" - "{{ docker_volumes_dir }}/pretix/data"
- "{{ docker_volumes_dir }}/pretix/conf" - "{{ docker_volumes_dir }}/pretix/conf"
- name: "Create directories for Pretix (Postgres DB)"
ansible.builtin.file:
path: "{{ item }}"
state: directory
owner: root #this is the ID Pretix uses
group: root
mode: '0750'
recurse: true
with_items:
- "{{ docker_volumes_dir }}/pretix/postgres-db"
- name: "Template .env files for Pretix" - name: "Template .env files for Pretix"
ansible.builtin.template: ansible.builtin.template:
src: "{{ item }}.j2" src: "{{ item }}.j2"

View file

@ -2,8 +2,8 @@
Description=Pretix with Docker Description=Pretix with Docker
After=docker.service After=docker.service
Requires=docker.service Requires=docker.service
Requires={{ pretix_db_container_name }} Requires=pretix-db.service
Requires={{ pretix_redis_container_name }} Requires=pretix-redis.service
[Service] [Service]
ExecStartPre=-/usr/bin/docker rm --force {{ pretix_container_name }} ExecStartPre=-/usr/bin/docker rm --force {{ pretix_container_name }}
@ -12,9 +12,11 @@ ExecStart=/usr/bin/docker run --rm --name {{ pretix_container_name }} --network
-v {{ docker_volumes_dir }}/pretix/data:/data \ -v {{ docker_volumes_dir }}/pretix/data:/data \
-v {{ docker_volumes_dir }}/pretix/conf:/etc/pretix \ -v {{ docker_volumes_dir }}/pretix/conf:/etc/pretix \
pretix/standalone:stable pretix/standalone:stable
ExecStartPost=/usr/bin/bash -c "/bin/sleep 10 && /usr/bin/docker network connect nginx_net {{ pretix_container_name }}"
ExecStop=/usr/bin/docker stop {{ watchtower_container_name }} ExecStop=/usr/bin/docker stop {{ watchtower_container_name }}
Restart=always Restart=always
RestartSec=15s RestartSec=15s
Type=exec
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target