@lobehub/lobehub 2.0.13 → 2.1.1

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.
Files changed (27) hide show
  1. package/CHANGELOG.md +50 -0
  2. package/changelog/v2.json +18 -0
  3. package/docker-compose/deploy/.env.example +35 -0
  4. package/docker-compose/deploy/.env.zh-CN.example +31 -0
  5. package/docker-compose/deploy/bucket.config.json +18 -0
  6. package/docker-compose/deploy/docker-compose.yml +148 -0
  7. package/docker-compose/deploy/searxng-settings.yml +2582 -0
  8. package/docker-compose/setup.sh +37 -88
  9. package/docs/self-hosting/advanced/auth/providers/casdoor.mdx +110 -0
  10. package/docs/self-hosting/advanced/auth/providers/casdoor.zh-CN.mdx +165 -0
  11. package/docs/self-hosting/platform/docker-compose.mdx +43 -561
  12. package/docs/self-hosting/platform/docker-compose.zh-CN.mdx +40 -537
  13. package/locales/en-US/setting.json +16 -0
  14. package/locales/zh-CN/setting.json +16 -0
  15. package/package.json +1 -1
  16. package/packages/const/src/url.ts +1 -1
  17. package/src/app/[variants]/(main)/agent/_layout/Sidebar/Cron/index.tsx +4 -2
  18. package/src/app/[variants]/(main)/agent/cron/[cronId]/features/CronJobContentEditor.tsx +39 -44
  19. package/src/app/[variants]/(main)/agent/cron/[cronId]/features/CronJobHeader.tsx +27 -20
  20. package/src/app/[variants]/(main)/agent/cron/[cronId]/features/CronJobSaveButton.tsx +4 -2
  21. package/src/app/[variants]/(main)/agent/cron/[cronId]/features/CronJobScheduleConfig.tsx +183 -145
  22. package/src/app/[variants]/(main)/agent/profile/features/AgentCronJobs/hooks/useAgentCronJobs.ts +3 -4
  23. package/src/app/[variants]/(main)/agent/profile/features/AgentCronJobs/index.tsx +4 -3
  24. package/src/app/[variants]/(main)/agent/profile/features/ProfileEditor/index.tsx +4 -3
  25. package/src/features/Conversation/Messages/AssistantGroup/components/MessageContent.tsx +6 -1
  26. package/src/locales/default/setting.ts +16 -0
  27. package/src/store/agent/slices/cron/action.ts +6 -4
@@ -31,13 +31,13 @@ tags:
31
31
 
