|  | 
|  | 1 | +# 数据库的默认账号和密码仅首次运行时设置有效 | 
|  | 2 | +# 如果修改了账号密码,记得改数据库和项目连接参数,别只改一处~ | 
|  | 3 | +# 该配置文件只是给快速启动,测试使用。正式使用,记得务必修改账号密码,以及调整合适的知识库参数,共享内存等。 | 
|  | 4 | +# 如何无法访问 dockerhub 和 git,可以用阿里云(阿里云没有arm包) | 
|  | 5 | + | 
|  | 6 | +version: '3.3' | 
|  | 7 | +services: | 
|  | 8 | +  # db | 
|  | 9 | +  gs: | 
|  | 10 | +    image: opengauss/opengauss:7.0.0-RC1 # docker hub | 
|  | 11 | +    container_name: gs | 
|  | 12 | +    restart: always | 
|  | 13 | +    # ports: # 生产环境建议不要暴露 | 
|  | 14 | +    #   - 5432:5432 | 
|  | 15 | +    networks: | 
|  | 16 | +      - fastgpt | 
|  | 17 | +    environment: | 
|  | 18 | +      # 这里的配置只有首次运行生效。修改后,重启镜像是不会生效的。需要把持久化数据删除再重启,才有效果 | 
|  | 19 | +      - GS_USER=username | 
|  | 20 | +      - GS_PASSWORD=password | 
|  | 21 | +      - GS_DB=postgres | 
|  | 22 | +    volumes: | 
|  | 23 | +      - ./opengauss/data:/var/lib/opengauss/data | 
|  | 24 | +    healthcheck: | 
|  | 25 | +      test: ['CMD-SHELL', 'netstat -lntp | grep tcp6 > /dev/null 2>&1'] | 
|  | 26 | +      interval: 10s | 
|  | 27 | +      timeout: 10s | 
|  | 28 | +      retries: 10 | 
|  | 29 | +  mongo: | 
|  | 30 | +    image: mongo:5.0.18 # dockerhub | 
|  | 31 | +    # image: registry.cn-hangzhou.aliyuncs.com/fastgpt/mongo:5.0.18 # 阿里云 | 
|  | 32 | +    # image: mongo:4.4.29 # cpu不支持AVX时候使用 | 
|  | 33 | +    container_name: mongo | 
|  | 34 | +    restart: always | 
|  | 35 | +    # ports: | 
|  | 36 | +    #   - 27017:27017 | 
|  | 37 | +    networks: | 
|  | 38 | +      - fastgpt | 
|  | 39 | +    command: mongod --keyFile /data/mongodb.key --replSet rs0 | 
|  | 40 | +    environment: | 
|  | 41 | +      - MONGO_INITDB_ROOT_USERNAME=myusername | 
|  | 42 | +      - MONGO_INITDB_ROOT_PASSWORD=mypassword | 
|  | 43 | +    volumes: | 
|  | 44 | +      - ./mongo/data:/data/db | 
|  | 45 | +    entrypoint: | 
|  | 46 | +      - bash | 
|  | 47 | +      - -c | 
|  | 48 | +      - | | 
|  | 49 | +        openssl rand -base64 128 > /data/mongodb.key | 
|  | 50 | +        chmod 400 /data/mongodb.key | 
|  | 51 | +        chown 999:999 /data/mongodb.key | 
|  | 52 | +        echo 'const isInited = rs.status().ok === 1 | 
|  | 53 | +        if(!isInited){ | 
|  | 54 | +          rs.initiate({ | 
|  | 55 | +              _id: "rs0", | 
|  | 56 | +              members: [ | 
|  | 57 | +                  { _id: 0, host: "mongo:27017" } | 
|  | 58 | +              ] | 
|  | 59 | +          }) | 
|  | 60 | +        }' > /data/initReplicaSet.js | 
|  | 61 | +        # 启动MongoDB服务 | 
|  | 62 | +        exec docker-entrypoint.sh "$$@" & | 
|  | 63 | +
 | 
|  | 64 | +        # 等待MongoDB服务启动 | 
|  | 65 | +        until mongo -u myusername -p mypassword --authenticationDatabase admin --eval "print('waited for connection')"; do | 
|  | 66 | +          echo "Waiting for MongoDB to start..." | 
|  | 67 | +          sleep 2 | 
|  | 68 | +        done | 
|  | 69 | +
 | 
|  | 70 | +        # 执行初始化副本集的脚本 | 
|  | 71 | +        mongo -u myusername -p mypassword --authenticationDatabase admin /data/initReplicaSet.js | 
|  | 72 | +
 | 
|  | 73 | +        # 等待docker-entrypoint.sh脚本执行的MongoDB服务进程 | 
|  | 74 | +        wait $$! | 
|  | 75 | +
 | 
