Commit ddff0839 authored by Leo Koppelkamm's avatar Leo Koppelkamm Committed by Matt Holt

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

* Make Upstart script more fault tolerant and easier to debug

* update readme
parent e1a6b607
......@@ -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`.
\ No newline at end of file
* Now you can use `sudo service caddy start|stop|restart`.
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
\ No newline at end of file
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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment