Skip to content

Latest commit

 

History

History
83 lines (56 loc) · 2.46 KB

README.md

File metadata and controls

83 lines (56 loc) · 2.46 KB

Caddy for openSenseMap

We are using Caddy as our web server for our openSenseMap services.

Build own Image

docker build -t osem-caddy .

Run own Image

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.

Volumes

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

Environmental Variables

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

Extending and adding new hosts

  • Go and update or create a new .enabled file inside the vhosts folder.
  • Check the documentation of Caddy for Caddyfile syntax

Caddy snippets

There are some Caddy snippets available that you can use in your site blocks so you don´t have to repeat everything

ratelimit

Adds rate limit support to your site.

Docs: https://github.com/mholt/caddy-ratelimit

import ratelimit events window

headerdown

Strips down the response headers. Must be used inside reverse_proxy directive.

import headerdown

stdout

Adds standard logging to stdout.

import stdout