lobehub / lobe-chat

🤯 Lobe Chat - an open-source, modern-design AI chat framework. Supports Multi AI Providers( OpenAI / Claude 3 / Gemini / Ollama / Azure / DeepSeek), Knowledge Base (file upload / knowledge management / RAG ), Multi-Modals (Vision/TTS) and plugin system. One-click FREE deployment of your private ChatGPT/ Claude application.
https://chat-preview.lobehub.com
Other
40.92k stars 9.32k forks source link

[Bug] docekr compose 快速启动,配置logto时会出现"http://localhost:3001/unknown-session" #4019

Open xlarryzhu opened 1 day ago

xlarryzhu commented 1 day ago

📦 部署环境

Docker

📌 软件版本

1.19.2

💻 系统环境

Other Linux

🌐 浏览器

Chrome, Edge

🐛 问题描述

使用 Docker Compose 部署 LobeChat 服务端数据库版本,使用默认配置文件进行快速部署,其余组件可以通过IP:端口进行访问(如IP:3210),但访问logto管理界面(IP:3002)时会自动跳转至"http://localhost:3001/unknown-session" ,无法添加logto的管理员账号。

📷 复现步骤

No response

🚦 期望结果

No response

📝 补充信息

No response

lobehubbot commented 1 day ago

👀 @xlarryzhu

Thank you for raising an issue. We will investigate into the matter and get back to you as soon as possible. Please make sure you have given us as much context as possible.\ 非常感谢您提交 issue。我们会尽快调查此事,并尽快回复您。 请确保您已经提供了尽可能多的背景信息。

lobehubbot commented 1 day ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


📦 Deployment environment

Docker

📌 Software version

1.19.2

💻 System environment

Other Linux

🌐 Browser

Chrome, Edge

🐛 Problem description

Use Docker Compose to deploy the LobeChat server database version, and use the default configuration file for rapid deployment. The other components can be accessed through the IP: port (such as IP: 3210), but when accessing the logto management interface (IP: 3002), it will automatically jump to "http://localhost:3001/unknown-session", the administrator account of logto cannot be added.

📷 Steps to reproduce

No response

🚦 Expected results

No response

📝 Supplementary information

No response

dosubot[bot] commented 1 day ago

@xlarryzhu 你好!我是Dosu,一个能够帮助你解决bug、回答问题并成为贡献者的机器人。我会在等待人类维护者的过程中帮助你解决问题。

I found a similar issue that might help resolve your problem. When accessing the Logto management interface in Docker Compose deployment, it redirects to "http://localhost:3001/unknown-session" and prevents adding a Logto admin account. Here are the steps to resolve it:

  1. Open http://localhost:3002 to access the Logto WebUI and register an administrator account.

  2. Create a Next.js (App Router) application and add the following configurations:

    • Redirect URI should be http://localhost:3210/api/auth/callback/logto
    • Post sign-out redirect URI should be http://localhost:3210/
  3. Obtain the App ID and App secrets, and fill them into your .env file corresponding to LOGTO_CLIENT_ID and LOGTO_CLIENT_SECRET.

  4. Ensure your docker-compose.yml file is correctly configured. Here is a sample configuration for reference:

    services:
      network-service:
        image: alpine
        container_name: lobe-network
        ports:
          - '${MINIO_PORT}:${MINIO_PORT}'  # MinIO API
          - '9001:9001'  # MinIO Console
          - '${LOGTO_PORT}:${LOGTO_PORT}' # Logto
          - '3002:3002'  # Logto Admin
          - '${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:
          - './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:
          - './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}'
        restart: always
        command: >
          server /etc/minio/data --address ":${MINIO_PORT}" --console-address ":9001"
    
      logto:
        image: svhd/logto
        container_name: lobe-logto
        network_mode: 'service:network-service'
        depends_on:
          postgresql:
            condition: service_healthy
        environment:
          - 'TRUST_PROXY_HEADER=1'
          - 'PORT=${LOGTO_PORT}'
          - 'DB_URL=postgresql://postgres:${POSTGRES_PASSWORD}@postgresql:5432/logto'
          - 'ENDPOINT=http://localhost:${LOGTO_PORT}'
          - 'ADMIN_ENDPOINT=http://localhost:3002'
        entrypoint: ['sh', '-c', 'npm run cli db seed -- --swe && npm start']
    
      lobe:
        image: lobehub/lobe-chat-database
        container_name: lobe-database
        network_mode: 'service:network-service'
        depends_on:
          postgresql:
            condition: service_healthy
          network-service:
            condition: service_started
          minio:
            condition: service_started
          logto:
            condition: service_started
    
        environment:
          - 'APP_URL=http://localhost:3210'
          - 'NEXT_AUTH_SSO_PROVIDERS=logto'
          - 'KEY_VAULTS_SECRET=Kix2wcUONd4CX51E/ZPAd36BqM4wzJgKjPtz2sGztqQ='
          - 'NEXT_AUTH_SECRET=NX2kaPE923dt6BL2U8e9oSre5RfoT7hg'
          - 'NEXTAUTH_URL=http://localhost:${LOBE_PORT}/api/auth'
          - 'LOGTO_ISSUER=http://localhost:${LOGTO_PORT}/oidc'
          - 'DATABASE_URL=postgresql://postgres:${POSTGRES_PASSWORD}@postgresql:5432/${LOBE_DB_NAME}'
          - 'S3_ENDPOINT=http://localhost:${MINIO_PORT}'
          - 'S3_BUCKET=${MINIO_LOBE_BUCKET}'
          - 'S3_PUBLIC_DOMAIN=http://localhost:${MINIO_PORT}'
          - 'S3_ENABLE_PATH_STYLE=1'
        env_file:
          - .env
        restart: always
    
    volumes:
      data:
        driver: local
      s3_data:
        driver: local
    
    networks:
      lobe-network:
        driver: bridge
  5. Restart the LobeChat service:

    docker compose up -d

Make sure you are not using the administrator account to log into LobeChat, as this will result in an error [1][2].

To continue talking to Dosu, mention @dosu.

gzxyls commented 1 day ago

我跟你问题一模一样

lobehubbot commented 1 day ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


I have the same problem as you

cy948 commented 9 hours ago

要访问3002的管理员端口,3001不允许直接访问

lobehubbot commented 9 hours ago

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


To access the administrator port of 3002, 3001 does not allow direct access