mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
Phase 1 — Docker Artifact Optimization: - Replace broad `COPY . .` with targeted frontend source copies (API/Python changes no longer bust the frontend build cache) - Replace build-essential with gcc/g++ (leaner runtime) - Fix LOG_LEVEL=debug → info for production - Harden .dockerignore (exclude worktrees, IDE, CI, test artifacts) Phase 2 — State & Persistence: - Add PUID/PGID support in entrypoint.sh for bind mount compatibility - Guard against PUID=0/PGID=0 to prevent accidental root execution - Evict conflicting system users (e.g. node:1000) before UID remap Phase 3 — Security: - Always register @fastify/rate-limit so login brute-force protection works even when global rate limit is disabled (RATE_LIMIT_PER_MIN=0) - Add trustProxy support (TRUST_PROXY env var, default true) so rate limiting and audit logs use real client IPs behind reverse proxies - Strip stack traces from 500 error responses in production - Fix FSTDEP022 deprecation: maxParamLength → routerOptions - Add multi-file guard on single-file tool endpoint with clear error message pointing to the /batch endpoint Phase 4 — Graceful Degradation: - Add consolidated hardware detection startup banner (GPU, rate limit, upload limit, proxy status) - Add ConnectionMonitor component with health polling and reconnecting overlay that auto-dismisses when the server comes back Phase 5 — Deployment Docs: - Rewrite deployment.md with copy-paste CPU and GPU compose templates - Add hardware requirements table (minimum, recommended, heavy workloads) - Add PUID/PGID bind mount documentation - Add complete env var reference table - Add reverse proxy guides for Nginx, Nginx Proxy Manager, Traefik, and Cloudflare Tunnels
60 lines
1.8 KiB
YAML
60 lines
1.8 KiB
YAML
name: ashim
|
|
|
|
# NVIDIA GPU deployment — requires nvidia-container-toolkit.
|
|
# Install: https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html
|
|
# Usage: docker compose -f docker-compose-gpu.yml up -d
|
|
# Verify: docker logs ashim 2>&1 | grep GPU
|
|
|
|
services:
|
|
ashim:
|
|
build:
|
|
context: ..
|
|
dockerfile: docker/Dockerfile
|
|
image: ashim:latest
|
|
container_name: ashim
|
|
ports:
|
|
- "1349:1349"
|
|
volumes:
|
|
- ashim-data:/data # Database, AI models, user files
|
|
- ashim-workspace:/tmp/workspace # Temp processing (auto-cleaned)
|
|
environment:
|
|
- AUTH_ENABLED=true
|
|
- DEFAULT_USERNAME=admin
|
|
- DEFAULT_PASSWORD=admin
|
|
- SKIP_MUST_CHANGE_PASSWORD=${SKIP_MUST_CHANGE_PASSWORD:-false}
|
|
- MAX_UPLOAD_SIZE_MB=${MAX_UPLOAD_SIZE_MB:-0}
|
|
- MAX_BATCH_SIZE=${MAX_BATCH_SIZE:-0}
|
|
- MAX_MEGAPIXELS=${MAX_MEGAPIXELS:-0}
|
|
- CONCURRENT_JOBS=${CONCURRENT_JOBS:-0}
|
|
- MAX_WORKER_THREADS=${MAX_WORKER_THREADS:-0}
|
|
- PROCESSING_TIMEOUT_S=${PROCESSING_TIMEOUT_S:-0}
|
|
- MAX_PIPELINE_STEPS=${MAX_PIPELINE_STEPS:-0}
|
|
- RATE_LIMIT_PER_MIN=${RATE_LIMIT_PER_MIN:-0}
|
|
- MAX_USERS=${MAX_USERS:-0}
|
|
- SESSION_DURATION_HOURS=${SESSION_DURATION_HOURS:-168}
|
|
- TRUST_PROXY=${TRUST_PROXY:-true}
|
|
restart: unless-stopped
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-f", "http://localhost:1349/api/v1/health"]
|
|
interval: 30s
|
|
timeout: 5s
|
|
start_period: 60s
|
|
retries: 3
|
|
shm_size: "2gb" # Required for PyTorch CUDA shared memory
|
|
deploy:
|
|
resources:
|
|
reservations:
|
|
devices:
|
|
- driver: nvidia
|
|
count: all
|
|
capabilities: [gpu]
|
|
logging:
|
|
driver: json-file
|
|
options:
|
|
max-size: "50m"
|
|
max-file: "5"
|
|
|
|
volumes:
|
|
ashim-data:
|
|
ashim-workspace:
|