@lobehub/chat 1.50.1 → 1.50.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 +25 -0
- package/changelog/v1.json +9 -0
- package/docker-compose/local/.env.example +9 -3
- package/docker-compose/local/.env.zh-CN.example +8 -3
- package/docker-compose/local/docker-compose.yml +22 -12
- package/docker-compose/local/init_data.json +473 -12
- package/docker-compose/setup.sh +660 -0
- package/docs/self-hosting/server-database/docker-compose.mdx +549 -271
- package/docs/self-hosting/server-database/docker-compose.zh-CN.mdx +405 -114
- package/package.json +1 -1
- package/src/libs/agent-runtime/github/index.ts +2 -2
- package/src/libs/agent-runtime/openai/index.ts +31 -23
- package/docker-compose/local/s3_data.tar.gz +0 -0
- package/docker-compose/local/setup.sh +0 -375
@@ -6,7 +6,7 @@ description: >-
|
|
6
6
|
tags:
|
7
7
|
- Docker Compose
|
8
8
|
- LobeChat
|
9
|
-
- Docker
|
9
|
+
- Docker Container
|
10
10
|
- Deployment Guide
|
11
11
|
---
|
12
12
|
|
@@ -20,57 +20,145 @@ tags:
|
|
20
20
|
[![][docker-pulls-shield]][docker-pulls-link]
|
21
21
|
</div>
|
22
22
|
|
23
|
-
<Callout type="info">
|
24
|
-
This article assumes you are familiar with the basic principles and processes of deploying the
|
25
|
-
LobeChat server database version (hereinafter referred to as DB version), so it only includes core
|
26
|
-
environment variable configurations. If you are not familiar with the deployment principles of
|
27
|
-
LobeChat DB version, please refer to [Deploying with a Server
|
28
|
-
Database](/docs/self-hosting/server-database).
|
29
|
-
</Callout>
|
30
|
-
|
31
23
|
<Callout type="warning">
|
32
|
-
|
24
|
+
**Note on Docker Deployment Limitations**
|
25
|
+
The Docker and Docker Compose deployment options do not support injecting the `NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY` through environment variables, which prevents enabling the Clerk authentication service. Recommended alternatives include:
|
26
|
+
|
27
|
+
- Hosting deployment via Vercel
|
33
28
|
|
34
|
-
|
29
|
+
- Running a local image build process
|
35
30
|
</Callout>
|
36
31
|
|
37
|
-
|
32
|
+
## Quick Start
|
38
33
|
|
39
|
-
|
40
|
-
|
41
|
-
- An object storage service that supports S3 protocol
|
42
|
-
- An SSO login authentication service supported by LobeChat
|
34
|
+
<Callout type="info">
|
35
|
+
**System Compatibility Notes**
|
43
36
|
|
44
|
-
|
37
|
+
- One-click deployment is supported in Unix environments (Linux/macOS).
|
45
38
|
|
46
|
-
|
39
|
+
- Windows users must run through [WSL 2](https://aka.ms/wsl).
|
47
40
|
|
48
|
-
|
41
|
+
- The one-click startup script is only for initial deployment; for subsequent deployments, please refer to the [Custom Deployment](#custom-deployment) section.
|
49
42
|
|
50
|
-
|
43
|
+
- Port occupation check: Ensure that ports `3210`, `8000`, `9000`, and `9001` are available.
|
44
|
+
</Callout>
|
51
45
|
|
52
|
-
|
46
|
+
Execute the following commands to set up the deployment environment; the directory `lobe-chat-db` will be used to store your configuration files and subsequent database files.
|
53
47
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
48
|
+
```sh
|
49
|
+
mkdir lobe-chat-db && cd lobe-chat-db
|
50
|
+
```
|
51
|
+
|
52
|
+
Fetch and execute the deployment script:
|
53
|
+
|
54
|
+
```sh
|
55
|
+
bash <(curl -fsSL https://lobe.li/setup.sh) -l en
|
56
|
+
```
|
57
|
+
|
58
|
+
The script supports the following deployment modes; please choose the appropriate mode based on your needs and read the rest of the documentation.
|
59
|
+
|
60
|
+
- [Local Mode (default)](#local-mode): Accessible only locally, not supporting LAN/public access; suitable for initial experiences.
|
61
|
+
- [Port Mode](#port-mode): Supports LAN/public `http` access; suitable for no domain or private network use.
|
62
|
+
- [Domain Mode](#domain-mode): Supports LAN/public `http/https` access with reverse proxy; suitable for personal or team use.
|
63
|
+
|
64
|
+
<Callout type="info">
|
65
|
+
In the script's options prompt `(Option1/Option2)[Option1]`: `(Option1 / Option2)` indicates selectable options, while `[Option1]` indicates the default option; simply press enter to choose the default.
|
58
66
|
</Callout>
|
59
67
|
|
68
|
+
### Local Mode
|
69
|
+
|
60
70
|
<Steps>
|
61
|
-
###
|
71
|
+
### Complete Remaining Configuration in Interactive Script
|
72
|
+
|
73
|
+
Continue pressing enter to use the default configuration.
|
74
|
+
|
75
|
+
### Check Configuration Generation Report
|
76
|
+
|
77
|
+
After the script finishes running, you need to check the configuration generation report, which includes the accounts and initial login passwords for the Casdoor administrator and user.
|
78
|
+
|
79
|
+
<Callout type="warning">
|
80
|
+
Please log in to LobeChat using the user account; the administrator account is only for managing Casdoor.
|
81
|
+
</Callout>
|
82
|
+
|
83
|
+
```log
|
84
|
+
The results of the secure key generation are as follows:
|
85
|
+
LobeChat:
|
86
|
+
- URL: http://localhost:3210
|
87
|
+
- Username: user
|
88
|
+
- Password: c66f8c
|
89
|
+
Casdoor:
|
90
|
+
- URL: http://localhost:8000
|
91
|
+
- Username: admin
|
92
|
+
- Password: c66f8c
|
93
|
+
Minio:
|
94
|
+
- URL: http://localhost:9000
|
95
|
+
- Username: admin
|
96
|
+
- Password: 8c82ea41
|
97
|
+
```
|
62
98
|
|
63
|
-
|
99
|
+
### Start Docker
|
64
100
|
|
65
101
|
```sh
|
66
|
-
|
67
|
-
cd lobe-chat-db
|
102
|
+
docker compose up -d
|
68
103
|
```
|
69
104
|
|
70
|
-
|
105
|
+
### Check Logs
|
71
106
|
|
72
107
|
```sh
|
73
|
-
|
108
|
+
docker logs -f lobe-chat
|
109
|
+
```
|
110
|
+
|
111
|
+
If you see the following logs in the container, it means the startup was successful:
|
112
|
+
|
113
|
+
```log
|
114
|
+
[Database] Start to migration...
|
115
|
+
✅ database migration pass.
|
116
|
+
-------------------------------------
|
117
|
+
▲ Next.js 14.x.x
|
118
|
+
- Local: http://localhost:3210
|
119
|
+
- Network: http://0.0.0.0:3210
|
120
|
+
|
121
|
+
✓ Starting...
|
122
|
+
✓ Ready in 95ms
|
123
|
+
```
|
124
|
+
|
125
|
+
### Access Application
|
126
|
+
|
127
|
+
Visit your LobeChat service at [http://localhost:3210](http://localhost:3210). The account credentials for the application can be found in the report from step `2`.
|
128
|
+
</Steps>
|
129
|
+
|
130
|
+
### Port Mode
|
131
|
+
|
132
|
+
<Steps>
|
133
|
+
### Complete Remaining Configuration in Interactive Script
|
134
|
+
|
135
|
+
In port mode, you need to complete the following based on the script prompts:
|
136
|
+
|
137
|
+
- Server IP address settings: for LAN/public access.
|
138
|
+
- Regenerate secure keys: We highly recommend regenerating the secure keys; if you lack the key generation library required by the script, we suggest referring to the [Custom Deployment](#custom-deployment) section for key modifications.
|
139
|
+
|
140
|
+
### Check Configuration Generation Report
|
141
|
+
|
142
|
+
After the script finishes running, please check the configuration generation report for the Casdoor administrator account, user account, and their initial login passwords.
|
143
|
+
|
144
|
+
<Callout type="warning">
|
145
|
+
Please log in to LobeChat using the user account; the administrator account is only for managing Casdoor.
|
146
|
+
</Callout>
|
147
|
+
|
148
|
+
```log
|
149
|
+
The results of the secure key generation are as follows:
|
150
|
+
LobeChat:
|
151
|
+
- URL: http://your_server_ip:3210
|
152
|
+
- Username: user
|
153
|
+
- Password: 837e26
|
154
|
+
Casdoor:
|
155
|
+
- URL: http://your_server_ip:8000
|
156
|
+
- Username: admin
|
157
|
+
- Password: 837e26
|
158
|
+
Minio:
|
159
|
+
- URL: http://your_server_ip:9000
|
160
|
+
- Username: admin
|
161
|
+
- Password: dbac8440
|
74
162
|
```
|
75
163
|
|
76
164
|
### Start Docker
|
@@ -79,8 +167,6 @@ To facilitate a quick start, this section uses the `docker-compose/local` direct
|
|
79
167
|
docker compose up -d
|
80
168
|
```
|
81
169
|
|
82
|
-
The default login account is the default account of Casdoor, with the username `admin`. You can find the password in the `init_data.json` file that is downloaded during setup. Note that the secret might fail to generate, please check the shell output.
|
83
|
-
|
84
170
|
### Check Logs
|
85
171
|
|
86
172
|
```sh
|
@@ -94,53 +180,251 @@ To facilitate a quick start, this section uses the `docker-compose/local` direct
|
|
94
180
|
✅ database migration pass.
|
95
181
|
-------------------------------------
|
96
182
|
▲ Next.js 14.x.x
|
97
|
-
- Local: http://
|
183
|
+
- Local: http://your_server_ip:3210
|
98
184
|
- Network: http://0.0.0.0:3210
|
99
|
-
|
100
185
|
✓ Starting...
|
101
186
|
✓ Ready in 95ms
|
102
187
|
```
|
188
|
+
|
189
|
+
### Access Application
|
190
|
+
|
191
|
+
You can access your LobeChat service at `http://your_server_ip:3210`. The account credentials for the application can be found in the report from step `2`.
|
103
192
|
</Steps>
|
104
193
|
|
105
|
-
|
194
|
+
### Domain Mode
|
195
|
+
|
196
|
+
<Steps>
|
197
|
+
### Complete Reverse Proxy Configuration
|
198
|
+
|
199
|
+
In domain mode, you need to complete the reverse proxy configuration and ensure that the LAN/public can access the following services. Please use a reverse proxy to map the following service ports to the domain names:
|
200
|
+
|
201
|
+
| Domain | Proxy Port | Required |
|
202
|
+
| --------------------- | ---------- | -------- |
|
203
|
+
| `lobe.example.com` | `3210` | Yes |
|
204
|
+
| `auth-ui.example.com` | `8000` | Yes |
|
205
|
+
| `s3-api.example.com` | `9000` | Yes |
|
206
|
+
| `s3-ui.example.com` | `9001` | No |
|
207
|
+
|
208
|
+
<Callout type="important">
|
209
|
+
If you are using panel software like [APanel](https://www.bt.cn/) for reverse proxy configuration,
|
210
|
+
ensure it does not intercept requests to the `.well-known` path to facilitate the proper functioning of Casdoor's OAuth2 configuration.
|
211
|
+
Below is a whitelist configuration for the Nginx server block concerning paths:
|
212
|
+
|
213
|
+
```nginx
|
214
|
+
location /.well-known/openid-configuration {
|
215
|
+
proxy_pass http://localhost:8000; # Forward to localhost:8000
|
216
|
+
proxy_set_header Host $host; # Keep the original host header
|
217
|
+
proxy_set_header X-Real-IP $remote_addr; # Keep the client's real IP
|
218
|
+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; # Keep the forwarded IP
|
219
|
+
proxy_set_header X-Forwarded-Proto $scheme; # Keep the request protocol
|
220
|
+
}
|
221
|
+
```
|
222
|
+
</Callout>
|
223
|
+
|
224
|
+
### Complete Remaining Configuration in Interactive Script
|
225
|
+
|
226
|
+
In domain mode, you need to complete the following configurations based on script prompts:
|
106
227
|
|
107
|
-
|
228
|
+
- Domain setup for the LobeChat service: `lobe.example.com`
|
229
|
+
- Domain setup for the Minio service: `s3-api.example.com`
|
230
|
+
- Domain setup for the Casdoor service: `auth-ui.example.com`
|
231
|
+
- Choose the access protocol: `http` or `https`
|
232
|
+
- Regenerate secure keys: We highly recommend regenerating the secure keys; if you lack the key generation library required by the script, we suggest referring to the [Custom Deployment](#custom-deployment) section for key modifications.
|
108
233
|
|
109
|
-
|
234
|
+
<Callout type="warning">
|
235
|
+
The following issues may impede access to your service:
|
110
236
|
|
111
|
-
The
|
237
|
+
- The domain configuration here must match the reverse proxy configuration in step `1`.
|
112
238
|
|
113
|
-
|
239
|
+
- If you are using Cloudflare for domain resolution and have activated `full proxy`, please use the `https` protocol.
|
240
|
+
|
241
|
+
- If you have used the HTTPS protocol, ensure that your domain certificate is correctly configured; one-click deployment does not support self-signed certificates by default.
|
242
|
+
</Callout>
|
243
|
+
|
244
|
+
### Check Configuration Generation Report
|
245
|
+
|
246
|
+
After the script finishes running, you need to check the configuration generation report, which includes the initial login password for the Casdoor administrator.
|
247
|
+
|
248
|
+
<Callout type="warning">
|
249
|
+
Please log in to LobeChat using the user account; the administrator account is only for managing Casdoor.
|
250
|
+
</Callout>
|
251
|
+
|
252
|
+
```log
|
253
|
+
The results of the secure key generation are as follows:
|
254
|
+
LobeChat:
|
255
|
+
- URL: https://lobe.example.com
|
256
|
+
- Username: user
|
257
|
+
- Password: 837e26
|
258
|
+
Casdoor:
|
259
|
+
- URL: https://auth-ui.example.com
|
260
|
+
- Username: admin
|
261
|
+
- Password: 837e26
|
262
|
+
Minio:
|
263
|
+
- URL: https://s3-api.example.com
|
264
|
+
- Username: admin
|
265
|
+
- Password: dbac8440
|
266
|
+
```
|
267
|
+
|
268
|
+
### Start Docker
|
269
|
+
|
270
|
+
```sh
|
271
|
+
docker compose up -d
|
272
|
+
```
|
273
|
+
|
274
|
+
### Check Logs
|
275
|
+
|
276
|
+
```sh
|
277
|
+
docker logs -f lobe-chat
|
278
|
+
```
|
279
|
+
|
280
|
+
If you see the following logs in the container, it indicates a successful startup:
|
281
|
+
|
282
|
+
```log
|
283
|
+
[Database] Start to migration...
|
284
|
+
✅ database migration pass.
|
285
|
+
-------------------------------------
|
286
|
+
▲ Next.js 14.x.x
|
287
|
+
- Local: https://localhost:3210
|
288
|
+
- Network: http://0.0.0.0:3210
|
289
|
+
✓ Starting...
|
290
|
+
✓ Ready in 95ms
|
291
|
+
```
|
292
|
+
|
293
|
+
### Access Application
|
294
|
+
|
295
|
+
You can access your LobeChat service via `https://lobe.example.com`. The account credentials for the application can be found in the report from step `3`.
|
296
|
+
</Steps>
|
297
|
+
|
298
|
+
## Custom Deployment
|
299
|
+
|
300
|
+
This section mainly introduces the configurations that need to be modified to customize the deployment of the LobeChat service in different network environments.
|
301
|
+
Before starting, you can download the [Docker Compose configuration file](https://raw.githubusercontent.com/lobehub/lobe-chat/HEAD/docker-compose/local/docker-compose.yml) and the [environment variable configuration file](https://raw.githubusercontent.com/lobehub/lobe-chat/HEAD/docker-compose/local/.env.en_US.example).
|
114
302
|
|
115
303
|
```sh
|
116
|
-
|
117
|
-
|
304
|
+
curl -O https://raw.githubusercontent.com/lobehub/lobe-chat/HEAD/docker-compose/local/docker-compose.yml
|
305
|
+
curl -O https://raw.githubusercontent.com/lobehub/lobe-chat/HEAD/docker-compose/local/.env.en_US.example
|
306
|
+
mv .env.en_US.example .env
|
307
|
+
```
|
308
|
+
|
309
|
+
<Callout type="info">
|
310
|
+
This section does not cover all complete variables; remaining variables can be referenced in [Deploying with the Server Database](/en/docs/self-hosting/server-database).
|
311
|
+
</Callout>
|
312
|
+
|
313
|
+
### Prerequisites
|
314
|
+
|
315
|
+
Generally, to fully run the LobeChat database version, you will need at least the following four services:
|
316
|
+
|
317
|
+
- The LobeChat database version itself
|
318
|
+
- PostgreSQL database with PGVector plugin
|
319
|
+
- Object storage service that supports S3 protocol
|
320
|
+
- An SSO authentication service supported by LobeChat
|
321
|
+
|
322
|
+
These services can be combined through self-hosting or online cloud services to meet various deployment needs. In this article, we provide a Docker Compose configuration entirely based on open-source self-hosted services, which can be used directly to start the LobeChat database version or modified to suit your requirements.
|
323
|
+
|
324
|
+
We use [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 by default.
|
325
|
+
|
326
|
+
<Callout type="warning">
|
327
|
+
If your network topology is complex, please make sure these services can communicate properly within your network environment.
|
328
|
+
</Callout>
|
329
|
+
|
330
|
+
### Necessary Configuration
|
331
|
+
|
332
|
+
Now, we will introduce the necessary configurations for running these services:
|
333
|
+
|
334
|
+
1. Casdoor
|
335
|
+
|
336
|
+
- LobeChat requires communication with Casdoor, so you need to configure Casdoor's Issuer.
|
337
|
+
|
338
|
+
```env
|
339
|
+
AUTH_CASDOOR_ISSUER=https://auth-ui.example.com
|
340
|
+
```
|
341
|
+
|
342
|
+
This configuration will affect LobeChat's login authentication service, and you need to ensure that the URL of the Casdoor service is correct. You can find common manifestations and solutions for errors in this configuration in the [FAQ](#faq).
|
343
|
+
|
344
|
+
- Additionally, you need to allow the callback URL in Casdoor to point to the LobeChat address:
|
345
|
+
|
346
|
+
Please add a line in the `Authentication -> Application` -> `<Application ID, default is app-built-in>` -> `Redirect URI` in Casdoor's web panel:
|
347
|
+
|
348
|
+
```
|
349
|
+
https://auth-ui.example.com/api/auth/callback/casdoor
|
350
|
+
```
|
351
|
+
|
352
|
+
- Casdoor needs to provide the Origin information for access in the environment variables:
|
353
|
+
|
354
|
+
```env
|
355
|
+
origin=https://auth-ui.example.com
|
356
|
+
```
|
357
|
+
|
358
|
+
2. MinIO
|
359
|
+
|
360
|
+
- LobeChat needs to provide a public access URL for object files for the LLM service provider, hence you need to configure MinIO's Endpoint.
|
361
|
+
|
362
|
+
```env
|
363
|
+
S3_PUBLIC_DOMAIN=https://s3-api.example.com
|
364
|
+
S3_ENDPOINT=https://s3-api.example.com
|
365
|
+
```
|
366
|
+
|
367
|
+
3. PostgreSQL
|
368
|
+
|
369
|
+
This configuration is found in the `docker-compose.yml` file, and you will need to configure the database name and password:
|
370
|
+
|
371
|
+
```yaml
|
372
|
+
services:
|
373
|
+
lobe:
|
374
|
+
environment:
|
375
|
+
- 'DATABASE_URL=postgresql://postgres:${POSTGRES_PASSWORD}@postgresql:5432/${LOBE_DB_NAME}'
|
118
376
|
```
|
119
377
|
|
120
|
-
|
378
|
+
## FAQ
|
379
|
+
|
380
|
+
#### Unable to Log In Properly
|
381
|
+
|
382
|
+
Check for the following errors based on the container logs:
|
121
383
|
|
122
384
|
```sh
|
123
|
-
|
124
|
-
docker compose up -d
|
385
|
+
docker logs -f lobe-chat
|
125
386
|
```
|
126
387
|
|
127
|
-
|
388
|
+
- r3: "response" is not a conform Authorization Server Metadata response (unexpected HTTP status code)
|
128
389
|
|
129
|
-
|
390
|
+
```log
|
391
|
+
lobe-chat | [auth][error] r3: "response" is not a conform Authorization Server Metadata response (unexpected HTTP status code)
|
392
|
+
```
|
130
393
|
|
131
|
-
|
394
|
+
Cause: This issue is typically caused by improper reverse proxy configuration; you need to ensure your reverse proxy configuration does not intercept the Casdoor OAuth2 configuration requests.
|
132
395
|
|
133
|
-
|
134
|
-
|
135
|
-
|
396
|
+
Solutions:
|
397
|
+
|
398
|
+
- Please refer to the reverse proxy configuration notes in the [Domain Mode](#domain-mode) section.
|
399
|
+
|
400
|
+
- A direct troubleshooting method is to access `https://auth-ui.example.com/.well-known/openid-configuration` directly; if:
|
401
|
+
- Non-JSON format data is returned, it indicates your reverse proxy configuration is incorrect.
|
402
|
+
- If the returned JSON format data contains an `"issuer": "URL"` field that does not match your configured `https://auth-ui.example.com`, it indicates your environment variable configuration is incorrect.
|
403
|
+
|
404
|
+
- TypeError: fetch failed
|
136
405
|
|
137
|
-
|
406
|
+
```log
|
407
|
+
lobe-chat | [auth][error] TypeError: fetch failed
|
408
|
+
```
|
409
|
+
|
410
|
+
Cause: LobeChat cannot access the authentication service.
|
411
|
+
|
412
|
+
Solutions:
|
413
|
+
|
414
|
+
- Check whether your authentication service is running properly and whether LobeChat's network can reach the authentication service.
|
415
|
+
|
416
|
+
- A straightforward troubleshooting method is to use the `curl` command in the LobeChat container terminal to access your authentication service at `https://auth-ui.example.com/.well-known/openid-configuration`. If JSON format data is returned, it indicates your authentication service is functioning correctly.
|
417
|
+
|
418
|
+
````markdown
|
419
|
+
## Extended Configuration
|
420
|
+
|
421
|
+
To enhance your LobeChat service, you can perform the following extended configurations according to your needs.
|
138
422
|
|
139
|
-
###
|
423
|
+
### Use MinIO to Store Casdoor Avatars
|
140
424
|
|
141
|
-
|
425
|
+
Allow users to change their avatars in Casdoor.
|
142
426
|
|
143
|
-
|
427
|
+
1. First, create a bucket named `casdoor` in `buckets`, select a custom policy, and copy and paste the content below (if you modify the bucket name, please find and replace accordingly).
|
144
428
|
|
145
429
|
```json
|
146
430
|
{
|
@@ -177,65 +461,103 @@ docker compose up -d
|
|
177
461
|
],
|
178
462
|
"Version": "2012-10-17"
|
179
463
|
}
|
180
|
-
|
464
|
+
````
|
181
465
|
|
182
|
-
|
466
|
+
2. Create a new access key and store the generated `Access Key` and `Secret Key`.
|
183
467
|
|
184
|
-
|
468
|
+
3. In Casdoor's `Authentication -> Providers`, associate the MinIO S3 service. Below is an example configuration:
|
185
469
|
|
186
470
|

|
187
471
|
|
188
|
-
|
472
|
+
Here, the client ID and client secret correspond to the `Access Key` and `Secret Key` from the previous step; replace `192.168.31.251` with `your_server_ip`.
|
473
|
+
|
474
|
+
4. In Casdoor's `Authentication -> Apps`, add a provider to the `app-built-in` application, select `minio`, and save and exit.
|
189
475
|
|
190
|
-
5.
|
476
|
+
5. You can attempt to upload a file in Casdoor's `Authentication -> Resources` to test if the configuration is correct.
|
191
477
|
|
192
|
-
|
478
|
+
### Migrating from `logto` to `Casdoor` in Production Deployment
|
193
479
|
|
194
|
-
|
480
|
+
This is applicable for users who have been using `logto` as their login and authentication service in a production environment.
|
195
481
|
|
196
482
|
<Callout type="info">
|
197
|
-
|
198
|
-
authentication service
|
199
|
-
authentication services like
|
200
|
-
authentication services may have different port configurations.
|
483
|
+
Due to significant instability when using [Logto](https://logto.io/)
|
484
|
+
as a login and authentication service, the following tutorial is based on deploying with an IP mode, implementing a domain release solution using Casdoor as the authentication service provider.
|
485
|
+
The remainder of this article will illustrate using this as an example. If you are using other login authentication services like Logto, the process should be similar, but be aware that port configurations may differ among different services.
|
201
486
|
</Callout>
|
202
487
|
|
203
|
-
In the following
|
488
|
+
In the following, it is assumed that in addition to the above services, you are also running an **Nginx** layer for reverse proxy and SSL configuration.
|
204
489
|
|
205
|
-
The domain and
|
490
|
+
The domain and corresponding service port descriptions are as follows:
|
206
491
|
|
207
|
-
- `lobe.example.com`:
|
208
|
-
- `
|
209
|
-
- `
|
210
|
-
- `
|
211
|
-
- `lobe-s3-ui.example.com`: Optional, your MinIO UI domain, which needs to reverse proxy to the MinIO WebUI service port, defaulting to `9001`.
|
492
|
+
- `lobe.example.com`: This is your LobeChat service domain, which needs to reverse proxy to the LobeChat service port, default is `3210`.
|
493
|
+
- `auth-ui.example.com`: This is your Logto UI domain, which needs to reverse proxy to the Logto WebUI service port, default is `8000`.
|
494
|
+
- `s3-api.example.com`: This is your MinIO API domain, which needs to reverse proxy to the MinIO API service port, default is `9000`.
|
495
|
+
- `s3-ui.example.com`: Optional, this is your MinIO UI domain, which needs to reverse proxy to the MinIO WebUI service port, default is `9001`.
|
212
496
|
|
213
|
-
|
497
|
+
#### Configuration File
|
214
498
|
|
215
|
-
|
499
|
+
```sh
|
500
|
+
bash <(curl -fsSL https://raw.githubusercontent.com/lobehub/lobe-chat/HEAD/docker-compose/local/setup.sh) -f -l zh_CN
|
501
|
+
docker compose up -d
|
502
|
+
```
|
216
503
|
|
217
|
-
|
218
|
-
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.
|
504
|
+
Make sure to save the newly generated password at this time!
|
219
505
|
|
220
|
-
|
506
|
+
After running, you will get three files:
|
221
507
|
|
222
|
-
|
223
|
-
|
508
|
+
- init\_data.json
|
509
|
+
- docker-compose.yml
|
510
|
+
- .env
|
224
511
|
|
225
|
-
|
512
|
+
Next, modify the configuration files to achieve domain release.
|
226
513
|
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
514
|
+
1. Modify the `docker-compose.yml` file.
|
515
|
+
1. Change the `MINIO_API_CORS_ALLOW_ORIGIN` field of `minio`.
|
516
|
+
```yaml
|
517
|
+
'MINIO_API_CORS_ALLOW_ORIGIN=https://lobe.example.com'
|
518
|
+
```
|
519
|
+
2. Modify the `origin` field of `casdoor`.
|
520
|
+
```yaml
|
521
|
+
origin: 'https://auth-ui.example.com'
|
522
|
+
```
|
523
|
+
3. Modify the `environment` field of `lobe`.
|
524
|
+
```yaml
|
525
|
+
# - 'APP_URL=http://localhost:3210'
|
526
|
+
- 'APP_URL=https://lobe.example.com'
|
527
|
+
|
528
|
+
- 'NEXT_AUTH_SSO_PROVIDERS=casdoor'
|
529
|
+
- 'KEY_VAULTS_SECRET=Kix2wcUONd4CX51E/ZPAd36BqM4wzJgKjPtz2sGztqQ='
|
530
|
+
- 'NEXT_AUTH_SECRET=NX2kaPE923dt6BL2U8e9oSre5RfoT7hg'
|
531
|
+
# - 'AUTH_URL=http://localhost:${LOBE_PORT}/api/auth'
|
532
|
+
- 'AUTH_URL=https://lobe.example.com/api/auth'
|
533
|
+
|
534
|
+
# - 'AUTH_CASDOOR_ISSUER=http://localhost:${CASDOOR_PORT}'
|
535
|
+
- 'AUTH_CASDOOR_ISSUER=https://auth-ui.example.com'
|
536
|
+
|
537
|
+
- 'DATABASE_URL=postgresql://postgres:${POSTGRES_PASSWORD}@postgresql:5432/${LOBE_DB_NAME}'
|
538
|
+
# - 'S3_ENDPOINT=http://localhost:${MINIO_PORT}'
|
539
|
+
- 'S3_ENDPOINT=https://s3-api.example.com'
|
540
|
+
|
541
|
+
- 'S3_BUCKET=${MINIO_LOBE_BUCKET}'
|
542
|
+
# - 'S3_PUBLIC_DOMAIN=http://localhost:${MINIO_PORT}'
|
543
|
+
- 'S3_PUBLIC_DOMAIN=https://s3-api.example.com'
|
544
|
+
|
545
|
+
- 'S3_ENABLE_PATH_STYLE=1'
|
546
|
+
- 'LLM_VISION_IMAGE_USE_BASE64=1'
|
547
|
+
```
|
548
|
+
2. Modify the `.env` file.
|
233
549
|
|
234
|
-
|
550
|
+
<Callout type="info">
|
551
|
+
For security reasons, modify the ROOT USER field in the `.env` file.
|
552
|
+
</Callout>
|
235
553
|
|
236
|
-
|
554
|
+
```sh
|
555
|
+
# MinIO S3 configuration
|
556
|
+
MINIO_ROOT_USER=XXXX
|
557
|
+
MINIO_ROOT_PASSWORD=XXXX
|
558
|
+
```
|
237
559
|
|
238
|
-
|
560
|
+
#### Postgres Database Configuration
|
239
561
|
|
240
562
|
You can check the logs with the following command:
|
241
563
|
|
@@ -244,13 +566,11 @@ docker logs -f lobe-chat
|
|
244
566
|
```
|
245
567
|
|
246
568
|
<Callout type="tip">
|
247
|
-
In our official Docker
|
248
|
-
|
249
|
-
database -> complete tables." Therefore, we recommend that your database instance use an empty
|
250
|
-
table instance to avoid the hassle of manual table structure maintenance or migration.
|
569
|
+
In our official Docker images, automatic migration of the database schema is performed before starting the images.
|
570
|
+
Our official images guarantee the stability of "empty database -> complete tables" for automatic table creation. Therefore, we recommend your database instance use an empty table instance to avoid the trouble of manually maintaining table structure or migrations.
|
251
571
|
</Callout>
|
252
572
|
|
253
|
-
If you encounter issues
|
573
|
+
If you encounter issues during table creation, you can try the following command to forcibly remove the database container and restart:
|
254
574
|
|
255
575
|
```sh
|
256
576
|
docker compose down # Stop the service
|
@@ -258,86 +578,59 @@ sudo rm -rf ./data # Remove mounted database data
|
|
258
578
|
docker compose up -d # Restart
|
259
579
|
```
|
260
580
|
|
261
|
-
|
262
|
-
|
263
|
-
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.
|
264
|
-
|
265
|
-
<Callout type="warning">
|
266
|
-
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.
|
267
|
-
|
268
|
-
In this article, you need to allow cross-domain requests from `https://lobe.example.com`.
|
269
|
-
</Callout>
|
270
|
-
|
271
|
-
You first need to visit the WebUI for configuration:
|
272
|
-
|
273
|
-
- If you have configured the reverse proxy as mentioned earlier, open `https://lobe-auth-ui.example.com`.
|
274
|
-
- Otherwise, open `http://localhost:3002` after performing port mapping.
|
275
|
-
|
276
|
-
1. Register a new account; the first registered account will automatically become an administrator.
|
277
|
-
|
278
|
-
2. In `Applications`, create a `Next.js (App Router)` application with any name.
|
279
|
-
|
280
|
-
3. Set `Redirect URI` to `https://lobe.example.com/api/auth/callback/logto`, and `Post sign-out redirect URI` to `https://lobe.example.com/`.
|
281
|
-
|
282
|
-
4. Set `CORS allowed origins` to `https://lobe.example.com`.
|
581
|
+
#### Login Authentication Service Configuration
|
283
582
|
|
284
|
-
|
583
|
+
You first need to access the WebUI for configuration:
|
285
584
|
|
286
|
-
|
585
|
+
- If you have set up the reverse proxy as mentioned before, open `https://auth-ui.example.com`
|
586
|
+
- Otherwise, after port mapping, open `http://localhost:8000`
|
287
587
|
|
288
|
-
|
588
|
+
Log in to the admin account:
|
289
589
|
|
290
|
-
|
590
|
+
- The default username is admin.
|
591
|
+
- The default password is the random password generated when downloading the config file. If forgotten, you can find it in the `init_data.json` file.
|
291
592
|
|
292
|
-
|
593
|
+
After logging in, perform the following actions:
|
293
594
|
|
294
|
-
|
595
|
+
1. In `User Management -> Organizations`, add a new organization with the name and display name `Lobe Users`. Keep the rest as default.
|
596
|
+
2. In `Authentication -> Apps`, add a new application.
|
295
597
|
|
296
|
-
|
598
|
+
- Name and display name should be `LobeChat`.
|
599
|
+
- Organization should be `Lobe Users`.
|
600
|
+
- Add a line in Redirect URLs as `https://lobe.example.com/api/auth/callback/casdoor`.
|
601
|
+
- Disable all login methods except password.
|
602
|
+
- Fill in the client ID and client secret in the `.env` file under `AUTH_CASDOOR_ID` and `AUTH_CASDOOR_SECRET`.
|
603
|
+
- (Optional) Design the appearance of the login and registration pages by mimicking the `built-in` application configuration.
|
604
|
+
- Save and exit.
|
297
605
|
|
298
|
-
|
299
|
-
|
300
|
-
```
|
301
|
-
|
302
|
-
<Callout type="warning">
|
303
|
-
Please note that the administrator account is not the same as a registered user. Do not log in to
|
304
|
-
LobeChat with your administrator account, as this will only result in an error.
|
606
|
+
<Callout type="info">
|
607
|
+
Following the steps above ensures that not all users are administrators by default, leading to an unsafe situation.
|
305
608
|
</Callout>
|
306
609
|
|
307
|
-
|
610
|
+
#### S3 Object Storage Service Configuration
|
308
611
|
|
309
|
-
This article uses MinIO as an example to explain the configuration process. If you are using
|
612
|
+
This article uses MinIO as an example to explain the configuration process. If you are using another S3 service provider, please refer to their documentation for configuration.
|
310
613
|
|
311
614
|
<Callout type="warning">
|
312
|
-
Please remember to configure the
|
615
|
+
Please remember to configure the corresponding S3 service provider's CORS settings to ensure that LobeChat can access the S3 service correctly.
|
313
616
|
|
314
|
-
In this
|
617
|
+
In this document, you need to allow cross-origin requests from `https://lobe.example.com`. This can either be configured in MinIO WebUI under `Configuration - API - Cors Allow Origin`, or in the Docker Compose configuration under `minio - environment - MINIO_API_CORS_ALLOW_ORIGIN`.
|
315
618
|
|
316
|
-
If you use the second method (which is also the default
|
619
|
+
If you use the second method (which is also the default), you will no longer be able to configure it in the MinIO WebUI.
|
317
620
|
</Callout>
|
318
621
|
|
319
|
-
You first need to
|
320
|
-
|
321
|
-
- If you have configured the reverse proxy as mentioned earlier, open `https://lobe-s3-ui.example.com`.
|
322
|
-
- Otherwise, open `http://localhost:9001` after performing port mapping.
|
622
|
+
You first need to access the WebUI for configuration:
|
323
623
|
|
324
|
-
|
624
|
+
- If you have set up the reverse proxy as mentioned before, open `https://s3-ui.example.com`
|
625
|
+
- Otherwise, after port mapping, open `http://localhost:9001`
|
325
626
|
|
326
|
-
|
627
|
+
1. Enter the `MINIO_ROOT_USER` and `MINIO_ROOT_PASSWORD` you set in the login interface, then click login.
|
327
628
|
|
328
|
-
|
329
|
-
|
330
|
-
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`):
|
331
|
-
|
332
|
-
<Image alt="Select MinIO Bucket Policy" src="https://github.com/user-attachments/assets/57032a82-7604-45d3-ba12-884af6fbcb7c" />
|
333
|
-
|
334
|
-
<Image alt="Configure MinIO Bucket Policy" src="https://github.com/user-attachments/assets/d8109f4e-71fc-4ba8-8402-ede92669d5e0" />
|
335
|
-
|
336
|
-
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`.
|
629
|
+
2. In the left panel under User / Access Keys, click `Create New Access Key`, no additional modifications needed, and fill the generated `Access Key` and `Secret Key` into your `.env` file under `S3_ACCESS_KEY_ID` and `S3_SECRET_ACCESS_KEY`.
|
337
630
|
|
338
631
|
<Image alt="Create MinIO Access Key" src="https://github.com/user-attachments/assets/72f02ce5-9991-425b-9864-9113ee1ed6bf" />
|
339
632
|
|
340
|
-
|
633
|
+
3. Restart the LobeChat service:
|
341
634
|
|
342
635
|
```sh
|
343
636
|
docker compose up -d
|
@@ -345,76 +638,66 @@ You first need to visit the WebUI for configuration:
|
|
345
638
|
|
346
639
|
At this point, you have successfully deployed the LobeChat database version, and you can access your LobeChat service at `https://lobe.example.com`.
|
347
640
|
|
348
|
-
|
641
|
+
#### Configuration Files
|
349
642
|
|
350
|
-
For convenience, here is a summary of
|
643
|
+
For convenience, here is a summary of example configuration files required for the production deployment using the Casdoor authentication scheme:
|
351
644
|
|
352
|
-
|
645
|
+
- `.env`
|
353
646
|
|
354
647
|
```sh
|
355
|
-
#
|
356
|
-
# Ensure this domain is whitelisted in your NextAuth providers and S3 service CORS settings
|
357
|
-
APP_URL=https://lobe.example.com/
|
358
|
-
|
359
|
-
# Postgres related environment variables
|
360
|
-
# Required: Secret key for encrypting sensitive information. Generate with: openssl rand -base64 32
|
361
|
-
KEY_VAULTS_SECRET=Kix2wcUONd4CX51E/ZPAd36BqM4wzJgKjPtz2sGztqQ=
|
362
|
-
# Required: Postgres database connection string
|
363
|
-
# Format: postgresql://username:password@host:port/dbname
|
364
|
-
# If using Docker, you can use the container name as the host
|
365
|
-
DATABASE_URL=postgresql://postgres:uWNZugjBqixf8dxC@postgresql:5432/lobe
|
366
|
-
|
367
|
-
# NEXT_AUTH related environment variables
|
368
|
-
# Supports auth0, Azure AD, GitHub, Authentik, Zitadel, Logto, etc.
|
369
|
-
# For supported providers, see: https://lobehub.com/docs/self-hosting/advanced/auth#next-auth
|
370
|
-
# If you have ACCESS_CODE, please remove it. We use NEXT_AUTH as the sole authentication source
|
371
|
-
# Required: NextAuth secret key. Generate with: openssl rand -base64 32
|
372
|
-
NEXT_AUTH_SECRET=NX2kaPE923dt6BL2U8e9oSre5RfoT7hg
|
373
|
-
# Required: Specify the authentication provider (e.g., Logto)
|
374
|
-
NEXT_AUTH_SSO_PROVIDERS=logto
|
375
|
-
# Required: NextAuth URL for callbacks
|
376
|
-
NEXTAUTH_URL=https://lobe.example.com/api/auth
|
377
|
-
|
378
|
-
# NextAuth providers configuration (example using Logto)
|
379
|
-
# For other providers, see: https://lobehub.com/docs/self-hosting/environment-variables/auth
|
380
|
-
AUTH_LOGTO_ID=YOUR_LOGTO_ID
|
381
|
-
AUTH_LOGTO_SECRET=YOUR_LOGTO_SECRET
|
382
|
-
AUTH_LOGTO_ISSUER=https://lobe-auth-api.example.com/oidc
|
383
|
-
|
384
|
-
# Proxy settings (if needed, e.g., when using GitHub as an auth provider)
|
648
|
+
# Proxy, if you need it
|
385
649
|
# HTTP_PROXY=http://localhost:7890
|
386
650
|
# HTTPS_PROXY=http://localhost:7890
|
387
651
|
|
388
|
-
#
|
389
|
-
# Required: S3 Access Key ID (for MinIO, invalid until manually created in MinIO UI)
|
390
|
-
S3_ACCESS_KEY_ID=YOUR_S3_ACCESS_KEY_ID
|
391
|
-
# Required: S3 Secret Access Key (for MinIO, invalid until manually created in MinIO UI)
|
392
|
-
S3_SECRET_ACCESS_KEY=YOUR_S3_SECRET_ACCESS_KEY
|
393
|
-
# Required: S3 Endpoint for server/client connections to S3 API
|
394
|
-
S3_ENDPOINT=https://lobe-s3-api.example.com
|
395
|
-
# Required: S3 Bucket (invalid until manually created in MinIO UI)
|
396
|
-
S3_BUCKET=lobe
|
397
|
-
# Required: S3 Public Domain for client access to unstructured data
|
398
|
-
S3_PUBLIC_DOMAIN=https://lobe-s3-api.example.com
|
399
|
-
# Optional: S3 Enable Path Style
|
400
|
-
# Use 0 for mainstream S3 cloud providers; use 1 for self-hosted MinIO
|
401
|
-
# See: https://lobehub.com/docs/self-hosting/advanced/s3#s-3-enable-path-style
|
402
|
-
S3_ENABLE_PATH_STYLE=1
|
403
|
-
|
404
|
-
# Other basic environment variables (as needed)
|
405
|
-
# See: https://lobehub.com/docs/self-hosting/environment-variables/basic
|
406
|
-
# Note: For server versions, the API must support embedding models (OpenAI text-embedding-3-small) for file processing
|
407
|
-
# You don't need to specify this model in OPENAI_MODEL_LIST
|
652
|
+
# Other environment variables, as needed. You can refer to the environment variables configuration for the client version, making sure not to have ACCESS_CODE.
|
408
653
|
# OPENAI_API_KEY=sk-xxxx
|
409
654
|
# OPENAI_PROXY_URL=https://api.openai.com/v1
|
410
655
|
# OPENAI_MODEL_LIST=...
|
656
|
+
|
657
|
+
# ===========================
|
658
|
+
# ====== Preset config ======
|
659
|
+
# ===========================
|
660
|
+
# if no special requirements, no need to change
|
661
|
+
LOBE_PORT=3210
|
662
|
+
CASDOOR_PORT=8000
|
663
|
+
MINIO_PORT=9000
|
664
|
+
|
665
|
+
# Postgres related, which are the necessary environment variables for DB
|
666
|
+
LOBE_DB_NAME=lobechat
|
667
|
+
POSTGRES_PASSWORD=uWNZugjBqixf8dxC
|
668
|
+
|
669
|
+
# Casdoor secret
|
670
|
+
AUTH_CASDOOR_ID=943e627d79d5dd8a22a1
|
671
|
+
AUTH_CASDOOR_SECRET=6ec24ac304e92e160ef0d0656ecd86de8cb563f1
|
672
|
+
|
673
|
+
# MinIO S3 configuration
|
674
|
+
MINIO_ROOT_USER=Joe
|
675
|
+
MINIO_ROOT_PASSWORD=Crj1570768
|
676
|
+
|
677
|
+
# Configure the bucket information of MinIO
|
678
|
+
MINIO_LOBE_BUCKET=lobe
|
679
|
+
S3_ACCESS_KEY_ID=dB6Uq9CYZPdWSZouPyEd
|
680
|
+
S3_SECRET_ACCESS_KEY=aPBW8CVULkh8bw1GatlT0GjLihcXHLNwRml4pieS
|
681
|
+
|
411
682
|
```
|
412
683
|
|
413
|
-
|
684
|
+
- `docker-compose.yml`
|
414
685
|
|
415
686
|
```yaml
|
416
687
|
name: lobe-chat-database
|
417
688
|
services:
|
689
|
+
network-service:
|
690
|
+
image: alpine
|
691
|
+
container_name: lobe-network
|
692
|
+
ports:
|
693
|
+
- '${MINIO_PORT}:${MINIO_PORT}' # MinIO API
|
694
|
+
- '9001:9001' # MinIO Console
|
695
|
+
- '${CASDOOR_PORT}:${CASDOOR_PORT}' # Casdoor
|
696
|
+
- '${LOBE_PORT}:3210' # LobeChat
|
697
|
+
command: tail -f /dev/null
|
698
|
+
networks:
|
699
|
+
- lobe-network
|
700
|
+
|
418
701
|
postgresql:
|
419
702
|
image: pgvector/pgvector:pg16
|
420
703
|
container_name: lobe-postgres
|
@@ -423,57 +706,87 @@ services:
|
|
423
706
|
volumes:
|
424
707
|
- './data:/var/lib/postgresql/data'
|
425
708
|
environment:
|
426
|
-
- 'POSTGRES_DB
|
427
|
-
- 'POSTGRES_PASSWORD
|
709
|
+
- 'POSTGRES_DB=${LOBE_DB_NAME}'
|
710
|
+
- 'POSTGRES_PASSWORD=${POSTGRES_PASSWORD}'
|
428
711
|
healthcheck:
|
429
712
|
test: ['CMD-SHELL', 'pg_isready -U postgres']
|
430
713
|
interval: 5s
|
431
714
|
timeout: 5s
|
432
715
|
retries: 5
|
433
716
|
restart: always
|
717
|
+
networks:
|
718
|
+
- lobe-network
|
434
719
|
|
435
720
|
minio:
|
436
721
|
image: minio/minio
|
437
722
|
container_name: lobe-minio
|
438
|
-
|
439
|
-
- '9000:9000'
|
440
|
-
- '9001:9001'
|
723
|
+
network_mode: 'service:network-service'
|
441
724
|
volumes:
|
442
725
|
- './s3_data:/etc/minio/data'
|
443
726
|
environment:
|
444
|
-
- 'MINIO_ROOT_USER
|
445
|
-
- 'MINIO_ROOT_PASSWORD
|
446
|
-
- '
|
447
|
-
- 'MINIO_API_CORS_ALLOW_ORIGIN=https://lobe.example.com'
|
727
|
+
- 'MINIO_ROOT_USER=${MINIO_ROOT_USER}'
|
728
|
+
- 'MINIO_ROOT_PASSWORD=${MINIO_ROOT_PASSWORD}'
|
729
|
+
# - 'MINIO_API_CORS_ALLOW_ORIGIN=http://localhost:${LOBE_PORT}'
|
730
|
+
- 'MINIO_API_CORS_ALLOW_ORIGIN=https://lobe.example.com'
|
448
731
|
restart: always
|
449
732
|
command: >
|
450
|
-
server /etc/minio/data --address "
|
733
|
+
server /etc/minio/data --address ":${MINIO_PORT}" --console-address ":9001"
|
451
734
|
|
452
|
-
|
453
|
-
image:
|
454
|
-
container_name: lobe-
|
455
|
-
|
456
|
-
|
457
|
-
- '3002:3002'
|
735
|
+
casdoor:
|
736
|
+
image: casbin/casdoor
|
737
|
+
container_name: lobe-casdoor
|
738
|
+
entrypoint: /bin/sh -c './server --createDatabase=true'
|
739
|
+
network_mode: 'service:network-service'
|
458
740
|
depends_on:
|
459
741
|
postgresql:
|
460
742
|
condition: service_healthy
|
461
743
|
environment:
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
744
|
+
RUNNING_IN_DOCKER: 'true'
|
745
|
+
driverName: 'postgres'
|
746
|
+
dataSourceName: 'user=postgres password=${POSTGRES_PASSWORD} host=postgresql port=5432 sslmode=disable dbname=casdoor'
|
747
|
+
# origin: 'http://localhost:${CASDOOR_PORT}'
|
748
|
+
origin: 'https://auth-ui.example.com'
|
749
|
+
runmode: 'dev'
|
750
|
+
volumes:
|
751
|
+
- ./init_data.json:/init_data.json
|
467
752
|
|
468
753
|
lobe:
|
469
754
|
image: lobehub/lobe-chat-database
|
470
|
-
container_name: lobe-chat
|
471
|
-
|
472
|
-
- '3210:3210'
|
755
|
+
container_name: lobe-chat-database
|
756
|
+
network_mode: 'service:network-service'
|
473
757
|
depends_on:
|
474
|
-
|
475
|
-
|
476
|
-
-
|
758
|
+
postgresql:
|
759
|
+
condition: service_healthy
|
760
|
+
network-service:
|
761
|
+
condition: service_started
|
762
|
+
minio:
|
763
|
+
condition: service_started
|
764
|
+
casdoor:
|
765
|
+
condition: service_started
|
766
|
+
|
767
|
+
environment:
|
768
|
+
# - 'APP_URL=http://localhost:3210'
|
769
|
+
- 'APP_URL=https://lobe.example.com'
|
770
|
+
|
771
|
+
- 'NEXT_AUTH_SSO_PROVIDERS=casdoor'
|
772
|
+
- 'KEY_VAULTS_SECRET=Kix2wcUONd4CX51E/ZPAd36BqM4wzJgKjPtz2sGztqQ='
|
773
|
+
- 'NEXT_AUTH_SECRET=NX2kaPE923dt6BL2U8e9oSre5RfoT7hg'
|
774
|
+
# - 'AUTH_URL=http://localhost:${LOBE_PORT}/api/auth'
|
775
|
+
- 'AUTH_URL=https://lobe.example.com/api/auth'
|
776
|
+
|
777
|
+
# - 'AUTH_CASDOOR_ISSUER=http://localhost:${CASDOOR_PORT}'
|
778
|
+
- 'AUTH_CASDOOR_ISSUER=https://auth-ui.example.com'
|
779
|
+
|
780
|
+
- 'DATABASE_URL=postgresql://postgres:${POSTGRES_PASSWORD}@postgresql:5432/${LOBE_DB_NAME}'
|
781
|
+
# - 'S3_ENDPOINT=http://localhost:${MINIO_PORT}'
|
782
|
+
- 'S3_ENDPOINT=https://s3-api.example.com'
|
783
|
+
|
784
|
+
- 'S3_BUCKET=${MINIO_LOBE_BUCKET}'
|
785
|
+
# - 'S3_PUBLIC_DOMAIN=http://localhost:${MINIO_PORT}'
|
786
|
+
- 'S3_PUBLIC_DOMAIN=https://s3-api.example.com'
|
787
|
+
|
788
|
+
- 'S3_ENABLE_PATH_STYLE=1'
|
789
|
+
- 'LLM_VISION_IMAGE_USE_BASE64=1'
|
477
790
|
env_file:
|
478
791
|
- .env
|
479
792
|
restart: always
|
@@ -483,45 +796,10 @@ volumes:
|
|
483
796
|
driver: local
|
484
797
|
s3_data:
|
485
798
|
driver: local
|
486
|
-
```
|
487
799
|
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
{
|
492
|
-
"Statement": [
|
493
|
-
{
|
494
|
-
"Effect": "Allow",
|
495
|
-
"Principal": {
|
496
|
-
"AWS": ["*"]
|
497
|
-
},
|
498
|
-
"Action": ["s3:GetBucketLocation"],
|
499
|
-
"Resource": ["arn:aws:s3:::lobe"]
|
500
|
-
},
|
501
|
-
{
|
502
|
-
"Effect": "Allow",
|
503
|
-
"Principal": {
|
504
|
-
"AWS": ["*"]
|
505
|
-
},
|
506
|
-
"Action": ["s3:ListBucket"],
|
507
|
-
"Resource": ["arn:aws:s3:::lobe"],
|
508
|
-
"Condition": {
|
509
|
-
"StringEquals": {
|
510
|
-
"s3:prefix": ["files/*"]
|
511
|
-
}
|
512
|
-
}
|
513
|
-
},
|
514
|
-
{
|
515
|
-
"Effect": "Allow",
|
516
|
-
"Principal": {
|
517
|
-
"AWS": ["*"]
|
518
|
-
},
|
519
|
-
"Action": ["s3:PutObject", "s3:DeleteObject", "s3:GetObject"],
|
520
|
-
"Resource": ["arn:aws:s3:::lobe/files/**"]
|
521
|
-
}
|
522
|
-
],
|
523
|
-
"Version": "2012-10-17"
|
524
|
-
}
|
800
|
+
networks:
|
801
|
+
lobe-network:
|
802
|
+
driver: bridge
|
525
803
|
```
|
526
804
|
|
527
805
|
[docker-pulls-link]: https://hub.docker.com/r/lobehub/lobe-chat-database
|