Prepare persistent Agent Zero and LobeHub trials on Unraid
This commit is contained in:
1 parent
35c92886d5
commit
194ff602e1
9 files changed
+3177
-1
No files matched your search
@@ -60,3 +60,43 @@ specific projects and MCPs still require configuration.
|
||||
- Existing old DockerMan template with matching Name was updated; there was no existing Agent Zero container or user-data directory.
|
||||
|
||||
User authentication, reverse proxy/domain and MCP import are not configured by this installation. Initial access is LAN HTTP using upstream onboarding defaults.
|
||||
|
||||
## Re-created trial — 2026-10-18
|
||||
|
||||
The earlier container/image was absent; the existing 404-KiB user-data folder
|
||||
and model presets remained. Keep these data; no deletion or new application
|
||||
source mount. `start-existing.sh` recreates the official image with 1 CPU,
|
||||
low CPU shares, the existing 4-GiB/no-swap bound and `unless-stopped`.
|
||||
The persistent DockerMan template now carries the same CPU and restart limits.
|
||||
|
||||
The scheduler JSON contained zero tasks before startup. No benchmark, chat,
|
||||
speech generation, scheduled agent run or MCP tool execution is authorized:
|
||||
the user's model is busy with coding. Basic web-page availability is the only
|
||||
acceptance performed during this deployment. No other container is restarted.
|
||||
|
||||
18 URL-based MCP definitions were copied internally from the configured Hermes
|
||||
instance into Agent Zero's own `settings.json`; two disabled, local or
|
||||
unresolved-placeholder entries were skipped. `copy-remote-mcps.rb` performs a
|
||||
safe YAML parse and never prints credentials. This is a copy, not a shared
|
||||
Hermes data mount or a dependency on running Hermes. The same JSON is prepared
|
||||
privately as LobeHub's `deployment/mcp-import.json` for normal per-account
|
||||
import after the user signs up. It is not a public artifact or Git file.
|
||||
Connection discovery/tool usability has not been claimed tested.
|
||||
|
||||
The built-in Agent Zero workspace is `/a0/usr/workdir` in this installation.
|
||||
Webtop's entire home is not mounted or granted access by this deployment.
|
||||
Speech, mobile clients, scheduled executions and a stop/start or fresh-host
|
||||
restore are not accepted just because the login/chat page opens. HTTPS and
|
||||
normal user login setup are still needed before broader/mobile microphone use.
|
||||
|
||||
The re-created trial uses the same published image digest as the prior
|
||||
installation:
|
||||
`agent0ai/agent-zero@sha256:b0c9763df7b8c4c5ddbdac9c101e8f84de8b7cdf9185203e446e2d7d8ebf2f1c`.
|
||||
The container started with its official supervisor/entrypoint; no bootstrap
|
||||
wrapper or dependency installer was added. HTTP readiness is recorded separately
|
||||
from process state. A running supervisor by itself does not prove UI readiness.
|
||||
|
||||
Final HTTP check returned 200 after the first startup. The image downloaded
|
||||
`en-core-web-sm` during initialization. No dependency installer or application
|
||||
patch was added by this deployment. Whether a later clean restart needs any
|
||||
additional download remains untested under the user's no-test instruction.
|
||||
@@ -0,0 +1,34 @@
|
||||
require 'psych'
|
||||
require 'json'
|
||||
require 'open3'
|
||||
ssh=['ssh','-i','/Users/mike_i386/.ssh/ha_agent','-o','BatchMode=yes','root@192.168.1.2']
|
||||
source,_,status=Open3.capture3(*ssh,'cat /mnt/nvme-storage/appdata/Hermes-Agent-Web-UI/home/config.yaml')
|
||||
abort('Cannot access MCP source') unless status.success?
|
||||
config=Psych.safe_load(source, permitted_classes: [], permitted_symbols: [], aliases: false)
|
||||
servers=config['mcp_servers'] || config['mcpServers'] || {}
|
||||
abort('Unexpected MCP source schema') unless servers.is_a?(Hash)
|
||||
remote={}; skipped=0
|
||||
servers.each do |name,s|
|
||||
next unless s.is_a?(Hash)
|
||||
url=s['url'] || s['serverUrl']
|
||||
if !url.is_a?(String) || !url.match?(/\Ahttps?:\/\//) || s['enabled']==false
|
||||
skipped+=1; next
|
||||
end
|
||||
item={'url'=>url}
|
||||
item['headers']=s['headers'] if s['headers'].is_a?(Hash)
|
||||
item['type']='sse' if url.split('?')[0].end_with?('/sse')
|
||||
item['type']='streamable-http' unless item.key?('type')
|
||||
if JSON.generate(item).match?(/\$\{|\$[A-Z_]/)
|
||||
skipped+=1;next
|
||||
end
|
||||
remote[name]=item
|
||||
end
|
||||
if remote.empty?
|
||||
puts "No transferable remote MCP entries; skipped #{skipped}."
|
||||
exit
|
||||
end
|
||||
payload=JSON.generate({'mcpServers'=>remote})
|
||||
command=%q{php -r '$p="/mnt/user/appdata/agent-zero/settings.json"; $x=is_file($p)?json_decode(file_get_contents($p),true):[];if(!is_array($x))exit(2);$v=stream_get_contents(STDIN);if(!json_decode($v,true))exit(3);$x["mcp_servers"]=$v;file_put_contents($p,json_encode($x,JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES));chmod($p,0600);file_put_contents("/mnt/user/appdata/lobehub/deployment/mcp-import.json",$v);chmod("/mnt/user/appdata/lobehub/deployment/mcp-import.json",0600);echo "MCP configuration saved.\n";'}
|
||||
out,_,status=Open3.capture3(*ssh,command,stdin_data:payload)
|
||||
abort('MCP transfer failed; details withheld') unless status.success?
|
||||
puts "Independent remote MCP configurations copied: #{remote.size}; skipped entries: #{skipped}. No tools executed."
|
||||
@@ -13,7 +13,7 @@
|
||||
<Beta>True</Beta>
|
||||
<Category>AI: Productivity:</Category>
|
||||
<WebUI>http://[IP]:50080/</WebUI>
|
||||
<ExtraParams>--publish=192.168.1.2:50080:80/tcp --cpus=2 --cpu-shares=128 --memory=4g --memory-swap=4g --pids-limit=1024 --shm-size=512m --log-opt=max-size=10m --log-opt=max-file=2</ExtraParams>
|
||||
<ExtraParams>--restart=unless-stopped --publish=192.168.1.2:50080:80/tcp --cpus=1 --cpu-shares=128 --memory=4g --memory-swap=4g --pids-limit=1024 --shm-size=512m --log-opt=max-size=10m --log-opt=max-file=2</ExtraParams>
|
||||
<TemplateURL>https://raw.githubusercontent.com/selfhosters/unRAID-CA-templates/master/templates/agent_zero.xml</TemplateURL>
|
||||
<Icon>https://raw.githubusercontent.com/selfhosters/unRAID-CA-templates/master/templates/img/agent-zero.png</Icon>
|
||||
<Config Name="Appdata Path" Target="/a0/usr" Default="/mnt/user/appdata/agent-zero" Mode="rw" Description="Persistent user data, chats, projects, memory and skills. Application files remain in the official image." Type="Path" Display="always" Required="true" Mask="false">/mnt/user/appdata/agent-zero</Config>
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
#!/bin/bash
|
||||
set -euo pipefail
|
||||
base=/mnt/user/appdata/agent-zero
|
||||
if docker container inspect agent-zero >/dev/null 2>&1; then
|
||||
echo 'Container exists; no replacement performed.' >&2
|
||||
exit 1
|
||||
fi
|
||||
php -r '$x=json_decode(file_get_contents("/mnt/user/appdata/agent-zero/scheduler/tasks.json"),true); if(count($x["tasks"]??[])!==0)exit(1);'
|
||||
docker image inspect agent0ai/agent-zero:latest >/dev/null
|
||||
# Reuse existing user data and its model presets, never mount application code.
|
||||
docker run -d --name agent-zero --network bridge --restart unless-stopped \
|
||||
--cpus=1 --cpu-shares=128 --memory=4g --memory-swap=4g \
|
||||
--pids-limit=1024 --shm-size=512m \
|
||||
--log-opt max-size=10m --log-opt max-file=2 \
|
||||
--label net.unraid.docker.managed=dockerman \
|
||||
--label 'net.unraid.docker.webui=http://[IP]:50080/' \
|
||||
--label net.unraid.docker.icon=https://raw.githubusercontent.com/selfhosters/unRAID-CA-templates/master/templates/img/agent-zero.png \
|
||||
-p 192.168.1.2:50080:80 -e TZ=Europe/Berlin \
|
||||
-v "$base:/a0/usr:rw" agent0ai/agent-zero:latest
|
||||
@@ -0,0 +1,92 @@
|
||||
# LobeHub trial on Unraid — 2026-10-18
|
||||
|
||||
Requested alongside Agent Zero. No model generation, speech generation,
|
||||
benchmark, scheduled agent task or tool action is authorized during setup:
|
||||
Athena is serving another coding job. Do not restart or change Athena,
|
||||
OpenCode, Webtop, or the stopped Hermes applications.
|
||||
|
||||
## Deployment
|
||||
|
||||
Official upstream deployment source:
|
||||
https://github.com/lobehub/lobehub/tree/HEAD/docker-compose/deploy
|
||||
|
||||
Use the official prebuilt images, not a local application build. The supplied
|
||||
Compose definition retains the manufacturer's application, gateway, PostgreSQL,
|
||||
Redis, RustFS, bucket initializer, and SearXNG. Optional Elasticsearch services
|
||||
remain disabled. This is a multi-container product; it is not a single-container
|
||||
workspace alternative.
|
||||
|
||||
Persistent deployment directory: `/mnt/user/appdata/lobehub/deployment`.
|
||||
Compose executable: `bin/docker-compose` (official Linux x86_64 v5.6.0, download
|
||||
verified against the official release SHA-256). It is local to this deployment,
|
||||
not installed into Unraid's volatile OS directories. Use it from this directory:
|
||||
|
||||
```sh
|
||||
./bin/docker-compose config --quiet
|
||||
./bin/docker-compose up -d
|
||||
./bin/docker-compose stop
|
||||
```
|
||||
|
||||
Never print `docker-compose config`, `.env`, or unfiltered initialization logs:
|
||||
the upstream bucket initializer prints credentials. Use `config --quiet`.
|
||||
`configure.php` generates private runtime secrets and copies the existing Athena
|
||||
API credential internally from Agent Zero's private environment. It refuses to
|
||||
overwrite an existing `.env`; mode 0600. It contains no actual credentials.
|
||||
Fetch the official `docker-compose/deploy/.env.example` as
|
||||
`env.upstream.example` before running it. No hardlink or data mount connects
|
||||
this deployment to Hermes or Agent Zero.
|
||||
|
||||
Changes from the manufacturer's Compose file are deployment settings only:
|
||||
conflict-free host ports, LAN/loopback binding, resource limits, bounded logs,
|
||||
Unraid WebUI label, and `unless-stopped` restart policies (also added to RustFS,
|
||||
which upstream omits). No application source changes or custom entrypoints.
|
||||
|
||||
- App: `http://192.168.1.2:3210`
|
||||
- Browser-accessible file store: `http://192.168.1.2:19000`
|
||||
- Agent gateway: `http://192.168.1.2:18787`
|
||||
- Device gateway: `192.168.1.2:18788`
|
||||
- DB, Redis and storage console: loopback-only ports 15439, 16389, 19001.
|
||||
|
||||
The private environment configures Athena's OpenAI-compatible endpoint, model
|
||||
IDs and context limits, using the documented `OPENAI_MODEL_LIST` syntax. Local
|
||||
addresses are enabled through the manufacturer's SSRF configuration. This trial
|
||||
is LAN-bound; no reverse proxy or public hostname is created. Mobile microphone
|
||||
use still requires HTTPS. Users create their own login in the normal UI.
|
||||
|
||||
## Persistence, backup and limitations
|
||||
|
||||
PostgreSQL state is in `deployment/data`. Redis, RustFS, and search checkpoints
|
||||
use the named volumes declared in Compose. These volumes are persistent but
|
||||
must be included separately in encrypted backups alongside `.env` and the
|
||||
deployment folder. Do not run `down -v`. This installation is not automatically
|
||||
included in Athena Deck's encrypted backup. Fresh-host restore is untested.
|
||||
|
||||
The official gateway keeps in-flight runs in memory: restarting it loses those
|
||||
runs (explicit upstream Compose comment). A restart policy does not provide
|
||||
resumption of a running task. Server-side scheduled tasks, native-mobile
|
||||
connection, local speech, terminal/host access, MCP/Skill migration and model
|
||||
quality must not be claimed verified without separate acceptance. They are
|
||||
not established just by a successful HTTP page response.
|
||||
|
||||
This optional Unraid client adds no prerequisite to the future native Debian
|
||||
Athena installation. Rebuilding the client needs Docker, the Compose executable,
|
||||
these deployment files and a separately secured state/secret backup.
|
||||
|
||||
## Initial setup scope
|
||||
|
||||
The regular sign-in/sign-up page was reached in the browser. Account creation
|
||||
and acceptance of the product terms are left to the user. Thus per-user MCP,
|
||||
Skills, speech and workspace configuration are not represented as completed.
|
||||
18 remote MCP entries are prepared privately in `deployment/mcp-import.json`;
|
||||
no actual tokens belong in Git. The default agent is Athena Strata 256K and
|
||||
automatic topic generation is disabled; system helpers use the same 256K model.
|
||||
When changing the primary Deck profile, review helper model selection too:
|
||||
static helper models must not silently switch the active Athena profile.
|
||||
|
||||
Installed app image digest:
|
||||
`lobehub/lobehub@sha256:8a46ff8c76aef731b6d228d92edfc384aa77335593187b670be23ce78a690716`.
|
||||
Source tree inspected: `bbeefe6a57ab166d04b1fa7cacabb4ab2b7facc2`.
|
||||
The source tree is not asserted to be the exact image build revision.
|
||||
The installed web app's migration completed and startup reported Ready.
|
||||
App, PostgreSQL, Redis, RustFS, gateway and SearXNG ran; bucket initialization
|
||||
exited successfully. No LLM generation or scheduler test was performed.
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"Id": "",
|
||||
"Statement": [
|
||||
{
|
||||
"Sid": "",
|
||||
"Effect": "Allow",
|
||||
"Principal": {
|
||||
"AWS": ["*"]
|
||||
},
|
||||
"Action": ["s3:GetObject"],
|
||||
"NotAction": [],
|
||||
"Resource": ["arn:aws:s3:::lobe/*"],
|
||||
"NotResource": [],
|
||||
"Condition": {}
|
||||
}
|
||||
],
|
||||
"Version": "2012-10-17"
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
umask(0077);
|
||||
$base='/mnt/user/appdata/lobehub/deployment';
|
||||
if(file_exists("$base/.env"))throw new Exception('Refusing to overwrite existing environment');
|
||||
$env=file_get_contents("$base/env.upstream.example");
|
||||
function setting($key,$value){global $env;$line=$key.'='.$value;if(preg_match('/^'.preg_quote($key,'/').'=/m',$env))$env=preg_replace_callback('/^'.preg_quote($key,'/').'=[^\r\n]*/m',fn()=>$line,$env);else $env.="\n$line\n";}
|
||||
foreach(['KEY_VAULTS_SECRET','AUTH_SECRET'] as $k)setting($k,base64_encode(random_bytes(32)));
|
||||
foreach(['POSTGRES_PASSWORD','RUSTFS_SECRET_KEY','GATEWAY_SERVICE_TOKEN'] as $k)setting($k,bin2hex(random_bytes(32)));
|
||||
function b64url($v){return rtrim(strtr(base64_encode($v),'+/','-_'),'=');}
|
||||
$key=openssl_pkey_new(['private_key_bits'=>2048,'private_key_type'=>OPENSSL_KEYTYPE_RSA]);
|
||||
if(!$key)throw new Exception('RSA generation failed');
|
||||
$rsa=openssl_pkey_get_details($key)['rsa'];$meta=['kty'=>'RSA','alg'=>'RS256','kid'=>bin2hex(random_bytes(8)),'use'=>'sig'];$pub=$meta+['n'=>b64url($rsa['n']),'e'=>b64url($rsa['e'])];$priv=$pub;
|
||||
foreach(['d'=>'d','p'=>'p','q'=>'q','dp'=>'dmp1','dq'=>'dmq1','qi'=>'iqmp'] as $j=>$k)$priv[$j]=b64url($rsa[$k]);
|
||||
setting('JWKS_KEY',json_encode(['keys'=>[$priv]],JSON_UNESCAPED_SLASHES));setting('JWKS_PUBLIC_KEY',json_encode(['keys'=>[$pub]],JSON_UNESCAPED_SLASHES));
|
||||
foreach(['LOBE_PORT'=>'3210','APP_URL'=>'http://192.168.1.2:3210','RUSTFS_PORT'=>'19000','RUSTFS_ADMIN_PORT'=>'19001','S3_ENDPOINT'=>'http://192.168.1.2:19000','AGENT_GATEWAY_PORT'=>'18787','DEVICE_GATEWAY_PORT'=>'18788','AGENT_GATEWAY_URL'=>'http://192.168.1.2:18787','DEVICE_GATEWAY_PUBLIC_URL'=>'http://192.168.1.2:18788','OPENAI_PROXY_URL'=>'http://192.168.1.212:8120/v1','ENABLED_OPENAI'=>'1','SSRF_ALLOW_PRIVATE_IP_ADDRESS'=>'1'] as $k=>$v)setting($k,$v);
|
||||
$models='-all,+flash-next-strata-iq3=Athena Strata 256K<262144:reasoning:fc>,+flash-next-strata-iq3-512k=Athena Strata 512K<524288:reasoning:fc>,+flash-next-strata-iq3-dual=Athena Dual Slot 256K<262144:reasoning:fc>,+qwen3-8-27b-medium=Athena Qwen 27B<80000:reasoning:fc>';
|
||||
setting('OPENAI_MODEL_LIST',"'$models'");
|
||||
setting('DEFAULT_AGENT_CONFIG', "'model=flash-next-strata-iq3;provider=openai;chatConfig.enableAutoCreateTopic=false'");
|
||||
setting('SYSTEM_AGENT','default=openai/flash-next-strata-iq3');
|
||||
$source=file_get_contents('/mnt/user/appdata/agent-zero/.env');
|
||||
if(!preg_match('/^API_KEY_OPENAI\s*=\s*(.*)$/m',$source,$m))throw new Exception('Existing Athena credential unavailable');
|
||||
$credential=trim(trim($m[1]),"\"'");if(!$credential)throw new Exception('Empty credential');setting('OPENAI_API_KEY',$credential);
|
||||
file_put_contents("$base/.env",$env);chmod("$base/.env",0600);
|
||||
echo "LobeHub persistent configuration generated; Athena credential transferred internally.\n";
|
||||
@@ -0,0 +1,368 @@
|
||||
name: lobehub
|
||||
services:
|
||||
lobe:
|
||||
cpus: "1.0"
|
||||
cpu_shares: 128
|
||||
mem_limit: 2g
|
||||
logging:
|
||||
driver: json-file
|
||||
options:
|
||||
max-size: "10m"
|
||||
max-file: "2"
|
||||
image: lobehub/lobehub
|
||||
container_name: lobehub
|
||||
labels:
|
||||
net.unraid.docker.webui: "http://[IP]:3210/"
|
||||
net.unraid.docker.icon: "https://avatars.githubusercontent.com/u/131470832?s=128"
|
||||
ports:
|
||||
- '192.168.1.2:${LOBE_PORT}:3210'
|
||||
depends_on:
|
||||
postgresql:
|
||||
condition: service_healthy
|
||||
redis:
|
||||
condition: service_healthy
|
||||
rustfs:
|
||||
condition: service_healthy
|
||||
rustfs-init:
|
||||
condition: service_completed_successfully
|
||||
environment:
|
||||
- 'KEY_VAULTS_SECRET=${KEY_VAULTS_SECRET}'
|
||||
- 'AUTH_SECRET=${AUTH_SECRET}'
|
||||
- 'DATABASE_URL=postgresql://postgres:${POSTGRES_PASSWORD}@postgresql:5432/${LOBE_DB_NAME}'
|
||||
- 'ES_REINDEX_STATE_DIR=/app/.elasticsearch-reindex'
|
||||
- 'INTERNAL_APP_URL=http://localhost:3210'
|
||||
- 'S3_ENDPOINT=${S3_ENDPOINT}'
|
||||
# S3_ENDPOINT is opened by browsers; server-side S3 requests stay on the Compose network
|
||||
- 'S3_INTERNAL_ENDPOINT=http://rustfs:9000'
|
||||
- 'S3_BUCKET=${RUSTFS_LOBE_BUCKET}'
|
||||
- 'S3_ENABLE_PATH_STYLE=1'
|
||||
- 'S3_ACCESS_KEY=${RUSTFS_ACCESS_KEY}'
|
||||
- 'S3_ACCESS_KEY_ID=${RUSTFS_ACCESS_KEY}'
|
||||
- 'S3_SECRET_ACCESS_KEY=${RUSTFS_SECRET_KEY}'
|
||||
- 'LLM_VISION_IMAGE_USE_BASE64=1'
|
||||
- 'S3_SET_ACL=0'
|
||||
- 'SEARXNG_URL=http://searxng:8080'
|
||||
- 'REDIS_URL=redis://redis:6379'
|
||||
- 'REDIS_PREFIX=lobechat'
|
||||
- 'REDIS_TLS=0'
|
||||
# Gateway Mode: agent runs execute on the server and stream to the browser
|
||||
# through the gateway service below. The browser-facing AGENT_GATEWAY_URL
|
||||
# comes from .env; server-to-gateway traffic stays on the Compose network.
|
||||
- 'ENABLE_AGENT_GATEWAY=1'
|
||||
- 'AGENT_GATEWAY_INTERNAL_URL=http://gateway:8787'
|
||||
- 'AGENT_GATEWAY_SERVICE_TOKEN=${GATEWAY_SERVICE_TOKEN:-}'
|
||||
- 'DEVICE_GATEWAY_SERVICE_TOKEN=${GATEWAY_SERVICE_TOKEN:-}'
|
||||
env_file:
|
||||
- .env
|
||||
volumes:
|
||||
- 'fts-search-reindex-state:/app/.elasticsearch-reindex'
|
||||
restart: unless-stopped
|
||||
networks:
|
||||
- lobe-network
|
||||
|
||||
# Single-instance LobeHub gateway (https://github.com/lobehub/lobehub-gateway):
|
||||
# - 8787 agent gateway: relays Gateway Mode runs to browsers over WebSocket,
|
||||
# so AGENT_GATEWAY_URL in .env must be reachable from the browser.
|
||||
# - 8788 device gateway: routes tool calls to devices joined with
|
||||
# `lh connect --gateway <url>`.
|
||||
# State is kept in memory: runs in flight are lost when this container restarts.
|
||||
gateway:
|
||||
cpus: "0.5"
|
||||
cpu_shares: 128
|
||||
mem_limit: 256m
|
||||
logging:
|
||||
driver: json-file
|
||||
options:
|
||||
max-size: "10m"
|
||||
max-file: "2"
|
||||
image: ghcr.io/lobehub/lobehub-gateway:0.5.0
|
||||
container_name: lobe-gateway
|
||||
ports:
|
||||
- '192.168.1.2:${AGENT_GATEWAY_PORT:-8787}:8787'
|
||||
- '192.168.1.2:${DEVICE_GATEWAY_PORT:-8788}:8788'
|
||||
environment:
|
||||
- 'SERVICE_TOKEN=${GATEWAY_SERVICE_TOKEN:-}'
|
||||
# Public key only: the private JWKS_KEY stays in the lobe container
|
||||
- 'JWKS_PUBLIC_KEY=${JWKS_PUBLIC_KEY:-}'
|
||||
- 'LOBE_API_BASE_URL=http://lobe:3210'
|
||||
restart: unless-stopped
|
||||
networks:
|
||||
- lobe-network
|
||||
|
||||
postgresql:
|
||||
cpus: "0.75"
|
||||
cpu_shares: 128
|
||||
mem_limit: 1g
|
||||
logging:
|
||||
driver: json-file
|
||||
options:
|
||||
max-size: "10m"
|
||||
max-file: "2"
|
||||
image: paradedb/paradedb:latest-pg17
|
||||
container_name: lobe-postgres
|
||||
# Optional: Remove or change these ports if:
|
||||
# - You don't need external database access
|
||||
# - The ports conflict with other services on your host
|
||||
ports:
|
||||
- '127.0.0.1:15439:5432'
|
||||
volumes:
|
||||
- './data:/var/lib/postgresql/data'
|
||||
# Keep the image's default preload list: its first-start bootstrap creates the pg_cron
|
||||
# extension and aborts initialization when pg_cron is missing from this list.
|
||||
command: ['postgres', '-c', 'shared_preload_libraries=pg_search,pg_cron,pg_stat_statements']
|
||||
environment:
|
||||
- 'POSTGRES_DB=${LOBE_DB_NAME}'
|
||||
- 'POSTGRES_PASSWORD=${POSTGRES_PASSWORD}'
|
||||
healthcheck:
|
||||
# Probe over TCP: during first-time initialization the image runs a temporary server that
|
||||
# only listens on the Unix socket, so a socket probe reports ready while LobeHub's TCP
|
||||
# connections are still refused.
|
||||
test: ['CMD-SHELL', 'pg_isready -U postgres -h 127.0.0.1']
|
||||
interval: 5s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
# TCP stays closed until initialization finishes, which can outlast the retries above
|
||||
start_period: 60s
|
||||
restart: unless-stopped
|
||||
networks:
|
||||
- lobe-network
|
||||
|
||||
redis:
|
||||
cpus: "0.25"
|
||||
cpu_shares: 128
|
||||
mem_limit: 256m
|
||||
logging:
|
||||
driver: json-file
|
||||
options:
|
||||
max-size: "10m"
|
||||
max-file: "2"
|
||||
image: redis:7-alpine
|
||||
container_name: lobe-redis
|
||||
# Optional: Remove or change these ports if:
|
||||
# - You don't need external access
|
||||
# - The ports conflict with other services on your host
|
||||
ports:
|
||||
- '127.0.0.1:16389:6379'
|
||||
command: redis-server --save 60 1000 --appendonly yes
|
||||
volumes:
|
||||
- 'redis_data:/data'
|
||||
healthcheck:
|
||||
test: ['CMD', 'redis-cli', 'ping']
|
||||
interval: 5s
|
||||
timeout: 3s
|
||||
retries: 5
|
||||
restart: unless-stopped
|
||||
networks:
|
||||
- lobe-network
|
||||
|
||||
rustfs:
|
||||
cpus: "0.5"
|
||||
cpu_shares: 128
|
||||
mem_limit: 768m
|
||||
logging:
|
||||
driver: json-file
|
||||
options:
|
||||
max-size: "10m"
|
||||
max-file: "2"
|
||||
image: rustfs/rustfs:latest
|
||||
container_name: lobe-rustfs
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- '192.168.1.2:${RUSTFS_PORT}:9000'
|
||||
- '127.0.0.1:${RUSTFS_ADMIN_PORT}:9001'
|
||||
# Optional: Remove or change RUSTFS_ADMIN_PORT if:
|
||||
# - You don't need external access to rustfs control panel
|
||||
# - The ports conflict with other services on your host
|
||||
# - RUSTFS_PORT is necessary only if you need to upload images to conversations. (avatar uploads are not affected)
|
||||
# - Uploading images to conversations requires a browser-accessible S3_ENDPOINT.
|
||||
environment:
|
||||
- RUSTFS_CONSOLE_ENABLE=true
|
||||
- RUSTFS_ACCESS_KEY=${RUSTFS_ACCESS_KEY}
|
||||
- RUSTFS_SECRET_KEY=${RUSTFS_SECRET_KEY}
|
||||
volumes:
|
||||
- 'rustfs-data:/data'
|
||||
healthcheck:
|
||||
test: ['CMD-SHELL', 'wget -qO- http://localhost:9000/health >/dev/null 2>&1 || exit 1']
|
||||
interval: 5s
|
||||
timeout: 3s
|
||||
retries: 30
|
||||
command:
|
||||
['--access-key', '${RUSTFS_ACCESS_KEY}', '--secret-key', '${RUSTFS_SECRET_KEY}', '/data']
|
||||
networks:
|
||||
- lobe-network
|
||||
|
||||
rustfs-init:
|
||||
cpus: "0.25"
|
||||
cpu_shares: 128
|
||||
mem_limit: 256m
|
||||
logging:
|
||||
driver: json-file
|
||||
options:
|
||||
max-size: "10m"
|
||||
max-file: "2"
|
||||
image: rustfs/rc:latest
|
||||
container_name: lobe-rustfs-init
|
||||
depends_on:
|
||||
rustfs:
|
||||
condition: service_healthy
|
||||
volumes:
|
||||
- ./bucket.config.json:/bucket.config.json:ro
|
||||
entrypoint: /bin/sh
|
||||
# Browsers upload through presigned URLs on the RustFS origin, so the bucket also needs a CORS rule
|
||||
command: -c ' set -eux; echo "S3_ACCESS_KEY=${RUSTFS_ACCESS_KEY}, S3_SECRET_KEY=${RUSTFS_SECRET_KEY}"; rc --version; rc alias set rustfs "http://rustfs:9000" "${RUSTFS_ACCESS_KEY}" "${RUSTFS_SECRET_KEY}"; rc ls rustfs || true; rc mb "rustfs/lobe" --ignore-existing; rc admin info cluster rustfs || true; 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" -; '
|
||||
restart: 'no'
|
||||
networks:
|
||||
- lobe-network
|
||||
|
||||
searxng:
|
||||
cpus: "0.5"
|
||||
cpu_shares: 128
|
||||
mem_limit: 512m
|
||||
logging:
|
||||
driver: json-file
|
||||
options:
|
||||
max-size: "10m"
|
||||
max-file: "2"
|
||||
image: searxng/searxng
|
||||
container_name: lobe-searxng
|
||||
volumes:
|
||||
- './searxng-settings.yml:/etc/searxng/settings.yml'
|
||||
environment:
|
||||
- 'SEARXNG_SETTINGS_FILE=/etc/searxng/settings.yml'
|
||||
restart: unless-stopped
|
||||
networks:
|
||||
- lobe-network
|
||||
env_file:
|
||||
- .env
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Optional: self-hosted single-node Elasticsearch for LobeHub full-text search.
|
||||
# Disabled by default; LobeHub keeps using PostgreSQL pg_search unless you opt in.
|
||||
# Enable with COMPOSE_PROFILES in .env and follow the docs:
|
||||
# https://lobehub.com/docs/self-hosting/advanced/full-text-search
|
||||
#
|
||||
# Resources: the JVM heap below (ES_JAVA_OPTS, default 1 GB) should stay at or
|
||||
# below half of the memory available to this container; plan for at least 2 GB
|
||||
# RAM for Elasticsearch alone. Linux hosts must set vm.max_map_count=262144.
|
||||
#
|
||||
# The image is built locally from ./elasticsearch/Dockerfile: the pinned
|
||||
# official image plus the required analysis-icu plugin. The build runs once,
|
||||
# the first time the profile is enabled, and needs outbound access to
|
||||
# docker.elastic.co / artifacts.elastic.co; afterwards container recreation
|
||||
# works offline. To upgrade, change the version in both `image` and
|
||||
# `build.args` below, then run `docker compose up -d --build`.
|
||||
# ---------------------------------------------------------------------------
|
||||
elasticsearch:
|
||||
image: lobehub-elasticsearch-icu:9.5.2
|
||||
build:
|
||||
context: ./elasticsearch
|
||||
args:
|
||||
ELASTICSEARCH_VERSION: 9.5.2
|
||||
container_name: lobe-elasticsearch
|
||||
# Only this profile starts the bundled node. The reindex and sync services
|
||||
# below deliberately do not depend on it, so the same services also work
|
||||
# against an external Elasticsearch (ES_URL + ES_API_KEY in .env) without
|
||||
# building or starting a local node.
|
||||
profiles: [elasticsearch]
|
||||
# Intentionally no `ports`: security is disabled, so this node must stay
|
||||
# reachable only from services on lobe-network. Never publish 9200.
|
||||
environment:
|
||||
- 'discovery.type=single-node'
|
||||
- 'cluster.name=lobehub'
|
||||
- 'xpack.security.enabled=false'
|
||||
- 'xpack.ml.enabled=false'
|
||||
- 'ingest.geoip.downloader.enabled=false'
|
||||
- 'ES_JAVA_OPTS=${ES_JAVA_OPTS:--Xms1g -Xmx1g}'
|
||||
volumes:
|
||||
- 'elasticsearch-data:/usr/share/elasticsearch/data'
|
||||
ulimits:
|
||||
nofile:
|
||||
soft: 65536
|
||||
hard: 65536
|
||||
healthcheck:
|
||||
test:
|
||||
[
|
||||
'CMD-SHELL',
|
||||
"curl -fsS 'http://localhost:9200/_cluster/health?wait_for_status=yellow&timeout=5s' >/dev/null || exit 1",
|
||||
]
|
||||
interval: 10s
|
||||
timeout: 10s
|
||||
retries: 30
|
||||
start_period: 90s
|
||||
restart: unless-stopped
|
||||
networks:
|
||||
- lobe-network
|
||||
|
||||
# One-off full backfill / status command for the optional Elasticsearch path.
|
||||
# It never starts with `docker compose up`; run it explicitly, for example:
|
||||
# docker compose run --rm fts-search-reindex --status
|
||||
# docker compose run --rm fts-search-reindex --apply --fresh-run --yes
|
||||
# The checkpoint lives in the fts-search-reindex-state volume so a later run
|
||||
# with the same arguments (without --fresh-run) resumes instead of restarting.
|
||||
# With the bundled node, start the stack with `docker compose up -d --wait`
|
||||
# first so Elasticsearch is healthy before the backfill connects to it.
|
||||
fts-search-reindex:
|
||||
image: lobehub/lobehub
|
||||
profiles: [elasticsearch-reindex]
|
||||
depends_on:
|
||||
postgresql:
|
||||
condition: service_healthy
|
||||
environment:
|
||||
- 'DATABASE_URL=postgresql://postgres:${POSTGRES_PASSWORD}@postgresql:5432/${LOBE_DB_NAME}'
|
||||
- 'ES_REINDEX_STATE_DIR=/app/.elasticsearch-reindex'
|
||||
env_file:
|
||||
- .env
|
||||
volumes:
|
||||
- 'fts-search-reindex-state:/app/.elasticsearch-reindex'
|
||||
# The script lives in the entrypoint so that arguments given to
|
||||
# `docker compose run fts-search-reindex ...` replace only `--status`.
|
||||
entrypoint: ['/bin/node', '/app/fts-search-elasticsearch-reindex.cjs']
|
||||
command: ['--status']
|
||||
restart: 'no'
|
||||
networks:
|
||||
- lobe-network
|
||||
|
||||
# Long-running incremental sync worker for the optional Elasticsearch path.
|
||||
# Start it only after the backfill status is ready_for_incremental_sync by
|
||||
# adding the elasticsearch-sync profile to COMPOSE_PROFILES in .env. It keeps
|
||||
# draining the PostgreSQL Outbox into Elasticsearch and exits non-zero (and is
|
||||
# restarted) when it hits failed or dead-letter work, so check its logs. It
|
||||
# also exits and is restarted until the Elasticsearch target is reachable.
|
||||
fts-search-sync:
|
||||
image: lobehub/lobehub
|
||||
container_name: lobe-fts-search-sync
|
||||
profiles: [elasticsearch-sync]
|
||||
depends_on:
|
||||
postgresql:
|
||||
condition: service_healthy
|
||||
environment:
|
||||
- 'DATABASE_URL=postgresql://postgres:${POSTGRES_PASSWORD}@postgresql:5432/${LOBE_DB_NAME}'
|
||||
- 'FTS_SEARCH_SYNC_ENABLED=true'
|
||||
- 'MIGRATION_DB=1'
|
||||
env_file:
|
||||
- .env
|
||||
entrypoint: ['/bin/node', '/app/fts-search-elasticsearch-sync.cjs']
|
||||
command: ['--max-steps=8', '--interval-seconds=${FTS_SEARCH_SYNC_INTERVAL_SECONDS:-15}', '--yes']
|
||||
# On SIGTERM the worker finishes only the current drain step (not all 8) and
|
||||
# then exits, so the grace period has to cover one step: its bulk request may
|
||||
# wait up to 20s plus database settlement. Compose's default of 10s would
|
||||
# SIGKILL mid-step and leave claims to expire into retries.
|
||||
stop_grace_period: 2m
|
||||
restart: unless-stopped
|
||||
networks:
|
||||
- lobe-network
|
||||
|
||||
networks:
|
||||
lobe-network:
|
||||
driver: bridge
|
||||
|
||||
volumes:
|
||||
redis_data:
|
||||
driver: local
|
||||
rustfs-data:
|
||||
driver: local
|
||||
# Only created when an Elasticsearch profile is enabled.
|
||||
elasticsearch-data:
|
||||
driver: local
|
||||
fts-search-reindex-state:
|
||||
driver: local
|
||||
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user