docs/self-hosting/platform/docker.mdx
Here is the process for deploying the LobeHub server database version on a Linux server:
<Steps> ### Create a Postgres Database InstancePlease create a Postgres database instance according to your needs, for example:
docker network create pg
docker run --name my-postgres --network pg -e POSTGRES_PASSWORD=mysecretpassword -p 5432:5432 -d paradedb/paradedb:latest-pg17
The above command will create a PG instance named my-postgres on the network pg, where paradedb/paradedb:latest-pg17 is a Postgres 17 image with pgvector and pg_search plugins installed by default.
lobehub.env to store environment variables:Click the buttons below to generate required secrets:
<GenerateSecret envName="KEY_VAULTS_SECRET" /> <GenerateSecret envName="AUTH_SECRET" />Click the button below to generate JWKS_KEY (for signing and verifying JWTs):
# Website domain
APP_URL=https://your-prod-domain.com
# DB required environment variables
KEY_VAULTS_SECRET=jgwsK28dspyVQoIf8/M3IIHl1h6LYYceSYNXeLpy6uk=
# Postgres database connection string
# Format: postgres://username:password@host:port/dbname; if your pg instance is a Docker container, use the container name
DATABASE_URL=postgres://postgres:mysecretpassword@my-postgres:5432/postgres
# Authentication (Better Auth)
# Session encryption key (generate with: openssl rand -base64 32)
AUTH_SECRET=jgwsK28dspyVQoIf8/M3IIHl1h6LYYceSYNXeLpy6uk=
# JWKS key for signing and verifying JWTs
JWKS_KEY='{"keys":[...]}'
# S3 related
S3_ACCESS_KEY_ID=xxxxxxxxxx
S3_SECRET_ACCESS_KEY=xxxxxxxxxx
S3_ENDPOINT=https://xxxxxxxxxx.r2.cloudflarestorage.com
S3_BUCKET=LobeHub
docker run -it -d -p 3210:3210 --network pg --env-file lobehub.env --name lobehub lobehub/lobehub
You can use the following command to check the logs:
docker logs -f lobehub
If you see the following logs in the container, it means it has started successfully:
[Database] Start to migration...
✅ database migration pass.
-------------------------------------
▲ Next.js 14.x.x
- Local: http://localhost:3210
- Network: http://0.0.0.0:3210
✓ Starting...
✓ Ready in 95ms
The data version of LobeHub also supports direct use on a local Mac/Windows machine.
Here, we assume that you have a pg instance available on port 5432 locally on your Mac/Windows, with the account postgres and password mysecretpassword, accessible at localhost:5432.
The script command you need to execute is:
$ docker run -it -d --name lobehub -p 3210:3210 \
-e DATABASE_URL=postgres://postgres:[email protected]:5432/postgres \
-e KEY_VAULTS_SECRET=jgwsK28dspyVQoIf8/M3IIHl1h6LYYceSYNXeLpy6uk= \
-e AUTH_SECRET=jgwsK28dspyVQoIf8/M3IIHl1h6LYYceSYNXeLpy6uk= \
-e JWKS_KEY='{"keys":[...]}' \
-e APP_URL=http://localhost:3210 \
-e S3_ACCESS_KEY_ID=xxxxxxxxxx \
-e S3_SECRET_ACCESS_KEY=xxxxxxxxxx \
-e S3_ENDPOINT=https://xxxxxxxxxx.r2.cloudflarestorage.com \
-e S3_BUCKET=LobeHub \
lobehub/lobehub