|  | 76 | +  redis: | 
|  | 77 | +    image: redis:7.2-alpine | 
|  | 78 | +    container_name: redis | 
|  | 79 | +    # ports: | 
|  | 80 | +    # - 6379:6379 | 
|  | 81 | +    networks: | 
|  | 82 | +      - fastgpt | 
|  | 83 | +    restart: always | 
|  | 84 | +    command: | | 
|  | 85 | +      redis-server --requirepass mypassword --loglevel warning --maxclients 10000 --appendonly yes --save 60 10 --maxmemory 4gb --maxmemory-policy noeviction | 
|  | 86 | +    healthcheck: | 
|  | 87 | +      test: ['CMD', 'redis-cli', '-a', 'mypassword', 'ping'] | 
|  | 88 | +      interval: 10s | 
|  | 89 | +      timeout: 3s | 
|  | 90 | +      retries: 3 | 
|  | 91 | +      start_period: 30s | 
|  | 92 | +    volumes: | 
|  | 93 | +      - ./redis/data:/data | 
|  | 94 | + | 
|  | 95 | +  # fastgpt | 
|  | 96 | +  sandbox: | 
|  | 97 | +    container_name: sandbox | 
|  | 98 | +    image: ghcr.io/labring/fastgpt-sandbox:v4.9.7-fix2 # git | 
|  | 99 | +    # image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-sandbox:v4.9.7-fix2 # 阿里云 | 
|  | 100 | +    networks: | 
|  | 101 | +      - fastgpt | 
|  | 102 | +    restart: always | 
|  | 103 | +  fastgpt-mcp-server: | 
|  | 104 | +    container_name: fastgpt-mcp-server | 
|  | 105 | +    image: ghcr.io/labring/fastgpt-mcp_server:v4.9.7-fix2 # git | 
|  | 106 | +    # image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-mcp_server:v4.9.7-fix2 # 阿里云 | 
|  | 107 | +    ports: | 
|  | 108 | +      - 3005:3000 | 
|  | 109 | +    networks: | 
|  | 110 | +      - fastgpt | 
|  | 111 | +    restart: always | 
|  | 112 | +    environment: | 
|  | 113 | +      - FASTGPT_ENDPOINT=http://fastgpt:3000 | 
|  | 114 | +  fastgpt: | 
|  | 115 | +    container_name: fastgpt | 
|  | 116 | +    image: ghcr.io/labring/fastgpt:v4.9.7-fix2 # git | 
|  | 117 | +    # image: registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt:v4.9.7-fix2 # 阿里云 | 
|  | 118 | +    # image: swr.cn-north-4.myhuaweicloud.com/ddn-k8s/ghcr.io/labring/fastgpt:v4.8.4-linuxarm64 # openGauss在arm架构上性能更好 | 
|  | 119 | +    ports: | 
|  | 120 | +      - 3000:3000 | 
|  | 121 | +    networks: | 
|  | 122 | +      - fastgpt | 
|  | 123 | +    depends_on: | 
|  | 124 | +      - mongo | 
|  | 125 | +      - gs | 
|  | 126 | +      - sandbox | 
|  | 127 | +    restart: always | 
|  | 128 | +    environment: | 
|  | 129 | +      # 前端外部可访问的地址,用于自动补全文件资源路径。例如 https:fastgpt.cn,不能填 localhost。这个值可以不填,不填则发给模型的图片会是一个相对路径,而不是全路径,模型可能伪造Host。 | 
|  | 130 | +      - FE_DOMAIN= | 
|  | 131 | +      # root 密码,用户名为: root。如果需要修改 root 密码,直接修改这个环境变量,并重启即可。 | 
|  | 132 | +      - DEFAULT_ROOT_PSW=1234 | 
|  | 133 | +      # AI Proxy 的地址,如果配了该地址,优先使用 | 
|  | 134 | +      - AIPROXY_API_ENDPOINT=http://aiproxy:3000 | 
|  | 135 | +      # AI Proxy 的 Admin Token,与 AI Proxy 中的环境变量 ADMIN_KEY | 
|  | 136 | +      - AIPROXY_API_TOKEN=aiproxy | 
|  | 137 | +      # 数据库最大连接数 | 
|  | 138 | +      - DB_MAX_LINK=30 | 
|  | 139 | +      # 登录凭证密钥 | 
|  | 140 | +      - TOKEN_KEY=any | 
|  | 141 | +      # root的密钥,常用于升级时候的初始化请求 | 
|  | 142 | +      - ROOT_KEY=root_key | 
|  | 143 | +      # 文件阅读加密 | 
|  | 144 | +      - FILE_TOKEN_KEY=filetoken | 
|  | 145 | +      # MongoDB 连接参数. 用户名myusername,密码mypassword。 | 
|  | 146 | +      - MONGODB_URI=mongodb://myusername:mypassword@mongo:27017/fastgpt?authSource=admin | 
|  | 147 | +      # openGauss 连接参数 | 
|  | 148 | +      - OPENGAUSS_URL=opengauss://gaussdb:Huawei12%23%24@gs:9999/test | 
|  | 149 | +      # Redis 连接参数 | 
|  | 150 | +      - REDIS_URL=redis://default:mypassword@redis:6379 | 
|  | 151 | +      # sandbox 地址 | 
|  | 152 | +      - SANDBOX_URL=http://sandbox:3000 | 
|  | 153 | +      # 日志等级: debug, info, warn, error | 
|  | 154 | +      - LOG_LEVEL=info | 
|  | 155 | +      - STORE_LOG_LEVEL=warn | 
|  | 156 | +      # 工作流最大运行次数 | 
|  | 157 | +      - WORKFLOW_MAX_RUN_TIMES=1000 | 
|  | 158 | +      # 批量执行节点,最大输入长度 | 
|  | 159 | +      - WORKFLOW_MAX_LOOP_TIMES=100 | 
|  | 160 | +      # 自定义跨域,不配置时,默认都允许跨域(多个域名通过逗号分割) | 
|  | 161 | +      - ALLOWED_ORIGINS= | 
|  | 162 | +      # 是否开启IP限制,默认不开启 | 
|  | 163 | +      - USE_IP_LIMIT=false | 
|  | 164 | +      # 对话文件过期天数 | 
|  | 165 | +      - CHAT_FILE_EXPIRE_TIME=7 | 
|  | 166 | +    volumes: | 
|  | 167 | +      - ./config.json:/app/data/config.json | 
|  | 168 | + | 
|  | 169 | +  # AI Proxy | 
|  | 170 | +  aiproxy: | 
|  | 171 | +    image: ghcr.io/labring/aiproxy:v0.1.7 | 
|  | 172 | +    # image: registry.cn-hangzhou.aliyuncs.com/labring/aiproxy:v0.1.7 # 阿里云 | 
|  | 173 | +    container_name: aiproxy | 
|  | 174 | +    restart: unless-stopped | 
|  | 175 | +    depends_on: | 
|  | 176 | +      aiproxy_pg: | 
|  | 177 | +        condition: service_healthy | 
|  | 178 | +    networks: | 
|  | 179 | +      - fastgpt | 
|  | 180 | +    environment: | 
|  | 181 | +      # 对应 fastgpt 里的AIPROXY_API_TOKEN | 
|  | 182 | +      - ADMIN_KEY=aiproxy | 
|  | 183 | +      # 错误日志详情保存时间(小时) | 
|  | 184 | +      - LOG_DETAIL_STORAGE_HOURS=1 | 
|  | 185 | +      # 数据库连接地址 | 
|  | 186 | +      - SQL_DSN=postgres://postgres:aiproxy@aiproxy_pg:5432/aiproxy | 
|  | 187 | +      # 最大重试次数 | 
|  | 188 | +      - RETRY_TIMES=3 | 
|  | 189 | +      # 不需要计费 | 
|  | 190 | +      - BILLING_ENABLED=false | 
|  | 191 | +      # 不需要严格检测模型 | 
|  | 192 | +      - DISABLE_MODEL_CONFIG=true | 
|  | 193 | +    healthcheck: | 
|  | 194 | +      test: ['CMD', 'curl', '-f', 'http://localhost:3000/api/status'] | 
|  | 195 | +      interval: 5s | 
|  | 196 | +      timeout: 5s | 
|  | 197 | +      retries: 10 | 
|  | 198 | +  aiproxy_pg: | 
|  | 199 | +    image: pgvector/pgvector:0.8.0-pg15 # docker hub | 
|  | 200 | +    # image: registry.cn-hangzhou.aliyuncs.com/fastgpt/pgvector:v0.8.0-pg15 # 阿里云 | 
|  | 201 | +    restart: unless-stopped | 
|  | 202 | +    container_name: aiproxy_pg | 
|  | 203 | +    volumes: | 
|  | 204 | +      - ./aiproxy_pg:/var/lib/postgresql/data | 
|  | 205 | +    networks: | 
|  | 206 | +      - fastgpt | 
|  | 207 | +    environment: | 
|  | 208 | +      TZ: Asia/Shanghai | 
|  | 209 | +      POSTGRES_USER: postgres | 
|  | 210 | +      POSTGRES_DB: aiproxy | 
|  | 211 | +      POSTGRES_PASSWORD: aiproxy | 
|  | 212 | +    healthcheck: | 
|  | 213 | +      test: ['CMD', 'pg_isready', '-U', 'postgres', '-d', 'aiproxy'] | 
|  | 214 | +      interval: 5s | 
|  | 215 | +      timeout: 5s | 
|  | 216 | +      retries: 10 | 
|  | 217 | +networks: | 
|  | 218 | +  fastgpt: | 
0 commit comments