File size: 7,139 Bytes
979853c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
# Full Docker Compose Deployment Sample Generated by Setup Wizard: `make base` and `make storage`
# This Sample File requires NVIDIA GPU for Milvus and VLLM services.
# You can customize your setup using the Setup Wizard; for detailed instructions, please refer to docs/InteractiveSetup.md
services:
  lightrag:
    image: ghcr.io/hkuds/lightrag:latest
    build:
      context: .
      dockerfile: Dockerfile
      tags:
        - ghcr.io/hkuds/lightrag:latest
    ports:
      - "${HOST:-0.0.0.0}:${PORT:-9621}:9621"
    volumes:
      - ./data/rag_storage:/app/data/rag_storage
      - ./data/inputs:/app/data/inputs
      - ./config.ini:/app/config.ini
      - ./.env:/app/.env
    deploy:
      restart_policy:
        condition: on-failure
        max_attempts: 10
    extra_hosts:
      - "host.docker.internal:host-gateway"
    environment:
      MILVUS_URI: "http://milvus:19530"
      NEO4J_URI: "neo4j://neo4j:7687"
      POSTGRES_HOST: "postgres"
      POSTGRES_PORT: "5432"
      EMBEDDING_BINDING_HOST: "http://vllm-embed:8001/v1"
      RERANK_BINDING_HOST: "http://vllm-rerank:8000/rerank"
      WORKING_DIR: "/app/data/rag_storage"
      INPUT_DIR: "/app/data/inputs"
      MEMGRAPH_URI: "bolt://host.docker.internal:7687"
      HOST: "0.0.0.0"
      PORT: "9621"
    depends_on:
      vllm-embed:
        condition: service_healthy
      vllm-rerank:
        condition: service_healthy
      postgres:
        condition: service_healthy
      neo4j:
        condition: service_healthy
      milvus:
        condition: service_healthy

  milvus:
    image: milvusdb/milvus:v2.6.11-gpu
    command: ["milvus", "run", "standalone"]
    security_opt:
      - seccomp:unconfined
    environment:
      ETCD_ENDPOINTS: milvus-etcd:2379
      MINIO_ADDRESS: milvus-minio:9000
      MINIO_ACCESS_KEY_ID: "${MINIO_ACCESS_KEY_ID:?missing}"
      MINIO_SECRET_ACCESS_KEY: "${MINIO_SECRET_ACCESS_KEY:?missing}"
    # ports:
    #   - "19530:19530"
    #   - "9091:9091"
    volumes:
      - milvus_data:/var/lib/milvus
    deploy:
      resources:
        reservations:
          devices:
            - driver: nvidia
              capabilities: ["gpu"]
    healthcheck:
      test:
        - CMD-SHELL
        - 'PORT_HEX="$(printf ''%04X'' 19530)"; cat /proc/net/tcp /proc/net/tcp6 2>/dev/null | grep -q ":$${PORT_HEX} "'
      interval: 10s
      timeout: 3s
      retries: 120
      start_period: 10s
    depends_on:
      milvus-etcd:
        condition: service_healthy
      milvus-minio:
        condition: service_healthy
    restart: unless-stopped

  milvus-etcd:
    image: quay.io/coreos/etcd:v3.5.25
    environment:
      ETCD_AUTO_COMPACTION_MODE: revision
      ETCD_AUTO_COMPACTION_RETENTION: "1000"
      ETCD_QUOTA_BACKEND_BYTES: "4294967296"
      ETCD_SNAPSHOT_COUNT: "50000"
    volumes:
      - milvus-etcd_data:/etcd
    command: >
      etcd
      -advertise-client-urls=http://0.0.0.0:2379
      -listen-client-urls=http://0.0.0.0:2379
      -data-dir /etcd
    healthcheck:
      test: ["CMD", "etcdctl", "endpoint", "health"]
      interval: 20s
      timeout: 20s
      retries: 3
    restart: unless-stopped

  milvus-minio:
    image: minio/minio:RELEASE.2025-09-07T16-13-09Z
    environment:
      MINIO_ROOT_USER: "${MINIO_ACCESS_KEY_ID:?missing}"
      MINIO_ROOT_PASSWORD: "${MINIO_SECRET_ACCESS_KEY:?missing}"
    volumes:
      - milvus-minio_data:/minio_data
    command: minio server /minio_data --console-address ":9001"
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
      interval: 30s
      timeout: 20s
      retries: 3
    restart: unless-stopped

  neo4j:
    image: neo4j:5-community
    # ports:
    #   - "7474:7474"
    #   - "${NEO4J_BOLT_PORT:-7687}:7687"
    volumes:
      - neo4j_data:/data
    healthcheck:
      test:
        - CMD-SHELL
        - 'PORT_HEX="$(printf ''%04X'' 7687)"; cat /proc/net/tcp /proc/net/tcp6 2>/dev/null | grep -q ":$${PORT_HEX} "'
      interval: 10s
      timeout: 3s
      retries: 120
      start_period: 10s
    restart: unless-stopped
    environment:
      NEO4J_AUTH: ${NEO4J_USERNAME:?missing}/${NEO4J_PASSWORD:?missing}
      NEO4J_dbms_default__database: "neo4j"

  postgres:
    image: gzdaniel/postgres-for-rag:16.6
    command: ["sh", "-c", "service postgresql start && sleep infinity"]
    # ports:
    #   - "5432:5432"
    volumes:
      - postgres_data:/var/lib/postgresql
    healthcheck:
      test:
        - CMD-SHELL
        - 'PORT_HEX="$(printf ''%04X'' 5432)"; cat /proc/net/tcp /proc/net/tcp6 2>/dev/null | grep -q ":$${PORT_HEX} "'
      interval: 5s
      timeout: 3s
      retries: 120
      start_period: 10s
    restart: unless-stopped
    environment:
      # The custom image featuring pre-installed AGE and pgvector extensions, including a pre-configured administrator account
      POSTGRES_USER: "rag"
      POSTGRES_PASSWORD: "rag"
      POSTGRES_DB: "rag"

  vllm-embed:
    image: vllm/vllm-openai:latest
    runtime: nvidia
    command: >
      --model ${VLLM_EMBED_MODEL:-BAAI/bge-m3}
      --port ${VLLM_EMBED_PORT:-8001}
      --dtype float16
      --api-key ${VLLM_EMBED_API_KEY}
      ${VLLM_EMBED_EXTRA_ARGS:-}
    environment:
      NVIDIA_VISIBLE_DEVICES: ${NVIDIA_VISIBLE_DEVICES:-all}
      NVIDIA_DRIVER_CAPABILITIES: ${NVIDIA_DRIVER_CAPABILITIES:-compute,utility}
    ports:
      - "${VLLM_EMBED_PORT:-8001}:${VLLM_EMBED_PORT:-8001}"
    volumes:
      - vllm_embed_cache:/root/.cache/huggingface
    ipc: host
    healthcheck:
      test:
        - CMD-SHELL
        - 'PORT_HEX="$(printf ''%04X'' ${VLLM_EMBED_PORT:-8001})"; cat /proc/net/tcp /proc/net/tcp6 2>/dev/null | grep -q ":$${PORT_HEX} "'
      interval: 5s
      timeout: 3s
      retries: 120
      start_period: 10s
    deploy:
      resources:
        reservations:
          devices:
            - driver: nvidia
              count: all
              capabilities: [gpu]
    restart: unless-stopped

  vllm-rerank:
    image: vllm/vllm-openai:latest
    runtime: nvidia
    command: >
      --model ${VLLM_RERANK_MODEL:-BAAI/bge-reranker-v2-m3}
      --port ${VLLM_RERANK_PORT:-8000}
      --dtype float16
      --api-key ${VLLM_RERANK_API_KEY}
      ${VLLM_RERANK_EXTRA_ARGS:-}
    environment:
      NVIDIA_VISIBLE_DEVICES: ${NVIDIA_VISIBLE_DEVICES:-all}
      NVIDIA_DRIVER_CAPABILITIES: ${NVIDIA_DRIVER_CAPABILITIES:-compute,utility}
    ports:
      - "${VLLM_RERANK_PORT:-8000}:${VLLM_RERANK_PORT:-8000}"
    volumes:
      - vllm_rerank_cache:/root/.cache/huggingface
    ipc: host
    healthcheck:
      test:
        - CMD-SHELL
        - 'PORT_HEX="$(printf ''%04X'' ${VLLM_RERANK_PORT:-8000})"; cat /proc/net/tcp /proc/net/tcp6 2>/dev/null | grep -q ":$${PORT_HEX} "'
      interval: 5s
      timeout: 3s
      retries: 120
      start_period: 10s
    deploy:
      resources:
        reservations:
          devices:
            - driver: nvidia
              count: all
              capabilities: [gpu]
    restart: unless-stopped

volumes:
  milvus_data:
  milvus-etcd_data:
  milvus-minio_data:
  neo4j_data:
  postgres_data:
  vllm_embed_cache:
  vllm_rerank_cache: