Make upstart script more fault tolerant and easier to debug (#824)

* Make Upstart script more fault tolerant and easier to debug

* update readme
This commit is contained in:
Leo Koppelkamm 2016-06-06 15:32:27 +02:00 committed by Matt Holt
parent e1a6b60736
commit ddff08392a
2 changed files with 12 additions and 6 deletions

View File

@ -9,5 +9,6 @@ Short recap:
* Download Caddy in `/usr/bin/caddy` and execute `sudo setcap cap_net_bind_service=+ep /usr/bin/caddy`.
* Save the upstart config file in `/etc/init/caddy.conf`.
* Ensure that the folder `/etc/caddy` exists and that the subfolder .caddy is owned by `www-data`.
* Create a Caddyfile in `/etc/caddy/Caddyfile`.
* Now you can use `sudo service caddy start|stop|restart`.
* Now you can use `sudo service caddy start|stop|restart`.

View File

@ -1,9 +1,9 @@
description "Caddy startup script"
author "Mathias Beke"
description "Caddy HTTP/2 web server"
start on runlevel [2345]
stop on runlevel [016]
console log
setuid www-data
setgid www-data
@ -11,8 +11,13 @@ setgid www-data
respawn
respawn limit 10 5
limit nofile 4096 4096
# Let's Encrypt certificates will be written to this directory.
env HOME=/etc/caddy
limit nofile 1048576 1048576
script
exec /usr/bin/caddy -agree=true -conf=/etc/caddy/Caddyfile
end script
cd /etc/caddy
rootdir="$(mktemp -d -t "caddy-run.XXXXXX")"
exec /usr/bin/caddy -agree -log=stdout -conf=/etc/caddy/Caddyfile -root=$rootdir
end script