Compare commits

..

18 Commits

Author SHA1 Message Date
4729af5774 fix: update backup compose for OS switch compatibility
- restic/restic -> restic/rest-server (restic server subcommand removed)
- embergarage/restic-browser -> floibach/restic-browser (old image deprecated)
- mount Restic/ -> /repo for browser filesystem scanning
- add persistent browser-data volume for SQLite config DB
- remove obsolete version attribute
2026-07-05 21:34:54 -04:00
0ba694adfa fix: add user directive to hermes service 2026-07-05 21:34:54 -04:00
aec2ea8143 feat: add llama-cpp-hermes service with ROCm 6.1 + gfx906 support
- Add custom llama.cpp Dockerfile with ROCm 6.1 + gfx906 (MI50) build
- Add llama-cpp-hermes service serving Hermes 4.3 on dual MI50 GPUs
- Strip GPU devices/ROCm env from ollama service (CPU-only for embeddings)

Hermes 4.3 runs at ~19 t/s on dual MI50s with 160K context.
2026-07-05 21:34:54 -04:00
e525145057 Merge pull request 'feat: add Honcho memory provider with Traefik + Authelia' (#48) from feat/honcho-only into master
Some checks failed
Build Hermes agent / build (push) Has been cancelled
Build ollama (gfx906) / build (push) Has been cancelled
Reviewed-on: #48
2026-06-15 17:08:20 +00:00
e5f1d98bd9 Merge remote-tracking branch 'origin/feat/honcho-only' into feat/honcho-only
Some checks failed
Build Hermes agent / build (pull_request) Has been cancelled
Build ollama (gfx906) / build (pull_request) Has been cancelled
2026-06-15 13:06:22 -04:00
82e3005d1f Added opencode api key 2026-06-15 13:05:10 -04:00
d88db00f3f deleted tmp files... fucking llm... 2026-06-15 13:04:18 -04:00
cf1e316af1 No more pre-created network, all bridge 2026-06-11 15:37:17 -04:00
0bff81bfa0 Fixed the honcho path 2026-06-11 15:30:59 -04:00
b185d43d67 switch-openconcho-to-fork
Some checks failed
Build Hermes agent / build (pull_request) Has been cancelled
Build ollama (gfx906) / build (pull_request) Has been cancelled
2026-05-28 17:15:36 -04:00
efaf3550b9 remove_temp_scratch_files
Some checks failed
Build Hermes agent / build (pull_request) Has been cancelled
Build ollama (gfx906) / build (pull_request) Has been cancelled
2026-05-25 16:52:13 -04:00
1460085718 Merge remote-tracking branch 'refs/remotes/origin/feat/honcho-only' into feat/honcho-only
Some checks failed
Build Hermes agent / build (pull_request) Has been cancelled
Build ollama (gfx906) / build (pull_request) Has been cancelled
2026-05-25 16:39:52 -04:00
6069ebd6a4 Removed version in compose 2026-05-25 16:37:25 -04:00
5dd6e9a442 fix_embedding_dims_to_1024_match_db
Some checks failed
Build Hermes agent / build (pull_request) Has been cancelled
Build ollama (gfx906) / build (pull_request) Has been cancelled
2026-05-25 16:34:00 -04:00
54e3868f94 fix_honcho_cmd_use_bash_instead_of_sh
Some checks failed
Build Hermes agent / build (pull_request) Has been cancelled
Build ollama (gfx906) / build (pull_request) Has been cancelled
2026-05-25 16:21:18 -04:00
68009f05c1 fix_honcho_dockerfile_ssh_client_and_keyscan
Some checks failed
Build Hermes agent / build (pull_request) Has been cancelled
Build ollama (gfx906) / build (pull_request) Has been cancelled
2026-05-25 16:10:57 -04:00
87e546beae merge commit
Some checks failed
Build Hermes agent / build (pull_request) Has been cancelled
Build ollama (gfx906) / build (pull_request) Has been cancelled
2026-05-25 16:08:19 -04:00
b4a0e4449d Fixed the honcho name 2026-05-25 16:04:19 -04:00
9 changed files with 97 additions and 320 deletions

View File

@@ -1,4 +1,3 @@
version: "3.8"
services: services:
# webui: # webui:
@@ -31,6 +30,7 @@ services:
ssh: ssh:
- default - default
container_name: hermes container_name: hermes
user: "10000:10000"
entrypoint: ["/bin/bash", "-c", entrypoint: ["/bin/bash", "-c",
"bash /opt/data/hermes-tools/install.sh && bash /usr/local/bin/run-multi-gateways.sh && exec /usr/bin/tini -g -- /opt/hermes/docker/entrypoint.sh \"$@\"", "bash /opt/data/hermes-tools/install.sh && bash /usr/local/bin/run-multi-gateways.sh && exec /usr/bin/tini -g -- /opt/hermes/docker/entrypoint.sh \"$@\"",
"hermes-entrypoint"] "hermes-entrypoint"]
@@ -50,6 +50,7 @@ services:
- API_SERVER_KEY=hermes_local_key - API_SERVER_KEY=hermes_local_key
- GATEWAY_ALLOW_ALL_USERS=true - GATEWAY_ALLOW_ALL_USERS=true
- OPENROUTER_API_KEY=${OPENROUTER_API_KEY} - OPENROUTER_API_KEY=${OPENROUTER_API_KEY}
- OPENCODE_API_KEY=${OPENCODE_API_KEY}
# ROCm for GPU-accelerated faster-whisper STT # ROCm for GPU-accelerated faster-whisper STT
- HSA_OVERRIDE_GFX_VERSION=9.0.6 - HSA_OVERRIDE_GFX_VERSION=9.0.6
- HCC_AMDGPU_TARGET=gfx906 - HCC_AMDGPU_TARGET=gfx906
@@ -144,25 +145,10 @@ services:
- /mnt/HoardingCow_docker_data/Ollama/ollama:/root/.ollama - /mnt/HoardingCow_docker_data/Ollama/ollama:/root/.ollama
environment: environment:
- OLLAMA_VULKAN=0 - OLLAMA_VULKAN=0
- HSA_OVERRIDE_GFX_VERSION=9.0.6
- HCC_AMDGPU_TARGET=gfx906
- HIP_VISIBLE_DEVICES=0,1
- ROCR_VISIBLE_DEVICES=0,1
- HSA_ENABLE_SDMA=0
- OLLAMA_HOST=0.0.0.0 - OLLAMA_HOST=0.0.0.0
- OLLAMA_DEBUG=1
- OLLAMA_FLASH_ATTENTION=1
- OLLAMA_NUM_PARALLEL=2
devices:
# Map the render nodes and KFD for ROCm to work inside the container
- /dev/kfd:/dev/kfd
- /dev/dri:/dev/dri
group_add:
- "303"
- "26"
# --- Honcho + OpenConcho combiné: API + Web UI nginx/FastAPI --- # --- Honcho + OpenConcho combiné: API + Web UI nginx/FastAPI ---
honcho-ui: honcho:
build: build:
context: ./honcho context: ./honcho
ssh: ssh:
@@ -173,13 +159,13 @@ services:
- DB_CONNECTION_URI=postgresql+psycopg://honcho:honcho_pass@honcho-db:5432/honcho - DB_CONNECTION_URI=postgresql+psycopg://honcho:honcho_pass@honcho-db:5432/honcho
- CACHE_URL=redis://honcho-redis:6379/0 - CACHE_URL=redis://honcho-redis:6379/0
- CACHE_ENABLED=true - CACHE_ENABLED=true
- EMBEDDING_VECTOR_DIMENSIONS=1536 - EMBEDDING_VECTOR_DIMENSIONS=1024
- AUTH_USE_AUTH=true - AUTH_USE_AUTH=true
- AUTH_JWT_SECRET=${HONCHO_AUTH_JWT_SECRET} - AUTH_JWT_SECRET=${HONCHO_AUTH_JWT_SECRET}
# Needed by deriver/dream to make LLM calls (api_key_env = "HONCHO_OPENAI_API_KEY" in config.toml) # Needed by deriver/dream to make LLM calls (api_key_env = "HONCHO_OPENAI_API_KEY" in config.toml)
- HONCHO_OPENAI_API_KEY=${HONCHO_OPENAI_API_KEY} - HONCHO_OPENAI_API_KEY=${HONCHO_OPENAI_API_KEY}
volumes: volumes:
- honcho_data:/app/data - /mnt/HoardingCow_docker_data/Honcho/data:/app/data
- /mnt/HoardingCow_docker_data/Honcho/config.toml:/app/config.toml:ro - /mnt/HoardingCow_docker_data/Honcho/config.toml:/app/config.toml:ro
networks: networks:
- ai_backend - ai_backend
@@ -260,47 +246,40 @@ volumes:
external: true external: true
name: honcho_data name: honcho_data
# llama_cpp_devstral: llama-cpp-hermes:
# image: ghcr.io/ggml-org/llama.cpp:server-rocm image: llama-cpp:rocm-gfx906
# container_name: llama_cpp_devstral container_name: llama-cpp-hermes
# restart: unless-stopped restart: unless-stopped
# networks: networks:
# - ai_backend - ai_backend
# ports: ports:
# - "8300:8080" - "127.0.0.1:8300:8080"
# ipc: host ipc: host
# devices: devices:
# - "/dev/kfd:/dev/kfd" - /dev/kfd:/dev/kfd
# - "/dev/dri:/dev/dri" - /dev/dri:/dev/dri
# group_add: group_add:
# - "303" # video - "303"
# - "26" # render - "26"
# environment: environment:
# HSA_OVERRIDE_GFX_VERSION: 9.0.6 - HSA_OVERRIDE_GFX_VERSION=9.0.6
# HIP_VISIBLE_DEVICES: 0,1 - HSA_ENABLE_SDMA=0
# LLAMA_CACHE: /models - HIP_VISIBLE_DEVICES=0,1
# volumes: - LLAMA_CACHE=/models
# - /mnt/HoardingCow_docker_data/Llama_cpp/models:/models volumes:
# - /mnt/HoardingCow_docker_data/Llama_cpp/devstral-agent.jinja:/template.jinja - /mnt/HoardingCow_docker_data/Llama_cpp/models:/models
# command: > - /mnt/HoardingCow_docker_data/Ollama/ollama/models/blobs/sha256-17823599694fa3503ef54bf748d5078c6ce881f4d01616cafa255dc05d215a08:/model.gguf:ro
# -hf unsloth/Devstral-Small-2-24B-Instruct-2512-GGUF:Devstral-Small-2-24B-Instruct-2512-Q8_0.gguf command: >
# -a devstral-2-small-llama_cpp -m /model.gguf
# --chat-template-file /template.jinja --host 0.0.0.0
# --host 0.0.0.0 --port 8080
# --port 8080 --gpu-layers 99
# --n-gpu-layers 99 --ctx-size 163840
# --ctx-size 163840 -ctk f16 -ctv f16
# --batch-size 4096 --flash-attn on
# --ubatch-size 4096 --split-mode layer
# --cache-type-k f16 --no-mmap
# --cache-type-v f16 --n-predict -1
# --cache-reuse 256
# --flash-attn on
# --context-shift
# --split-mode layer
# --no-mmap
# --n-predict -1
# --parallel 2
# vllm: # vllm:
# image: nalanzeyu/vllm-gfx906:v0.9.0-rocm6.3 # image: nalanzeyu/vllm-gfx906:v0.9.0-rocm6.3

View File

@@ -2,13 +2,14 @@
FROM python:3.13-slim-bookworm AS honcho-builder FROM python:3.13-slim-bookworm AS honcho-builder
RUN apt-get update && \ RUN apt-get update && \
apt-get install -y --no-install-recommends git && \ apt-get install -y --no-install-recommends git openssh-client && \
rm -rf /var/lib/apt/lists/* rm -rf /var/lib/apt/lists/*
COPY --from=ghcr.io/astral-sh/uv:0.9.24 /uv /bin/uv COPY --from=ghcr.io/astral-sh/uv:0.9.24 /uv /bin/uv
ARG HONCHO_REPO=ssh://git@code.lazyworkhorse.net:2222/Hermes/honcho.git ARG HONCHO_REPO=ssh://git@code.lazyworkhorse.net:2222/Hermes/honcho.git
ARG HONCHO_REF=main ARG HONCHO_REF=main
RUN mkdir -p -m 0700 ~/.ssh && ssh-keyscan -p 2222 code.lazyworkhorse.net >> ~/.ssh/known_hosts 2>/dev/null
RUN --mount=type=ssh git clone --depth 1 --branch ${HONCHO_REF} ${HONCHO_REPO} /app RUN --mount=type=ssh git clone --depth 1 --branch ${HONCHO_REF} ${HONCHO_REPO} /app
WORKDIR /app WORKDIR /app
@@ -29,8 +30,8 @@ RUN corepack enable && corepack prepare pnpm@latest --activate
WORKDIR /app WORKDIR /app
RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/* RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*
ARG OPENCONCHO_SHA=e490d911fcb27ee193558fd9a28856cde2057665 ARG OPENCONCHO_SHA=3b5c3293fc18d768dbe85285264a8d66c896bd81
RUN git clone --depth 1 https://github.com/offendingcommit/openconcho.git /app && \ RUN --mount=type=ssh git clone --depth 1 ssh://git@code.lazyworkhorse.net:2222/gortium/openconcho.git /app && \
git -C /app fetch --depth 1 origin ${OPENCONCHO_SHA} && \ git -C /app fetch --depth 1 origin ${OPENCONCHO_SHA} && \
git -C /app checkout ${OPENCONCHO_SHA} git -C /app checkout ${OPENCONCHO_SHA}
@@ -71,4 +72,4 @@ COPY honcho-nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 80 EXPOSE 80
CMD ["sh", "-c", "nginx -g 'daemon off;' & fastapi run --host 127.0.0.1 --port 8000 src/main.py & python3 -m src.deriver & wait -n"] CMD ["bash", "-c", "nginx -g 'daemon off;' & fastapi run --host 127.0.0.1 --port 8000 src/main.py & python3 -m src.deriver & wait -n"]

30
ai/llama-cpp/Dockerfile Normal file
View File

@@ -0,0 +1,30 @@
# llama-cpp-rocm6/Dockerfile
# Custom llama.cpp server with ROCm 6.1 + gfx906 (MI50) support.
# Build: docker build -t llama-cpp:rocm-gfx906 .
FROM rocm/dev-ubuntu-22.04:6.1.2-complete AS builder
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y curl git build-essential pkg-config cmake make && rm -rf /var/lib/apt/lists/*
ARG LLAMACPP_VERSION=b9596
RUN git clone --depth 1 --branch ${LLAMACPP_VERSION} https://github.com/ggml-org/llama.cpp.git /build
WORKDIR /build
ENV HIP_PATH=/opt/rocm ROCM_PATH=/opt/rocm PATH=/opt/rocm/bin:/opt/rocm/llvm/bin:${PATH} CMAKE_PREFIX_PATH=/opt/rocm
RUN mkdir build && cd build && \
cmake .. -DGGML_HIP=ON -DCMAKE_BUILD_TYPE=Release \
-DAMDGPU_TARGETS="gfx906:xnack-" \
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
-DGGML_CUDA=OFF -DGGML_VULKAN=OFF -DGGML_METAL=OFF \
-DBUILD_SHARED_LIBS=OFF && \
cmake --build . --target llama-server -- -j $(nproc)
FROM ubuntu:24.04
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
ca-certificates curl libstdc++6 libgomp1 libopenblas0 \
libnuma1 libelf1 libdrm2 libdrm-amdgpu1 \
&& rm -rf /var/lib/apt/lists/*
COPY --from=builder /opt/rocm/lib/ /opt/rocm/lib/
COPY --from=builder /opt/rocm/share/ /opt/rocm/share/
COPY --from=builder /build/build/bin/llama-server /usr/local/bin/llama-server
RUN echo /opt/rocm/lib > /etc/ld.so.conf.d/rocm.conf && ldconfig
ENV HSA_OVERRIDE_GFX_VERSION=9.0.6 HCC_AMDGPU_TARGET=gfx906 HSA_ENABLE_SDMA=0
EXPOSE 8080
ENTRYPOINT ["/usr/local/bin/llama-server"]

1
backup/.env Normal file
View File

@@ -0,0 +1 @@
RESTIC_PASSWORD=CVvxpEKWSydmsZ5bW9lb_UZ2NR3KAKibv00tYbyZ9-E

View File

@@ -1,98 +1,42 @@
version: "3.8"
services: services:
# kopia:
# image: kopia/kopia:latest
# container_name: kopia
# restart: unless-stopped
# # We explicitly run as root (0:0) to solve the CHDIR issue,
# # OR we make sure the host folders match UID 1000.
# user: "0:0"
# command:
# - server
# - start
# - --address=0.0.0.0:51515
# - --server-username=${KOPIA_SERVER_USER}
# - --server-password=${KOPIA_SERVER_PASSWORD}
# - --config-file=/app/config/repository.config
# - --disable-csrf-token-checks
# - --insecure
# environment:
# - TZ=America/Montreal
# - KOPIA_PASSWORD=${KOPIA_PASSWORD}
# - USER=${KOPIA_USER}
# volumes:
# - /mnt/HoardingCow_docker_data/Kopia/config:/app/config
# - /mnt/HoardingCow_docker_data/Kopia/cache:/app/cache
# - /mnt/HoardingCow_docker_data/Kopia/repository:/repository
# # Required if you want to use the 'Mount' feature later
# - /tmp:/tmp:shared
# # Required for mounting backups as drives
# cap_add:
# - SYS_ADMIN
# devices:
# - /dev/fuse:/dev/fuse
# networks:
# - traefik-net
# labels:
# - "traefik.enable=true"
# # 1. HTTP to HTTPS Redirect
# - "traefik.http.routers.kopia-http.rule=Host(`backup.lazyworkhorse.net`)"
# - "traefik.http.routers.kopia-http.entrypoints=web"
# - "traefik.http.routers.kopia-http.middlewares=redirect-to-https@docker"
#
# # 2. HTTPS Configuration
# - "traefik.http.routers.kopia.rule=Host(`backup.lazyworkhorse.net`)"
# - "traefik.http.routers.kopia.entrypoints=websecure"
# - "traefik.http.routers.kopia.tls=true"
# - "traefik.http.routers.kopia.tls.certresolver=njalla"
#
# # 3. Backend Service Config
# - "traefik.http.services.kopia.loadbalancer.server.port=51515"
restic-server: restic-server:
image: restic/restic:latest image: restic/rest-server:latest
container_name: restic-server container_name: restic-server
restart: always restart: always
user: "0:0" user: "0:0"
command: ["server", "--listen", ":8080", "--repo", "/data", "--tls-cert", "", "--tls-key", ""] command: ["rest-server", "--listen", ":8080", "--path", "/data", "--no-auth"]
environment: environment:
- TZ=America/Montreal - TZ=America/Montreal
- RESTIC_PASSWORD=${RESTIC_PASSWORD}
volumes: volumes:
- /mnt/HoardingCow_docker_data/Restic/data:/data - /mnt/HoardingCow_docker_data/Restic/data:/data
# Mount paths to backup (adjust as needed)
- /mnt/HoardingCow_docker_data:/source:ro
networks: networks:
- backup_net - backup_net
labels: labels:
- "traefik.enable=false" # Internal only, accessed by restic-browser - "traefik.enable=false"
restic-browser: restic-browser:
image: embergarage/restic-browser:latest image: floibach/restic-browser:latest
container_name: restic-browser container_name: restic-browser
restart: always restart: always
ports:
- "8081:8080"
environment: environment:
- TZ=America/Montreal - TZ=America/Montreal
- RESTIC_REPOSITORY=http://restic-server:8080 volumes:
- RESTIC_PASSWORD=${RESTIC_PASSWORD} - /mnt/HoardingCow_docker_data/Restic:/repo:ro
- /mnt/HoardingCow_docker_data/Restic/browser-data:/data
networks: networks:
- backup_net - backup_net
labels: labels:
- "traefik.enable=true" - "traefik.enable=true"
# 1. HTTP to HTTPS Redirect
- "traefik.http.routers.restic-browser-http.rule=Host(`backup.lazyworkhorse.net`)" - "traefik.http.routers.restic-browser-http.rule=Host(`backup.lazyworkhorse.net`)"
- "traefik.http.routers.restic-browser-http.entrypoints=web" - "traefik.http.routers.restic-browser-http.entrypoints=web"
- "traefik.http.routers.restic-browser-http.middlewares=redirect-to-https@docker" - "traefik.http.routers.restic-browser-http.middlewares=redirect-to-https@docker"
# 2. HTTPS Configuration
- "traefik.http.routers.restic-browser.rule=Host(`backup.lazyworkhorse.net`)" - "traefik.http.routers.restic-browser.rule=Host(`backup.lazyworkhorse.net`)"
- "traefik.http.routers.restic-browser.entrypoints=websecure" - "traefik.http.routers.restic-browser.entrypoints=websecure"
- "traefik.http.routers.restic-browser.tls=true" - "traefik.http.routers.restic-browser.tls=true"
- "traefik.http.routers.restic-browser.tls.certresolver=njalla" - "traefik.http.routers.restic-browser.tls.certresolver=njalla"
- "traefik.http.services.restic-browser.loadbalancer.server.port=8080"
# 3. Backend Service Config
- "traefik.http.services.restic-browser.loadbalancer.server.port=8000"
networks: networks:
backup_net: backup_net:

View File

@@ -1,7 +0,0 @@
import shutil, os
src = "/opt/data/projects/gortium/compose/ai/compose_updated.txt"
dst = "/opt/data/projects/gortium/compose/ai/compose.yml"
print(f"Source exists: {os.path.exists(src)}, size: {os.path.getsize(src)}")
print(f"Dest exists: {os.path.exists(dst)}")
shutil.copy2(src, dst)
print(f"Copied, dest size: {os.path.getsize(dst)}")

View File

@@ -1,154 +0,0 @@
#!/bin/bash
# ── Hermes Workspace Combined Entrypoint ──
# Waits for the Hermes gateway container (hermes:8642) to become healthy,
# then starts the Hermes Workspace web UI in the foreground.
# Supports graceful shutdown via SIGTERM/SIGINT.
# ──────────────────────────────────────────
set -euo pipefail
# ── Configuration ──────────────────────────────────────────────
GATEWAY_HOST="${GATEWAY_HOST:-hermes}"
GATEWAY_PORT="${GATEWAY_PORT:-8642}"
GATEWAY_URL="http://${GATEWAY_HOST}:${GATEWAY_PORT}"
HEALTH_ENDPOINT="${HEALTH_ENDPOINT:-/health}"
MAX_RETRIES="${HEALTH_MAX_RETRIES:-60}"
RETRY_INTERVAL="${HEALTH_RETRY_INTERVAL:-2}"
WORKSPACE_DIR="${WORKSPACE_DIR:-/workspace}"
WORKSPACE_ENTRY="${WORKSPACE_ENTRY:-server-entry.js}"
PID_FILE="${PID_FILE:-/tmp/workspace.pid}"
# ── Logging ────────────────────────────────────────────────────
log_info() { echo "[$(date '+%Y-%m-%d %H:%M:%S')] [INFO] $*"; }
log_warn() { echo "[$(date '+%Y-%m-%d %H:%M:%S')] [WARN] $*"; }
log_error() { echo "[$(date '+%Y-%m-%d %H:%M:%S')] [ERROR] $*"; }
# ── Graceful Shutdown ──────────────────────────────────────────
_workspace_pid=""
_shutting_down=false
cleanup() {
if [ "$_shutting_down" = true ]; then
return
fi
_shutting_down=true
log_info "Shutdown signal received, cleaning up..."
# Stop workspace process if running
if [ -n "$_workspace_pid" ] && kill -0 "$_workspace_pid" 2>/dev/null; then
log_info "Stopping workspace (PID: $_workspace_pid)..."
kill -TERM "$_workspace_pid" 2>/dev/null || true
# Give it time to shut down gracefully
local wait_sec=10
while kill -0 "$_workspace_pid" 2>/dev/null && [ "$wait_sec" -gt 0 ]; do
sleep 1
wait_sec=$((wait_sec - 1))
done
# Force kill if still running
if kill -0 "$_workspace_pid" 2>/dev/null; then
log_warn "Workspace did not shut down gracefully, force killing..."
kill -KILL "$_workspace_pid" 2>/dev/null || true
fi
fi
# Clean up PID file
[ -f "$PID_FILE" ] && rm -f "$PID_FILE"
log_info "Shutdown complete."
exit 0
}
# Trap termination signals for graceful shutdown
trap cleanup SIGTERM SIGINT
# ── Gateway Health Check ───────────────────────────────────────
wait_for_gateway() {
local url="${GATEWAY_URL}${HEALTH_ENDPOINT}"
local retries="$MAX_RETRIES"
local interval="$RETRY_INTERVAL"
local attempt=0
log_info "Waiting for Hermes gateway at ${GATEWAY_URL}..."
log_info "Max retries: ${retries}, interval: ${interval}s"
while [ "$attempt" -lt "$retries" ]; do
attempt=$((attempt + 1))
if curl -fsS "${url}" >/dev/null 2>&1; then
log_info "Gateway is healthy after ${attempt} attempt(s) (${GATEWAY_URL})"
return 0
fi
if [ "$attempt" -lt "$retries" ]; then
log_info "Gateway not ready yet (attempt ${attempt}/${retries}), retrying in ${interval}s..."
sleep "$interval"
fi
done
log_error "Gateway did not become healthy after ${retries} attempts (${retries * interval}s)"
return 1
}
# ── Workspace Startup ──────────────────────────────────────────
start_workspace() {
local entry="${WORKSPACE_DIR}/${WORKSPACE_ENTRY}"
if [ ! -d "$WORKSPACE_DIR" ]; then
log_error "Workspace directory not found: ${WORKSPACE_DIR}"
return 1
fi
if [ ! -f "$entry" ]; then
log_error "Workspace entry point not found: ${entry}"
return 1
fi
log_info "Starting Hermes Workspace web UI..."
log_info " Directory: ${WORKSPACE_DIR}"
log_info " Entry: ${entry}"
cd "$WORKSPACE_DIR"
# Start workspace in background so we can trap signals
exec node --max-old-space-size=2048 "${entry}" &
_workspace_pid=$!
echo "$_workspace_pid" > "$PID_FILE"
log_info "Workspace started (PID: ${_workspace_pid})"
# Wait for workspace process
wait "$_workspace_pid"
local exit_code=$?
log_info "Workspace exited with code ${exit_code}"
return "$exit_code"
}
# ── Main ───────────────────────────────────────────────────────
main() {
log_info "=== Hermes Workspace Combined Entrypoint ==="
log_info "Gateway: ${GATEWAY_URL}"
log_info "Workspace: ${WORKSPACE_DIR}/${WORKSPACE_ENTRY}"
log_info "PID file: ${PID_FILE}"
# Wait for gateway to be healthy
if ! wait_for_gateway; then
log_warn "Proceeding without confirmed gateway health..."
fi
# Start the workspace
start_workspace
local exit_code=$?
log_info "Entrypoint exiting with code ${exit_code}"
return "$exit_code"
}
# Run main; exit with its return code
main "$@"

View File

@@ -82,37 +82,37 @@ networks:
driver: bridge driver: bridge
name: traefik_backend name: traefik_backend
ai_net: ai_net:
external: true driver: bridge
name: ai_net name: ai_net
auth_net: auth_net:
external: true driver: bridge
name: auth_net name: auth_net
backup_net: backup_net:
external: true driver: bridge
name: backup_net name: backup_net
cloud_net: cloud_net:
external: true driver: bridge
name: cloud_net name: cloud_net
coms_net: coms_net:
external: true driver: bridge
name: coms_net name: coms_net
finance_net: finance_net:
external: true driver: bridge
name: finance_net name: finance_net
home_auto_net: home_auto_net:
external: true driver: bridge
name: home_auto_net name: home_auto_net
homepage_net: homepage_net:
external: true driver: bridge
name: homepage_net name: homepage_net
passman_net: passman_net:
external: true driver: bridge
name: passman_net name: passman_net
tak_net: tak_net:
external: true driver: bridge
name: tak_net name: tak_net
vc_net: vc_net:
external: true driver: bridge
name: vc_net name: vc_net
# duckdns: # duckdns:

View File

@@ -1,17 +0,0 @@
#!/usr/bin/env python3
"""Copy the updated txt file over the original yml file."""
import shutil
import os
src = "/opt/data/projects/gortium/compose/ai/compose_updated.txt"
dst = "/opt/data/projects/gortium/compose/ai/compose.yml"
# Check src exists
print(f"Source exists: {os.path.exists(src)}")
print(f"Source size: {os.path.getsize(src)} bytes")
print(f"Destination exists: {os.path.exists(dst)}")
# Copy
shutil.copy2(src, dst)
print(f"Copied {src} -> {dst}")
print(f"Destination size: {os.path.getsize(dst)} bytes")