241024-RAGflow离线部署Docker-Rootless环境配置修改

A. 最终效果

在这里插入图片描述

B. 文件修改

  • docker-compose.yml
include:
  - path: ./docker-compose-base.yml
    env_file: ./.env

services:
  ragflow:
    depends_on:
      mysql:
        condition: service_healthy
      es01:
        condition: service_healthy
    image: ${RAGFLOW_IMAGE}
    container_name: ragflow-server
    ports:
      - ${SVR_HTTP_PORT}:9380
      - 9980:80  # 🌟 此处需要修改,default 80:80
      - 8443:443 # 🌟 此处需要修改,default 443:443
      - 5678:5678
    volumes:
      - ./service_conf.yaml:/ragflow/conf/service_conf.yaml
      - ./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
    environment:
      - TZ=${TIMEZONE}
      - HF_ENDPOINT=${HF_ENDPOINT}
      - MACOS=${MACOS}
    networks:
      - ragflow
    restart: always
  • docker-compose-base.yml
services:
  es01:
    container_name: ragflow-es-01
    privileged: true # 🌟 此处新增

    image: docker.elastic.co/elasticsearch/elasticsearch:${STACK_VERSION}
    volumes:
      - esdata01:/usr/share/elasticsearch/data
    ports:
      - ${ES_PORT}:9200
    environment:
      - node.name=es01
      - ELASTIC_PASSWORD=${ELASTIC_PASSWORD}
      - bootstrap.memory_lock=false
      - discovery.type=single-node
      - xpack.security.enabled=true
      - xpack.security.http.ssl.enabled=false
      - xpack.security.transport.ssl.enabled=false
      - TZ=${TIMEZONE}
    mem_limit: ${MEM_LIMIT}
    ulimits:
      nproc: 65535 # 🌟 此处新增
      # memlock:   # 🌟 此处注释
      #   soft: -1 # 🌟 此处注释
      #   hard: -1 # 🌟 此处注释
    healthcheck:
      test: ["CMD-SHELL", "curl http://localhost:9200"]
      interval: 10s
      timeout: 10s
      retries: 120
    networks:
      - ragflow
    restart: always

  mysql:
    # mysql:5.7 linux/arm64 image is unavailable.
    image: mysql:8.0.39
    container_name: ragflow-mysql
    environment:
      - MYSQL_ROOT_PASSWORD=${MYSQL_PASSWORD}
      - TZ=${TIMEZONE}
    command:
      --max_connections=1000
      --character-set-server=utf8mb4
      --collation-server=utf8mb4_general_ci
      --default-authentication-plugin=mysql_native_password
      --tls_version="TLSv1.2,TLSv1.3"
      --init-file /data/application/init.sql
    ports:
      - ${MYSQL_PORT}:3306
    volumes:
      - mysql_data:/var/lib/mysql
      - ./init.sql:/data/application/init.sql
    networks:
      - ragflow
    healthcheck:
      test: ["CMD", "mysqladmin" ,"ping", "-uroot", "-p${MYSQL_PASSWORD}"]
      interval: 10s
      timeout: 10s
      retries: 3
    restart: always

  minio:
    image: quay.io/minio/minio:RELEASE.2023-12-20T01-00-02Z
    container_name: ragflow-minio
    command: server --console-address ":9001" /data
    ports:
      - ${MINIO_PORT}:9000
      - ${MINIO_CONSOLE_PORT}:9001
    environment:
      - MINIO_ROOT_USER=${MINIO_USER}
      - MINIO_ROOT_PASSWORD=${MINIO_PASSWORD}
      - TZ=${TIMEZONE}
    volumes:
      - minio_data:/data
    networks:
      - ragflow
    restart: always

  redis:
    image: redis:7.2.4
    container_name: ragflow-redis
    command: redis-server --requirepass ${REDIS_PASSWORD} --maxmemory 128mb --maxmemory-policy allkeys-lru
    ports:
      - ${REDIS_PORT}:6379
    volumes:
      - redis_data:/data
    networks:
      - ragflow
    restart: always



volumes:
  esdata01:
    driver: local
  mysql_data:
    driver: local
  minio_data:
    driver: local
  redis_data:
    driver: local

networks:
  ragflow:
    driver: bridge

C. 参考文献

### Ragflow离线部署方法 Ragflow 是一种开源的检索增强生成(RAG, Retrieval-Augmented Generation)引擎,其设计依赖于深度文档理解技术来实现高效的信息检索和生成能力[^2]。为了在断网环境中完成 Ragflow部署,可以参考以下方式: #### 1. Docker Rootless 环境配置 由于 Ragflow 部署通常涉及容器化运行环境,因此需要先设置一个支持离线操作的 Docker Rootless 环境。此过程可以通过预下载所需的镜像文件并将其导入到目标机器上来实现。 - **准备阶段**:在联网设备上拉取 Ragflow 所需的基础镜像以及任何附加组件。 ```bash docker pull infiniflow/ragflow:latest ``` - **导出镜像**:将上述镜像保存为 tar 文件以便传输至无网络连接的目标主机。 ```bash docker save -o ragflow_latest.tar infiniflow/ragflow:latest ``` - **导入镜像**:在目标主机执行如下命令加载之前保存下来的镜像包。 ```bash docker load < ragflow_latest.tar ``` 以上步骤确保即使处于完全隔离状态也能正常启动服务。 #### 2. 数据集与模型资源管理 除了基础架构外,还需要考虑数据源及预训练模型等静态资产的处理方案。这些内容同样应该提前打包好并通过安全介质传递给实际使用的计算节点。 - 将所有必要的自然语言处理(NLP)模型权重、索引数据库以及其他关联素材集中存放在统一目录下; - 使用压缩工具创建单一档案文件方便携带; - 解压后按照官方指南调整路径映射关系使之匹配当前实例的具体情况。 通过这种方式能够有效规避因缺乏在线访问权限而导致的功能缺失问题。 ```python import os def check_model_files(directory_path): """验证指定目录下的模型文件是否存在""" required_files = ['model.bin', 'config.json'] missing = [] for file_name in required_files: full_path = os.path.join(directory_path, file_name) if not os.path.exists(full_path): missing.append(file_name) return f"All files present." if not missing else f"Missing {missing}." print(check_model_files("/path/to/offline/models")) ```
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

GuokLiu

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值