Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
xlarryzhu opened this issue Sep 19, 2024 · 5 comments
Labels
🐛 Bug Something isn't working | 缺陷

Comments

@xlarryzhu
Copy link

📦 部署环境

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

@xlarryzhu xlarryzhu added the 🐛 Bug Something isn't working | 缺陷 label Sep 19, 2024
@lobehubbot
Copy link
Member

👀 @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
Copy link
Member

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

Copy link

dosubot bot commented Sep 19, 2024

@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
Copy link

gzxyls commented Sep 19, 2024

我跟你问题一模一样

@lobehubbot
Copy link
Member

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


I have the same problem as you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 Bug Something isn't working | 缺陷
Projects
Status: Roadmap - Chat 1.x
Development

No branches or pull requests

3 participants