amangs commited on
Commit
7a19fe4
·
1 Parent(s): 35eeda3

Move volatile Hermes & Ekko SQLite databases and caches off FUSE /data to container overlayfs

Browse files
entrypoint.sh CHANGED
@@ -5,10 +5,12 @@ echo "🚀 Starting REA + Codeman Mission Control Space..."
5
  echo "================================================="
6
 
7
  # 1. Directories:
8
- # - /data (S3 bucket): ONLY persistent files (workspace, services, config, code-server, opencode, hermes, hermes-web-ui)
9
- # - /tmp (ephemeral local disk): logs, caches, databases, scratch files
10
- mkdir -p /data/{workspace,code-server,services,config/opencode,.hermes,.hermes-web-ui}
 
11
  mkdir -p /tmp/{logs,.cache,code-server-cache}
 
12
  chmod -R 755 /data/services
13
 
14
  # Ensure opencode global configuration persists on /data
@@ -35,17 +37,14 @@ fi
35
  mkdir -p /data/workspace/.opencode
36
  ln -sfn /data/config/opencode/opencode.json /data/workspace/.opencode/opencode.json 2>/dev/null || true
37
 
38
- # Fix root home links so Ekko Studio (.ekko / .config) persists cleanly on /data
39
- mkdir -p /data/.ekko /data/.config
40
- ln -sfn /data/.ekko /root/.ekko 2>/dev/null || true
41
- ln -sfn /data/.hermes-web-ui /root/.hermes-web-ui 2>/dev/null || true
42
 
43
- # Save environment secrets to /tmp/.env (mode 600) so services can access them
44
- env | grep -E '^(AUTH_TOKEN|REA_API_KEY|CODE_PASSWORD|GOFILES_PASS|TELEGRAM|LLM_AMAN)' > /tmp/.env || true
45
- chmod 600 /tmp/.env
46
-
47
- # Clean legacy logs/tmp from previous iterations
48
- rm -rf /data/logs /data/tmp /data/.cache /data/openclaw /data/script/codeman 2>/dev/null || true
49
 
50
  # Deploy clean opencode-router with assets and public UI into /data/script/opencode-router
51
  mkdir -p /data/script/opencode-router
 
5
  echo "================================================="
6
 
7
  # 1. Directories:
8
+ # - /data (S3 bucket): ONLY workspace code files, services, opencode config
9
+ # - /tmp (ephemeral local disk): logs, caches, scratch files
10
+ # - /home/appuser (container overlayfs): SQLite databases (hermes-web-ui.db, state.db)
11
+ mkdir -p /data/{workspace,code-server,services,config/opencode}
12
  mkdir -p /tmp/{logs,.cache,code-server-cache}
13
+ mkdir -p /home/appuser/{.hermes,.hermes-web-ui}
14
  chmod -R 755 /data/services
15
 
16
  # Ensure opencode global configuration persists on /data
 
37
  mkdir -p /data/workspace/.opencode
38
  ln -sfn /data/config/opencode/opencode.json /data/workspace/.opencode/opencode.json 2>/dev/null || true
39
 
40
+ # Clean legacy logs/tmp and active SQLite DBs from FUSE bucket to prevent deadlocks
41
+ rm -rf /data/logs /data/tmp /data/.cache /data/openclaw /data/script/codeman /data/.hermes /data/.hermes-web-ui /data/.ekko-studio /data/.ekko 2>/dev/null || true
 
 
42
 
43
+ # Hermes & Ekko Studio run purely on local fast container storage (/home/appuser)
44
+ mkdir -p /home/appuser/{.hermes,.hermes-web-ui}
45
+ ln -sfn /home/appuser/.hermes /root/.hermes 2>/dev/null || true
46
+ ln -sfn /home/appuser/.hermes-web-ui /root/.hermes-web-ui 2>/dev/null || true
47
+ ln -sfn /home/appuser/.hermes-web-ui /root/.ekko 2>/dev/null || true
 
48
 
49
  # Deploy clean opencode-router with assets and public UI into /data/script/opencode-router
50
  mkdir -p /data/script/opencode-router
services/25-ekko-studio.sh CHANGED
@@ -19,13 +19,13 @@ export PORT=8648
19
  export HOST="0.0.0.0"
20
  export UPSTREAM="http://127.0.0.1:8642"
