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

📝 docs: update local docker-compose auth to casdoor #3855

Merged
merged 25 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
925fa22
:construction_worker: ci: casdoor in compose
cy948 Sep 9, 2024
a38272f
:bug: fix: casdoor well-known error
cy948 Sep 9, 2024
11bbfea
:recycle: refactor: move envs
cy948 Sep 9, 2024
b455a83
:construction_worker: ci: add s3 demo data
cy948 Sep 9, 2024
87a993e
:construction_worker: ci: Add start script
cy948 Sep 10, 2024
c399b30
:construction_worker: ci: update setup script
cy948 Sep 11, 2024
7b81a83
:construction_worker: ci: compress asserts
cy948 Sep 11, 2024
a6acb40
:recycle: refactor: rename `demo` to `local`, `local` to `local-logto`
cy948 Sep 11, 2024
f831de0
:bug: fix: file not found
cy948 Sep 11, 2024
4251caf
:recycle: refactro: download asynchronously
cy948 Sep 11, 2024
53d005a
:globe_with_meridians: i18n: support zh_CN in setup.sh
cy948 Sep 11, 2024
d57c406
:bug: fix: tips shown format error
cy948 Sep 11, 2024
98010ef
:recycle: fix: spacing
cy948 Sep 11, 2024
e794f83
:bug: fix: LC error
cy948 Sep 11, 2024
75d191b
:bug: fix: update url to main repo
cy948 Sep 11, 2024
4d62de8
:recycle: refactor: remove annotations
cy948 Sep 11, 2024
0cd8323
:memo: docs: update local-logto docs
cy948 Sep 11, 2024
910d482
:construction_worker: build: add `LLM_VISION_IMAGE_USE_BASE64=1`
cy948 Sep 14, 2024
fb48848
:lipstick: style: remove alert text color
cy948 Sep 21, 2024
25e48a2
:recycle: refactor: use casdoor provider
cy948 Sep 21, 2024
b1e9124
:recycle: refactor: no multithreading
cy948 Sep 21, 2024
f712cc7
:bug: fix: use casdoor provider
cy948 Sep 21, 2024
a9d3bbf
:bug: fix: i18n in lower version of bash
cy948 Sep 21, 2024
cc72431
:lipstick: style: remove color
cy948 Sep 21, 2024
6094095
:recycle: refactor: - duplicate casdoor ports
cy948 Sep 24, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions docker-compose/local-logto/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Logto secret
LOGTO_CLIENT_ID=
LOGTO_CLIENT_SECRET=

# MinIO S3 configuration
MINIO_ROOT_USER=YOUR_MINIO_USER
MINIO_ROOT_PASSWORD=YOUR_MINIO_PASSWORD

# Configure the bucket information of MinIO
MINIO_LOBE_BUCKET=lobe
S3_ACCESS_KEY_ID=
S3_SECRET_ACCESS_KEY=

# 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=...


# ----- Other config -----
# if no special requirements, no need to change
LOBE_PORT=3210
LOGTO_PORT=3001
MINIO_PORT=9000

# Postgres related, which are the necessary environment variables for DB
LOBE_DB_NAME=lobechat
POSTGRES_PASSWORD=uWNZugjBqixf8dxC
33 changes: 33 additions & 0 deletions docker-compose/local-logto/.env.zh-CN.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Logto secret
LOGTO_CLIENT_ID=
LOGTO_CLIENT_SECRET=

# MinIO S3 配置
MINIO_ROOT_USER=YOUR_MINIO_USER
MINIO_ROOT_PASSWORD=YOUR_MINIO_PASSWORD

# 在下方配置 minio 中添加的桶
MINIO_LOBE_BUCKET=lobe
S3_ACCESS_KEY_ID=
S3_SECRET_ACCESS_KEY=


# Proxy,如果你需要的话(比如你使用 GitHub 作为鉴权服务提供商)
# HTTP_PROXY=http://localhost:7890
# HTTPS_PROXY=http://localhost:7890

# 其他环境变量,视需求而定,可以参照客户端版本的环境变量配置,注意不要有 ACCESS_CODE
# OPENAI_API_KEY=sk-xxxx
# OPENAI_PROXY_URL=https://api.openai.com/v1
# OPENAI_MODEL_LIST=...


# ----- 相关配置 start -----
# 如没有特殊需要不用更改
LOBE_PORT=3210
LOGTO_PORT=3001
MINIO_PORT=9000

# Postgres 相关,也即 DB 必须的环境变量
LOBE_DB_NAME=lobechat
POSTGRES_PASSWORD=uWNZugjBqixf8dxC
102 changes: 102 additions & 0 deletions docker-compose/local-logto/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
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
32 changes: 17 additions & 15 deletions docker-compose/local/.env.example
Original file line number Diff line number Diff line change
@@ -1,16 +1,3 @@
# Logto secret
LOGTO_CLIENT_ID=
LOGTO_CLIENT_SECRET=

# MinIO S3 configuration
MINIO_ROOT_USER=YOUR_MINIO_USER
MINIO_ROOT_PASSWORD=YOUR_MINIO_PASSWORD

# Configure the bucket information of MinIO
MINIO_LOBE_BUCKET=lobe
S3_ACCESS_KEY_ID=
S3_SECRET_ACCESS_KEY=

# Proxy, if you need it
# HTTP_PROXY=http://localhost:7890
# HTTPS_PROXY=http://localhost:7890
Expand All @@ -22,12 +9,27 @@ S3_SECRET_ACCESS_KEY=
# OPENAI_MODEL_LIST=...


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

# Postgres related, which are the necessary environment variables for DB
LOBE_DB_NAME=lobechat
POSTGRES_PASSWORD=uWNZugjBqixf8dxC

