caddy/dist/init
George Hartzell 580f7677ad Use syslog to manage caddy std{out,err} on FreeBSD (#2652)
* Use syslog to manage caddy std{out,err} on FreeBSD

There is no good way to rotate the logfile created by the previous
FreeBSD rc.d script (it's the result of redirecting std{out,err} and
is held open by the shell).

This solves the problem by sending caddy's std{out,err} stream to
syslog, using the daemon command's builtin functionality.

It replaces the old `caddy_logfile` rc.conf variable with
`caddy_syslog_facility` (which defaults to 'local7') and
`caddy_syslog_level` (which defaults to 'notice').

By default, these messages will end up in /var/log/messages but can
be redirected as documented in the script's comments.

* Add info about rotating log with newsyslog

If you create a caddy specific logfile in `/var/log`, you should
rotate it.

This adds a bit of info to the dist/init/freebsd/README.md about
rotating that log file with newsyslog.
2019-07-18 13:58:40 -06:00
..
freebsd Use syslog to manage caddy std{out,err} on FreeBSD (#2652) 2019-07-18 13:58:40 -06:00
linux-systemd Updated systemd caddy.service (#2620) 2019-07-18 13:46:00 -06:00
linux-sysvinit implemented sourcing of default file for sysvinit (#1984) 2018-01-15 18:22:53 -07:00
linux-upstart init: Fix upstart script for Centos6 (and Amazon Linux) (#1914) 2017-10-12 17:02:46 -06: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.