@lobehub/chat 1.22.0 → 1.22.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +50 -0
- package/docker-compose/local/docker-compose.yml +11 -9
- package/docker-compose/{local-logto → local/logto}/.env.example +2 -2
- package/docker-compose/{local-logto → local/logto}/.env.zh-CN.example +3 -3
- package/docker-compose/{local-logto → local/logto}/docker-compose.yml +8 -7
- package/docker-compose/local/setup.sh +31 -29
- package/docker-compose/local/zitadel/docker-compose.yml +8 -8
- package/docker-compose/production/{.env.example → logto/.env.example} +3 -3
- package/docker-compose/production/{.env.zh-CN.example → logto/.env.zh-CN.example} +3 -3
- package/docker-compose/production/{docker-compose.yml → logto/docker-compose.yml} +2 -1
- package/docker-compose/production/zitadel/docker-compose.yml +5 -5
- package/docs/self-hosting/advanced/auth/next-auth/authentik.zh-CN.mdx +2 -2
- package/docs/self-hosting/advanced/auth/next-auth/casdoor.mdx +120 -0
- package/docs/self-hosting/advanced/auth/next-auth/casdoor.zh-CN.mdx +121 -0
- package/docs/self-hosting/advanced/auth/next-auth/cloudflare-zero-trust.zh-CN.mdx +3 -3
- package/docs/self-hosting/advanced/auth/next-auth/logto.mdx +10 -8
- package/docs/self-hosting/advanced/auth/next-auth/logto.zh-CN.mdx +1 -1
- package/docs/self-hosting/advanced/auth.mdx +5 -1
- package/docs/self-hosting/advanced/auth.zh-CN.mdx +5 -1
- package/docs/self-hosting/environment-variables/auth.mdx +88 -63
- package/docs/self-hosting/environment-variables/auth.zh-CN.mdx +91 -68
- package/docs/self-hosting/server-database/docker-compose.mdx +163 -280
- package/docs/self-hosting/server-database/docker-compose.zh-CN.mdx +92 -210
- package/docs/usage/providers/ai21.mdx +3 -1
- package/docs/usage/providers/ai360.mdx +1 -1
- package/docs/usage/providers/fireworksai.mdx +3 -1
- package/docs/usage/providers/github.mdx +1 -1
- package/docs/usage/providers/hunyuan.mdx +3 -1
- package/docs/usage/providers/siliconcloud.mdx +3 -1
- package/docs/usage/providers/spark.mdx +1 -1
- package/docs/usage/providers/upstage.mdx +1 -1
- package/docs/usage/providers/wenxin.mdx +3 -1
- package/docs/usage/providers/zeroone.mdx +2 -2
- package/package.json +5 -5
- package/src/libs/agent-runtime/siliconcloud/index.ts +8 -0
- package/src/libs/next-auth/sso-providers/logto.ts +1 -1
@@ -1,16 +1,14 @@
|
|
1
1
|
---
|
2
|
-
title: Deploying LobeChat
|
3
|
-
description:
|
4
|
-
Learn how to deploy LobeChat Server Database using Docker Compose, including
|
5
|
-
configuration tutorials for various services.
|
2
|
+
title: Deploying LobeChat with Docker Compose
|
3
|
+
description: Learn how to deploy the LobeChat service using Docker Compose, including configuration tutorials for various services.
|
6
4
|
tags:
|
7
5
|
- Docker Compose
|
8
6
|
- LobeChat
|
9
|
-
- Docker
|
7
|
+
- Docker Containers
|
10
8
|
- Deployment Guide
|
11
9
|
---
|
12
10
|
|
13
|
-
# Deploying LobeChat
|
11
|
+
# Deploying LobeChat Server Database Version with Docker Compose
|
14
12
|
|
15
13
|
<div style={{display:"flex", gap: 4}}>
|
16
14
|
[![][docker-release-shield]][docker-release-link]
|
@@ -22,81 +20,128 @@ tags:
|
|
22
20
|
</div>
|
23
21
|
|
24
22
|
<Callout type="info">
|
25
|
-
This article assumes
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
Database](/
|
23
|
+
This article assumes you are familiar with the basic principles and processes of deploying the
|
24
|
+
LobeChat server database version (hereinafter referred to as DB version), so it only includes core
|
25
|
+
environment variable configurations. If you are not familiar with the deployment principles of
|
26
|
+
LobeChat DB version, please refer to [Deploying with a Server
|
27
|
+
Database](/docs/self-hosting/server-database).
|
30
28
|
</Callout>
|
31
29
|
|
32
30
|
<Callout type="warning">
|
33
|
-
Due to the inability to expose `NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY` using Docker environment variables, you cannot use Clerk as
|
31
|
+
Due to the inability to expose `NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY` using Docker environment variables, you cannot use Clerk as a login authentication service when deploying LobeChat with Docker / Docker Compose.
|
34
32
|
|
35
|
-
If you
|
33
|
+
If you need Clerk as a login authentication service, consider deploying with Vercel or building your own image.
|
36
34
|
|
37
35
|
</Callout>
|
38
36
|
|
39
|
-
|
37
|
+
In general, to fully run the LobeChat database version, you need at least the following four services:
|
40
38
|
|
41
|
-
- LobeChat database version itself
|
42
|
-
- PostgreSQL database with PGVector plugin
|
43
|
-
-
|
44
|
-
- SSO authentication service supported by LobeChat
|
39
|
+
- The LobeChat database version itself
|
40
|
+
- A PostgreSQL database with the PGVector plugin
|
41
|
+
- An object storage service that supports S3 protocol
|
42
|
+
- An SSO login authentication service supported by LobeChat
|
45
43
|
|
46
|
-
These services can be combined through self-
|
44
|
+
These services can be combined through self-built or online cloud services to meet different levels of deployment needs.
|
47
45
|
|
48
|
-
|
46
|
+
In this article, we provide a Docker Compose configuration entirely based on open-source self-built services. You can use this configuration file directly to start the LobeChat database version or modify it to suit your needs.
|
49
47
|
|
50
|
-
We default to using [MinIO](https://github.com/minio/minio) as the local S3 object storage service and [
|
48
|
+
We default to using [MinIO](https://github.com/minio/minio) as the local S3 object storage service and [Casdoor](https://github.com/casdoor/casdoor) as the local authentication service.
|
51
49
|
|
52
50
|
## Quick Start
|
53
51
|
|
54
|
-
To facilitate quick start, this
|
52
|
+
To facilitate a quick start, this section uses the `docker-compose/local` directory's `docker-compose.yml` configuration file. The started LobeChat application runs at `http://localhost:3210` and can be run locally.
|
55
53
|
|
56
54
|
<Callout type="warning">
|
57
|
-
|
55
|
+
For a quick start, this `docker-compose.yml` contains a large number of sensitive Secret/Password
|
56
|
+
fields, suitable only for quick demonstrations or personal local use. Do not use it directly in a
|
57
|
+
production environment! Otherwise, you will be responsible for any security issues encountered!
|
58
58
|
</Callout>
|
59
59
|
|
60
60
|
<Steps>
|
61
|
-
###
|
61
|
+
### One-click Startup Script
|
62
62
|
|
63
|
-
Create a new `lobe-chat-db`
|
63
|
+
Create a new directory named `lobe-chat-db` to store your configuration files and subsequent database files.
|
64
64
|
|
65
65
|
```sh
|
66
66
|
mkdir lobe-chat-db
|
67
|
+
cd lobe-chat-db
|
67
68
|
```
|
68
69
|
|
69
|
-
|
70
|
+
We provide a one-click startup script `setup.sh`, which can automatically use the default configuration and start the service:
|
70
71
|
|
71
72
|
```sh
|
72
|
-
curl -fsSL https://raw.githubusercontent.com/lobehub/lobe-chat/HEAD/docker-compose/local
|
73
|
-
curl -fsSL https://raw.githubusercontent.com/lobehub/lobe-chat/HEAD/docker-compose/local-logto/.env.example > .env
|
73
|
+
bash <(curl -fsSL https://raw.githubusercontent.com/lobehub/lobe-chat/HEAD/docker-compose/local/setup.sh) -f
|
74
74
|
```
|
75
75
|
|
76
|
-
### Start
|
76
|
+
### Start Docker
|
77
77
|
|
78
78
|
```sh
|
79
79
|
docker compose up -d
|
80
80
|
```
|
81
81
|
|
82
|
-
|
82
|
+
The default login account is the default account of Casdoor, with the username `admin` and password `123`.
|
83
83
|
|
84
|
-
|
84
|
+
### Check Logs
|
85
85
|
|
86
|
-
|
86
|
+
```sh
|
87
|
+
docker logs -f lobe-chat
|
88
|
+
```
|
89
|
+
|
90
|
+
If you see the following logs in the container, it means the startup was successful:
|
91
|
+
|
92
|
+
```log
|
93
|
+
[Database] Start to migration...
|
94
|
+
✅ database migration pass.
|
95
|
+
-------------------------------------
|
96
|
+
▲ Next.js 14.x.x
|
97
|
+
- Local: http://localhost:3210
|
98
|
+
- Network: http://0.0.0.0:3210
|
99
|
+
|
100
|
+
✓ Starting...
|
101
|
+
✓ Ready in 95ms
|
102
|
+
```
|
103
|
+
|
104
|
+
</Steps>
|
87
105
|
|
88
|
-
|
89
|
-
- `Post sign-out redirect URI` should be `http://localhost:3210/`
|
106
|
+
At this point, you have successfully deployed the LobeChat database version, and you can access your LobeChat service at `http://localhost:3210`.
|
90
107
|
|
91
|
-
|
108
|
+
If you encounter problems, try checking the Docker logs and console logs for troubleshooting.
|
109
|
+
|
110
|
+
## Publishing to Production (IP Mode)
|
111
|
+
|
112
|
+
The following assumes that the machine IP running the LobeChat service on the LAN/public network is `your_server_ip`.
|
113
|
+
|
114
|
+
To access via the local network IP, you first need to run the local startup:
|
115
|
+
|
116
|
+
```sh
|
117
|
+
bash <(curl -fsSL https://raw.githubusercontent.com/lobehub/lobe-chat/HEAD/docker-compose/local/setup.sh) -f
|
118
|
+
docker compose up -d
|
119
|
+
```
|
120
|
+
|
121
|
+
Next, you need to modify the downloaded `docker-compose.yml` file, performing a global replacement to change `localhost` to `your_server_ip`, and then restart:
|
122
|
+
|
123
|
+
```sh
|
124
|
+
sed -i 's/localhost/your_server_ip/g' docker-compose.yml
|
125
|
+
docker compose up -d
|
126
|
+
```
|
127
|
+
|
128
|
+
### Configuring Casdoor
|
129
|
+
|
130
|
+
1. After starting with the `setup.sh` script, the default port for Casdoor WebUI is `8000`. You can access it via `http://your_server_ip:8000`, with the default username `admin` and password `123`.
|
131
|
+
|
132
|
+
2. In `Identity -> Applications`, add a new line:
|
133
|
+
|
134
|
+
```
|
135
|
+
http://your_server_ip:3210/api/auth/callback/casdoor
|
136
|
+
```
|
92
137
|
|
93
|
-
|
138
|
+
3. Most other configurations can remain default; you can modify the default configurations in `Identity -> Applications`.
|
94
139
|
|
95
|
-
|
140
|
+
### Configuring MinIO S3
|
96
141
|
|
97
|
-
|
142
|
+
1. After starting with the `setup.sh` script, the default port for MinIO WebUI is `9001`. You can access it via `http://your_server_ip:9001`, with the default username `YOUR_MINIO_USER` and password `YOUR_MINIO_PASSWORD`.
|
98
143
|
|
99
|
-
|
144
|
+
2. Most configurations can remain default. If you wish to allow users to change their avatars, you need to create a bucket named `casdoor` in `buckets`, select custom policy, and copy and paste the following content (if you have changed the bucket name, please find and replace):
|
100
145
|
|
101
146
|
```json
|
102
147
|
{
|
@@ -107,7 +152,7 @@ docker compose up -d
|
|
107
152
|
"AWS": ["*"]
|
108
153
|
},
|
109
154
|
"Action": ["s3:GetBucketLocation"],
|
110
|
-
"Resource": ["arn:aws:s3:::
|
155
|
+
"Resource": ["arn:aws:s3:::casdoor"]
|
111
156
|
},
|
112
157
|
{
|
113
158
|
"Effect": "Allow",
|
@@ -115,7 +160,7 @@ docker compose up -d
|
|
115
160
|
"AWS": ["*"]
|
116
161
|
},
|
117
162
|
"Action": ["s3:ListBucket"],
|
118
|
-
"Resource": ["arn:aws:s3:::
|
163
|
+
"Resource": ["arn:aws:s3:::casdoor"],
|
119
164
|
"Condition": {
|
120
165
|
"StringEquals": {
|
121
166
|
"s3:prefix": ["files/*"]
|
@@ -128,122 +173,108 @@ docker compose up -d
|
|
128
173
|
"AWS": ["*"]
|
129
174
|
},
|
130
175
|
"Action": ["s3:PutObject", "s3:DeleteObject", "s3:GetObject"],
|
131
|
-
"Resource": ["arn:aws:s3:::
|
176
|
+
"Resource": ["arn:aws:s3:::casdoor/**"]
|
132
177
|
}
|
133
178
|
],
|
134
179
|
"Version": "2012-10-17"
|
135
180
|
}
|
136
181
|
```
|
137
182
|
|
138
|
-
|
183
|
+
3. Create a new access key and store the generated `Access Key` and `Secret Key`.
|
139
184
|
|
140
|
-
|
185
|
+
4. In Casdoor's `Identity -> Providers`, associate the MinIO S3 service. Here is a sample configuration:
|
141
186
|
|
142
|
-
|
143
|
-
docker compose up -d
|
144
|
-
```
|
187
|
+

|
145
188
|
|
146
|
-
|
147
|
-
At this point, do not use `docker compose restart lobe` to restart, as this method will not reload the environment variables, and your S3 configuration will not take effect.
|
148
|
-
|
149
|
-
</Callout>
|
150
|
-
|
151
|
-
If you see the following logs in the container, it indicates that it has started successfully:
|
152
|
-
|
153
|
-
```log
|
154
|
-
[Database] Start to migration...
|
155
|
-
✅ database migration pass.
|
156
|
-
-------------------------------------
|
157
|
-
▲ Next.js 14.x.x
|
158
|
-
- Local: http://localhost:3210
|
159
|
-
- Network: http://0.0.0.0:3210
|
160
|
-
|
161
|
-
✓ Starting...
|
162
|
-
✓ Ready in 95ms
|
163
|
-
```
|
189
|
+
The Client ID and Client Secret should be the `Access Key` and `Secret Key` from the previous step, and `192.168.31.251` should be replaced with `your_server_ip`.
|
164
190
|
|
165
|
-
|
191
|
+
5. In Casdoor's `Identity -> Applications`, add the provider to the `app-built-in` application, select `minio`, save and exit.
|
166
192
|
|
167
|
-
You
|
193
|
+
6. You can try uploading a file in Casdoor's `Identity -> Resources` to test if the configuration is correct.
|
168
194
|
|
169
|
-
|
195
|
+
## Publishing to Production (Domain Name Mode)
|
170
196
|
|
171
|
-
|
197
|
+
<Callout type="info">
|
198
|
+
For deployments with a domain name, we recommend using [Logto](https://logto.io/) as the login
|
199
|
+
authentication service. The remainder of this article will use it as an example. If you use other
|
200
|
+
authentication services like Casdoor, the process should be similar, but note that different
|
201
|
+
authentication services may have different port configurations.
|
202
|
+
</Callout>
|
172
203
|
|
173
|
-
|
204
|
+
In the following text, we assume that in addition to the above services, you are also running a layer of Nginx for reverse proxy and SSL configuration.
|
174
205
|
|
175
|
-
The domain
|
206
|
+
The domain and associated service port descriptions are as follows:
|
176
207
|
|
177
|
-
- `lobe.example.com`:
|
178
|
-
- `lobe-auth-api.example.com`:
|
179
|
-
- `lobe-auth-ui.example.com`:
|
180
|
-
- `lobe-s3-api.example.com`:
|
181
|
-
- `lobe-s3-ui.example.com`:
|
208
|
+
- `lobe.example.com`: Your LobeChat service domain, which needs to reverse proxy to the LobeChat service port, defaulting to `3210`.
|
209
|
+
- `lobe-auth-api.example.com`: Your Logto service domain, which needs to reverse proxy to the Logto API service port, defaulting to `3001`.
|
210
|
+
- `lobe-auth-ui.example.com`: Your Logto UI domain, which needs to reverse proxy to the Logto WebUI service port, defaulting to `3002`.
|
211
|
+
- `lobe-s3-api.example.com`: Your MinIO API domain, which needs to reverse proxy to the MinIO API service port, defaulting to `9000`.
|
212
|
+
- `lobe-s3-ui.example.com`: Optional, your MinIO UI domain, which needs to reverse proxy to the MinIO WebUI service port, defaulting to `9001`.
|
182
213
|
|
183
|
-
And the service
|
214
|
+
And the service ports that do not require reverse proxy:
|
184
215
|
|
185
|
-
- `postgresql`:
|
216
|
+
- `postgresql`: Your PostgreSQL database service port, defaulting to `5432`.
|
186
217
|
|
187
218
|
<Callout type="warning">
|
188
|
-
Please note that CORS cross-
|
189
|
-
|
219
|
+
Please note that CORS cross-domain is configured internally in MinIO / Logto services. Do not configure CORS additionally in your reverse proxy, as this will cause errors.
|
220
|
+
|
221
|
+
For MinIO not on port 443, the Host must be `$http_host` (with port number), otherwise a 403 error will occur: `proxy_set_header Host $http_host`.
|
190
222
|
|
191
|
-
If you need to configure SSL
|
223
|
+
If you need to configure an SSL certificate, please configure it uniformly in the outer Nginx reverse proxy and not in MinIO.
|
192
224
|
|
193
225
|
</Callout>
|
194
226
|
|
195
227
|
### Configuration Files
|
196
228
|
|
197
229
|
```sh
|
198
|
-
curl -fsSL https://raw.githubusercontent.com/lobehub/lobe-chat/HEAD/docker-compose/production/docker-compose.yml > docker-compose.yml
|
199
|
-
curl -fsSL https://raw.githubusercontent.com/lobehub/lobe-chat/HEAD/docker-compose/production/.env.example > .env
|
230
|
+
curl -fsSL https://raw.githubusercontent.com/lobehub/lobe-chat/HEAD/docker-compose/production/logto/docker-compose.yml > docker-compose.yml
|
231
|
+
curl -fsSL https://raw.githubusercontent.com/lobehub/lobe-chat/HEAD/docker-compose/production/logto/.env.example > .env
|
200
232
|
```
|
201
233
|
|
202
|
-
The configuration files include `.env` and `docker-compose.yml`, where the `.env` file is used to configure
|
234
|
+
The configuration files include both `.env` and `docker-compose.yml`, where the `.env` file is used to configure the environment variables for LobeChat, and the `docker-compose.yml` file is used to configure the Postgres, MinIO, and Logto services.
|
203
235
|
|
204
|
-
|
236
|
+
Generally, you should only modify sensitive information such as domain names and account passwords, while keeping other configuration items at their default values.
|
205
237
|
|
206
|
-
Refer to the
|
238
|
+
Refer to the appendix for example configurations.
|
207
239
|
|
208
|
-
###
|
240
|
+
### Postgres Database Configuration
|
209
241
|
|
210
|
-
You can check the logs
|
242
|
+
You can check the logs with the following command:
|
211
243
|
|
212
244
|
```sh
|
213
|
-
docker logs -f lobe-
|
245
|
+
docker logs -f lobe-chat
|
214
246
|
```
|
215
247
|
|
216
248
|
<Callout type="tip">
|
217
|
-
In our official Docker
|
218
|
-
|
219
|
-
|
220
|
-
table instance
|
221
|
-
migrations.
|
249
|
+
In our official Docker image, database schema migration is automatically executed before starting
|
250
|
+
the image. Our official image promises stability in the automatic creation of tables from "empty
|
251
|
+
database -> complete tables." Therefore, we recommend that your database instance use an empty
|
252
|
+
table instance to avoid the hassle of manual table structure maintenance or migration.
|
222
253
|
</Callout>
|
223
254
|
|
224
|
-
If you encounter issues when creating tables, you can try
|
255
|
+
If you encounter issues when creating tables, you can try the following command to force remove the database container and restart:
|
225
256
|
|
226
257
|
```sh
|
227
|
-
docker compose down # Stop
|
258
|
+
docker compose down # Stop the service
|
228
259
|
sudo rm -rf ./data # Remove mounted database data
|
229
260
|
docker compose up -d # Restart
|
230
261
|
```
|
231
262
|
|
232
|
-
### Authentication Service Configuration
|
263
|
+
### Login Authentication Service Configuration
|
233
264
|
|
234
265
|
This article uses Logto as an example to explain the configuration process. If you are using other authentication service providers, please refer to their documentation for configuration.
|
235
266
|
|
236
267
|
<Callout type="warning">
|
237
|
-
Please remember to configure the
|
268
|
+
Please remember to configure the CORS cross-domain settings for the corresponding login authentication service provider to ensure LobeChat can access the authentication service properly.
|
238
269
|
|
239
|
-
In this article, you need to allow cross-
|
270
|
+
In this article, you need to allow cross-domain requests from `https://lobe.example.com`.
|
240
271
|
|
241
272
|
</Callout>
|
242
273
|
|
243
|
-
You need to
|
274
|
+
You first need to visit the WebUI for configuration:
|
244
275
|
|
245
|
-
- If you configured the reverse proxy as mentioned earlier, open `https://lobe-auth-ui.example.com
|
246
|
-
- Otherwise,
|
276
|
+
- If you have configured the reverse proxy as mentioned earlier, open `https://lobe-auth-ui.example.com`.
|
277
|
+
- Otherwise, open `http://localhost:3002` after performing port mapping.
|
247
278
|
|
248
279
|
1. Register a new account; the first registered account will automatically become an administrator.
|
249
280
|
|
@@ -254,7 +285,7 @@ You need to first access the WebUI for configuration:
|
|
254
285
|
4. Set `CORS allowed origins` to `https://lobe.example.com`.
|
255
286
|
|
256
287
|
<Image
|
257
|
-
alt="
|
288
|
+
alt="Configuring Logto"
|
258
289
|
src="https://github.com/user-attachments/assets/5b816379-c07b-40ea-bde4-df16e2e4e523"
|
259
290
|
/>
|
260
291
|
|
@@ -263,14 +294,14 @@ You need to first access the WebUI for configuration:
|
|
263
294
|
6. Set `AUTH_LOGTO_ISSUER` in your `.env` file to `https://lobe-auth-api.example.com/oidc`.
|
264
295
|
|
265
296
|
<Image
|
266
|
-
alt="
|
297
|
+
alt="Configuring Logto Environment Variables"
|
267
298
|
src="https://github.com/user-attachments/assets/15af6d94-af4f-4aa9-bbab-7a46e9f9e837"
|
268
299
|
/>
|
269
300
|
|
270
|
-
7.
|
301
|
+
7. Optionally, in the left panel under `Sign-in experience`, you can disable `Enable user registration` in `Sign-up and sign-in - Advanced Options` to prevent users from registering on their own. If you disable user registration, you will need to manually add users in the left panel under `User Management`.
|
271
302
|
|
272
303
|
<Image
|
273
|
-
alt="Disable
|
304
|
+
alt="Disable User Registration"
|
274
305
|
src="https://github.com/user-attachments/assets/6b2e6f7b-fec5-41c6-864a-a1add40f74a0"
|
275
306
|
/>
|
276
307
|
|
@@ -281,8 +312,8 @@ You need to first access the WebUI for configuration:
|
|
281
312
|
```
|
282
313
|
|
283
314
|
<Callout type="warning">
|
284
|
-
Please note that the administrator account is not the same as a registered user
|
285
|
-
|
315
|
+
Please note that the administrator account is not the same as a registered user. Do not log in to
|
316
|
+
LobeChat with your administrator account, as this will only result in an error.
|
286
317
|
</Callout>
|
287
318
|
|
288
319
|
### S3 Object Storage Service Configuration
|
@@ -290,44 +321,44 @@ You need to first access the WebUI for configuration:
|
|
290
321
|
This article uses MinIO as an example to explain the configuration process. If you are using other S3 service providers, please refer to their documentation for configuration.
|
291
322
|
|
292
323
|
<Callout type="warning">
|
293
|
-
Please remember to configure the
|
324
|
+
Please remember to configure the CORS cross-domain settings for the corresponding S3 service provider to ensure LobeChat can access the S3 service properly.
|
294
325
|
|
295
|
-
In this article, you need to allow cross-
|
326
|
+
In this article, you need to allow cross-domain requests from `https://lobe.example.com`. This can be configured in MinIO WebUI under `Configuration - API - Cors Allow Origin`, or in the Docker Compose under `minio - environment - MINIO_API_CORS_ALLOW_ORIGIN`.
|
296
327
|
|
297
|
-
If you
|
328
|
+
If you use the second method (which is also the default method) for configuration, you will not be able to configure it in MinIO WebUI anymore.
|
298
329
|
|
299
330
|
</Callout>
|
300
331
|
|
301
|
-
You need to
|
332
|
+
You first need to visit the WebUI for configuration:
|
302
333
|
|
303
|
-
- If you configured the reverse proxy as mentioned earlier, open `https://lobe-s3-ui.example.com
|
304
|
-
- Otherwise,
|
334
|
+
- If you have configured the reverse proxy as mentioned earlier, open `https://lobe-s3-ui.example.com`.
|
335
|
+
- Otherwise, open `http://localhost:9001` after performing port mapping.
|
305
336
|
|
306
|
-
1. Enter your `MINIO_ROOT_USER` and `MINIO_ROOT_PASSWORD` on the login
|
337
|
+
1. Enter your set `MINIO_ROOT_USER` and `MINIO_ROOT_PASSWORD` on the login page, then click login.
|
307
338
|
|
308
|
-
2. In the left panel under Administer / Buckets, click `Create Bucket`, enter `lobe` (
|
339
|
+
2. In the left panel under Administer / Buckets, click `Create Bucket`, enter `lobe` (which corresponds to your `S3_BUCKET` environment variable), and then click `Create`.
|
309
340
|
|
310
341
|
<Image
|
311
|
-
alt="Create
|
342
|
+
alt="Create MinIO Bucket"
|
312
343
|
src="https://github.com/user-attachments/assets/79f44a13-00d3-4302-a6bc-5f4c6cdbffab"
|
313
344
|
/>
|
314
345
|
|
315
|
-
3. Select your bucket, click Summary - Access Policy, edit, choose `Custom`,
|
346
|
+
3. Select your bucket, click Summary - Access Policy, edit, choose `Custom`, input the content from `minio-bucket-config.json` (see appendix), and save (assuming your bucket name is `lobe`):
|
316
347
|
|
317
348
|
<Image
|
318
|
-
alt="Select MinIO
|
349
|
+
alt="Select MinIO Bucket Policy"
|
319
350
|
src="https://github.com/user-attachments/assets/57032a82-7604-45d3-ba12-884af6fbcb7c"
|
320
351
|
/>
|
321
352
|
|
322
353
|
<Image
|
323
|
-
alt="Configure MinIO
|
354
|
+
alt="Configure MinIO Bucket Policy"
|
324
355
|
src="https://github.com/user-attachments/assets/d8109f4e-71fc-4ba8-8402-ede92669d5e0"
|
325
356
|
/>
|
326
357
|
|
327
|
-
4. In the left panel under User / Access Keys, click `Create New Access Key`,
|
358
|
+
4. In the left panel under User / Access Keys, click `Create New Access Key`, without any extra modifications, and fill the generated `Access Key` and `Secret Key` into your `.env` file under `S3_ACCESS_KEY_ID` and `S3_SECRET_ACCESS_KEY`.
|
328
359
|
|
329
360
|
<Image
|
330
|
-
alt="Create
|
361
|
+
alt="Create MinIO Access Key"
|
331
362
|
src="https://github.com/user-attachments/assets/72f02ce5-9991-425b-9864-9113ee1ed6bf"
|
332
363
|
/>
|
333
364
|
|
@@ -337,161 +368,13 @@ You need to first access the WebUI for configuration:
|
|
337
368
|
docker compose up -d
|
338
369
|
```
|
339
370
|
|
340
|
-
|
371
|
+
At this point, you have successfully deployed the LobeChat database version, and you can access your LobeChat service at `https://lobe.example.com`.
|
341
372
|
|
342
373
|
## Appendix
|
343
374
|
|
344
|
-
|
375
|
+
For convenience, here is a summary of the example configuration files needed for deploying the server database in domain name mode (for local quick start, local IP access, etc., please directly use the `setup.sh` script to generate and modify it yourself):
|
345
376
|
|
346
|
-
###
|
347
|
-
|
348
|
-
#### `.env`
|
349
|
-
|
350
|
-
```sh
|
351
|
-
# Logto secret
|
352
|
-
AUTH_LOGTO_ID=
|
353
|
-
AUTH_LOGTO_SECRET=
|
354
|
-
|
355
|
-
# MinIO S3 configuration
|
356
|
-
MINIO_ROOT_USER=YOUR_MINIO_USER
|
357
|
-
MINIO_ROOT_PASSWORD=YOUR_MINIO_PASSWORD
|
358
|
-
|
359
|
-
# Configure the bucket information of MinIO
|
360
|
-
MINIO_LOBE_BUCKET=lobe
|
361
|
-
S3_ACCESS_KEY_ID=
|
362
|
-
S3_SECRET_ACCESS_KEY=
|
363
|
-
|
364
|
-
# Proxy, if you need it
|
365
|
-
# HTTP_PROXY=http://localhost:7890
|
366
|
-
# HTTPS_PROXY=http://localhost:7890
|
367
|
-
|
368
|
-
# Other environment variables, as needed. You can refer to the environment variables configuration for the client version, making sure not to have ACCESS_CODE.
|
369
|
-
# OPENAI_API_KEY=sk-xxxx
|
370
|
-
# OPENAI_PROXY_URL=https://api.openai.com/v1
|
371
|
-
# OPENAI_MODEL_LIST=...
|
372
|
-
|
373
|
-
# ----- Other config -----
|
374
|
-
# if no special requirements, no need to change
|
375
|
-
LOBE_PORT=3210
|
376
|
-
LOGTO_PORT=3001
|
377
|
-
MINIO_PORT=9000
|
378
|
-
|
379
|
-
# Postgres related, which are the necessary environment variables for DB
|
380
|
-
LOBE_DB_NAME=lobechat
|
381
|
-
POSTGRES_PASSWORD=uWNZugjBqixf8dxC
|
382
|
-
|
383
|
-
```
|
384
|
-
|
385
|
-
#### `docker-compose.yml`
|
386
|
-
|
387
|
-
```yaml
|
388
|
-
services:
|
389
|
-
network-service:
|
390
|
-
image: alpine
|
391
|
-
container_name: lobe-network
|
392
|
-
ports:
|
393
|
-
- '${MINIO_PORT}:${MINIO_PORT}' # MinIO API
|
394
|
-
- '9001:9001' # MinIO Console
|
395
|
-
- '${LOGTO_PORT}:${LOGTO_PORT}' # Logto
|
396
|
-
- '3002:3002' # Logto Admin
|
397
|
-
- '${LOBE_PORT}:3210' # LobeChat
|
398
|
-
command: tail -f /dev/null
|
399
|
-
networks:
|
400
|
-
- lobe-network
|
401
|
-
|
402
|
-
postgresql:
|
403
|
-
image: pgvector/pgvector:pg16
|
404
|
-
container_name: lobe-postgres
|
405
|
-
ports:
|
406
|
-
- "5432:5432"
|
407
|
-
volumes:
|
408
|
-
- './data:/var/lib/postgresql/data'
|
409
|
-
environment:
|
410
|
-
- 'POSTGRES_DB=${LOBE_DB_NAME}'
|
411
|
-
- 'POSTGRES_PASSWORD=${POSTGRES_PASSWORD}'
|
412
|
-
healthcheck:
|
413
|
-
test: ['CMD-SHELL', 'pg_isready -U postgres']
|
414
|
-
interval: 5s
|
415
|
-
timeout: 5s
|
416
|
-
retries: 5
|
417
|
-
restart: always
|
418
|
-
networks:
|
419
|
-
- lobe-network
|
420
|
-
|
421
|
-
minio:
|
422
|
-
image: minio/minio
|
423
|
-
container_name: lobe-minio
|
424
|
-
network_mode: 'service:network-service'
|
425
|
-
volumes:
|
426
|
-
- './s3_data:/etc/minio/data'
|
427
|
-
environment:
|
428
|
-
- 'MINIO_ROOT_USER=${MINIO_ROOT_USER}'
|
429
|
-
- 'MINIO_ROOT_PASSWORD=${MINIO_ROOT_PASSWORD}'
|
430
|
-
- 'MINIO_API_CORS_ALLOW_ORIGIN=http://localhost:${LOBE_PORT}'
|
431
|
-
restart: always
|
432
|
-
command: >
|
433
|
-
server /etc/minio/data --address ":${MINIO_PORT}" --console-address ":9001"
|
434
|
-
|
435
|
-
logto:
|
436
|
-
image: svhd/logto
|
437
|
-
container_name: lobe-logto
|
438
|
-
network_mode: 'service:network-service'
|
439
|
-
depends_on:
|
440
|
-
postgresql:
|
441
|
-
condition: service_healthy
|
442
|
-
environment:
|
443
|
-
- 'TRUST_PROXY_HEADER=1'
|
444
|
-
- 'PORT=${LOGTO_PORT}'
|
445
|
-
- 'DB_URL=postgresql://postgres:${POSTGRES_PASSWORD}@postgresql:5432/logto'
|
446
|
-
- 'ENDPOINT=http://localhost:${LOGTO_PORT}'
|
447
|
-
- 'ADMIN_ENDPOINT=http://localhost:3002'
|
448
|
-
entrypoint: ['sh', '-c', 'npm run cli db seed -- --swe && npm start']
|
449
|
-
|
450
|
-
lobe:
|
451
|
-
image: lobehub/lobe-chat-database
|
452
|
-
container_name: lobe-database
|
453
|
-
network_mode: 'service:network-service'
|
454
|
-
depends_on:
|
455
|
-
postgresql:
|
456
|
-
condition: service_healthy
|
457
|
-
network-service:
|
458
|
-
condition: service_started
|
459
|
-
minio:
|
460
|
-
condition: service_started
|
461
|
-
logto:
|
462
|
-
condition: service_started
|
463
|
-
|
464
|
-
environment:
|
465
|
-
- 'APP_URL=http://localhost:3210'
|
466
|
-
- 'NEXT_AUTH_SSO_PROVIDERS=logto'
|
467
|
-
- 'KEY_VAULTS_SECRET=Kix2wcUONd4CX51E/ZPAd36BqM4wzJgKjPtz2sGztqQ='
|
468
|
-
- 'NEXT_AUTH_SECRET=NX2kaPE923dt6BL2U8e9oSre5RfoT7hg'
|
469
|
-
- 'NEXTAUTH_URL=http://localhost:${LOBE_PORT}/api/auth'
|
470
|
-
- 'AUTH_LOGTO_ISSUER=http://localhost:${LOGTO_PORT}/oidc'
|
471
|
-
- 'DATABASE_URL=postgresql://postgres:${POSTGRES_PASSWORD}@postgresql:5432/${LOBE_DB_NAME}'
|
472
|
-
- 'S3_ENDPOINT=http://localhost:${MINIO_PORT}'
|
473
|
-
- 'S3_BUCKET=${MINIO_LOBE_BUCKET}'
|
474
|
-
- 'S3_PUBLIC_DOMAIN=http://localhost:${MINIO_PORT}'
|
475
|
-
- 'S3_ENABLE_PATH_STYLE=1'
|
476
|
-
env_file:
|
477
|
-
- .env
|
478
|
-
restart: always
|
479
|
-
|
480
|
-
volumes:
|
481
|
-
data:
|
482
|
-
driver: local
|
483
|
-
s3_data:
|
484
|
-
driver: local
|
485
|
-
|
486
|
-
networks:
|
487
|
-
lobe-network:
|
488
|
-
driver: bridge
|
489
|
-
|
490
|
-
```
|
491
|
-
|
492
|
-
### Deploying to Production
|
493
|
-
|
494
|
-
#### `.env`
|
377
|
+
### `.env`
|
495
378
|
|
496
379
|
```sh
|
497
380
|
# Required: LobeChat domain for tRPC calls
|
@@ -519,8 +402,8 @@ NEXTAUTH_URL=https://lobe.example.com/api/auth
|
|
519
402
|
|
520
403
|
# NextAuth providers configuration (example using Logto)
|
521
404
|
# For other providers, see: https://lobehub.com/docs/self-hosting/environment-variables/auth
|
522
|
-
|
523
|
-
|
405
|
+
AUTH_LOGTO_CLIENT_ID=YOUR_LOGTO_CLIENT_ID
|
406
|
+
AUTH_LOGTO_CLIENT_SECRET=YOUR_LOGTO_CLIENT_SECRET
|
524
407
|
AUTH_LOGTO_ISSUER=https://lobe-auth-api.example.com/oidc
|
525
408
|
|
526
409
|
# Proxy settings (if needed, e.g., when using GitHub as an auth provider)
|
@@ -550,12 +433,12 @@ S3_ENABLE_PATH_STYLE=1
|
|
550
433
|
# OPENAI_API_KEY=sk-xxxx
|
551
434
|
# OPENAI_PROXY_URL=https://api.openai.com/v1
|
552
435
|
# OPENAI_MODEL_LIST=...
|
553
|
-
|
554
436
|
```
|
555
437
|
|
556
|
-
|
438
|
+
### `docker-compose.yml`
|
557
439
|
|
558
440
|
```yaml
|
441
|
+
name: lobe-chat-database
|
559
442
|
services:
|
560
443
|
postgresql:
|
561
444
|
image: pgvector/pgvector:pg16
|
@@ -591,6 +474,7 @@ services:
|
|
591
474
|
command: >
|
592
475
|
server /etc/minio/data --address ":9000" --console-address ":9001"
|
593
476
|
|
477
|
+
|
594
478
|
logto:
|
595
479
|
image: svhd/logto
|
596
480
|
container_name: lobe-logto
|
@@ -609,7 +493,7 @@ services:
|
|
609
493
|
|
610
494
|
lobe:
|
611
495
|
image: lobehub/lobe-chat-database
|
612
|
-
container_name: lobe-
|
496
|
+
container_name: lobe-chat
|
613
497
|
ports:
|
614
498
|
- '3210:3210'
|
615
499
|
depends_on:
|
@@ -625,10 +509,9 @@ volumes:
|
|
625
509
|
driver: local
|
626
510
|
s3_data:
|
627
511
|
driver: local
|
628
|
-
|
629
512
|
```
|
630
513
|
|
631
|
-
|
514
|
+
### `minio-bucket-config.json`
|
632
515
|
|
633
516
|
```json
|
634
517
|
{
|