Files
configpolicy/roles/bitwarden_rs/templates/vaultwarden.service.j2
Dustin C. Hatch 1834f9a108 r/bitwarden_rs: Remove dangling container at start
If the *vaultwarden* service terminates unexpectedly, e.g. due to a
power loss, `podman` may not successfully remove the container.  We
therefore need to try to delete it before starting it again, or `podman`
will exit with an error because the container already exists.
2022-08-22 20:06:02 -05:00

27 lines
677 B
Django/Jinja

[Unit]
Description=Vaultwarden API server
[Service]
Type=notify
NotifyAccess=all
ExecStartPre=-/usr/bin/podman container rm --force --ignore vaultwarden
ExecStart=/usr/bin/podman run \
--pull never \
--sdnotify=conmon --cgroups=no-conmon \
--rm \
--network=host \
--name vaultwarden \
-v /var/lib/vaultwarden/data:/data:Z \
--env-file /etc/sysconfig/vaultwarden \
--uidmap 0:{{ vaultwarden_user.uid }}:1 \
--gidmap 0:{{ vaultwarden_user.group }}:1 \
--uidmap 1:100000:65536 \
--gidmap 1:100000:65536 \
docker.io/vaultwarden/server:latest
SuccessExitStatus=143
ProtectSystem=full
UMask=0077
[Install]
WantedBy=multi-user.target