File size: 3,911 Bytes
ad79323
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
services:
  postgres:
    image: pgvector/pgvector:pg15
    # restart: unless-stopped
    environment:
      POSTGRES_DB: ${POSTGRES_DB:-courtrix}
      POSTGRES_USER: ${POSTGRES_USER:-courtrix}
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-courtrix}
      TZ: ${TZ:-Africa/Cairo}
    ports:
      - "5432:5432"
    volumes:
      - postgres_data:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-courtrix} -d ${POSTGRES_DB:-courtrix}"]
      interval: 10s
      timeout: 5s
      retries: 10

  minio:
    image: minio/minio:RELEASE.2025-03-12T18-04-18Z
    command: server /data --console-address ":9001"
    environment:
      MINIO_ROOT_USER: ${MINIO_ACCESS_KEY:-courtrixminio}
      MINIO_ROOT_PASSWORD: ${MINIO_SECRET_KEY:-courtrixminiosecret}
      TZ: ${TZ:-Africa/Cairo}
    ports:
      - "9000:9000"
      - "9001:9001"
    volumes:
      - minio_data:/data

  minio-init:
    image: minio/mc:RELEASE.2025-03-12T17-29-24Z
    depends_on:
      minio:
        condition: service_started
    entrypoint: >
      /bin/sh -c "
      until mc alias set local http://minio:9000 ${MINIO_ACCESS_KEY:-courtrixminio} ${MINIO_SECRET_KEY:-courtrixminiosecret}; do
        echo 'Waiting for MinIO to accept connections...';
        sleep 2;
      done &&
      mc mb --ignore-existing local/${MINIO_BUCKET_NAME:-courtrix-case-files} &&
      mc anonymous set private local/${MINIO_BUCKET_NAME:-courtrix-case-files}
      "

  web:
    image: hamzaelkotp/courtrix-web:latest
    build:
      context: .
      dockerfile: Dockerfile
    # restart: unless-stopped
    depends_on:
      postgres:
        condition: service_healthy
      minio:
        condition: service_started
      minio-init:
        condition: service_completed_successfully
      rag:
        condition: service_started
    environment:
      NODE_ENV: production
      TZ: ${TZ:-Africa/Cairo}
      DATABASE_URL: ${DOCKER_DATABASE_URL:-postgresql://courtrix:courtrix@postgres:5432/courtrix?schema=public}
      SESSION_COOKIE_NAME: ${SESSION_COOKIE_NAME:-courtrix_session}
      SESSION_TTL_DAYS: ${SESSION_TTL_DAYS:-30}
      MINIO_ENDPOINT: minio
      MINIO_PORT: 9000
      MINIO_USE_SSL: "false"
      MINIO_ACCESS_KEY: ${MINIO_ACCESS_KEY:-courtrixminio}
      MINIO_SECRET_KEY: ${MINIO_SECRET_KEY:-courtrixminiosecret}
      MINIO_BUCKET_NAME: ${MINIO_BUCKET_NAME:-courtrix-case-files}
      RAG_SERVICE_URL: ${DOCKER_RAG_SERVICE_URL:-http://rag:8001}
      RAG_SERVICE_SECRET: ${RAG_SERVICE_SECRET:-courtrix-rag-secret}
      RAG_REQUEST_TIMEOUT_MS: ${RAG_REQUEST_TIMEOUT_MS:-120000}
    ports:
      - "3100:3000"

  rag:
    image: hamzaelkotp/courtrix-rag:latest
    build:
      context: ./rag-server
      dockerfile: Dockerfile
    depends_on:
      postgres:
        condition: service_healthy
      minio:
        condition: service_started
      minio-init:
        condition: service_completed_successfully
    environment:
      TZ: ${TZ:-Africa/Cairo}
      RAG_DATABASE_URL: ${DOCKER_RAG_DATABASE_URL:-postgresql://courtrix:courtrix@postgres:5432/courtrix}
      MINIO_ENDPOINT: minio
      MINIO_PORT: 9000
      MINIO_USE_SSL: "false"
      MINIO_ACCESS_KEY: ${MINIO_ACCESS_KEY:-courtrixminio}
      MINIO_SECRET_KEY: ${MINIO_SECRET_KEY:-courtrixminiosecret}
      RAG_SERVICE_SECRET: ${RAG_SERVICE_SECRET:-courtrix-rag-secret}
      GEMINI_API_KEY: ${GEMINI_API_KEY:-}
      GEMINI_CHAT_MODEL: ${GEMINI_CHAT_MODEL:-gemini-2.5-flash}
      GEMINI_EMBEDDING_MODEL: ${GEMINI_EMBEDDING_MODEL:-gemini-embedding-001}
      GEMINI_EMBEDDING_DIMENSION: ${GEMINI_EMBEDDING_DIMENSION:-1536}
      OPENROUTER_API_KEY: ${OPENROUTER_API_KEY:-}
      XAI_API_KEY: ${XAI_API_KEY:-}
      RAG_TOP_K: ${RAG_TOP_K:-5}
      RAG_CHUNK_SIZE: ${RAG_CHUNK_SIZE:-1200}
      RAG_CHUNK_OVERLAP: ${RAG_CHUNK_OVERLAP:-200}
    ports:
      - "8001:8001"

volumes:
  postgres_data:
  minio_data: