docs: short readme

This commit is contained in:
hh committed 2026-10-08 21:34:48 +02:00
1 parent 21eafc610b
commit 70cb984151
2 files changed
+3 -21

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
# caddy # caddy
Copier template for a `caddy/` directory: a portable `site.caddy` for the project's `api` and `frontend` services, a standalone Caddy compose file and an example global Caddyfile. Copier template for a `caddy/` directory: a portable `site.caddy` for the project's `api` and `frontend`, a standalone compose file and an example Caddyfile.
```sh ```sh
copier copy --trust -d project_slug=my_thing -d 'routes=["api","frontend"]' <this-repo> <dest> copier copy --trust -d project_slug=my_thing -d 'routes=["api","frontend"]' <this-repo> <dest>
+2 -20
View File
@@ -1,23 +1,5 @@
{%- set dash = project_slug | replace('_', '-') -%} {%- set dash = project_slug | replace('_', '-') -%}
{%- set domain = project_slug | upper | replace('-', '_') ~ '_DOMAIN' -%}
# caddy # caddy
`site.caddy` routes `{{ '{$' }}{{ project_slug | upper | replace('-', '_') }}_DOMAIN}` to the project's services over the external `caddy` docker network. It works standalone and inside a shared Caddy that fronts several projects. `site.caddy` routes `{{ '{$' }}{{ domain }}}` to the project over the external `caddy` network. In a shared Caddy, mount this directory as `/etc/caddy/projects.d/{{ dash }}:ro` and set `{{ domain }}`. Keep it portable: domain only from the env, no `tls`, snippets prefixed with `{{ project_slug }}_`.
Standalone:
```sh
docker network create caddy
cp Caddyfile.example Caddyfile
cp .env.example .env
docker compose up -d
```
Shared Caddy: mount this directory as `/etc/caddy/projects.d/{{ dash }}:ro`, keep `import /etc/caddy/projects.d/*/site.caddy` in its Caddyfile and put `{{ project_slug | upper | replace('-', '_') }}_DOMAIN` in its environment.
Rules that keep `site.caddy` portable:
- the domain comes only from the environment variable
- no `tls` block, certificates are configured by the host Caddy (`acme_dns cloudflare {env.CLOUDFLARE_API_TOKEN}` in the global block)
- snippets are prefixed with the project slug because Caddy snippets are global
- mount the directory, not the file: a single-file bind mount goes stale when git replaces the inode
- keep `admin localhost:2019`, `admin off` makes `caddy reload` impossible