ansible/roles/authentik_docker/templates/authentik-server-docker.service.j2

22 lines
938 B
Django/Jinja

[Unit]
Description=Authentik with Docker
After=docker.service
Requires=docker.service
[Service]
ExecStartPre=-/usr/bin/docker rm --force {{ container_names.authentik.server }}
ExecStart=/usr/bin/docker run --rm --name {{ container_names.authentik.server }} \
--network authentik_net --publish 127.0.0.1:9000:9000 --publish 127.0.0.1:9443:9443 \
--env-file {{ docker_volumes_dir }}/authentik/authentik.env \
-v {{ docker_volumes_dir }}/authentik/media:/media \
-v {{ docker_volumes_dir }}/authentik/custom-templates:/templates \
ghcr.io/goauthentik/server:{{ version.authentik }} server
ExecStartPost=/usr/bin/bash -c "/bin/sleep 45 && /usr/bin/docker network connect nginx_net {{ container_names.authentik.server }}"
ExecStop=-/usr/bin/docker stop {{ container_names.authentik.server }}
Restart=always
RestartSec=60s
TimeoutRestartSec=60s
Type=exec
[Install]
WantedBy=multi-user.target