* refactor(auth): replace dashboard sessions with stateless tokens * feat(auth): harden session issuance and distributed enforcement * fix(proxy): preserve trusted proxy compatibility defaults * refactor: address dashboard auth review feedback * refactor: remove classic frontend and flatten web app
79 lines
2.1 KiB
YAML
79 lines
2.1 KiB
YAML
# Frontend Development - Backend built from local source
|
|
#
|
|
# Usage:
|
|
# 1. docker compose -f docker-compose.dev.yml up -d
|
|
# 2. make dev-web
|
|
# 3. Open http://localhost:5173 (Rsbuild dev server, API auto-proxied to :3000)
|
|
#
|
|
# Rebuild backend after Go code changes:
|
|
# docker compose -f docker-compose.dev.yml up -d --build new-api
|
|
#
|
|
# Stop:
|
|
# docker compose -f docker-compose.dev.yml down
|
|
#
|
|
# Reset data:
|
|
# docker compose -f docker-compose.dev.yml down -v
|
|
|
|
services:
|
|
new-api:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile.dev
|
|
image: new-api-dev:local
|
|
container_name: new-api-dev
|
|
restart: unless-stopped
|
|
ports:
|
|
- "3000:3000"
|
|
volumes:
|
|
- dev_data:/data
|
|
environment:
|
|
- SQL_DSN=postgresql://root:123456@postgres:5432/new-api
|
|
- REDIS_CONN_STRING=redis://redis
|
|
- TZ=Asia/Shanghai
|
|
- BATCH_UPDATE_ENABLED=true
|
|
# Local HTTP dev mode: keep Secure=false and leave TRUSTED_URL unset. This disables the refresh/logout OriginGuard so the :5173 -> :3000 dev proxy works.
|
|
- SESSION_COOKIE_SECURE=false
|
|
# For HTTPS only: set Secure=true and list every exact trusted HTTPS browser Origin. This does not configure relay CORS.
|
|
# - SESSION_COOKIE_SECURE=true
|
|
# - SESSION_COOKIE_TRUSTED_URL=https://example.com,https://admin.example.com
|
|
depends_on:
|
|
redis:
|
|
condition: service_started
|
|
postgres:
|
|
condition: service_healthy
|
|
networks:
|
|
- dev-network
|
|
|
|
redis:
|
|
image: redis:7-alpine
|
|
container_name: new-api-dev-redis
|
|
restart: unless-stopped
|
|
networks:
|
|
- dev-network
|
|
|
|
postgres:
|
|
image: postgres:15-alpine
|
|
container_name: new-api-dev-pg
|
|
restart: unless-stopped
|
|
environment:
|
|
POSTGRES_USER: root
|
|
POSTGRES_PASSWORD: 123456
|
|
POSTGRES_DB: new-api
|
|
volumes:
|
|
- dev_pg_data:/var/lib/postgresql/data
|
|
networks:
|
|
- dev-network
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U root -d new-api"]
|
|
interval: 5s
|
|
timeout: 3s
|
|
retries: 5
|
|
|
|
volumes:
|
|
dev_data:
|
|
dev_pg_data:
|
|
|
|
networks:
|
|
dev-network:
|
|
driver: bridge
|