有没有好大哥可以教一下怎么在openwrt的docker上部署lobechat db

lobechat个人网页端很简单,这服务器版我是真搞不定啊,有没有好大哥有比较好上手的教程解释解释

3 个赞

docker直接用配置一键部署 :crazy_face:

2 个赞

上来一个fold 没有找到,请先安装,直接蒙了

1 个赞

不是一个yml吗 :tieba_015:

1 个赞

我已经部署成功,以下是我的docker-compose文件,路径是./lobe-chat-db

name: lobe-chat-database
services:
  network-service:
    image: alpine
    container_name: lobe-network
    ports:
      - '${MINIO_PORT}:${MINIO_PORT}' # MinIO API
      - '9001:9001' # MinIO Console
      - '${CASDOOR_PORT}:${CASDOOR_PORT}' # Casdoor
      - '${LOBE_PORT}:3210' # LobeChat
    command: tail -f /dev/null
    networks:
      - lobe-network

  postgresql:
    image: pgvector/pgvector:pg16
    container_name: lobe-postgres
    ports:
      - '5432:5432'
    volumes:
      - '/opt/docker/Configs/postgresql/data:/var/lib/postgresql/data'
    environment:
      - 'POSTGRES_DB=${LOBE_DB_NAME}'
      - 'POSTGRES_PASSWORD=${POSTGRES_PASSWORD}'
    healthcheck:
      test: ['CMD-SHELL', 'pg_isready -U postgres']
      interval: 5s
      timeout: 5s
      retries: 5
    restart: always
    networks:
      - lobe-network

  minio:
    image: minio/minio
    container_name: lobe-minio
    network_mode: 'service:network-service'
    volumes:
      - '/opt/docker/Configs/Minio/s3_data:/etc/minio/data'
    environment:
      - 'MINIO_ROOT_USER=${MINIO_ROOT_USER}'
      - 'MINIO_ROOT_PASSWORD=${MINIO_ROOT_PASSWORD}'
      # - 'MINIO_API_CORS_ALLOW_ORIGIN=http://localhost:${LOBE_PORT}'
      - 'MINIO_API_CORS_ALLOW_ORIGIN=反代lobechat地址'
    restart: always
    command: >
      server /etc/minio/data --address ":${MINIO_PORT}" --console-address ":9001"


  casdoor:
    image: casbin/casdoor
    container_name: lobe-casdoor
    entrypoint: /bin/sh -c './server --createDatabase=true'
    network_mode: 'service:network-service'
    depends_on:
      postgresql:
        condition: service_healthy
    environment:
      RUNNING_IN_DOCKER: 'true'
      driverName: 'postgres'
      dataSourceName: 'user=postgres password=${POSTGRES_PASSWORD} host=postgresql port=5432 sslmode=disable dbname=casdoor'
      # origin: 'http://localhost:${CASDOOR_PORT}'
      origin: '反代casdoor地址'
      runmode: 'dev'
    volumes:
      - ./init_data.json:/init_data.json

  lobe:
    image: lobehub/lobe-chat-database
    container_name: lobe-chat-database
    network_mode: 'service:network-service'
    depends_on:
      postgresql:
        condition: service_healthy
      network-service:
        condition: service_started
      minio:
        condition: service_started
      casdoor:
        condition: service_started

    environment:
      # - 'APP_URL=http://localhost:3210'
      - 'APP_URL=反代lobechat地址'

      - 'NEXT_AUTH_SSO_PROVIDERS=casdoor'
      - 'KEY_VAULTS_SECRET=Kix2wcUONd4CX51E/ZPAd36BqM4wzJgKjPtz2sGztqQ=' #不用改
      - 'NEXT_AUTH_SECRET=NX2kaPE923dt6BL2U8e9oSre5RfoT7hg' #不用改
      # - 'AUTH_URL=http://localhost:${LOBE_PORT}/api/auth'
      - 'AUTH_URL=反代lobechat地址/api/auth'

      # - 'AUTH_CASDOOR_ISSUER=http://localhost:${CASDOOR_PORT}'
      - 'AUTH_CASDOOR_ISSUER=反代casdoor地址'

      - 'DATABASE_URL=postgresql://postgres:${POSTGRES_PASSWORD}@postgresql:5432/${LOBE_DB_NAME}'
      # - 'S3_ENDPOINT=http://localhost:${MINIO_PORT}'
      - 'S3_ENDPOINT=反代minio地址,内网9000端口'

      - 'S3_BUCKET=${MINIO_LOBE_BUCKET}'
      # - 'S3_PUBLIC_DOMAIN=http://localhost:${MINIO_PORT}'
      - 'S3_PUBLIC_DOMAIN=反代minio地址,内网9000端口'

      - 'S3_ENABLE_PATH_STYLE=1'
      - 'LLM_VISION_IMAGE_USE_BASE64=1'
      - 'SEARXNG_URL=我用的反代searXNG地址'
      # 记得容器的文件中/etc/searXNG/settings.yml中搜索- html回车加上一行- json
    env_file:
      - .env
    restart: always

