Files

169 lines
5.8 KiB
YAML

version: "3.7"
services:
app_proxy:
environment:
APP_HOST: lobe-chat_app_1
APP_PORT: 3210
PROXY_AUTH_ADD: "false"
app:
image: lobehub/lobehub:2.3.4@sha256:33fe4f6721c82dbda67d2d17ec96aeb4c32b3dc8d6611b70c970788353c29959
restart: on-failure
env_file:
- ${APP_DATA_DIR}/settings.env
environment:
APP_URL: http://${DEVICE_DOMAIN_NAME}:7455
INTERNAL_APP_URL: http://lobe-chat_app_1:3210
AUTH_TRUSTED_ORIGINS: http://${DEVICE_DOMAIN_NAME}:7455
DATABASE_URL: postgresql://postgres:lobehubsecret@lobe-chat_postgres_1:5432/lobehub
ES_REINDEX_STATE_DIR: /app/.elasticsearch-reindex
REDIS_URL: redis://lobe-chat_redis_1:6379
REDIS_PREFIX: lobechat
REDIS_TLS: "0"
S3_ENDPOINT: http://${DEVICE_DOMAIN_NAME}:7458
S3_INTERNAL_ENDPOINT: http://lobe-chat_rustfs_1:9000
S3_BUCKET: lobe
S3_ACCESS_KEY: lobehub
S3_ENABLE_PATH_STYLE: "1"
S3_ACCESS_KEY_ID: lobehub
S3_SECRET_ACCESS_KEY: ${APP_PASSWORD}
S3_SET_ACL: "0"
LLM_VISION_IMAGE_USE_BASE64: "1"
SEARXNG_URL: http://lobe-chat_searxng_1:8080
ENABLE_AGENT_GATEWAY: "1"
AGENT_GATEWAY_URL: http://${DEVICE_DOMAIN_NAME}:7459
AGENT_GATEWAY_INTERNAL_URL: http://lobe-chat_gateway_1:8787
DEVICE_GATEWAY_URL: http://lobe-chat_gateway_1:8788
volumes:
- ${APP_DATA_DIR}/data/elasticsearch-reindex:/app/.elasticsearch-reindex
depends_on:
postgres-upgrade:
condition: service_completed_successfully
redis:
condition: service_healthy
rustfs:
condition: service_healthy
rustfs-init:
condition: service_completed_successfully
gateway:
condition: service_started
gateway:
image: ghcr.io/lobehub/lobehub-gateway:0.5.0@sha256:63647fd8f97407dafd344dd08b509ff74a033b23292cf1d451d804cb09d35759
restart: on-failure
env_file:
- ${APP_DATA_DIR}/gateway.env
ports:
- "7459:8787"
- "7460:8788"
environment:
LOBE_API_BASE_URL: http://lobe-chat_app_1:3210
postgres:
image: paradedb/paradedb:0.24.3-pg17@sha256:a784ffa6471729af6be5178ad39ea607e5cbfec94f81bcaad439de40ecb45834
user: "1000:1000"
restart: on-failure
environment:
POSTGRES_DB: lobehub
POSTGRES_PASSWORD: lobehubsecret
volumes:
- ${APP_DATA_DIR}/data/db:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres -d lobehub -h 127.0.0.1"]
interval: 10s
timeout: 5s
retries: 10
start_period: 60s
# Image upgrades leave extension SQL unchanged in existing databases.
# Finish the upstream-required upgrades before Lobe Hub runs migrations.
postgres-upgrade:
image: paradedb/paradedb:0.24.3-pg17@sha256:a784ffa6471729af6be5178ad39ea607e5cbfec94f81bcaad439de40ecb45834
user: "1000:1000"
depends_on:
postgres:
condition: service_healthy
environment:
PGHOST: lobe-chat_postgres_1
PGUSER: postgres
PGPASSWORD: lobehubsecret
PGCONNECT_TIMEOUT: "10"
entrypoint: ["/bin/sh", "-ec"]
command:
- |
for database in template1 paradedb lobehub; do
psql --no-psqlrc --dbname="$${database}" --set=ON_ERROR_STOP=1 --single-transaction --file=- <<'SQL'
SELECT format('ALTER EXTENSION %I UPDATE;', name)
FROM pg_available_extensions
WHERE installed_version IS NOT NULL AND installed_version <> default_version
ORDER BY name
\gexec
SQL
done
redis:
image: redis:7.4.8@sha256:a5995dfdf108997f8a7c9587f54fad5e94ed5848de5236a6b28119e99efd67e0
user: "1000:1000"
restart: on-failure
command: redis-server --save 60 1000 --appendonly yes
volumes:
- ${APP_DATA_DIR}/data/redis:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 10
rustfs:
image: rustfs/rustfs:1.0.0-alpha.90@sha256:0725587f6fcca83c1898f321424327d6e6da5e01ea20382905dd258ed5af3be4
restart: on-failure
ports:
- "7458:9000"
volumes:
- ${APP_DATA_DIR}/data/rustfs:/data
- ${APP_DATA_DIR}/data/rustfs-logs:/logs
environment:
RUSTFS_ADDRESS: 0.0.0.0:9000
RUSTFS_CONSOLE_ADDRESS: 0.0.0.0:9001
RUSTFS_CONSOLE_ENABLE: "true"
RUSTFS_VOLUMES: /data
RUSTFS_ACCESS_KEY: lobehub
RUSTFS_SECRET_KEY: ${APP_PASSWORD}
RUSTFS_OBS_LOG_DIRECTORY: /logs
healthcheck:
test:
["CMD", "sh", "-c", "curl -f http://127.0.0.1:9000/health && curl -f http://127.0.0.1:9001/rustfs/console/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
rustfs-init:
image: rustfs/rc:v0.1.36@sha256:ab024bfebee49a750ce886b4c70963ccd9ddaa03f491704a90710641d7a26699
restart: on-failure
depends_on:
rustfs:
condition: service_healthy
volumes:
- ${APP_DATA_DIR}/bucket.config.json:/bucket.config.json:ro
entrypoint: /bin/sh
command:
- -c
- >
set -eu;
rc --version;
rc alias set rustfs "http://lobe-chat_rustfs_1:9000" "lobehub" "${APP_PASSWORD}";
rc ls rustfs || true;
rc mb "rustfs/lobe" --ignore-existing;
rc anonymous set-json "/bucket.config.json" "rustfs/lobe";
printf "%s" "<CORSConfiguration><CORSRule><AllowedOrigin>*</AllowedOrigin><AllowedMethod>GET</AllowedMethod><AllowedMethod>PUT</AllowedMethod><AllowedMethod>HEAD</AllowedMethod><AllowedHeader>*</AllowedHeader><ExposeHeader>ETag</ExposeHeader><MaxAgeSeconds>3600</MaxAgeSeconds></CORSRule></CORSConfiguration>" | rc bucket cors set "rustfs/lobe" -
searxng:
image: ghcr.io/searxng/searxng:2026.4.22-74f1ca203@sha256:37c616a774b90fb5df9239eb143f1b11866ddf7b830cd1ebcca6ba11b38cc2bf
restart: on-failure
environment:
SEARXNG_SECRET: ${APP_SEED}
volumes:
- ${APP_DATA_DIR}/data/searxng/settings.yml:/etc/searxng/settings.yml