Repository navigation
API Deployment
English · 한국어
Miroven-API remains version 0.1.0; the client is v1.0.0. Configure domains, database, SMTP, storage, and limits through environment/Compose settings. Never publish live environment files or secrets. Commands run from the API checkout unless stated otherwise.
| Layout | Standalone Compose | Example environment |
|---|---|---|
| Same-origin client/API | compose.production.yaml |
.env.production.example |
| API-only host with separate static client | compose.truenas.yaml |
.env.truenas.example |
Copy the selected example to .env.production. Set random DB password/SECRET_KEY, matching DB URL credentials, SMTP, and fixed image tags/digests. MIROVEN_DOMAIN is the Caddy host, MIROVEN_PUBLIC_ORIGIN the app origin, and MIROVEN_API_ORIGIN the API origin, defaulting to the app origin.
Use same-origin or same-site HTTPS subdomains; unrelated sites cannot use this cookie authentication. Never allow credential CORS for arbitrary origins, the website, or previews. See authentication.
Build the API image locally with docker build -t miroven-api:0.1.0 .. For integrated deployment, build the client in the sibling Miroven checkout with:
docker build -t miroven-web:1.0.0 --build-arg NEXT_PUBLIC_APP_URL=https://journal.example.com --build-arg NEXT_PUBLIC_MIROVEN_API_URL=/api/v1 --build-arg NEXT_PUBLIC_WEBSITE_URL=https://www.example.com .Set MIROVEN_API_IMAGE and MIROVEN_WEB_IMAGE to the images you actually built or their digests. The API examples still contain 0.1.0 defaults; explicitly select the 1.0.0 client image when using it. Example local tags do not imply a published registry image. Transfer images to the host as needed.
Check persistent volumes, disk space, startup after reboot, and ports 80/443. On TrueNAS, separate the service IP/ports from its management UI if necessary. Back up DB and blobs together. Route public DNS/80/443 to Caddy; never expose DB/API ports directly. These examples use Caddy TLS. If adding a proxy/tunnel, configure ingress and trusted proxy scope and verify spoofed X-Forwarded-For cannot bypass limits. Do not cache API responses in a CDN.
# For integrated deployment, use compose.production.yaml instead.
docker compose --env-file .env.production -f compose.truenas.yaml config --quiet
docker compose --env-file .env.production -f compose.truenas.yaml up -d --wait --wait-timeout 180
docker compose --env-file .env.production -f compose.truenas.yaml exec api python scripts/check_integrity.pyExpose only /api/* and check readiness internally. Restrict live env-file access to the operator. Apply migration 0004_attachments before the multi-photo client. See operations for deletion ledgers, paired backup/restore, and upgrade/rollback, and sync protocol for S3 constraints.
Build in Miroven/web/ with:
NEXT_PUBLIC_APP_URL=https://journal.example.com
NEXT_PUBLIC_MIROVEN_API_URL=https://api.example.com/api/v1
NEXT_PUBLIC_WEBSITE_URL=https://www.example.comRun npm run build and deploy out/; the full command includes CSP/SW post-processing. For Pages: root web, build npm run build, output out, Node 22.13 or later. Empty API URL means local-only, /api/v1 means same-origin. App/website defaults refer to the official service, so set your own URLs explicitly. Rebuild on changes; runtime container environment does not rewrite static JS. Docker accepts the same three public variables as build arguments.
Apply generated out/_headers at the real host. Review policies, contacts, providers, and retention for your instance. Changing origin does not move IndexedDB: export encrypted backup at the old address and restore into an empty vault at the new one. See client self-hosting and backup.
Use validation and launch checks before serving traffic. Local tests are not public-service validation. The website handles no API credentials and preview builds must not use production API.
Reproduce baseline load with uv run python scripts/benchmark.py --base-url http://localhost:8000. For authenticated usage measurement, pass a test cookie only through MIROVEN_BENCH_SESSION. Defaults are 100 requests/concurrency 4; maxima are 10,000/concurrency 32. After warm-up it records p50/p95/max, statuses, and errors. --output accepts a new file only. Measure host resources, full sync/photos, worker load, and operating costs separately.
- Client development · 클라이언트 개발
- Self-hosting · 자체 호스팅
- PWA, offline use, and updates · PWA·오프라인·업데이트
- Client performance · 클라이언트 성능
- Architecture · 아키텍처
- Cryptographic format · 암호화 형식
- Image processing · 사진 처리
- Security model · 보안 경계
- Product principles · 제품 원칙
- Dependency licenses · 의존성 라이선스
- Account and sync · 계정과 동기화
- Backup and recovery · 백업과 복구
- Entry quotes · 기록 인용
- Profile document · 프로필 문서