docs: replace nginx with Caddy across all documentation and installer

This commit is contained in:
2026-07-26 21:10:45 +02:00
parent 4dd7b6991d
commit 9457d3f8cc
8 changed files with 239 additions and 180 deletions
+15 -8
View File
@@ -18,7 +18,7 @@ See [Cutting a release](#cutting-a-release) for the full procedure.
- **Go 1.26+** (uses Go 1.22+ `http.ServeMux` method patterns and `log/slog`)
- [`just`](https://github.com/casey/just) command runner (the `justfile` is the source of truth for build / test / run / install / uninstall)
- Linux, macOS, or FreeBSD
- Linux or FreeBSD
- A local SMTP account for end-to-end testing. Tests in `internal/storage` and `pkg/contactform` do not require SMTP.
### Quick Start
@@ -42,8 +42,15 @@ just test
The suite covers:
- `pkg/contactform` — validators for all four form types (contact, feedback, newsletter, generic), whitespace trimming, and error message shape.
- `cmd/server` — client IP extraction, request-logging middleware.
- `internal/config` — TOML loading, env-var expansion, schema validation.
- `internal/email` — SMTP message composition (`multipart/alternative`) and subject templates.
- `internal/handler` — form handler pipeline (CORS, rate limit, honeypot, validation, send), rate-limiter cleanup loop.
- `internal/storage``Append` / `Count` / `List` semantics, file and directory auto-creation, missing-file tolerance, malformed-line resilience.
- `internal/version` — version identity and `--version` smoke output.
- `pkg/contactform` — validators for all four form types (contact, feedback, newsletter, generic), whitespace trimming, and error message shape.
CI enforces a **≥80 % coverage threshold** on `internal/...` and `pkg/...`. Run `go test -coverprofile=coverage.out ./internal/... ./pkg/... && go tool cover -func=coverage.out` locally to check before pushing.
### Linting
@@ -151,7 +158,7 @@ nuntius/
```mermaid
graph TD
Browser[Browser / Frontend]:::accent6
Nginx[nginx reverse proxy]:::accent6
Caddy[Caddy reverse proxy]:::accent6
CLI[cmd/server/main.go]:::accent0
Config[internal/config/]:::accent7
Handler[internal/handler/]:::accent0
@@ -161,8 +168,8 @@ graph TD
SMTP[(SMTP server)]:::accent2
JSONL[(data_dir/newsletter-*.jsonl)]:::accent2
Browser -->|POST /api/nuntius/contact| Nginx
Nginx -->|forward with X-Forwarded-For| CLI
Browser -->|POST /api/nuntius/contact| Caddy
Caddy -->|forward with X-Forwarded-For| CLI
CLI --> Config
CLI --> Handler
Handler --> Validate
@@ -170,8 +177,8 @@ graph TD
Handler --> Storage
Email -->|SMTP PLAIN| SMTP
Storage -->|append JSONL| JSONL
Handler -->|200 ok / 4xx / 5xx| Nginx
Nginx --> Browser
Handler -->|200 ok / 4xx / 5xx| Caddy
Caddy --> Browser
classDef accent0 fill:#3B82F6,stroke:#2563EB,color:#fff
classDef accent1 fill:#22C55E,stroke:#16A34A,color:#fff
@@ -212,7 +219,7 @@ Triggered on every push to `development` and on every pull request targeting `de
| Job | What it does | Why it exists |
|---|---|---|
| `vet` | `gofmt -l cmd internal pkg` (must print nothing) and `go vet ./...` | Catches formatting drift and static-analysis issues before tests run. |
| `test` | `go test -race -count=1 ./...` plus `go build ./examples/...` | Race detector catches issues in the per-form rate limiter, the storage mutex, and the SMTP send path. `-count=1` disables the result cache. The example build is a smoke test for the public library. |
| `test` | `go test -race -count=1 ./...`, coverage gate (`≥80 %` on `internal/...` and `pkg/...`), plus `go build ./examples/...` | Race detector catches issues in the per-form rate limiter, the storage mutex, and the SMTP send path. `-count=1` disables the result cache. The coverage gate fails the build if the combined statement coverage drops below 80 %. The example build is a smoke test for the public library. |
| `build` | `just build`, `just test`, and `./bin/nuntius --version` smoke test | Confirms the `justfile` build recipe works end-to-end and that `--version` still prints the expected output. |
Run the same checks locally before opening a pull request: