From 330728257018c9567eee8d644af3324a046ae984 Mon Sep 17 00:00:00 2001 From: curo1305 Date: Tue, 16 Jun 2026 15:35:06 +0200 Subject: [PATCH] Fix Docker stack bootstrap --- .env.example | 8 +++---- README.md | 3 ++- docker-compose.yml | 57 ++++++++++++++++++++++++++++++++++++++++++++- frontend/Dockerfile | 2 +- 4 files changed, 63 insertions(+), 7 deletions(-) diff --git a/.env.example b/.env.example index 84763b5..e592935 100644 --- a/.env.example +++ b/.env.example @@ -17,7 +17,7 @@ POSTGRES_PASSWORD=changeme_super MINIO_ROOT_USER=minioadmin MINIO_ROOT_PASSWORD=changeme_minio_root MINIO_ENDPOINT=minio:9000 -# App-level access key — minimal permissions on docuvault bucket only +# App-level access key. docker-compose.yml provisions this user and a bucket-scoped policy. MINIO_ACCESS_KEY=docuvault_app MINIO_SECRET_KEY=changeme_minio_app MINIO_BUCKET=docuvault @@ -51,9 +51,9 @@ SMTP_PASSWORD= SMTP_FROM=noreply@docuvault.local # ── CORS (Phase 2 — D-09) ──────────────────────────────────────────────────── -# Comma-separated list of allowed origins. Default: http://localhost:5173 -# Example for production: https://app.docuvault.example.com -CORS_ORIGINS=http://localhost:5173 +# JSON list of allowed origins. Default: ["http://localhost:5173"] +# Example for production: ["https://app.docuvault.example.com"] +CORS_ORIGINS=["http://localhost:5173"] # ── Cloud Storage Backends (Phase 5) ───────────────────────────────────────── # Master key for HKDF per-user cloud credential encryption. diff --git a/README.md b/README.md index 34fafc3..0e19c9d 100644 --- a/README.md +++ b/README.md @@ -158,13 +158,14 @@ Copy `.env.example` to `.env`. Only the fields marked **Required** must be set b | `ADMIN_PASSWORD` | Bootstrap admin password (must pass strength check) | | `POSTGRES_PASSWORD` | PostgreSQL superuser password | | `MINIO_ROOT_PASSWORD` | MinIO root password | +| `MINIO_ACCESS_KEY` / `MINIO_SECRET_KEY` | App-level MinIO credentials; Docker Compose provisions this user and bucket policy | | `REDIS_PASSWORD` | Redis `requirepass` password | ### Optional (sensible defaults for local dev) | Variable | Default | Description | |----------|---------|-------------| -| `CORS_ORIGINS` | `http://localhost:5173` | Comma-separated allowed origins | +| `CORS_ORIGINS` | `["http://localhost:5173"]` | JSON list of allowed origins | | `SMTP_HOST` | *(unset)* | Leave empty to log password-reset links to stdout | | `LOG_JSON` | `false` | Set `true` in production for structured JSON logs | | `DEFAULT_AI_PROVIDER` | `ollama` | Used on first boot seed; overridable per-user in admin panel | diff --git a/docker-compose.yml b/docker-compose.yml index 3ba7f4f..f8dcc43 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -37,6 +37,55 @@ services: retries: 5 start_period: 15s + minio-init: + image: minio/mc:latest + depends_on: + minio: + condition: service_healthy + environment: + MINIO_ROOT_USER: ${MINIO_ROOT_USER} + MINIO_ROOT_PASSWORD: ${MINIO_ROOT_PASSWORD} + MINIO_ACCESS_KEY: ${MINIO_ACCESS_KEY} + MINIO_SECRET_KEY: ${MINIO_SECRET_KEY} + MINIO_BUCKET: ${MINIO_BUCKET} + entrypoint: ["/bin/sh", "-c"] + command: + - | + set -eu + mc alias set local http://minio:9000 "$$MINIO_ROOT_USER" "$$MINIO_ROOT_PASSWORD" + mc mb --ignore-existing "local/$$MINIO_BUCKET" + mc admin user add local "$$MINIO_ACCESS_KEY" "$$MINIO_SECRET_KEY" || true + cat > /tmp/docuvault-policy.json <