docker-compose-gpu-CN-oc9.yml


Overview

The docker-compose-gpu-CN-oc9.yml file is a Docker Compose configuration designed to orchestrate the deployment of the RAGFlow server environment with GPU support, specifically tailored for usage in a China network context (as implied by "CN" in the filename) and possibly optimized for OpenCore 9 (oc9). This file extends a base Docker Compose configuration (docker-compose-base.yml) and specifies additional service configurations, resource reservations, and environment settings to enable GPU acceleration using NVIDIA drivers inside the container.

Key Points:

Important Note:
The RAGFlow team explicitly mentions this file is not actively maintained, so users should proceed with caution and are encouraged to contribute improvements via pull requests.


Detailed Explanation of Components

Included File

include:
  - ./docker-compose-base.yml

Services

ragflow

The primary service defined in this file.

services:
  ragflow:
    depends_on:
      mysql:
        condition: service_healthy
    image: edwardelric233/ragflow:oc9
    container_name: ragflow-server
    ports:
      - ${SVR_HTTP_PORT}:9380
      - 80:80
      - 443:443
    volumes:
      - ./ragflow-logs:/ragflow/logs
      - ./nginx/ragflow.conf:/etc/nginx/conf.d/ragflow.conf
      - ./nginx/proxy.conf:/etc/nginx/proxy.conf
      - ./nginx/nginx.conf:/etc/nginx/nginx.conf
    env_file: .env
    environment:
      - TZ=${TIMEZONE}
      - HF_ENDPOINT=${HF_ENDPOINT}
      - MACOS=${MACOS}
    networks:
      - ragflow
    restart: on-failure
    extra_hosts:
      - "host.docker.internal:host-gateway"
    deploy:
      resources:
        reservations:
          devices:
            - driver: nvidia
              count: all
              capabilities: [gpu]
Explanation:

Implementation Details


Interaction with Other Parts of the System


Usage Example

To deploy the stack defined by this file:

# Ensure NVIDIA drivers and container toolkit are installed and configured

# Export required environment variables in .env file, e.g.:
# SVR_HTTP_PORT=8080
# TIMEZONE=Asia/Shanghai
# HF_ENDPOINT=https://huggingface.cn
# MACOS=false

# Run docker-compose with this file
docker-compose -f docker-compose-gpu-CN-oc9.yml up -d

This command will start the ragflow service with GPU support, linked to a healthy MySQL service, exposing the necessary ports and volumes.


Mermaid Diagram

This file defines a single main service that depends on a database service and includes volume mounts, environment variables, and GPU device reservations. The following flowchart illustrates the key structural relationships and resource dependencies:

flowchart TD
    A[Start Ragflow Service] --> B{Is MySQL Healthy?}
    B -- Yes --> C[Launch ragflow-container]
    B -- No --> D[Wait for MySQL]

    C --> E[Mount Volumes]
    C --> F[Set Environment Variables]
    C --> G[Expose Ports: ${SVR_HTTP_PORT}, 80, 443]
    C --> H[Connect to ragflow network]
    C --> I[Reserve GPUs: NVIDIA (all)]

    E --> J[./ragflow-logs:/ragflow/logs]
    E --> K[./nginx/*.conf:/etc/nginx/*.conf]
    
    I --> L[NVIDIA Container Toolkit Required]

    D --> B

    style C fill:#9fdfbf,stroke:#333,stroke-width:2px
    style B fill:#f9f,stroke:#333,stroke-width:2px

Summary

This configuration is intended for advanced users with GPU-enabled Docker environments and familiarity with Docker Compose service orchestration, particularly in Chinese network environments or setups requiring specific endpoint configurations.