systemd: ensure unix socket is removed on ungraceful shutdown

Caddy chokes if it dies or systemd timeout kills the process ungracefully as it
can't deal with a left over unix file socket.
Ensure the unit always deletes the socket as a post exit cleanup strategy.
This commit is contained in:
Levente Polyak 2021-02-13 16:14:45 +00:00
parent f87a41a2de
commit 3415690be9
2 changed files with 2 additions and 1 deletions

View File

@ -29,7 +29,7 @@ source=("git+https://github.com/caddyserver/caddy#tag=${_gitcommit}?signed"
override-main-module-version.patch)
sha512sums=('SKIP'
'SKIP'
'd162f16e16be1673f11c384b79505b82fedbecacea77c2e64303b573aa982ace5706fb74eb7d0b219c5935427459537b685832357aed5ee48345648f439bf274'
'b6f69b9818b1807ebd614f696f39ca2bacc58b748273d1122c2a96641093c2acf9e168ff6a2d5b2e8b2da073993b5245740d77975d4ca823ff0598675a6b7806'
'a4d9bbcccf3c6fe9be2b7ba98214d579ecd40991c5cc520ca1d105f307b31622f1c6b5a6cd7a4e8b32ccd2a229ed70115cba9c507baa413803897b7183f9abe0'
'55ee8d3f8b14f9adddc7a1026addcea4f85b4bae4cd512fd4da2a5e8adaae4b6fd0f486d2e3847f75518f4710a897b4fca84e48ee15700b968bad762125c4742'
'c893d88fec89e37da6596030c8dce7103e7e575371e8542a24d2a0741e877358d85219f2d8ade9d6aa0f515efe1156a4badd9fef5f65f553a5b0c72330c4728f'

View File

@ -29,6 +29,7 @@ Environment=XDG_CONFIG_HOME=/etc
ExecStartPre=/usr/bin/caddy validate --config /etc/caddy/Caddyfile
ExecStart=/usr/bin/caddy run --environ --config /etc/caddy/Caddyfile
ExecReload=/usr/bin/caddy reload --config /etc/caddy/Caddyfile
ExecStopPost=/usr/bin/rm -f /run/caddy/admin.socket
# Do not allow the process to be restarted in a tight loop. If the
# process fails to start, something critical needs to be fixed.