chore(*): adopt project templates
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
BEAVERGRAM_DOMAIN=beavergram.localhost
|
||||
BEAVERGRAM_DEV_DOMAIN=dev.beavergram.localhost
|
||||
|
||||
CLOUDFLARE_API_TOKEN=
|
||||
|
||||
+1
-1
@@ -1,2 +1,2 @@
|
||||
Caddyfile
|
||||
.env
|
||||
Caddyfile
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
{
|
||||
admin off
|
||||
# acme_dns cloudflare {env.CLOUDFLARE_API_TOKEN}
|
||||
admin localhost:2019
|
||||
|
||||
log {
|
||||
format console
|
||||
@@ -12,8 +11,4 @@
|
||||
}
|
||||
}
|
||||
|
||||
(compress) {
|
||||
encode zstd gzip
|
||||
}
|
||||
|
||||
import /etc/caddy/projects.d/*.caddy
|
||||
import /etc/caddy/projects.d/*/site.caddy
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
# caddy
|
||||
|
||||
`site.caddy` routes `{$BEAVERGRAM_DOMAIN}` to the project's services over the external `caddy` docker network. It works standalone and inside a shared Caddy that fronts several projects.
|
||||
|
||||
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/beavergram:ro`, keep `import /etc/caddy/projects.d/*/site.caddy` in its Caddyfile and put `BEAVERGRAM_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
|
||||
@@ -12,7 +12,7 @@ services:
|
||||
- .env
|
||||
volumes:
|
||||
- ./Caddyfile:/etc/caddy/Caddyfile:ro
|
||||
- ./site.caddy:/etc/caddy/projects.d/beavergram.caddy:ro
|
||||
- .:/etc/caddy/projects.d/beavergram:ro
|
||||
- caddy_data:/data
|
||||
|
||||
networks:
|
||||
|
||||
+1
-1
@@ -5,5 +5,5 @@
|
||||
|
||||
{$BEAVERGRAM_DEV_DOMAIN} {
|
||||
encode zstd gzip
|
||||
reverse_proxy beavergram-frontend:5173
|
||||
reverse_proxy beavergram-frontend:3000
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user