15
infra/services/caddy/Caddyfile
Normal file
15
infra/services/caddy/Caddyfile
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
email custom-domains@ente.io
|
||||
on_demand_tls {
|
||||
ask https://api.ente.io/custom-domain
|
||||
}
|
||||
}
|
||||
|
||||
https:// {
|
||||
tls {
|
||||
on_demand
|
||||
}
|
||||
reverse_proxy https://custom-albums.ente.io {
|
||||
header_up Host {upstream_hostport}
|
||||
}
|
||||
}
|
||||
19
infra/services/caddy/README.md
Normal file
19
infra/services/caddy/README.md
Normal file
@@ -0,0 +1,19 @@
|
||||
# Caddy
|
||||
|
||||
Caddy is used to terminate TLS and manage certificates for custom domains.
|
||||
|
||||
## Installation
|
||||
|
||||
```sh
|
||||
sudo mkdir -p /root/caddy/conf
|
||||
sudo mv Caddyfile /root/caddy/conf
|
||||
sudo chown root:root /root/caddy/conf/Caddyfile
|
||||
```
|
||||
|
||||
Rest of it works like our other systemd services.
|
||||
|
||||
If the Caddyfile changes, the running instance can be updated without restarts by using `sudo systemctl reload caddy`.
|
||||
|
||||
## Backups
|
||||
|
||||
The entire `/root/caddy` directory can be backed up and contains the everything needed to resurrect the same setup.
|
||||
17
infra/services/caddy/caddy.service
Normal file
17
infra/services/caddy/caddy.service
Normal file
@@ -0,0 +1,17 @@
|
||||
[Unit]
|
||||
Documentation=https://caddyserver.com/docs/running
|
||||
Requires=docker.service
|
||||
After=docker.service
|
||||
|
||||
[Service]
|
||||
ExecStartPre=docker pull caddy
|
||||
ExecStartPre=-docker stop caddy
|
||||
ExecStartPre=-docker rm caddy
|
||||
ExecStart=docker run --name caddy \
|
||||
--cap-add NET_ADMIN \
|
||||
-p 80:80 -p 443:443 -p 443:443/udp \
|
||||
-v /root/caddy/conf:/etc/caddy \
|
||||
-v /root/caddy/data:/data \
|
||||
-v /root/caddy/config:/config \
|
||||
caddy
|
||||
ExecReload=docker exec -w /etc/caddy caddy caddy reload
|
||||
Reference in New Issue
Block a user