0
Fork 0
mirror of https://github.com/caddyserver/caddy.git synced 2024-12-23 22:27:38 -05:00
caddy/dist/init
Andreas Linz 53ae9b8521 Increase restart rate limit
The previous setting caused the service to hit a rate-limit when it was
restarted more than 5 times in 24h.
Editing the Caddyfile and restarting the service could also easily
trigger this rate limit.
One could argue that users could simply call `systemctl reset-failed
caddy` to reset the rate-limit counter, but this is counterintuitive
because most users won't know this command and are possibly unaware that
they had hit a rate-limit.

The service is now allowed to restart 10 times in 10 seconds before
hitting a rate limit.
This should be conservative enough to rate limit quickly failing
services and to allow users to edit and test their caddy configuration.

This closes #1718

Remove restart limit settings and use defaults

By default 5 restarts within 10 seconds are allowed without
encountering a restart limit hit, see  `man systemd.unit` for details.

Set Restart to on-abnormal

The table in https://www.freedesktop.org/software/systemd/man/systemd.service.html#Restart=
shows the conditions for which on-abnormal would restart the service.
It will *not* restart the service in the following cases:

- a non-zero exit status, e.g. an invalid Caddyfile
- a zero exit code (or those specified in SuccessExitStatus=) and a clean signal
    clean signals are SIGHUP, SIGINT, SIGTERM or SIGPIPE
    3536f49e8f/src/basic/exit-status.c (L205)

The service *will be restarted* in the following cases:

- a unclean signal, e.g. SIGKILL
- on start and watchdog timeout (we don't use those systemd service
constructs explicitly)
2017-08-13 16:38:19 +02:00
..
freebsd freebsd init: typo in filename. (#1799) 2017-08-04 18:20:00 -06:00
linux-systemd Increase restart rate limit 2017-08-13 16:38:19 +02:00
linux-sysvinit Update Initscripts 2017-06-04 12:18:33 +08:00
linux-upstart Make CADDYPATH equal across init scripts 2017-03-28 22:04:19 +01:00
mac-launchd update macOS launchd example (#1600) 2017-04-26 13:44:32 -06:00
README.md Post init script guidelines 2016-12-30 11:56:37 -07:00

Init/Service Scripts

This folder contains init/service scripts for using Caddy on various Linux and BSD distributions. They are created and maintained by the community.

Getting Help

Different scripts have different maintainers; please consult the comments in the file and any README for assistance setting it up. Do not open an issue on the Caddy project about these scripts; instead, to ask a question or suggest a change, please contact the maintainer of the script directly.

Disclaimer

The files contained herein are not officially supported by the Caddy project author and/or contributors, and as such, the files are not endorsed by the same. The Caddy project author and its contributors are not responsible for the function or malfunction of these scripts/files, or any unintended consequences to your system or website in attempting to set up Caddy. Users are expected to know how to administer their system, and these files should be considered as only a guide or suggestion for using Caddy in certain environments.

Guidelines

The files distributed here should adhere to these principles where relevant (adjust accordingly for each system/platform):

  • Don't run as root.
  • Create a no-shell default user to run it.
  • Raise file descriptor limits.
  • Don't restart endlessly; if Caddy fails to start, there's a reason -- fix it, don't hammer it.
  • Allow Caddy to re-use the same, persistent folder for storage.
  • Stay as simple and minimal as possible.
  • Be idempotent.
  • Use comments to explain unexpected or unusual lines/patterns.
  • Be secure by default.

Thank you for using Caddy! May it serve you well.