Backend Phase A: foundation, migrations, Docker setup
- Go backend skeleton: config (caarlos0/env), slog JSON logging, pgxpool store, HTTP server with graceful shutdown. - httpapi: render helpers, Problem errors, middleware chain (requestID / logging / recover / CORS), /healthz and /readyz. - Migrations: full initial schema (users, sessions, lists, list_members, items, op_log SOURCE OF TRUTH, item_names) + golang-migrate runner binary using source/iofs (embedded). - Docker: multi-stage Dockerfile (Go 1.26 -> distroless nonroot), builds both server and migrate binaries. - deploy: docker-compose (caddy + backend + migrate + postgres:16), Caddyfile (auto-HTTPS), .env.example, pg extensions init script. - AGENTS.md: project context + roadmap for AI agents. Verified: image builds, both binaries run in container (smoke test).
This commit is contained in:
commit
2899eb205b
23 changed files with 1372 additions and 0 deletions
31
deploy/Caddyfile
Normal file
31
deploy/Caddyfile
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
# Caddyfile for mitbringsl.
|
||||
# Caddy automatically obtains and renews a Let's Encrypt certificate when the
|
||||
# site address is a real domain. For local development it falls back to an
|
||||
# internal CA / self-signed cert automatically.
|
||||
{
|
||||
# email you@example.com # optional, for ACME account
|
||||
}
|
||||
|
||||
{$SITE_ADDRESS:localhost} {
|
||||
reverse_proxy backend:8080 {
|
||||
header_up X-Real-IP {remote_host}
|
||||
header_up X-Forwarded-For {remote_host}
|
||||
}
|
||||
|
||||
# Useful default headers
|
||||
header {
|
||||
Strict-Transport-Security "max-age=31536000"
|
||||
X-Content-Type-Options "nosniff"
|
||||
Referrer-Policy "no-referrer"
|
||||
}
|
||||
|
||||
# Health endpoint passthrough already handled by backend; keep it simple.
|
||||
request_body {
|
||||
max_size 2MB
|
||||
}
|
||||
|
||||
log {
|
||||
output stdout
|
||||
format console
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue