We are using Caddy as our web server for our openSenseMap services.
docker build -t osem-caddy .
docker run \
--volume $PWD/certs:/root/.caddy \
--env WEB_DOMAIN=your.web.domain \
--env API_DOMAIN=your.api.domain \
--env INGRESS_DOMAIN=your.ingress.domain \
--env ISSUER_ADDRESS=your.email@domain \
--env ACME_CA_ENDPOINT=https://acme-staging-v02.api.letsencrypt.org/directory
--publish 80:80 \
--publish 443:443 \
--publish 8000:8000 \
caddy
By default the container is using the Production endpoint of Let´s encrypt. Change it to the Staging endpoint by using the env ACME_CA_ENDPOINT and not hitting rate-limits.
Also checkout our docker-compose.yml how to run it with Docker Compose.
It is possible to add additional vhosts through the ADDITIONAL_VHOSTS
environment variable. The whole contents of this variable will be parsed as caddy directives.
The default caddy configuration is activating the file_server
directive under https://static.WEB_DOMAIN
.
To serve static files map a volume to /etc/caddy/roots/statics
For configuration there are the following env variables available:
Name | Value | Description |
---|---|---|
ACME_CA_ENDPOINT | https://acme-v02.api.letsencrypt.org/directory | Let´s Encrypt Endpoint |
ISSUER_ADDRESS | - | Email address used when creating an ACME account with your CA. |
API_DOMAIN | - | Your API domain |
INGRESS_DOMAIN | - | Your Ingress domain |
WEB_DOMAIN | - | Your Web domain |
TTN_DOMAIN | - | Your TTN domain |
TINGG_DOMAIN | - | Your TINGG domain |
METRICS_DOMAIN | - | Your metrics domain |
METRICS_USER | - | Your metrics basic auth user |
METRICS_PASSWORD | - | Your metrics basic auth password |
ADDITIONAL_VHOSTS | - | Additional hosts |
- Go and update or create a new .enabled file inside the
vhosts
folder. - Check the documentation of Caddy for Caddyfile syntax
There are some Caddy snippets available that you can use in your site blocks so you don´t have to repeat everything
Adds rate limit support to your site.
Docs: https://github.com/mholt/caddy-ratelimit
import ratelimit events window
Strips down the response headers. Must be used inside reverse_proxy directive.
import headerdown
Adds standard logging to stdout.
import stdout