21
  export HERMES_BIN="/usr/local/bin/hermes"
22
- export HERMES_HOME="/data/.hermes"
23
- export HERMES_WEB_UI_HOME="/data/.hermes-web-ui"
24
  export AUTH_TOKEN="${AUTH_TOKEN:-${CODE_PASSWORD:-123456}}"
25
  export PASSWORD="$AUTH_TOKEN"
26
  export TMPDIR="/tmp"
27
 
28
- if pgrep -f "hermes-web-ui.*7861" >/dev/null 2>&1; then
29
  echo "ekko-studio already running"
30
  exit 0
31
  fi
 
19
  export HOST="0.0.0.0"
20
  export UPSTREAM="http://127.0.0.1:8642"
21
  export HERMES_BIN="/usr/local/bin/hermes"
22
+ export HERMES_HOME="/home/appuser/.hermes"
23
+ export HERMES_WEB_UI_HOME="/home/appuser/.hermes-web-ui"
24
  export AUTH_TOKEN="${AUTH_TOKEN:-${CODE_PASSWORD:-123456}}"
25
  export PASSWORD="$AUTH_TOKEN"
26
  export TMPDIR="/tmp"
27
 
28
+ if pgrep -f "hermes-web-ui.*8648" >/dev/null 2>&1; then
29
  echo "ekko-studio already running"
30
  exit 0
31
  fi
services/28-hermes-agent.sh CHANGED
@@ -14,7 +14,7 @@ if [ -f /data/.env ]; then
14
  set +a
15
  fi
16
 
17
- export HERMES_HOME="/data/.hermes"
18
  export HERMES_MODEL="${MODEL_NAME:-deepseek-ai/deepseek-v4-flash}"
19
  export HERMES_BIN="/usr/local/bin/hermes"
20
  export API_SERVER_ENABLED=true
@@ -23,15 +23,16 @@ export API_SERVER_HOST=127.0.0.1
23
  export GATEWAY_ALLOW_ALL_USERS=true
24
 
25
  # Seed hermes config if not present
26
- if [ ! -f /data/.hermes/config.yaml ]; then
27
- cp /app/config/hermes.yaml /data/.hermes/config.yaml
 
28
  fi
29
 
30
  # Ensure custom telegram api base is set in config
31
  BASE_URL="${TELEGRAM_BOT_APIBASE:-tgp.ind.pp.ua}"
32
- if [ -n "$BASE_URL" ] && [ -f /data/.hermes/config.yaml ]; then
33
- sed -i "s|https://tgp.ind.pp.ua/bot|https://${BASE_URL}/bot|g" /data/.hermes/config.yaml
34
- sed -i "s|https://tgp.ind.pp.ua/file/bot|https://${BASE_URL}/file/bot|g" /data/.hermes/config.yaml
35
  fi
36
 
37
  if pgrep -f "hermes gateway run" >/dev/null 2>&1; then
 
14
  set +a
15
  fi
16
 
17
+ export HERMES_HOME="/home/appuser/.hermes"
18
  export HERMES_MODEL="${MODEL_NAME:-deepseek-ai/deepseek-v4-flash}"
19
  export HERMES_BIN="/usr/local/bin/hermes"
20
  export API_SERVER_ENABLED=true
 
23
  export GATEWAY_ALLOW_ALL_USERS=true
24
 
25
  # Seed hermes config if not present
26
+ mkdir -p /home/appuser/.hermes
27
+ if [ ! -f /home/appuser/.hermes/config.yaml ]; then
28
+ cp /app/config/hermes.yaml /home/appuser/.hermes/config.yaml
29
  fi
30
 
31
  # Ensure custom telegram api base is set in config
32
  BASE_URL="${TELEGRAM_BOT_APIBASE:-tgp.ind.pp.ua}"
33
+ if [ -n "$BASE_URL" ] && [ -f /home/appuser/.hermes/config.yaml ]; then
34
+ sed -i "s|https://tgp.ind.pp.ua/bot|https://${BASE_URL}/bot|g" /home/appuser/.hermes/config.yaml
35
+ sed -i "s|https://tgp.ind.pp.ua/file/bot|https://${BASE_URL}/file/bot|g" /home/appuser/.hermes/config.yaml
36
  fi
37
 
38
  if pgrep -f "hermes gateway run" >/dev/null 2>&1; then