# Casdoor secret
AUTH_CASDOOR_ID=a387a4892ee19b1a2249
AUTH_CASDOOR_SECRET=dbf205949d704de81b0b5b3603174e23fbecc354

# MinIO S3 configuration
MINIO_ROOT_USER=YOUR_MINIO_USER
MINIO_ROOT_PASSWORD=YOUR_MINIO_PASSWORD

# Configure the bucket information of MinIO
MINIO_LOBE_BUCKET=lobe
S3_ACCESS_KEY_ID=soaucnP8Bip0TDdUjxng
S3_SECRET_ACCESS_KEY=ZPUzvY34umfcfxvWKSv0P00vczVMB6YmgJS5J9eO
35 changes: 19 additions & 16 deletions docker-compose/local/.env.zh-CN.example
Original file line number Diff line number Diff line change
@@ -1,33 +1,36 @@
# Logto secret
LOGTO_CLIENT_ID=
LOGTO_CLIENT_SECRET=

# MinIO S3 配置
MINIO_ROOT_USER=YOUR_MINIO_USER
MINIO_ROOT_PASSWORD=YOUR_MINIO_PASSWORD

# 在下方配置 minio 中添加的桶
MINIO_LOBE_BUCKET=lobe
S3_ACCESS_KEY_ID=
S3_SECRET_ACCESS_KEY=


# Proxy,如果你需要的话(比如你使用 GitHub 作为鉴权服务提供商)
# HTTP_PROXY=http://localhost:7890
# HTTPS_PROXY=http://localhost:7890


# 其他环境变量,视需求而定,可以参照客户端版本的环境变量配置,注意不要有 ACCESS_CODE
# OPENAI_API_KEY=sk-xxxx
# OPENAI_PROXY_URL=https://api.openai.com/v1
# OPENAI_MODEL_LIST=...


# ----- 相关配置 start -----
# ===================
# ===== 预设配置 =====
# ===================
# 如没有特殊需要不用更改
LOBE_PORT=3210
LOGTO_PORT=3001
CASDOOR_PORT=8000
MINIO_PORT=9000

# Postgres 相关,也即 DB 必须的环境变量
LOBE_DB_NAME=lobechat
POSTGRES_PASSWORD=uWNZugjBqixf8dxC

# Casdoor secret
AUTH_CASDOOR_ID=a387a4892ee19b1a2249
AUTH_CASDOOR_SECRET=dbf205949d704de81b0b5b3603174e23fbecc354

# MinIO S3 配置
MINIO_ROOT_USER=YOUR_MINIO_USER
MINIO_ROOT_PASSWORD=YOUR_MINIO_PASSWORD

# 在下方配置 minio 中添加的桶
MINIO_LOBE_BUCKET=lobe
S3_ACCESS_KEY_ID=soaucnP8Bip0TDdUjxng
S3_SECRET_ACCESS_KEY=ZPUzvY34umfcfxvWKSv0P00vczVMB6YmgJS5J9eO

33 changes: 17 additions & 16 deletions docker-compose/local/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ services:
ports:
- '${MINIO_PORT}:${MINIO_PORT}' # MinIO API
- '9001:9001' # MinIO Console
- '${LOGTO_PORT}:${LOGTO_PORT}' # Logto
- '3002:3002' # Logto Admin
- '${CASDOOR_PORT}:${CASDOOR_PORT}' # Casdoor
- '${LOBE_PORT}:3210' # LobeChat
command: tail -f /dev/null
networks:
Expand Down Expand Up @@ -45,21 +44,22 @@ services:
command: >
server /etc/minio/data --address ":${MINIO_PORT}" --console-address ":9001"

logto:
image: svhd/logto
container_name: lobe-logto
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:
- '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']

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}"
runmode: "dev"
volumes:
- ./init_data.json:/init_data.json

lobe:
image: lobehub/lobe-chat-database
Expand All @@ -72,21 +72,22 @@ services:
condition: service_started
minio:
condition: service_started
logto:
casdoor:
condition: service_started

environment:
- 'APP_URL=http://localhost:3210'
- 'NEXT_AUTH_SSO_PROVIDERS=logto'
- 'NEXT_AUTH_SSO_PROVIDERS=casdoor'
- 'KEY_VAULTS_SECRET=Kix2wcUONd4CX51E/ZPAd36BqM4wzJgKjPtz2sGztqQ='
- 'NEXT_AUTH_SECRET=NX2kaPE923dt6BL2U8e9oSre5RfoT7hg'
- 'NEXTAUTH_URL=http://localhost:${LOBE_PORT}/api/auth'
- 'LOGTO_ISSUER=http://localhost:${LOGTO_PORT}/oidc'
- 'AUTH_URL=http://localhost:${LOBE_PORT}/api/auth'
- 'AUTH_CASDOOR_ISSUER=http://localhost:${CASDOOR_PORT}'
- 'DATABASE_URL=postgresql://postgres:${POSTGRES_PASSWORD}@postgresql:5432/${LOBE_DB_NAME}'
- 'S3_ENDPOINT=http://localhost:${MINIO_PORT}'
- 'S3_BUCKET=${MINIO_LOBE_BUCKET}'
arvinxx marked this conversation as resolved.
Show resolved Hide resolved
- 'S3_PUBLIC_DOMAIN=http://localhost:${MINIO_PORT}'
- 'S3_ENABLE_PATH_STYLE=1'
- 'LLM_VISION_IMAGE_USE_BASE64=1'
env_file:
- .env
restart: always
Expand Down
Binary file added docker-compose/local/init_data.json.tar.gz
Binary file not shown.
Binary file added docker-compose/local/s3_data.tar.gz
Binary file not shown.
Loading
Loading