volumes:
  data:
    driver: local
  s3_data:
    driver: local

networks:
  lobe-network:
    driver: bridge

同时,docker-compose.yml还需要一个.env,一个init_data.json
前者配置如下

# Proxy, if you need it
# HTTP_PROXY=http://localhost:7890
# HTTPS_PROXY=http://localhost:7890


# Other environment variables, as needed. You can refer to the environment variables configuration for the client version, making sure not to have ACCESS_CODE.
# OPENAI_API_KEY=sk-xxxx
# OPENAI_PROXY_URL=https://api.openai.com/v1
# OPENAI_MODEL_LIST=...


# ===========================
# ====== Preset config ======
# ===========================
# if no special requirements, no need to change
LOBE_PORT=3210
CASDOOR_PORT=8000
MINIO_PORT=9000

# Postgres related, which are the necessary environment variables for DB
LOBE_DB_NAME=lobechat
POSTGRES_PASSWORD=#自己设置密码

# Casdoor secret
AUTH_CASDOOR_ID=#见官网https://lobehub.com/zh/docs/self-hosting/server-database/docker-compose
AUTH_CASDOOR_SECRET=#见官网#https://lobehub.com/zh/docs/self-hosting/server-database/docker-compose

# MinIO S3 configuration
MINIO_ROOT_USER=#自己设置
MINIO_ROOT_PASSWORD=#自己设置

# Configure the bucket information of MinIO
MINIO_LOBE_BUCKET=casdoor
S3_ACCESS_KEY_ID=#见官网https://lobehub.com/zh/docs/self-hosting/server-database/docker-compose
S3_SECRET_ACCESS_KEY=#见官网https://lobehub.com/zh/docs/self-hosting/server-database/docker-compose

其中见官网的步骤多数都在最下面 生产部署下从 logto 迁移至 Casdoor

init_data.json这个文件需要在一个空白文件夹中运行

bash <(curl -fsSL https://lobe.li/setup.sh) -l zh_CN

这个命令获取,然后复制到你放置docker-compose.yml的文件夹中,所有的参数都填对了之后可以运行docker compose up -d命令

再提一嘴,casdoor默认的用户是admin,密码123,进入casdoor之后建议直接用户管理-用户中,新建一个built-in组织,应用为app-built-in中的账户,并将是组织管理员勾上,保存退出。然后将admin的是组织管理员给取消,并且勾上被禁用,然后保存退出。

直接进init_data.json,修改默认用户的账号密码不行么?

好像默认的admin删不掉

Tounh 通过 LINUX DO <[email protected]>于2025年3月9日 周日16:43写道:

哦哦,那倒是没去研究过,之前嫌logto麻烦,一直用auth0到现在。还没切到casdoor

我倒是想研究怎么切换到auth0去的,过阵子再搞