@lobehub/lobehub 2.0.3 → 2.0.5
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/.github/ISSUE_TEMPLATE/1_bug_report.yml +0 -11
- package/CHANGELOG.md +50 -0
- package/README.md +9 -13
- package/README.zh-CN.md +6 -8
- package/apps/desktop/Development.md +1 -1
- package/changelog/v2.json +18 -0
- package/docker-compose/local/docker-compose.yml +2 -2
- package/docker-compose/local/grafana/docker-compose.yml +3 -3
- package/docker-compose/local/logto/docker-compose.yml +3 -4
- package/docker-compose/local/zitadel/.env.example +3 -4
- package/docker-compose/local/zitadel/.env.zh-CN.example +1 -2
- package/docker-compose/local/zitadel/docker-compose.yml +3 -3
- package/docker-compose/production/grafana/docker-compose.yml +3 -3
- package/docker-compose/production/logto/.env.example +7 -9
- package/docker-compose/production/logto/.env.zh-CN.example +7 -9
- package/docker-compose/production/logto/docker-compose.yml +3 -3
- package/docker-compose/production/zitadel/.env.example +4 -6
- package/docker-compose/production/zitadel/.env.zh-CN.example +3 -5
- package/docker-compose/production/zitadel/docker-compose.yml +3 -3
- package/docs/development/basic/folder-structure.mdx +1 -2
- package/docs/development/basic/folder-structure.zh-CN.mdx +1 -2
- package/docs/self-hosting/advanced/auth/legacy.mdx +1 -1
- package/docs/self-hosting/advanced/auth/legacy.zh-CN.mdx +1 -1
- package/docs/self-hosting/advanced/auth/nextauth-to-betterauth.mdx +4 -0
- package/docs/self-hosting/advanced/auth/nextauth-to-betterauth.zh-CN.mdx +4 -0
- package/docs/self-hosting/advanced/auth/providers/casdoor.mdx +8 -0
- package/docs/self-hosting/advanced/auth/providers/casdoor.zh-CN.mdx +8 -0
- package/docs/self-hosting/advanced/auth.mdx +28 -1
- package/docs/self-hosting/advanced/auth.zh-CN.mdx +29 -2
- package/docs/self-hosting/advanced/upstream-sync.mdx +5 -5
- package/docs/self-hosting/advanced/upstream-sync.zh-CN.mdx +5 -5
- package/docs/self-hosting/environment-variables/auth.mdx +2 -334
- package/docs/self-hosting/environment-variables/auth.zh-CN.mdx +2 -307
- package/docs/self-hosting/environment-variables/basic.mdx +1 -1
- package/docs/self-hosting/environment-variables/basic.zh-CN.mdx +1 -1
- package/docs/self-hosting/environment-variables.mdx +1 -1
- package/docs/self-hosting/platform/docker-compose.mdx +837 -90
- package/docs/self-hosting/platform/docker-compose.zh-CN.mdx +809 -84
- package/docs/self-hosting/platform/docker.mdx +110 -111
- package/docs/self-hosting/platform/docker.zh-CN.mdx +103 -151
- package/docs/self-hosting/{server-database → platform}/dokploy.mdx +2 -2
- package/docs/self-hosting/{server-database → platform}/dokploy.zh-CN.mdx +2 -2
- package/docs/self-hosting/platform/repocloud.mdx +11 -10
- package/docs/self-hosting/platform/repocloud.zh-CN.mdx +13 -11
- package/docs/self-hosting/platform/sealos.mdx +79 -13
- package/docs/self-hosting/platform/sealos.zh-CN.mdx +92 -11
- package/docs/self-hosting/platform/vercel.mdx +323 -19
- package/docs/self-hosting/platform/vercel.zh-CN.mdx +318 -24
- package/docs/self-hosting/platform/zeabur.mdx +41 -37
- package/docs/self-hosting/platform/zeabur.zh-CN.mdx +34 -39
- package/docs/self-hosting/server-database.mdx +6 -6
- package/docs/self-hosting/server-database.zh-CN.mdx +5 -5
- package/package.json +1 -1
- package/packages/types/src/user/preference.ts +2 -2
- package/scripts/_shared/checkDeprecatedAuth.js +16 -0
- package/src/libs/next/proxy/createRouteMatcher.test.ts +0 -8
- package/src/libs/trpc/middleware/userAuth.test.ts +0 -6
- package/src/proxy.ts +0 -1
- package/src/server/routers/async/__tests__/caller.test.ts +2 -2
- package/src/server/routers/lambda/config/index.test.ts +0 -6
- package/src/tools/artifacts/systemRole.ts +84 -120
- package/docs/self-hosting/platform/alibaba-cloud.mdx +0 -28
- package/docs/self-hosting/platform/alibaba-cloud.zh-CN.mdx +0 -25
- package/docs/self-hosting/platform/btpanel.mdx +0 -48
- package/docs/self-hosting/platform/btpanel.zh-CN.mdx +0 -51
- package/docs/self-hosting/platform/netlify.mdx +0 -91
- package/docs/self-hosting/platform/netlify.zh-CN.mdx +0 -86
- package/docs/self-hosting/platform/railway.mdx +0 -29
- package/docs/self-hosting/platform/railway.zh-CN.mdx +0 -29
- package/docs/self-hosting/platform/tencentcloud-lighthouse.mdx +0 -29
- package/docs/self-hosting/platform/tencentcloud-lighthouse.zh-CN.mdx +0 -26
- package/docs/self-hosting/server-database/docker-compose.mdx +0 -879
- package/docs/self-hosting/server-database/docker-compose.zh-CN.mdx +0 -854
- package/docs/self-hosting/server-database/docker.mdx +0 -154
- package/docs/self-hosting/server-database/docker.zh-CN.mdx +0 -153
- package/docs/self-hosting/server-database/netlify.mdx +0 -13
- package/docs/self-hosting/server-database/netlify.zh-CN.mdx +0 -16
- package/docs/self-hosting/server-database/railway.mdx +0 -13
- package/docs/self-hosting/server-database/railway.zh-CN.mdx +0 -15
- package/docs/self-hosting/server-database/repocloud.mdx +0 -33
- package/docs/self-hosting/server-database/repocloud.zh-CN.mdx +0 -32
- package/docs/self-hosting/server-database/sealos.mdx +0 -97
- package/docs/self-hosting/server-database/sealos.zh-CN.mdx +0 -112
- package/docs/self-hosting/server-database/vercel.mdx +0 -344
- package/docs/self-hosting/server-database/vercel.zh-CN.mdx +0 -337
- package/docs/self-hosting/server-database/zeabur.mdx +0 -76
- package/docs/self-hosting/server-database/zeabur.zh-CN.mdx +0 -67
|
@@ -1,344 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: Deploy LobeHub with database on Vercel
|
|
3
|
-
description: >-
|
|
4
|
-
Learn how to deploy LobeHub with database on Vercel with ease, including:
|
|
5
|
-
database, authentication and S3 storage service.
|
|
6
|
-
tags:
|
|
7
|
-
- Deploy LobeHub
|
|
8
|
-
- Vercel Deployment
|
|
9
|
-
- Better Auth
|
|
10
|
-
- S3 Storage
|
|
11
|
-
---
|
|
12
|
-
|
|
13
|
-
# Deploying Server Database Version on Vercel
|
|
14
|
-
|
|
15
|
-
This article will detail how to deploy the server database version of LobeHub on Vercel, including: 1) database configuration; 2) identity authentication service configuration; 3) steps for setting up the S3 storage service.
|
|
16
|
-
|
|
17
|
-
<Callout type={'warning'}>
|
|
18
|
-
Before proceeding, please make sure of the following:
|
|
19
|
-
|
|
20
|
-
- Export all data, as after deploying the server-side database, existing user data cannot be automatically migrated and can only be manually imported after backup!
|
|
21
|
-
- When configuring the environment variables required for the server-side database, make sure to fill in all of them before deployment, otherwise you may encounter database migration issues!
|
|
22
|
-
</Callout>
|
|
23
|
-
|
|
24
|
-
## 1. Configure the Database
|
|
25
|
-
|
|
26
|
-
<Steps>
|
|
27
|
-
### Prepare the Server Database Instance and Obtain the Connection URL
|
|
28
|
-
|
|
29
|
-
Before deployment, make sure you have prepared a Postgres database instance. You can choose one of the following methods:
|
|
30
|
-
|
|
31
|
-
- `A.` Use Serverless Postgres instances like Vercel / Neon;
|
|
32
|
-
- `B.` Use self-deployed Postgres instances like Docker.
|
|
33
|
-
|
|
34
|
-
The configuration for both methods is slightly different, and will be distinguished in the next step.
|
|
35
|
-
|
|
36
|
-
### Add Environment Variables in Vercel
|
|
37
|
-
|
|
38
|
-
In Vercel's deployment environment variables, add `DATABASE_URL` and other environment variables, and fill in the Postgres database connection URL prepared in the previous step. The typical format for the database connection URL is `postgres://username:password@host:port/database`.
|
|
39
|
-
|
|
40
|
-
<Tabs items={['Serverless Postgres', 'Node Postgres']}>
|
|
41
|
-
<Tab>
|
|
42
|
-
<Callout type={'warning'}>
|
|
43
|
-
Please confirm the `Postgres` type provided by your vendor. If it is `Node Postgres`, switch to
|
|
44
|
-
the `Node Postgres` Tab.
|
|
45
|
-
</Callout>
|
|
46
|
-
|
|
47
|
-
Variables to be filled for Serverless Postgres are as follows:
|
|
48
|
-
|
|
49
|
-
```shell
|
|
50
|
-
# Serverless Postgres DB Url
|
|
51
|
-
DATABASE_URL=
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
An example of filling in Vercel is as follows:
|
|
55
|
-
|
|
56
|
-
<Image alt={'Add Serverless Postgres DATABASE_URL'} src={'/blog/assets28616219/d4a710cd-6404-4196-90d0-cd08ca385074.webp'} />
|
|
57
|
-
</Tab>
|
|
58
|
-
|
|
59
|
-
<Tab>
|
|
60
|
-
Variables to be filled for Node Postgres are as follows:
|
|
61
|
-
|
|
62
|
-
```shell
|
|
63
|
-
# Node Postgres DB Url
|
|
64
|
-
DATABASE_URL=
|
|
65
|
-
|
|
66
|
-
# Specify Postgres database driver as node
|
|
67
|
-
DATABASE_DRIVER=node
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
An example of filling in Vercel is as follows:
|
|
71
|
-
|
|
72
|
-
<Image alt={'Add Node Postgres DATABASE_URL'} src={'/blog/assets28616219/1c689738-809b-4199-b305-ba5770d39da7.webp'} />
|
|
73
|
-
</Tab>
|
|
74
|
-
</Tabs>
|
|
75
|
-
|
|
76
|
-
<Callout type={'info'}>
|
|
77
|
-
If you wish to enable SSL when connecting to the database, please refer to the
|
|
78
|
-
[link](https://stackoverflow.com/questions/14021998/using-psql-to-connect-to-postgresql-in-ssl-mode)
|
|
79
|
-
for setup instructions.
|
|
80
|
-
</Callout>
|
|
81
|
-
|
|
82
|
-
### Add the `KEY_VAULTS_SECRET` Environment Variable
|
|
83
|
-
|
|
84
|
-
After adding the `DATABASE_URL` environment variable for the database, you need to add a `KEY_VAULTS_SECRET` environment variable. This variable is used to encrypt sensitive information such as apikeys stored by users. Click the button below to generate:
|
|
85
|
-
|
|
86
|
-
<GenerateSecret envName="KEY_VAULTS_SECRET" />
|
|
87
|
-
|
|
88
|
-
Make sure to add this to the Vercel environment variables as well.
|
|
89
|
-
|
|
90
|
-
### Add the `APP_URL` Environment Variable
|
|
91
|
-
|
|
92
|
-
Finally, you need to add the `APP_URL` environment variable, which specifies the URL address of the LobeHub application.
|
|
93
|
-
</Steps>
|
|
94
|
-
|
|
95
|
-
## 2. Configure Authentication Service
|
|
96
|
-
|
|
97
|
-
The server-side database needs to be paired with a user authentication service to function properly. Therefore, the corresponding authentication service needs to be configured.
|
|
98
|
-
|
|
99
|
-
<Steps>
|
|
100
|
-
### Add Authentication Environment Variables
|
|
101
|
-
|
|
102
|
-
In Vercel's deployment environment variables, add the following environment variables to enable authentication (powered by [Better Auth](https://www.better-auth.com)):
|
|
103
|
-
|
|
104
|
-
Click the button below to generate `AUTH_SECRET` (session encryption key):
|
|
105
|
-
|
|
106
|
-
<GenerateSecret envName="AUTH_SECRET" />
|
|
107
|
-
|
|
108
|
-
You also need to configure the `JWKS_KEY` environment variable for signing and verifying JWTs. Click the button below to generate:
|
|
109
|
-
|
|
110
|
-
<GenerateJWKSKey />
|
|
111
|
-
|
|
112
|
-
With these variables, users can register and login with email and password.
|
|
113
|
-
|
|
114
|
-
<Callout type={'info'}>
|
|
115
|
-
For advanced features like SSO providers, magic link login, and email verification, see [Authentication Service](/docs/self-hosting/advanced/auth).
|
|
116
|
-
</Callout>
|
|
117
|
-
|
|
118
|
-
### Add Public and Private Key Environment Variables in Vercel
|
|
119
|
-
|
|
120
|
-
In Vercel's deployment environment variables, add the `NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY` and `CLERK_SECRET_KEY` environment variables. You can click on "API Keys" in the menu, then copy the corresponding values and paste them into Vercel's environment variables.
|
|
121
|
-
|
|
122
|
-
<Image alt={'Find the corresponding public and private key environment variables in Clerk'} src={'/blog/assets28616219/89883703-7a1a-4a11-b944-5d804544e57c.webp'} />
|
|
123
|
-
|
|
124
|
-
The environment variables required for this step are as follows:
|
|
125
|
-
|
|
126
|
-
```shell
|
|
127
|
-
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_live_xxxxxxxxxxx
|
|
128
|
-
CLERK_SECRET_KEY=sk_live_xxxxxxxxxxxxxxxxxxxxxx
|
|
129
|
-
```
|
|
130
|
-
|
|
131
|
-
Add the above variables to Vercel:
|
|
132
|
-
|
|
133
|
-
<Image alt={'Add Clerk public and private key environment variables in Vercel'} src={'/blog/assets28616219/2bfa13df-6e20-4768-97c0-4dad06c85a2f.webp'} />
|
|
134
|
-
|
|
135
|
-
### Create and Configure Webhook in Clerk
|
|
136
|
-
|
|
137
|
-
Since we let Clerk fully handle user authentication and management, we need Clerk to notify our application and store data in the database when there are changes in the user's lifecycle (create, update, delete). We achieve this requirement through the Webhook provided by Clerk.
|
|
138
|
-
|
|
139
|
-
We need to add an endpoint in Clerk's Webhooks to inform Clerk to send notifications to this endpoint when a user's information changes.
|
|
140
|
-
|
|
141
|
-
<Image alt={'Add Webhooks endpoint in Clerk'} src={'/blog/assets28616219/f50f47fb-5e8e-4930-bf4e-8cf6f5b8afb9.webp'} />
|
|
142
|
-
|
|
143
|
-
Fill in the endpoint with the URL of your Vercel project, such as `https://your-project.vercel.app/api/webhooks/clerk`. Then, subscribe to events by checking the three user events (`user.created`, `user.deleted`, `user.updated`), and click create.
|
|
144
|
-
|
|
145
|
-
<Callout type={'warning'}>
|
|
146
|
-
The `https://` in the URL is essential to maintain the integrity of the URL.
|
|
147
|
-
</Callout>
|
|
148
|
-
|
|
149
|
-
<Image alt={'Configure URL and user events when adding Clerk Webhooks'} src={'/blog/assets28616219/0249ea56-ab17-4aa9-a56c-9ebd556c2645.webp'} />
|
|
150
|
-
|
|
151
|
-
### Add Webhook Secret to Vercel Environment Variables
|
|
152
|
-
|
|
153
|
-
After creation, you can find the secret of this Webhook in the bottom right corner:
|
|
154
|
-
|
|
155
|
-
<Image alt={'View Clerk Webhooks secret'} src={'/blog/assets28616219/fab4abb2-584b-49de-9340-813382951635.webp'} />
|
|
156
|
-
|
|
157
|
-
The environment variable corresponding to this secret is `CLERK_WEBHOOK_SECRET`:
|
|
158
|
-
|
|
159
|
-
```shell
|
|
160
|
-
CLERK_WEBHOOK_SECRET=whsec_xxxxxxxxxxxxxxxxxxxxxx
|
|
161
|
-
```
|
|
162
|
-
|
|
163
|
-
Add it to Vercel's environment variables:
|
|
164
|
-
|
|
165
|
-
<Image alt={'Add Clerk Webhooks secret in Vercel'} src={'/blog/assets28616219/5fdc9479-007f-46ab-9d6e-a9603e949116.webp'} />
|
|
166
|
-
</Steps>
|
|
167
|
-
|
|
168
|
-
By completing these steps, you have successfully configured the authentication service. Next, we will configure the S3 storage service.
|
|
169
|
-
|
|
170
|
-
## 3. Configure S3 Storage Service
|
|
171
|
-
|
|
172
|
-
In the server-side database, we need to configure the S3 storage service to store files.
|
|
173
|
-
|
|
174
|
-
<Callout type={'info'}>
|
|
175
|
-
In this article, S3 refers to a compatible S3 storage solution, which supports object storage
|
|
176
|
-
systems that comply with the Amazon S3 API. Common examples include Cloudflare R2, Alibaba Cloud
|
|
177
|
-
OSS, etc., all of which support S3-compatible APIs.
|
|
178
|
-
</Callout>
|
|
179
|
-
|
|
180
|
-
<Steps>
|
|
181
|
-
### Configure and Obtain S3 Bucket
|
|
182
|
-
|
|
183
|
-
You need to go to your S3 service provider (such as AWS S3, Cloudflare R2, etc.) and create a new storage bucket. The following steps will use Cloudflare R2 as an example to explain the creation process.
|
|
184
|
-
|
|
185
|
-
The interface of Cloudflare R2 is shown below:
|
|
186
|
-
|
|
187
|
-
<Image alt={'Cloudflare R2 Storage Interface'} src={'/blog/assets28616219/41f7f677-0153-4a96-b849-5ac9b7ebefee.webp'} />
|
|
188
|
-
|
|
189
|
-
When creating a storage bucket, specify its name and then click create.
|
|
190
|
-
|
|
191
|
-
<Image alt={'Create Storage Bucket in R2'} src={'/blog/assets28616219/9c0d184c-3169-40fa-9115-011cfffb9ca7.webp'} />
|
|
192
|
-
|
|
193
|
-
### Obtain Environment Variables for the Bucket
|
|
194
|
-
|
|
195
|
-
In the settings of the R2 storage bucket, you can view the bucket configuration information:
|
|
196
|
-
|
|
197
|
-
<Image alt={'View Storage Bucket Information'} src={'/blog/assets28616219/2ceb210c-eca0-4439-ba27-8734d4ebb3ee.webp'} />
|
|
198
|
-
|
|
199
|
-
The corresponding environment variables are:
|
|
200
|
-
|
|
201
|
-
```shell
|
|
202
|
-
# Storage bucket name
|
|
203
|
-
S3_BUCKET=LobeHub
|
|
204
|
-
# Storage bucket request endpoint (note that the path in this link includes the bucket name, which must be removed, or use the link provided on the S3 API token application page)
|
|
205
|
-
S3_ENDPOINT=https://0b33a03b5c993fd2f453379dc36558e5.r2.cloudflarestorage.com
|
|
206
|
-
# Public access domain for the storage bucket
|
|
207
|
-
S3_PUBLIC_DOMAIN=https://s3-for-LobeHub.your-domain.com
|
|
208
|
-
```
|
|
209
|
-
|
|
210
|
-
<Callout type={'warning'}>
|
|
211
|
-
`S3_ENDPOINT` must have its path removed, otherwise uploaded files will not be accessible
|
|
212
|
-
</Callout>
|
|
213
|
-
|
|
214
|
-
### Obtain S3 Key Environment Variables
|
|
215
|
-
|
|
216
|
-
You need to obtain the access key for S3 so that the LobeHub server has permission to access the S3 storage service. In R2, you can configure the access key in the account details:
|
|
217
|
-
|
|
218
|
-
<Image alt={'View Storage Bucket Access Key'} src={'/blog/assets28616219/be0c95c0-6693-44ee-a490-7e8dfaa8b34d.webp'} />
|
|
219
|
-
|
|
220
|
-
Click the button in the upper right corner to create an API token and enter the create API Token page.
|
|
221
|
-
|
|
222
|
-
<Image alt={'Create Corresponding API Token'} src={'/blog/assets28616219/7b0ea46c-5157-40a8-888f-f47664a4884f.webp'} />
|
|
223
|
-
|
|
224
|
-
Since our server-side database needs to read and write to the S3 storage service, the permission needs to be set to `Object Read and Write`, then click create.
|
|
225
|
-
|
|
226
|
-
<Image alt={'Configure API Token Permissions'} src={'/blog/assets28616219/d6f5a918-7b50-4d6e-83a6-3894ab930ddf.webp'} />
|
|
227
|
-
|
|
228
|
-
After creation, you can see the corresponding S3 API token.
|
|
229
|
-
|
|
230
|
-
<Image alt={'Copy API Token'} src={'/blog/assets28616219/763b18f9-2b5f-44bb-a479-9b56d46f7397.webp'} />
|
|
231
|
-
|
|
232
|
-
The corresponding environment variables are:
|
|
233
|
-
|
|
234
|
-
```shell
|
|
235
|
-
S3_ACCESS_KEY_ID=9998d6757e276cf9f1edbd325b7083a6
|
|
236
|
-
S3_SECRET_ACCESS_KEY=55af75d8eb6b99f189f6a35f855336ea62cd9c4751a5cf4337c53c1d3f497ac2
|
|
237
|
-
```
|
|
238
|
-
|
|
239
|
-
### Adding Corresponding Environment Variables in Vercel
|
|
240
|
-
|
|
241
|
-
The steps to obtain the required environment variables may vary for different S3 service providers, but the obtained environment variables should be consistent:
|
|
242
|
-
|
|
243
|
-
<Callout type={'warning'}>
|
|
244
|
-
The `https://` in the URL is essential and must be maintained for the completeness of the URL.
|
|
245
|
-
</Callout>
|
|
246
|
-
|
|
247
|
-
```shell
|
|
248
|
-
# S3 Keys
|
|
249
|
-
S3_ACCESS_KEY_ID=9998d6757e276cf9f1edbd325b7083a6
|
|
250
|
-
S3_SECRET_ACCESS_KEY=55af75d8eb6b99f189f6a35f855336ea62cd9c4751a5cf4337c53c1d3f497ac2
|
|
251
|
-
|
|
252
|
-
# Bucket name
|
|
253
|
-
S3_BUCKET=LobeHub
|
|
254
|
-
# Bucket request endpoint
|
|
255
|
-
S3_ENDPOINT=https://0b33a03b5c993fd2f453379dc36558e5.r2.cloudflarestorage.com
|
|
256
|
-
# Public domain for bucket access
|
|
257
|
-
S3_PUBLIC_DOMAIN=https://s3-dev.your-domain.com
|
|
258
|
-
|
|
259
|
-
# Bucket region, such as us-west-1, generally not required, but some providers may need to configure
|
|
260
|
-
# S3_REGION=us-west-1
|
|
261
|
-
```
|
|
262
|
-
|
|
263
|
-
Then, insert the above environment variables into Vercel's environment variables:
|
|
264
|
-
|
|
265
|
-
<Image alt={'Adding S3 environment variables in Vercel'} src={'/blog/assets28616219/cd74152d-0ae8-44fd-b815-3307c56a3c18.webp'} />
|
|
266
|
-
|
|
267
|
-
### Configuring Cross-Origin Resource Sharing (CORS)
|
|
268
|
-
|
|
269
|
-
Since S3 storage services are often on a separate domain, cross-origin access needs to be configured.
|
|
270
|
-
|
|
271
|
-
In R2, you can find the CORS configuration in the bucket settings:
|
|
272
|
-
|
|
273
|
-
<Image alt={'Cloudflare R2 CORS settings'} src={'/blog/assets28616219/ab008be7-26b2-4b78-8bd9-24301bf34d23.webp'} />
|
|
274
|
-
|
|
275
|
-
Add a CORS rule to allow requests from your domain (in this case, `https://your-project.vercel.app`):
|
|
276
|
-
|
|
277
|
-
<Image alt={'Configuring allowed site domain'} src={'/blog/assets28616219/dfcc2cb3-2958-4498-a8a4-51bec584fe7d.webp'} />
|
|
278
|
-
|
|
279
|
-
Example configuration:
|
|
280
|
-
|
|
281
|
-
```json
|
|
282
|
-
[
|
|
283
|
-
{
|
|
284
|
-
"AllowedOrigins": ["https://your-project.vercel.app"],
|
|
285
|
-
"AllowedMethods": ["GET", "PUT", "HEAD", "POST", "DELETE"],
|
|
286
|
-
"AllowedHeaders": ["*"]
|
|
287
|
-
}
|
|
288
|
-
]
|
|
289
|
-
```
|
|
290
|
-
|
|
291
|
-
After configuring, click save.
|
|
292
|
-
</Steps>
|
|
293
|
-
|
|
294
|
-
## Four, Deployment and Verification
|
|
295
|
-
|
|
296
|
-
After completing the steps above, the configuration of the server-side database should be done. Next, we can deploy LobeHub to Vercel and then visit your Vercel link to verify if the server-side database is working correctly.
|
|
297
|
-
|
|
298
|
-
<Steps>
|
|
299
|
-
### Redeploy the latest commit
|
|
300
|
-
|
|
301
|
-
After configuring the environment variables, you need to redeploy the latest commit and wait for the deployment to complete.
|
|
302
|
-
|
|
303
|
-
<Image alt={'Redeploy the latest commit'} src={'/blog/assets28616219/b3a78112-adc8-4837-b4e3-48f67058f16e.webp'} />
|
|
304
|
-
|
|
305
|
-
### Check if the features are working properly
|
|
306
|
-
|
|
307
|
-
If you click on the login button in the top left corner and the login popup appears normally, then you have successfully configured it. Enjoy using it\~
|
|
308
|
-
|
|
309
|
-
<Image alt={'User login popup'} src={'/blog/assets28616219/da84edc3-46f7-4e2b-a0cd-dc33a98bf5cb.webp'} />
|
|
310
|
-
|
|
311
|
-
<Image alt={'Login successful state'} src={'/blog/assets28616219/9cb5150d-6e1e-4c59-9a18-4e418dce1a5d.webp'} />
|
|
312
|
-
</Steps>
|
|
313
|
-
|
|
314
|
-
## Appendix
|
|
315
|
-
|
|
316
|
-
### Overview of Server-side Database Environment Variables
|
|
317
|
-
|
|
318
|
-
For easy copying, here is a summary of the environment variables required to configure the server-side database:
|
|
319
|
-
|
|
320
|
-
```shell
|
|
321
|
-
APP_URL=https://your-project.com
|
|
322
|
-
|
|
323
|
-
# Postgres database URL
|
|
324
|
-
DATABASE_URL=
|
|
325
|
-
KEY_VAULTS_SECRET=jgwsK28dspyVQoIf8/M3IIHl1h6LYYceSYNXeLpy6uk=
|
|
326
|
-
|
|
327
|
-
# Authentication
|
|
328
|
-
AUTH_SECRET=jgwsK28dspyVQoIf8/M3IIHl1h6LYYceSYNXeLpy6uk=
|
|
329
|
-
JWKS_KEY='{"keys":[...]}'
|
|
330
|
-
|
|
331
|
-
# S3 related configurations
|
|
332
|
-
# S3 keys
|
|
333
|
-
S3_ACCESS_KEY_ID=9998d6757e276cf9f1edbd325b7083a6
|
|
334
|
-
S3_SECRET_ACCESS_KEY=55af75d8eb6b99f189f6a35f855336ea62cd9c4751a5cf4337c53c1d3f497ac2
|
|
335
|
-
|
|
336
|
-
# Bucket name
|
|
337
|
-
S3_BUCKET=LobeHub
|
|
338
|
-
# Bucket request endpoint
|
|
339
|
-
S3_ENDPOINT=https://0b33a03b5c993fd2f453379dc36558e5.r2.cloudflarestorage.com
|
|
340
|
-
# Public access domain for the bucket
|
|
341
|
-
S3_PUBLIC_DOMAIN=https://s3-for-LobeHub.your-domain.com
|
|
342
|
-
# Bucket region, such as us-west-1, generally not needed to add, but some service providers may require configuration
|
|
343
|
-
# S3_REGION=us-west-1
|
|
344
|
-
```
|
|
@@ -1,337 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: 在 Vercel 上部署 LobeHub 的服务端数据库版本
|
|
3
|
-
description: 本文详细介绍如何在 Vercel 中部署服务端数据库版 LobeHub,包括数据库配置、身份验证服务配置和 S3 存储服务的设置步骤。
|
|
4
|
-
tags:
|
|
5
|
-
- 服务端数据库
|
|
6
|
-
- Postgres
|
|
7
|
-
- Better Auth
|
|
8
|
-
- S3存储服务
|
|
9
|
-
- Vercel部署
|
|
10
|
-
- 数据库配置
|
|
11
|
-
- 身份验证服务
|
|
12
|
-
- 环境变量配置
|
|
13
|
-
---
|
|
14
|
-
|
|
15
|
-
# 在 Vercel 上部署服务端数据库版
|
|
16
|
-
|
|
17
|
-
本文将详细介绍如何在 Vercel 中部署服务端数据库版 LobeHub,包括: 1)数据库配置;2)身份验证服务配置;3) S3 存储服务的设置步骤。
|
|
18
|
-
|
|
19
|
-
<Callout type={'warning'}>
|
|
20
|
-
进行后续操作前,请务必确认以下事项:
|
|
21
|
-
|
|
22
|
-
- 导出所有数据,部署服务端数据库后,原有用户数据无法自动迁移,只能提前备份后进行手动导入!
|
|
23
|
-
- 配置服务端数据库所需要的环境变量时,需全部填入后再进行部署,否则可能遭遇数据库迁移问题!
|
|
24
|
-
</Callout>
|
|
25
|
-
|
|
26
|
-
## 一、 配置数据库
|
|
27
|
-
|
|
28
|
-
<Steps>
|
|
29
|
-
### 准备服务端数据库实例,获取连接 URL
|
|
30
|
-
|
|
31
|
-
在部署之前,请确保你已经准备好 Postgres 数据库实例,你可以选择以下任一方式:
|
|
32
|
-
|
|
33
|
-
- `A.` 使用 Vercel / Neon 等 Serverless Postgres 实例;
|
|
34
|
-
- `B.` 使用 Docker 等自部署 Postgres 实例。
|
|
35
|
-
|
|
36
|
-
两者的配置方式略有不同,在下一步会有所区分。
|
|
37
|
-
|
|
38
|
-
### 在 Vercel 中添加环境变量
|
|
39
|
-
|
|
40
|
-
在 Vercel 的部署环境变量中,添加 `DATABASE_URL` 等环境变量,将上一步准备好的 Postgres 数据库连接 URL 填入其中。数据库连接 URL 的通常格式为 `postgres://username:password@host:port/database`。
|
|
41
|
-
|
|
42
|
-
<Tabs items={['Serverless Postgres', 'Node Postgres']}>
|
|
43
|
-
<Tab>
|
|
44
|
-
<Callout type={'warning'}>
|
|
45
|
-
请确认您的供应商所提供的 `Postgres` 类型,若为 `Node Postgres`,请切换到 `Node Postgres` Tab 。
|
|
46
|
-
</Callout>
|
|
47
|
-
|
|
48
|
-
Serverless Postgres 需要填写的变量如下:
|
|
49
|
-
|
|
50
|
-
```shell
|
|
51
|
-
# Serverless Postgres DB Url
|
|
52
|
-
DATABASE_URL=
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
在 Vercel 中填写的示例如下:
|
|
56
|
-
|
|
57
|
-
<Image alt={'添加 Serverless Postgres DATABASE_URL'} src={'/blog/assets28616219/d4a710cd-6404-4196-90d0-cd08ca385074.webp'} />
|
|
58
|
-
</Tab>
|
|
59
|
-
|
|
60
|
-
<Tab>
|
|
61
|
-
Node Postgres 需要填写的变量如下:
|
|
62
|
-
|
|
63
|
-
```shell
|
|
64
|
-
# Node Postgres DB Url
|
|
65
|
-
DATABASE_URL=
|
|
66
|
-
|
|
67
|
-
# 指定 Postgres database driver 为 node
|
|
68
|
-
DATABASE_DRIVER=node
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
在 Vercel 中填写的示例如下:
|
|
72
|
-
|
|
73
|
-
<Image alt={'添加 Node Postgres DATABASE_URL'} src={'/blog/assets28616219/1c689738-809b-4199-b305-ba5770d39da7.webp'} />
|
|
74
|
-
</Tab>
|
|
75
|
-
</Tabs>
|
|
76
|
-
|
|
77
|
-
<Callout type={'info'}>
|
|
78
|
-
如果希望连接数据库时启用 SSL
|
|
79
|
-
,请自行参考[链接](https://stackoverflow.com/questions/14021998/using-psql-to-connect-to-postgresql-in-ssl-mode)进行设置
|
|
80
|
-
</Callout>
|
|
81
|
-
|
|
82
|
-
### 添加 `KEY_VAULTS_SECRET` 环境变量
|
|
83
|
-
|
|
84
|
-
在完成数据库 `DATABASE_URL` 环境变量添加后,需要添加一个 `KEY_VAULTS_SECRET` 环境变量。该变量用于加密用户存储的 apikey 等敏感信息。点击下方按钮一键生成:
|
|
85
|
-
|
|
86
|
-
<GenerateSecret envName="KEY_VAULTS_SECRET" />
|
|
87
|
-
|
|
88
|
-
同样需要将其添加到 Vercel 环境变量中。
|
|
89
|
-
|
|
90
|
-
### 添加 `APP_URL` 环境变量
|
|
91
|
-
|
|
92
|
-
该部分最后需要添加 `APP_URL` 环境变量,用于指定 LobeHub 应用的 URL 地址。
|
|
93
|
-
</Steps>
|
|
94
|
-
|
|
95
|
-
## 二、 配置身份验证服务
|
|
96
|
-
|
|
97
|
-
服务端数据库需要搭配用户身份验证服务才可以正常使用。因此需要配置对应的身份验证服务。
|
|
98
|
-
|
|
99
|
-
<Steps>
|
|
100
|
-
### 添加身份验证环境变量
|
|
101
|
-
|
|
102
|
-
在 Vercel 的部署环境变量中,添加以下环境变量以启用身份验证(基于 [Better Auth](https://www.better-auth.com)):
|
|
103
|
-
|
|
104
|
-
点击下方按钮一键生成 `AUTH_SECRET`(会话加密密钥):
|
|
105
|
-
|
|
106
|
-
<GenerateSecret envName="AUTH_SECRET" />
|
|
107
|
-
|
|
108
|
-
同时需要配置 `JWKS_KEY` 环境变量,用于签名和验证 JWT。点击下方按钮一键生成:
|
|
109
|
-
|
|
110
|
-
<GenerateJWKSKey />
|
|
111
|
-
|
|
112
|
-
配置这些变量后,用户即可使用邮箱和密码注册登录。
|
|
113
|
-
|
|
114
|
-
<Callout type={'info'}>
|
|
115
|
-
如需 SSO 登录、魔法链接登录、邮箱验证等高级功能,请参阅 [身份验证服务](/zh/docs/self-hosting/advanced/auth)。
|
|
116
|
-
</Callout>
|
|
117
|
-
|
|
118
|
-
### 在 Vercel 中添加公、私钥环境变量
|
|
119
|
-
|
|
120
|
-
在 Vercel 的部署环境变量中,添加 `NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY` 和 `CLERK_SECRET_KEY` 环境变量。你可以在菜单中点击「API Keys」,然后复制对应的值填入 Vercel 的环境变量中。
|
|
121
|
-
|
|
122
|
-
<Image alt={'在 Clerk 中找到对应的公私钥环境变量'} src={'/blog/assets28616219/89883703-7a1a-4a11-b944-5d804544e57c.webp'} />
|
|
123
|
-
|
|
124
|
-
此步骤所需的环境变量如下:
|
|
125
|
-
|
|
126
|
-
```shell
|
|
127
|
-
NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=pk_live_xxxxxxxxxxx
|
|
128
|
-
CLERK_SECRET_KEY=sk_live_xxxxxxxxxxxxxxxxxxxxxx
|
|
129
|
-
```
|
|
130
|
-
|
|
131
|
-
添加上述变量到 Vercel 中:
|
|
132
|
-
|
|
133
|
-
<Image alt={'在 Vercel 中添加 Clerk 公私钥环境变量'} src={'/blog/assets28616219/2bfa13df-6e20-4768-97c0-4dad06c85a2f.webp'} />
|
|
134
|
-
|
|
135
|
-
### 在 Clerk 中创建并配置 Webhook
|
|
136
|
-
|
|
137
|
-
由于我们让 Clerk 完全接管用户鉴权与管理,因此我们需要在 Clerk 用户生命周期变更时(创建、更新、删除)中通知我们的应用并存储落库。我们通过 Clerk 提供的 Webhook 来实现这一诉求。
|
|
138
|
-
|
|
139
|
-
我们需要在 Clerk 的 Webhooks 中添加一个端点(Endpoint),告诉 Clerk 当用户发生变更时,向这个端点发送通知。
|
|
140
|
-
|
|
141
|
-
<Image alt={'Clerk 添加 Webhooks 端点'} src={'/blog/assets28616219/f50f47fb-5e8e-4930-bf4e-8cf6f5b8afb9.webp'} />
|
|
142
|
-
|
|
143
|
-
在 endpoint 中填写你的 Vercel 项目的 URL,如 `https://your-project.vercel.app/api/webhooks/clerk`。然后在订阅事件(Subscribe to events)中,勾选 user 的三个事件(`user.created` 、`user.deleted`、`user.updated`),然后点击创建。
|
|
144
|
-
|
|
145
|
-
<Callout type={'warning'}>URL 的`https://`不可缺失,须保持 URL 的完整性</Callout>
|
|
146
|
-
|
|
147
|
-
<Image alt={'添加 Clerk Webhooks 时,配置 URL 和用户事件'} src={'/blog/assets28616219/0249ea56-ab17-4aa9-a56c-9ebd556c2645.webp'} />
|
|
148
|
-
|
|
149
|
-
### 将 Webhook 秘钥添加到 Vercel 环境变量
|
|
150
|
-
|
|
151
|
-
创建完毕后,可以在右下角找到该 Webhook 的秘钥:
|
|
152
|
-
|
|
153
|
-
<Image alt={'查看 Clerk Webhooks 秘钥'} src={'/blog/assets28616219/fab4abb2-584b-49de-9340-813382951635.webp'} />
|
|
154
|
-
|
|
155
|
-
这个秘钥所对应的环境变量名为 `CLERK_WEBHOOK_SECRET`:
|
|
156
|
-
|
|
157
|
-
```shell
|
|
158
|
-
CLERK_WEBHOOK_SECRET=whsec_xxxxxxxxxxxxxxxxxxxxxx
|
|
159
|
-
```
|
|
160
|
-
|
|
161
|
-
将其添加到 Vercel 的环境变量中:
|
|
162
|
-
|
|
163
|
-
<Image alt={'在 Vercel 中 添加 Clerk Webhooks 秘钥'} src={'/blog/assets28616219/5fdc9479-007f-46ab-9d6e-a9603e949116.webp'} />
|
|
164
|
-
</Steps>
|
|
165
|
-
|
|
166
|
-
这样,你已经成功配置了身份验证服务。接下来我们将配置 S3 存储服务。
|
|
167
|
-
|
|
168
|
-
## 三、 配置 S3 存储服务
|
|
169
|
-
|
|
170
|
-
在服务端数据库中我们需要配置 S3 存储服务来存储文件。
|
|
171
|
-
|
|
172
|
-
<Callout type={'info'}>
|
|
173
|
-
在本文,S3 所指代的是指兼容 S3 存储方案,即支持 Amazon S3 API 的对象存储系统,常见例如 Cloudflare
|
|
174
|
-
R2 、阿里云 OSS 等均支持 S3 兼容 API。
|
|
175
|
-
</Callout>
|
|
176
|
-
|
|
177
|
-
<Steps>
|
|
178
|
-
### 配置并获取 S3 存储桶
|
|
179
|
-
|
|
180
|
-
你需要前往你的 S3 服务提供商(如 AWS S3、Cloudflare R2 等)并创建一个新的存储桶(Bucket)。接下来以 Cloudflare R2 为例,介绍创建流程。
|
|
181
|
-
|
|
182
|
-
下图是 Cloudflare R2 的界面:
|
|
183
|
-
|
|
184
|
-
<Image alt={'Cloudflare R2 存储界面'} src={'/blog/assets28616219/41f7f677-0153-4a96-b849-5ac9b7ebefee.webp'} />
|
|
185
|
-
|
|
186
|
-
创建存储桶时将指定其名称,然后点击创建。
|
|
187
|
-
|
|
188
|
-
<Image alt={'R2 创建存储桶'} src={'/blog/assets28616219/9c0d184c-3169-40fa-9115-011cfffb9ca7.webp'} />
|
|
189
|
-
|
|
190
|
-
### 获取存储桶相关环境变量
|
|
191
|
-
|
|
192
|
-
在 R2 存储桶的设置中,可以看到桶配置的信息:
|
|
193
|
-
|
|
194
|
-
<Image alt={'查看存储桶的相关信息'} src={'/blog/assets28616219/2ceb210c-eca0-4439-ba27-8734d4ebb3ee.webp'} />
|
|
195
|
-
|
|
196
|
-
其对应的环境变量为:
|
|
197
|
-
|
|
198
|
-
```shell
|
|
199
|
-
# 存储桶的名称
|
|
200
|
-
S3_BUCKET=LobeHub
|
|
201
|
-
# 存储桶的请求端点(注意此处链接的路径带存储桶名称,必须删除该路径,或使用申请 S3 API token 页面所提供的链接)
|
|
202
|
-
S3_ENDPOINT=https://0b33a03b5c993fd2f453379dc36558e5.r2.cloudflarestorage.com
|
|
203
|
-
# 存储桶对外的访问域名
|
|
204
|
-
S3_PUBLIC_DOMAIN=https://s3-for-LobeHub.your-domain.com
|
|
205
|
-
```
|
|
206
|
-
|
|
207
|
-
<Callout type={'warning'}>`S3_ENDPOINT`必须删除其路径,否则会无法访问所上传文件</Callout>
|
|
208
|
-
|
|
209
|
-
### 获取 S3 密钥环境变量
|
|
210
|
-
|
|
211
|
-
你需要获取 S3 的访问密钥,以便 LobeHub 的服务端有权限访问 S3 存储服务。在 R2 中,你可以在账户详情中配置访问密钥:
|
|
212
|
-
|
|
213
|
-
<Image alt={'查看存储桶的访问秘钥'} src={'/blog/assets28616219/be0c95c0-6693-44ee-a490-7e8dfaa8b34d.webp'} />
|
|
214
|
-
|
|
215
|
-
点击右上角按钮创建 API token,进入创建 API Token 页面
|
|
216
|
-
|
|
217
|
-
<Image alt={'创建对应 API token'} src={'/blog/assets28616219/7b0ea46c-5157-40a8-888f-f47664a4884f.webp'} />
|
|
218
|
-
|
|
219
|
-
鉴于我们的服务端数据库需要读写 S3 存储服务,因此权限需要选择`对象读与写`,然后点击创建。
|
|
220
|
-
|
|
221
|
-
<Image alt={'配置 API token 权限'} src={'/blog/assets28616219/d6f5a918-7b50-4d6e-83a6-3894ab930ddf.webp'} />
|
|
222
|
-
|
|
223
|
-
创建完成后,就可以看到对应的 S3 API token
|
|
224
|
-
|
|
225
|
-
<Image alt={'复制 API token'} src={'/blog/assets28616219/763b18f9-2b5f-44bb-a479-9b56d46f7397.webp'} />
|
|
226
|
-
|
|
227
|
-
其对应的环境变量为:
|
|
228
|
-
|
|
229
|
-
```shell
|
|
230
|
-
S3_ACCESS_KEY_ID=9998d6757e276cf9f1edbd325b7083a6
|
|
231
|
-
S3_SECRET_ACCESS_KEY=55af75d8eb6b99f189f6a35f855336ea62cd9c4751a5cf4337c53c1d3f497ac2
|
|
232
|
-
```
|
|
233
|
-
|
|
234
|
-
### 在 Vercel 中添加对应的环境变量
|
|
235
|
-
|
|
236
|
-
不同 S3 服务商获取所需环境变量的步骤可能有所不同,但最终获得到的环境变量应该都是一致的:
|
|
237
|
-
|
|
238
|
-
<Callout type={'warning'}>URL 的`https://`不可缺失,须保持 URL 的完整性</Callout>
|
|
239
|
-
|
|
240
|
-
```shell
|
|
241
|
-
# S3 秘钥
|
|
242
|
-
S3_ACCESS_KEY_ID=9998d6757e276cf9f1edbd325b7083a6
|
|
243
|
-
S3_SECRET_ACCESS_KEY=55af75d8eb6b99f189f6a35f855336ea62cd9c4751a5cf4337c53c1d3f497ac2
|
|
244
|
-
|
|
245
|
-
# 存储桶的名称
|
|
246
|
-
S3_BUCKET=LobeHub
|
|
247
|
-
# 存储桶的请求端点
|
|
248
|
-
S3_ENDPOINT=https://0b33a03b5c993fd2f453379dc36558e5.r2.cloudflarestorage.com
|
|
249
|
-
# 存储桶对外的访问域名
|
|
250
|
-
S3_PUBLIC_DOMAIN=https://s3-dev.your-domain.com
|
|
251
|
-
|
|
252
|
-
# 桶的区域,如 us-west-1,一般来说不需要添加,但某些服务商则需要配置
|
|
253
|
-
# S3_REGION=us-west-1
|
|
254
|
-
```
|
|
255
|
-
|
|
256
|
-
然后将上述环境变量填入 Vercel 的环境变量中:
|
|
257
|
-
|
|
258
|
-
<Image alt={'在 Vercel 中添加 S3 的环境变量'} src={'/blog/assets28616219/cd74152d-0ae8-44fd-b815-3307c56a3c18.webp'} />
|
|
259
|
-
|
|
260
|
-
### 配置跨域
|
|
261
|
-
|
|
262
|
-
由于 S3 存储服务往往是一个独立的网址,因此需要配置跨域访问。
|
|
263
|
-
|
|
264
|
-
在 R2 中,你可以在存储桶的设置中找到跨域配置:
|
|
265
|
-
|
|
266
|
-
<Image alt={'Cloudflare R2 的跨域设置'} src={'/blog/assets28616219/ab008be7-26b2-4b78-8bd9-24301bf34d23.webp'} />
|
|
267
|
-
|
|
268
|
-
添加跨域规则,允许你的域名(在上文是 `https://your-project.vercel.app`)来源的请求:
|
|
269
|
-
|
|
270
|
-
<Image alt={'配置允许你的站点域名'} src={'/blog/assets28616219/dfcc2cb3-2958-4498-a8a4-51bec584fe7d.webp'} />
|
|
271
|
-
|
|
272
|
-
示例配置如下:
|
|
273
|
-
|
|
274
|
-
```json
|
|
275
|
-
[
|
|
276
|
-
{
|
|
277
|
-
"AllowedOrigins": ["https://your-project.vercel.app"],
|
|
278
|
-
"AllowedMethods": ["GET", "PUT", "HEAD", "POST", "DELETE"],
|
|
279
|
-
"AllowedHeaders": ["*"]
|
|
280
|
-
}
|
|
281
|
-
]
|
|
282
|
-
```
|
|
283
|
-
|
|
284
|
-
配置后点击保存即可。
|
|
285
|
-
</Steps>
|
|
286
|
-
|
|
287
|
-
## 四、部署并验证
|
|
288
|
-
|
|
289
|
-
通过上述步骤之后,我们应该就完成了服务端数据库的配置。接下来我们可以将 LobeHub 部署到 Vercel 上,然后访问你的 Vercel 链接,验证服务端数据库是否正常工作。
|
|
290
|
-
|
|
291
|
-
<Steps>
|
|
292
|
-
### 重新部署最新的 commit
|
|
293
|
-
|
|
294
|
-
配置好环境变量后,你需要重新部署最新的 commit,并等待部署完成。
|
|
295
|
-
|
|
296
|
-
<Image alt={'重新部署最新的 commit'} src={'/blog/assets28616219/b3a78112-adc8-4837-b4e3-48f67058f16e.webp'} />
|
|
297
|
-
|
|
298
|
-
### 检查功能是否正常
|
|
299
|
-
|
|
300
|
-
如果你点击左上角登录,可以正常显示登录弹窗,那么说明你已经配置成功了,尽情享用吧~
|
|
301
|
-
|
|
302
|
-
<Image alt={'用户登录弹窗'} src={'/blog/assets28616219/da84edc3-46f7-4e2b-a0cd-dc33a98bf5cb.webp'} />
|
|
303
|
-
|
|
304
|
-
<Image alt={'登录成功状态'} src={'/blog/assets28616219/9cb5150d-6e1e-4c59-9a18-4e418dce1a5d.webp'} />
|
|
305
|
-
</Steps>
|
|
306
|
-
|
|
307
|
-
## 附录
|
|
308
|
-
|
|
309
|
-
### 服务端数据库环境变量一览
|
|
310
|
-
|
|
311
|
-
为方便一键复制,在此汇总配置服务端数据库所需要的环境变量:
|
|
312
|
-
|
|
313
|
-
```shell
|
|
314
|
-
APP_URL=https://your-project.com
|
|
315
|
-
|
|
316
|
-
# Postgres 数据库 URL
|
|
317
|
-
DATABASE_URL=
|
|
318
|
-
KEY_VAULTS_SECRET=jgwsK28dspyVQoIf8/M3IIHl1h6LYYceSYNXeLpy6uk=
|
|
319
|
-
|
|
320
|
-
# 身份验证
|
|
321
|
-
AUTH_SECRET=jgwsK28dspyVQoIf8/M3IIHl1h6LYYceSYNXeLpy6uk=
|
|
322
|
-
JWKS_KEY='{"keys":[...]}'
|
|
323
|
-
|
|
324
|
-
# S3 相关配置
|
|
325
|
-
# S3 秘钥
|
|
326
|
-
S3_ACCESS_KEY_ID=9998d6757e276cf9f1edbd325b7083a6
|
|
327
|
-
S3_SECRET_ACCESS_KEY=55af75d8eb6b99f189f6a35f855336ea62cd9c4751a5cf4337c53c1d3f497ac2
|
|
328
|
-
|
|
329
|
-
# 存储桶的名称
|
|
330
|
-
S3_BUCKET=LobeHub
|
|
331
|
-
# 存储桶的请求端点
|
|
332
|
-
S3_ENDPOINT=https://0b33a03b5c993fd2f453379dc36558e5.r2.cloudflarestorage.com
|
|
333
|
-
# 存储桶对外的访问域名
|
|
334
|
-
S3_PUBLIC_DOMAIN=https://s3-for-LobeHub.your-domain.com
|
|
335
|
-
# 桶的区域,如 us-west-1,一般来说不需要添加,但某些服务商则需要配置
|
|
336
|
-
# S3_REGION=us-west-1
|
|
337
|
-
```
|