mirror of
https://github.com/lobehub/lobehub.git
synced 2026-03-27 13:29:15 +07:00
137 lines
4.6 KiB
Plaintext
137 lines
4.6 KiB
Plaintext
---
|
|
title: Deploy LobeHub with database on Dokploy
|
|
description: >-
|
|
Learn how to deploy LobeHub with database on Dokploy with ease, including:
|
|
database, authentication and S3 storage service.
|
|
tags:
|
|
- Deploy LobeHub
|
|
- Vercel Deployment
|
|
- OpenAI API Key
|
|
- Custom Domain Binding
|
|
---
|
|
|
|
# Deploying Server Database Version on Dokploy.
|
|
|
|
This article will detail how to deploy the server database version of LobeHub.
|
|
|
|
## 1. Preparation Work
|
|
|
|
### Deploy Dokploy and configure related settings.
|
|
|
|
```shell
|
|
curl -sSL https://dokploy.com/install.sh | sh
|
|
```
|
|
|
|
1. Connect your GitHub to Dokploy in the Settings / Git section according to the prompt.
|
|
|
|

|
|
|
|
2. Enter the Projects interface to create a Project.
|
|
|
|

|
|
|
|
### Configure S3 Storage Service
|
|
|
|
In the server-side database, we need to configure the S3 storage service to store files. For detailed configuration instructions, please refer to the section [Configure S3 Storage Service](https://lobehub.com/docs/self-hosting/platform/vercel#3-configure-s-3-storage-service) in the Vercel deployment guide。After the configuration is complete, you will obtain the following environment variables:
|
|
|
|
```shell
|
|
S3_ACCESS_KEY_ID=
|
|
S3_SECRET_ACCESS_KEY=
|
|
S3_ENDPOINT=
|
|
S3_BUCKET=
|
|
S3_ENABLE_PATH_STYLE=
|
|
```
|
|
|
|
### Configure KEY\_VAULTS\_SECRET Environment Variable
|
|
|
|
`KEY_VAULTS_SECRET` is used to encrypt sensitive information such as API keys stored by users. Click the button below to generate:
|
|
|
|
<GenerateSecret envName="KEY_VAULTS_SECRET" />
|
|
|
|
### Configure authentication environment variables
|
|
|
|
Prepare the following authentication environment variables (powered by [Better Auth](https://www.better-auth.com)):
|
|
|
|
Click the button below to generate `AUTH_SECRET` (session encryption key):
|
|
|
|
<GenerateSecret envName="AUTH_SECRET" />
|
|
|
|
You also need to configure the `JWKS_KEY` environment variable for signing and verifying JWTs. Click the button below to generate:
|
|
|
|
<GenerateJWKSKey />
|
|
|
|
<Callout type={'info'}>
|
|
For advanced features like SSO providers, magic link login, and email verification, see [Authentication Service](/docs/self-hosting/advanced/auth).
|
|
</Callout>
|
|
|
|
## 2. Deploying the database on Dokploy
|
|
|
|
Enter the previously created Project, click on Create Service, and select Database. In the Database interface, choose PostgreSQL, then set the database name, user, and password. In the Docker image field, enter `paradedb/paradedb:latest-pg17`, and finally click Create to create the database.
|
|
|
|

|
|
|
|
Enter the created database and set an unused port in External Credentials to allow external access; otherwise, LobeHub will not be able to connect to the database. You can view the Postgres database connection URL in External Host, as shown below:
|
|
|
|
```shell
|
|
postgresql://postgres:wAbLxfXSwkxxxxxx@45.577.281.48:5432/postgres
|
|
```
|
|
|
|
Finally, click Deploy to deploy the database.
|
|
|
|

|
|
|
|
## Deploy LobeHub on Dokploy.
|
|
|
|
Click "Create Service", select "Application", and create the LobeHub application.
|
|
|
|

|
|
|
|
Enter the created LobeHub application, select the forked lobe-chat project and branch, and click Save to save.
|
|
|
|

|
|
|
|
Switch to the Environment section, fill in the environment variables, and click Save.
|
|
|
|

|
|
|
|
```shell
|
|
# Environment variables required for building
|
|
NIXPACKS_PKGS="bun"
|
|
NIXPACKS_INSTALL_CMD="pnpm install"
|
|
NIXPACKS_BUILD_CMD="NODE_OPTIONS='--max-old-space-size=8192' pnpm run build"
|
|
NIXPACKS_START_CMD="pnpm start"
|
|
|
|
APP_URL=
|
|
|
|
# Configuration related to Postgres database
|
|
DATABASE_DRIVER=node
|
|
DATABASE_URL=
|
|
|
|
# Use the values generated above
|
|
KEY_VAULTS_SECRET=
|
|
AUTH_SECRET=
|
|
JWKS_KEY=
|
|
|
|
# S3 related configuration
|
|
S3_ACCESS_KEY_ID=
|
|
S3_SECRET_ACCESS_KEY=
|
|
S3_ENDPOINT=
|
|
S3_BUCKET=
|
|
S3_ENABLE_PATH_STYLE=
|
|
|
|
```
|
|
|
|
After adding the environment variables and saving, click Deploy to initiate the deployment. You can check the deployment progress and log information under Deployments.
|
|
|
|

|
|
|
|
After a successful deployment, bind your own domain to your LobeHub application and request a certificate on the Domains page.
|
|
|
|

|
|
|
|
## Check if LobeHub is working properly.
|
|
|
|
Go to your LobeHub website, and if you click on the login button in the upper left corner and the login pop-up appears normally, it means you have configured it successfully. Enjoy it to the fullest!
|
|
|
|

|