diff --git a/specs/04-Infrastructure-OPS/04-00-docker-compose/QNAP/app/.env.example b/specs/04-Infrastructure-OPS/04-00-docker-compose/QNAP/app/.env.example index 366284c3..5741e27a 100644 --- a/specs/04-Infrastructure-OPS/04-00-docker-compose/QNAP/app/.env.example +++ b/specs/04-Infrastructure-OPS/04-00-docker-compose/QNAP/app/.env.example @@ -68,7 +68,7 @@ HOSTNAME=0.0.0.0 BACKEND_IMAGE_TAG=latest FRONTEND_IMAGE_TAG=latest -# ClamAV +# ClamAV (service in app stack) CLAMAV_HOST=localhost CLAMAV_PORT=3310 @@ -76,8 +76,9 @@ CLAMAV_PORT=3310 # ADR-022 RAG — Retrieval-Augmented Generation # ======================================== -# Qdrant vector store (local docker-compose or QNAP) -QDRANT_URL=http://localhost:6333 +# Qdrant vector store (service in service stack) +QDRANT_HOST=qdrant +QDRANT_PORT=6333 # Ollama (Admin Desktop Desk-5439 — ADR-018 AI boundary) OLLAMA_EMBED_MODEL=nomic-embed-text @@ -96,3 +97,13 @@ RAG_TOPK=20 RAG_FINAL_K=5 RAG_TIMEOUT_MS=5000 RAG_QUERY_CACHE_TTL=300 + +# BullMQ Queues +BULLMQ_QUEUE_PREFIX=rfa +BULLMQ_REMINDER_QUEUE=rfa-reminders +BULLMQ_DISTRIBUTION_QUEUE=rfa-distribution + +# Reminder Schedule +REMINDER_DAYS_BEFORE_DUE=2 +ESCALATION_DAYS_AFTER_DUE_L1=1 +ESCALATION_DAYS_AFTER_DUE_L2=3 diff --git a/specs/04-Infrastructure-OPS/04-00-docker-compose/QNAP/app/docker-compose-app.yml b/specs/04-Infrastructure-OPS/04-00-docker-compose/QNAP/app/docker-compose-app.yml index 0e09f12b..160d735a 100644 --- a/specs/04-Infrastructure-OPS/04-00-docker-compose/QNAP/app/docker-compose-app.yml +++ b/specs/04-Infrastructure-OPS/04-00-docker-compose/QNAP/app/docker-compose-app.yml @@ -89,8 +89,11 @@ services: JWT_EXPIRATION: '8h' JWT_REFRESH_SECRET: ${JWT_REFRESH_SECRET:?JWT_REFRESH_SECRET required} # --- ClamAV (ADR-016 file upload scan) --- - CLAMAV_HOST: 'clamav' + CLAMAV_HOST: 'localhost' CLAMAV_PORT: '3310' + # --- Qdrant (Vector Database for RAG — ADR-023A) --- + QDRANT_HOST: 'qdrant' + QDRANT_PORT: '6333' # --- Numbering --- NUMBERING_LOCK_TIMEOUT: '5000' NUMBERING_RESERVATION_TTL: '300' @@ -119,7 +122,43 @@ services: condition: service_healthy # ---------------------------------------------------------------- - # 2. Frontend Web App (Next.js) + # 3. ClamAV (Antivirus scanning for file uploads — ADR-016) + # Service Name: clamav (Backend อ้างอิง CLAMAV_HOST=clamav, port 3310) + # ---------------------------------------------------------------- + clamav: + <<: [*restart_policy, *default_logging] + image: clamav/clamav:1.4.4 + container_name: clamav + deploy: + resources: + limits: + cpus: '1.0' + memory: 2G + reservations: + cpus: '0.25' + memory: 1G + environment: + CLAMAV_NO_LOG_FILE: 'true' # ปิดการเขียนไฟล์ clamd.log + FRESHCLAM_NO_LOG_FILE: 'true' # ปิดการเขียนไฟล์ freshclam.log + TZ: 'Asia/Bangkok' + CLAMAV_NO_FRESHCLAMD: 'false' + CLAMAV_NO_CLAMD: 'false' + CLAMD_STARTUP_TIMEOUT: '1800' + networks: + - lcbp3 + volumes: + # cache definitions เพื่อไม่ต้อง download ทุกครั้งที่ restart + - '/share/np-dms/services/clamav/data:/var/lib/clamav' + - '/share/np-dms/data/logs/clamav:/var/log/clamav' + healthcheck: + test: ['CMD', 'clamdcheck.sh'] + interval: 60s + timeout: 30s + retries: 3 + start_period: 300s + + # ---------------------------------------------------------------- + # 4. Frontend Web App (Next.js) # Service Name: frontend (ตามที่ NPM อ้างอิง → frontend:3000) # ---------------------------------------------------------------- frontend: diff --git a/specs/04-Infrastructure-OPS/04-00-docker-compose/QNAP/service/.env.example b/specs/04-Infrastructure-OPS/04-00-docker-compose/QNAP/service/.env.example index 1a99fe84..f0c80e34 100644 --- a/specs/04-Infrastructure-OPS/04-00-docker-compose/QNAP/service/.env.example +++ b/specs/04-Infrastructure-OPS/04-00-docker-compose/QNAP/service/.env.example @@ -1,4 +1,4 @@ -# Per-stack .env.example — services (cache, search) +# Per-stack .env.example — services (cache, search, qdrant) # Source: ../../.env.template # --- Redis (Cache & Queue) --- REDIS_HOST=cache @@ -10,3 +10,7 @@ ELASTICSEARCH_HOST=search ELASTICSEARCH_PORT=9200 ELASTICSEARCH_USERNAME=elastic ELASTICSEARCH_PASSWORD=elasticed0bbde94 + +# --- Qdrant (Vector Database for RAG — ADR-023A) --- +QDRANT_HOST=qdrant +QDRANT_PORT=6333 diff --git a/specs/04-Infrastructure-OPS/04-00-docker-compose/QNAP/service/docker-compose.yml b/specs/04-Infrastructure-OPS/04-00-docker-compose/QNAP/service/docker-compose.yml index cf754122..6bfc3c3a 100644 --- a/specs/04-Infrastructure-OPS/04-00-docker-compose/QNAP/service/docker-compose.yml +++ b/specs/04-Infrastructure-OPS/04-00-docker-compose/QNAP/service/docker-compose.yml @@ -125,45 +125,8 @@ services: timeout: 10s retries: 5 - # ---------------------------------------------------------------- - # 3. ClamAV (Antivirus scanning for file uploads — ADR-016) - # Service Name: clamav (Backend อ้างอิง CLAMAV_HOST=clamav, port 3310) - # ---------------------------------------------------------------- - clamav: - <<: [*restart_policy, *default_logging] - image: clamav/clamav:1.4.4 - container_name: clamav - deploy: - resources: - limits: - cpus: '1.0' - memory: 2G - reservations: - cpus: '0.25' - memory: 1G - environment: - CLAMAV_NO_LOG_FILE: 'true' # ปิดการเขียนไฟล์ clamd.log - FRESHCLAM_NO_LOG_FILE: 'true' # ปิดการเขียนไฟล์ freshclam.log - TZ: 'Asia/Bangkok' - CLAMAV_NO_FRESHCLAMD: 'false' - CLAMAV_NO_CLAMD: 'false' - CLAMD_STARTUP_TIMEOUT: '1800' - networks: - - lcbp3 - volumes: - # cache definitions เพื่อไม่ต้อง download ทุกครั้งที่ restart - - '/share/np-dms/clamav/data:/var/lib/clamav' - - '/share/np-dms/data/logs/clamav:/var/log/clamav' - healthcheck: - test: ['CMD', 'clamdcheck.sh'] - interval: 60s - timeout: 30s - retries: 3 - start_period: 300s - - # ---------------------------------------------------------------- - # 4. Qdrant (Vector Database for RAG — ADR-023A) + # 3. Qdrant (Vector Database for RAG — ADR-023A) # Service Name: qdrant (Backend อ้างอิง QDRANT_HOST=qdrant, port 6333) # ---------------------------------------------------------------- qdrant: @@ -188,7 +151,7 @@ services: - '6333:6333' # HTTP API - '6334:6334' # gRPC API volumes: - - '/share/np-dms/qdrant/storage:/qdrant/storage' + - '/share/np-dms/services/qdrant/storage:/qdrant/storage' healthcheck: test: ['CMD', 'curl', '-f', 'http://localhost:6333/health'] interval: 30s @@ -196,11 +159,5 @@ services: retries: 3 start_period: 30s -# sudo chown -R 100:101 /share/np-dms/data/logs/clamav -# sudo chmod -R 755 /share/np-dms/data/logs/climax - -# sudo chown -R 100:101 /share/np-dms/clamav/data -# sudo chmod -R 775 /share/np-dms/clamav/data - -# sudo mkdir -p /share/np-dms/qdrant/storage -# sudo chown -R 100:101 /share/np-dms/qdrant/storage +# mkdir -p /share/np-dms/services/qdrant/storage +# chown -R 100:101 /share/np-dms/services/qdrant/storage