32
32
  - The one-click startup script is only for initial deployment; for subsequent deployments, please refer to the [Custom Deployment](#custom-deployment) section.
33
33
 
34
- - Port occupation check: Ensure that ports `3210`, `8000`, `9000`, and `9001` are available.
34
+ - Port occupation check: Ensure that ports `3210`, `9000`, and `9001` are available.
35
35
  </Callout>
36
36
 
37
- 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.
37
+ Execute the following commands to set up the deployment environment; the directory `lobehub` will be used to store your configuration files and subsequent database files.
38
38
 
39
39
  ```sh
40
- mkdir lobe-chat-db && cd lobe-chat-db
40
+ mkdir lobehub && cd lobehub
41
41
  ```
42
42
 
43
43
  Fetch and execute the deployment script:
@@ -67,24 +67,13 @@ The script supports the following deployment modes; please choose the appropriat
67
67
 
68
68
  ### Check Configuration Generation Report
69
69
 
70
- 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.
71
-
72
- <Callout type="warning">
73
- Please log in to LobeHub using the user account; the administrator account is only for managing
74
- Casdoor.
75
- </Callout>
70
+ After the script finishes running, check the configuration generation report which includes service URLs and passwords.
76
71
 
77
72
  ```log
78
73
  The results of the secure key generation are as follows:
79
74
  LobeHub:
80
75
  - URL: http://localhost:3210
81
- - Username: user
82
- - Password: c66f8c
83
- Casdoor:
84
- - URL: http://localhost:8000
85
- - Username: admin
86
- - Password: c66f8c
87
- Minio:
76
+ RustFS:
88
77
  - URL: http://localhost:9000
89
78
  - Username: admin
90
79
  - Password: 8c82ea41
@@ -99,7 +88,7 @@ The script supports the following deployment modes; please choose the appropriat
99
88
  ### Check Logs
100
89
 
101
90
  ```sh
102
- docker logs -f lobe-chat
91
+ docker logs -f lobehub
103
92
  ```
104
93
 
105
94
  If you see the following logs in the container, it means the startup was successful:
@@ -108,7 +97,7 @@ The script supports the following deployment modes; please choose the appropriat
108
97
  [Database] Start to migration...
109
98
  ✅ database migration pass.
110
99
  -------------------------------------
111
- ▲ Next.js 14.x.x
100
+ ▲ Next.js 16.x.x
112
101
  - Local: http://localhost:3210
113
102
  - Network: http://0.0.0.0:3210
114
103
 
@@ -118,7 +107,7 @@ The script supports the following deployment modes; please choose the appropriat
118
107
 
119
108
  ### Access Application
120
109
 
121
- Visit your LobeHub service at [http://localhost:3210](http://localhost:3210). The account credentials for the application can be found in the report from step `2`.
110
+ Visit your LobeHub service at [http://localhost:3210](http://localhost:3210).
122
111
  </Steps>
123
112
 
124
113
  ### Port Mode
@@ -133,24 +122,13 @@ The script supports the following deployment modes; please choose the appropriat
133
122
 
134
123
  ### Check Configuration Generation Report
135
124
 
136
- After the script finishes running, please check the configuration generation report for the Casdoor administrator account, user account, and their initial login passwords.
137
-
138
- <Callout type="warning">
139
- Please log in to LobeHub using the user account; the administrator account is only for managing
140
- Casdoor.
141
- </Callout>
125
+ After the script finishes running, check the configuration generation report which includes service URLs and passwords.
142
126
 
143
127
  ```log
144
128
  The results of the secure key generation are as follows:
145
129
  LobeHub:
146
130
  - URL: http://your_server_ip:3210
147
- - Username: user
148
- - Password: 837e26
149
- Casdoor:
150
- - URL: http://your_server_ip:8000
151
- - Username: admin
152
- - Password: 837e26
153
- Minio:
131
+ RustFS:
154
132
  - URL: http://your_server_ip:9000
155
133
  - Username: admin
156
134
  - Password: dbac8440
@@ -165,7 +143,7 @@ The script supports the following deployment modes; please choose the appropriat
165
143
  ### Check Logs
166
144
 
167
145
  ```sh
168
- docker logs -f lobe-chat
146
+ docker logs -f lobehub
169
147
  ```
170
148
 
171
149
  If you see the following logs in the container, it means the startup was successful:
@@ -174,7 +152,7 @@ The script supports the following deployment modes; please choose the appropriat
174
152
  [Database] Start to migration...
175
153
  ✅ database migration pass.
176
154
  -------------------------------------
177
- ▲ Next.js 14.x.x
155
+ ▲ Next.js 16.x.x
178
156
  - Local: http://your_server_ip:3210
179
157
  - Network: http://0.0.0.0:3210
180
158
  ✓ Starting...
@@ -183,14 +161,7 @@ The script supports the following deployment modes; please choose the appropriat
183
161
 
184
162
  ### Access Application
185
163
 
186
- You can access your LobeHub service at `http://your_server_ip:3210`. The account credentials for the application can be found in the report from step `2`.
187
-
188
- <Callout type="warning">
189
- If your service can accessed via the public network,
190
- we strongly recommend disabling the registration,
191
- refer to the [documentation](https://lobehub.com/docs/self-hosting/advanced/auth/providers/casdoor)
192
- for more information.
193
- </Callout>
164
+ You can access your LobeHub service at `http://your_server_ip:3210`.
194
165
  </Steps>
195
166
 
196
167
  ### Domain Mode
@@ -200,40 +171,18 @@ The script supports the following deployment modes; please choose the appropriat
200
171
 
201
172
  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:
202
173
 
203
- | Domain | Proxy Port | Required |
204
- | ---------------------- | ---------- | -------- |
205
- | `lobe.example.com` | `3210` | Yes |
206
- | `auth.example.com` | `8000` | Yes |
207
- | `minio.example.com` | `9000` | Yes |
208
- | `minio-ui.example.com` | `9001` | |
209
-
210
- <Callout type="important">
211
- If you are using panel software like [aaPanel](https://www.bt.cn/) for reverse proxy configuration,
212
- ensure it does not intercept requests to the `.well-known` path to facilitate the proper functioning of Casdoor's OAuth2 configuration.
213
- Below is a whitelist configuration for the Nginx server block concerning paths for Casdoor reverse proxy:
214
-
215
- ```nginx
216
- location /.well-known/openid-configuration {
217
- proxy_pass http://localhost:8000; # Forward to localhost:8000
218
- proxy_set_header Host $host; # Keep the original host header
219
- proxy_set_header X-Real-IP $remote_addr; # Keep the client's real IP
220
- proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; # Keep the forwarded IP
221
- proxy_set_header X-Forwarded-Proto $scheme; # Keep the request protocol
222
- }
223
- ```
224
-
225
- ⚠️ If you are using such panel software,
226
- please do not enable any form of caching in the reverse proxy settings of such panel software to avoid affecting the normal operation of the service.
227
- Read more at [https://github.com/lobehub/lobe-chat/discussions/5986](https://github.com/lobehub/lobe-chat/discussions/5986)
228
- </Callout>
174
+ | Domain | Proxy Port | Required |
175
+ | ------------------- | ---------- | -------- |
176
+ | `lobe.example.com` | `3210` | Yes |
177
+ | `s3.example.com` | `9000` | Yes |
178
+ | `s3-ui.example.com` | `9001` | |
229
179
 
230
180
  ### Complete Remaining Configuration in Interactive Script
231
181
 
232
182
  In domain mode, you need to complete the following configurations based on script prompts:
233
183
 
234
184
  - Domain setup for the LobeHub service: `lobe.example.com`
235
- - Domain setup for the Minio service: `minio.example.com`
236
- - Domain setup for the Casdoor service: `auth.example.com`
185
+ - Domain setup for the S3 service: `s3.example.com`
237
186
  - Choose the access protocol: `http` or `https`
238
187
  - 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.
239
188
 
@@ -249,25 +198,14 @@ The script supports the following deployment modes; please choose the appropriat
249
198
 
250
199
  ### Check Configuration Generation Report
251
200
 
252
- After the script finishes running, you need to check the configuration generation report, which includes the initial login password for the Casdoor administrator.
253
-
254
- <Callout type="warning">
255
- Please log in to LobeHub using the user account; the administrator account is only for managing
256
- Casdoor.
257
- </Callout>
201
+ After the script finishes running, check the configuration generation report which includes service URLs and passwords.
258
202
 
259
203
  ```log
260
204
  The results of the secure key generation are as follows:
261
205
  LobeHub:
262
206
  - URL: https://lobe.example.com
263
- - Username: user
264
- - Password: 837e26
265
- Casdoor:
266
- - URL: https://auth.example.com
267
- - Username: admin
268
- - Password: 837e26
269
- Minio:
270
- - URL: https://minio.example.com
207
+ RustFS:
208
+ - URL: https://s3.example.com
271
209
  - Username: admin
272
210
  - Password: dbac8440
273
211
  ```
@@ -281,7 +219,7 @@ The script supports the following deployment modes; please choose the appropriat
281
219
  ### Check Logs
282
220
 
283
221
  ```sh
284
- docker logs -f lobe-chat
222
+ docker logs -f lobehub
285
223
  ```
286
224
 
287
225
  If you see the following logs in the container, it indicates a successful startup:
@@ -290,7 +228,7 @@ The script supports the following deployment modes; please choose the appropriat
290
228
  [Database] Start to migration...
291
229
  ✅ database migration pass.
292
230
  -------------------------------------
293
- ▲ Next.js 14.x.x
231
+ ▲ Next.js 16.x.x
294
232
  - Local: https://localhost:3210
295
233
  - Network: http://0.0.0.0:3210
296
234
  ✓ Starting...
@@ -299,23 +237,16 @@ The script supports the following deployment modes; please choose the appropriat
299
237
 
300
238
  ### Access Application
301
239
 
302
- You can access your LobeHub service via `https://lobe.example.com`. The account credentials for the application can be found in the report from step `3`.
303
-
304
- <Callout type="warning">
305
- If your service can accessed via the public network,
306
- we strongly recommend disabling the registration,
307
- refer to the [documentation](https://lobehub.com/docs/self-hosting/advanced/auth/providers/casdoor)
308
- for more information.
309
- </Callout>
240
+ You can access your LobeHub service via `https://lobe.example.com`.
310
241
  </Steps>
311
242
 
312
243
  ## Custom Deployment
313
244
 
314
- This section mainly introduces the configurations that need to be modified to customize the deployment of the LobeHub service in different network environments. 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/refs/heads/main/docker-compose/local/.env.example).
245
+ This section mainly introduces the configurations that need to be modified to customize the deployment of the LobeHub service in different network environments. Before starting, you can download the [Docker Compose configuration file](https://raw.githubusercontent.com/lobehub/lobe-chat/HEAD/docker-compose/deploy/docker-compose.yml) and the [environment variable configuration file](https://raw.githubusercontent.com/lobehub/lobe-chat/HEAD/docker-compose/deploy/.env.example).
315
246
 
316
247
  ```sh
317
- curl -O https://raw.githubusercontent.com/lobehub/lobe-chat/HEAD/docker-compose/local/docker-compose.yml
318
- curl -O https://raw.githubusercontent.com/lobehub/lobe-chat/HEAD/docker-compose/local/.env.example
248
+ curl -O https://raw.githubusercontent.com/lobehub/lobe-chat/HEAD/docker-compose/deploy/docker-compose.yml
249
+ curl -O https://raw.githubusercontent.com/lobehub/lobe-chat/HEAD/docker-compose/deploy/.env.example
319
250
  mv .env.example .env
320
251
  ```
321
252
 
@@ -326,16 +257,15 @@ mv .env.example .env
326
257
 
327
258
  ### Prerequisites
328
259
 
329
- Generally, to fully run the LobeHub database version, you will need at least the following four services:
260
+ Generally, to fully run the LobeHub database version, you will need at least the following three services:
330
261
 
331
262
  - The LobeHub database version itself
332
263
  - PostgreSQL database with PGVector plugin
333
264
  - Object storage service that supports S3 protocol
334
- - An SSO authentication service supported by LobeHub
335
265
 
336
266
  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 LobeHub database version or modified to suit your requirements.
337
267
 
338
- 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.
268
+ We use [RustFS](https://github.com/rustfs/rustfs) as the local S3 object storage service by default. To configure SSO authentication services, please refer to the [Authentication Services](/docs/self-hosting/advanced/auth) documentation.
339
269
 
340
270
  <Callout type="warning">
341
271
  If your network topology is complex, please make sure these services can communicate properly
@@ -346,40 +276,16 @@ We use [MinIO](https://github.com/minio/minio) as the local S3 object storage se
346
276
 
347
277
  Now, we will introduce the necessary configurations for running these services:
348
278
 
349
- 1. Casdoor
279
+ 1. S3 Object Storage
350
280
 
351
- - LobeHub requires communication with Casdoor, so you need to configure Casdoor's Issuer.
281
+ LobeHub needs to provide a public access URL for object files for the LLM service provider, so you need to configure the S3 Endpoint:
352
282
 
353
283
  ```env
354
- AUTH_CASDOOR_ISSUER=https://auth.example.com
284
+ S3_PUBLIC_DOMAIN=https://s3.example.com
285
+ S3_ENDPOINT=https://s3.example.com
355
286
  ```
356
287
 
357
- This configuration will affect LobeHub'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).
358
-
359
- - Additionally, you need to allow the callback URL in Casdoor to point to the LobeHub address:
360
-
361
- Please add a line in the `Authentication -> Application` -> `<Application ID, default is app-built-in>` -> `Redirect URI` in Casdoor's web panel:
362
-
363
- ```
364
- https://auth.example.com/api/auth/callback/casdoor
365
- ```
366
-
367
- - Casdoor needs to provide the Origin information for access in the environment variables:
368
-
369
- ```env
370
- origin=https://auth.example.com
371
- ```
372
-
373
- 2. MinIO
374
-
375
- - LobeHub needs to provide a public access URL for object files for the LLM service provider, hence you need to configure MinIO's Endpoint.
376
-
377
- ```env
378
- S3_PUBLIC_DOMAIN=https://minio.example.com
379
- S3_ENDPOINT=https://minio.example.com
380
- ```
381
-
382
- 3. PostgreSQL
288
+ 2. PostgreSQL
383
289
 
384
290
  This configuration is found in the `docker-compose.yml` file, and you will need to configure the database name and password:
385
291
 
@@ -392,220 +298,16 @@ services:
392
298
 
393
299
  ## FAQ
394
300
 
395
- #### Unable to Log In Properly
301
+ #### Database Migration Issues
396
302
 
397
- Check for the following errors based on the container logs:
303
+ You can check the logs using the following command:
398
304
 
399
305
  ```sh
400
- docker logs -f lobe-chat
401
- ```
402
-
403
- - r3: "response" is not a conform Authorization Server Metadata response (unexpected HTTP status code)
404
-
405
- ```log
406
- lobe-chat | [auth][error] r3: "response" is not a conform Authorization Server Metadata response (unexpected HTTP status code)
407
- ```
408
-
409
- 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.
410
-
411
- Solutions:
412
-
413
- - Please refer to the reverse proxy configuration notes in the [Domain Mode](#domain-mode) section.
414
-
415
- - A direct troubleshooting method is to access `https://auth.example.com/.well-known/openid-configuration` directly; if:
416
-
417
- - Non-JSON format data is returned, it indicates your reverse proxy configuration is incorrect.
418
- - If the returned JSON format data contains an `"issuer": "URL"` field that does not match your configured `https://auth.example.com`, it indicates your environment variable configuration is incorrect.
419
-
420
- - TypeError: fetch failed
421
-
422
- ```log
423
- lobe-chat | [auth][error] TypeError: fetch failed
424
- ```
425
-
426
- Cause: LobeHub cannot access the authentication service.
427
-
428
- Solutions:
429
-
430
- - Check whether your authentication service is running properly and whether LobeHub's network can reach the authentication service.
431
-
432
- - A straightforward troubleshooting method is to use the `curl` command in the LobeHub container terminal to access your authentication service at `https://auth.example.com/.well-known/openid-configuration`. If JSON format data is returned, it indicates your authentication service is functioning correctly.
433
-
434
- #### OAuth Token Exchange Failures with Reverse Proxy
435
-
436
- If OAuth authentication fails during the token exchange phase when using Docker behind a reverse proxy, this is typically caused by the default `MIDDLEWARE_REWRITE_THROUGH_LOCAL=1` setting which rewrites URLs to `127.0.0.1:3210`.
437
-
438
- **Solution**: Set `MIDDLEWARE_REWRITE_THROUGH_LOCAL=0` in your `.env` file and restart Docker containers:
439
-
440
- ```bash
441
- docker compose down
442
- docker compose up -d
443
- ```
444
-
445
- ````markdown
446
- ## Extended Configuration
447
-
448
- To enhance your LobeHub service, you can perform the following extended configurations according to your needs.
449
-
450
- ### Use MinIO to Store Casdoor Avatars
451
-
452
- Allow users to change their avatars in Casdoor.
453
-
454
- 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).
455
-
456
- ```json
457
- {
458
- "Statement": [
459
- {
460
- "Effect": "Allow",
461
- "Principal": {
462
- "AWS": ["*"]
463
- },
464
- "Action": ["s3:GetBucketLocation"],
465
- "Resource": ["arn:aws:s3:::casdoor"]
466
- },
467
- {
468
- "Effect": "Allow",
469
- "Principal": {
470
- "AWS": ["*"]
471
- },
472
- "Action": ["s3:ListBucket"],
473
- "Resource": ["arn:aws:s3:::casdoor"],
474
- "Condition": {
475
- "StringEquals": {
476
- "s3:prefix": ["files/*"]
477
- }
478
- }
479
- },
480
- {
481
- "Effect": "Allow",
482
- "Principal": {
483
- "AWS": ["*"]
484
- },
485
- "Action": ["s3:PutObject", "s3:DeleteObject", "s3:GetObject"],
486
- "Resource": ["arn:aws:s3:::casdoor/**"]
487
- }
488
- ],
489
- "Version": "2012-10-17"
490
- }
491
- ```
492
- ````
493
-
494
- 2. Create a new access key and store the generated `Access Key` and `Secret Key`.
495
-
496
- 3. In Casdoor's `Authentication -> Providers`, associate the MinIO S3 service. Below is an example configuration:
497
-
498
- ![casdoor](/blog/assets18bb134dbc5792d6a624199cca8bf7d3.webp)
499
-
500
- 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`.
501
-
502
- 4. In Casdoor's `Authentication -> Apps`, add a provider to the `app-built-in` application, select `minio`, and save and exit.
503
-
504
- 5. You can attempt to upload a file in Casdoor's `Authentication -> Resources` to test if the configuration is correct.
505
-
506
- ### Migrating from `logto` to `Casdoor` in Production Deployment
507
-
508
- This is applicable for users who have been using `logto` as their login and authentication service in a production environment.
509
-
510
- <Callout type="info">
511
- Due to significant instability when using [Logto](https://logto.io/) as a login and authentication
512
- service, the following tutorial is based on deploying with an IP mode, implementing a domain
513
- release solution using Casdoor as the authentication service provider. The remainder of this
514
- article will illustrate using this as an example. If you are using other login authentication
515
- services like Logto, the process should be similar, but be aware that port configurations may
516
- differ among different services.
517
- </Callout>
518
-
519
- 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.
520
-
521
- The domain and corresponding service port descriptions are as follows:
522
-
523
- - `lobe.example.com`: This is your LobeHub service domain, which needs to reverse proxy to the LobeHub service port, default is `3210`.
524
- - `auth.example.com`: This is your Logto UI domain, which needs to reverse proxy to the Logto WebUI service port, default is `8000`.
525
- - `minio.example.com`: This is your MinIO API domain, which needs to reverse proxy to the MinIO API service port, default is `9000`.
526
- - `minio-ui.example.com`: Optional, this is your MinIO UI domain, which needs to reverse proxy to the MinIO WebUI service port, default is `9001`.
527
-
528
- #### Configuration File
529
-
530
- ```sh
531
- bash <(curl -fsSL https://raw.githubusercontent.com/lobehub/lobe-chat/HEAD/docker-compose/local/setup.sh) -f -l zh_CN
532
- docker compose up -d
533
- ```
534
-
535
- Make sure to save the newly generated password at this time!
536
-
537
- After running, you will get three files:
538
-
539
- - init\_data.json
540
- - docker-compose.yml
541
- - .env
542
-
543
- Next, modify the configuration files to achieve domain release.
544
-
545
- 1. Modify the `docker-compose.yml` file.
546
-
547
- 1. Change the `MINIO_API_CORS_ALLOW_ORIGIN` field of `minio`.
548
-
549
- ```yaml
550
- 'MINIO_API_CORS_ALLOW_ORIGIN=https://lobe.example.com'
551
- ```
552
-
553
- 2. Modify the `origin` field of `casdoor`.
554
-
555
- ```yaml
556
- origin: 'https://auth.example.com'
557
- ```
558
-
559
- 3. Modify the `environment` field of `lobe`.
560
-
561
- ```yaml
562
- # - 'APP_URL=http://localhost:3210'
563
- - 'APP_URL=https://lobe.example.com'
564
-
565
- - 'AUTH_SSO_PROVIDERS=casdoor'
566
- - 'KEY_VAULTS_SECRET=Kix2wcUONd4CX51E/ZPAd36BqM4wzJgKjPtz2sGztqQ='
567
- - 'AUTH_SECRET=NX2kaPE923dt6BL2U8e9oSre5RfoT7hg'
568
- # - 'AUTH_URL=http://localhost:${LOBE_PORT}/api/auth'
569
- - 'AUTH_URL=https://lobe.example.com/api/auth'
570
-
571
- # - 'AUTH_CASDOOR_ISSUER=http://localhost:${CASDOOR_PORT}'
572
- - 'AUTH_CASDOOR_ISSUER=https://auth.example.com'
573
-
574
- - 'DATABASE_URL=postgresql://postgres:${POSTGRES_PASSWORD}@postgresql:5432/${LOBE_DB_NAME}'
575
- # - 'S3_ENDPOINT=http://localhost:${MINIO_PORT}'
576
- - 'S3_ENDPOINT=https://minio.example.com'
577
-
578
- - 'S3_BUCKET=${MINIO_LOBE_BUCKET}'
579
- # - 'S3_PUBLIC_DOMAIN=http://localhost:${MINIO_PORT}'
580
- - 'S3_PUBLIC_DOMAIN=https://minio.example.com'
581
-
582
- - 'S3_ENABLE_PATH_STYLE=1'
583
- - 'LLM_VISION_IMAGE_USE_BASE64=1'
584
- ```
585
-
586
- 2. Modify the `.env` file.
587
-
588
- <Callout type="info">For security reasons, modify the ROOT USER field in the `.env` file.</Callout>
589
-
590
- ```sh
591
- # MinIO S3 configuration
592
- MINIO_ROOT_USER=XXXX
593
- MINIO_ROOT_PASSWORD=XXXX
594
- ```
595
-
596
- #### Postgres Database Configuration
597
-
598
- You can check the logs with the following command:
599
-
600
- ```sh
601
- docker logs -f lobe-chat
306
+ docker logs -f lobehub
602
307
  ```
603
308
 
604
309
  <Callout type="tip">
605
- In our official Docker images, automatic migration of the database schema is performed before
606
- starting the images. Our official images guarantee the stability of "empty database -> complete
607
- tables" for automatic table creation. Therefore, we recommend your database instance use an empty
608
- table instance to avoid the trouble of manually maintaining table structure or migrations.
310
+ In our official Docker images, database schema migration is automatically performed before starting. 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.
609
311
  </Callout>
610
312
 
611
313
  If you encounter issues during table creation, you can try the following command to forcibly remove the database container and restart:
@@ -616,71 +318,10 @@ sudo rm -rf ./data # Remove mounted database data
616
318
  docker compose up -d # Restart
617
319
  ```
618
320
 
619
- #### Login Authentication Service Configuration
620
-
621
- You first need to access the WebUI for configuration:
622
-
623
- - If you have set up the reverse proxy as mentioned before, open `https://auth.example.com`
624
- - Otherwise, after port mapping, open `http://localhost:8000`
625
-
626
- Log in to the admin account:
627
-
628
- - The default username is admin.
629
- - 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.
630
-
631
- After logging in, perform the following actions:
632
-
633
- 1. In `User Management -> Organizations`, add a new organization with the name and display name `Lobe Users`. Keep the rest as default.
634
- 2. In `Authentication -> Apps`, add a new application.
635
-
636
- - Name and display name should be `LobeHub`.
637
- - Organization should be `Lobe Users`.
638
- - Add a line in Redirect URLs as `https://lobe.example.com/api/auth/callback/casdoor`.
639
- - Disable all login methods except password.
640
- - Fill in the client ID and client secret in the `.env` file under `AUTH_CASDOOR_ID` and `AUTH_CASDOOR_SECRET`.
641
- - (Optional) Design the appearance of the login and registration pages by mimicking the `built-in` application configuration.
642
- - Save and exit.
643
-
644
- <Callout type="info">
645
- Following the steps above ensures that not all users are administrators by default, leading to an
646
- unsafe situation.
647
- </Callout>
648
-
649
- #### S3 Object Storage Service Configuration
650
-
651
- 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.
652
-
653
- <Callout type="warning">
654
- Please remember to configure the corresponding S3 service provider's CORS settings to ensure that LobeHub can access the S3 service correctly.
655
-
656
- 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`.
657
-
658
- If you use the second method (which is also the default), you will no longer be able to configure it in the MinIO WebUI.
659
- </Callout>
660
-
661
- You first need to access the WebUI for configuration:
662
-
663
- - If you have set up the reverse proxy as mentioned before, open `https://minio-ui.example.com`
664
- - Otherwise, after port mapping, open `http://localhost:9001`
665
-
666
- 1. Enter the `MINIO_ROOT_USER` and `MINIO_ROOT_PASSWORD` you set in the login interface, then click login.
667
-
668
- 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`.
669
-
670
- <Image alt="Create MinIO Access Key" src="/blog/assetsfa2c650be15522ac2fd71a3e434a1b2e.webp" />
671
-
672
- 3. Restart the LobeHub service:
673
-
674
- ```sh
675
- docker compose up -d
676
- ```
677
-
678
- At this point, you have successfully deployed the LobeHub database version, and you can access your LobeHub service at `https://lobe.example.com`.
679
-
680
- #### Configuring Internal Server Communication with `INTERNAL_APP_URL`
321
+ #### Using `INTERNAL_APP_URL` for Internal Server Communication
681
322
 
682
323
  <Callout type="info">
683
- If you are deploying LobeHub behind a CDN (like Cloudflare) or reverse proxy, you may want to configure internal server-to-server communication to bypass the CDN/proxy layer for better performance.
324
+ If you're deploying LobeHub behind a CDN (like Cloudflare) or reverse proxy, you may want to configure internal server-to-server communication to bypass the CDN/proxy layer for better performance.
684
325
  </Callout>
685
326
 
686
327
  You can configure the `INTERNAL_APP_URL` environment variable:
@@ -708,168 +349,9 @@ If `INTERNAL_APP_URL` is not set, it defaults to `APP_URL`.
708
349
  For Docker Compose deployments with `network_mode: 'service:network-service'`, use `http://localhost:3210` as the `INTERNAL_APP_URL`.
709
350
  </Callout>
710
351
 
711
- #### Configuration Files
712
-
713
- For convenience, here is a summary of example configuration files required for the production deployment using the Casdoor authentication scheme:
714
-
715
- - `.env`
716
-
717
- ```sh
718
- # Proxy, if you need it
719
- # HTTP_PROXY=http://localhost:7890
720
- # HTTPS_PROXY=http://localhost:7890
721
-
722
- # Other environment variables, as needed. You can refer to the environment variables configuration for the client version.
723
- # OPENAI_API_KEY=sk-xxxx
724
- # OPENAI_PROXY_URL=https://api.openai.com/v1
725
- # OPENAI_MODEL_LIST=...
726
-
727
- # ===========================
728
- # ====== Preset config ======
729
- # ===========================
730
- # if no special requirements, no need to change
731
- LOBE_PORT=3210
732
- CASDOOR_PORT=8000
733
- MINIO_PORT=9000
734
-
735
- # Postgres related, which are the necessary environment variables for DB
736
- LOBE_DB_NAME=LobeHub
737
- POSTGRES_PASSWORD=uWNZugjBqixf8dxC
738
-
739
- # Casdoor secret
740
- AUTH_CASDOOR_ID=943e627d79d5dd8a22a1
741
- AUTH_CASDOOR_SECRET=6ec24ac304e92e160ef0d0656ecd86de8cb563f1
742
-
743
- # MinIO S3 configuration
744
- MINIO_ROOT_USER=Joe
745
- MINIO_ROOT_PASSWORD=Crj1570768
746
-
747
- # Configure the bucket information of MinIO
748
- MINIO_LOBE_BUCKET=lobe
749
- S3_ACCESS_KEY_ID=dB6Uq9CYZPdWSZouPyEd
750
- S3_SECRET_ACCESS_KEY=aPBW8CVULkh8bw1GatlT0GjLihcXHLNwRml4pieS
751
- ```
752
-
753
- - `docker-compose.yml`
754
-
755
- ```yaml
756
- name: lobehub
757
- services:
758
- network-service:
759
- image: alpine
760
- container_name: lobe-network
761
- ports:
762
- - '${MINIO_PORT}:${MINIO_PORT}' # MinIO API
763
- - '9001:9001' # MinIO Console
764
- - '${CASDOOR_PORT}:${CASDOOR_PORT}' # Casdoor
765
- - '${LOBE_PORT}:3210' # LobeHub
766
- command: tail -f /dev/null
767
- networks:
768
- - lobe-network
769
-
770
- postgresql:
771
- image: pgvector/pgvector:pg17
772
- container_name: lobe-postgres
773
- ports:
774
- - '5432:5432'
775
- volumes:
776
- - './data:/var/lib/postgresql/data'
777
- environment:
778
- - 'POSTGRES_DB=${LOBE_DB_NAME}'
779
- - 'POSTGRES_PASSWORD=${POSTGRES_PASSWORD}'
780
- healthcheck:
781
- test: ['CMD-SHELL', 'pg_isready -U postgres']
782
- interval: 5s
783
- timeout: 5s
784
- retries: 5
785
- restart: always
786
- networks:
787
- - lobe-network
788
-
789
- minio:
790
- image: minio/minio:RELEASE.2025-04-22T22-12-26Z
791
- container_name: lobe-minio
792
- network_mode: 'service:network-service'
793
- volumes:
794
- - './s3_data:/etc/minio/data'
795
- environment:
796
- - 'MINIO_ROOT_USER=${MINIO_ROOT_USER}'
797
- - 'MINIO_ROOT_PASSWORD=${MINIO_ROOT_PASSWORD}'
798
- # - 'MINIO_API_CORS_ALLOW_ORIGIN=http://localhost:${LOBE_PORT}'
799
- - 'MINIO_API_CORS_ALLOW_ORIGIN=https://lobe.example.com'
800
- restart: always
801
- command: >
802
- server /etc/minio/data --address ":${MINIO_PORT}" --console-address ":9001"
803
-
804
- casdoor:
805
- image: casbin/casdoor
806
- container_name: lobe-casdoor
807
- entrypoint: /bin/sh -c './server --createDatabase=true'
808
- network_mode: 'service:network-service'
809
- depends_on:
810
- postgresql:
811
- condition: service_healthy
812
- environment:
813
- RUNNING_IN_DOCKER: 'true'
814
- driverName: 'postgres'
815
- dataSourceName: 'user=postgres password=${POSTGRES_PASSWORD} host=postgresql port=5432 sslmode=disable dbname=casdoor'
816
- # origin: 'http://localhost:${CASDOOR_PORT}'
817
- origin: 'https://auth.example.com'
818
- runmode: 'dev'
819
- volumes:
820
- - ./init_data.json:/init_data.json
352
+ ## Configuring Authentication
821
353
 
822
- lobe:
823
- image: lobehub/lobehub
824
- container_name: lobehub
825
- network_mode: 'service:network-service'
826
- depends_on:
827
- postgresql:
828
- condition: service_healthy
829
- network-service:
830
- condition: service_started
831
- minio:
832
- condition: service_started
833
- casdoor:
834
- condition: service_started
835
-
836
- environment:
837
- # - 'APP_URL=http://localhost:3210'
838
- - 'APP_URL=https://lobe.example.com'
839
-
840
- - 'AUTH_SSO_PROVIDERS=casdoor'
841
- - 'KEY_VAULTS_SECRET=Kix2wcUONd4CX51E/ZPAd36BqM4wzJgKjPtz2sGztqQ='
842
- - 'AUTH_SECRET=NX2kaPE923dt6BL2U8e9oSre5RfoT7hg'
843
- # - 'AUTH_URL=http://localhost:${LOBE_PORT}/api/auth'
844
- - 'AUTH_URL=https://lobe.example.com/api/auth'
845
-
846
- # - 'AUTH_CASDOOR_ISSUER=http://localhost:${CASDOOR_PORT}'
847
- - 'AUTH_CASDOOR_ISSUER=https://auth.example.com'
848
-
849
- - 'DATABASE_URL=postgresql://postgres:${POSTGRES_PASSWORD}@postgresql:5432/${LOBE_DB_NAME}'
850
- # - 'S3_ENDPOINT=http://localhost:${MINIO_PORT}'
851
- - 'S3_ENDPOINT=https://minio.example.com'
852
-
853
- - 'S3_BUCKET=${MINIO_LOBE_BUCKET}'
854
- # - 'S3_PUBLIC_DOMAIN=http://localhost:${MINIO_PORT}'
855
- - 'S3_PUBLIC_DOMAIN=https://minio.example.com'
856
-
857
- - 'S3_ENABLE_PATH_STYLE=1'
858
- - 'LLM_VISION_IMAGE_USE_BASE64=1'
859
- env_file:
860
- - .env
861
- restart: always
862
-
863
- volumes:
864
- data:
865
- driver: local
866
- s3_data:
867
- driver: local
868
-
869
- networks:
870
- lobe-network:
871
- driver: bridge
872
- ```
354
+ To configure SSO authentication services (such as Casdoor, Logto, etc.), please refer to the [Authentication Services](/docs/self-hosting/advanced/auth) documentation.
873
355
 
874
356
  [docker-pulls-link]: https://hub.docker.com/r/lobehub/lobehub
875
357
  [docker-pulls-shield]: https://img.shields.io/docker/pulls/lobehub/lobehub?color=45cc11&labelColor=black&style=flat-square