ansible/roles/pretix_docker/templates/pretix.service.j2

22 lines
859 B
Django/Jinja

[Unit]
Description=Pretix with Docker
After=docker.service
Requires=docker.service
Requires=pretix-db.service
Requires=pretix-redis.service
[Service]
ExecStartPre=-/usr/bin/docker rm --force {{ pretix_container_name }}
ExecStart=/usr/bin/docker run --rm --name {{ pretix_container_name }} --network pretix \
--label com.centurylinklabs.watchtower.enable={WATCHTOWER_ENABLED} --env-file {{ docker_volumes_dir }}/pretix/pretix.env \
-v {{ docker_volumes_dir }}/pretix/data:/data \
-v {{ docker_volumes_dir }}/pretix/conf:/etc/pretix \
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 }}
Restart=always
RestartSec=15s
Type=exec
[Install]
WantedBy=multi-user.target