Compare commits
2 Commits
feat/drop-
...
670a2c47a1
| Author | SHA1 | Date | |
|---|---|---|---|
| 670a2c47a1 | |||
| 946ebb2957 |
70
ai/compose.yml
Executable file → Normal file
70
ai/compose.yml
Executable file → Normal file
@@ -26,24 +26,13 @@ services:
|
|||||||
# - "traefik.http.routers.webui-https.tls.certresolver=njalla"
|
# - "traefik.http.routers.webui-https.tls.certresolver=njalla"
|
||||||
|
|
||||||
hermes:
|
hermes:
|
||||||
build:
|
build: ./hermes
|
||||||
context: ./hermes
|
|
||||||
args:
|
|
||||||
HERMES_PLUGIN_URLS: "git+https://code.lazyworkhorse.net/gortium/hermes-piper-plugin.git;git+https://code.lazyworkhorse.net/gortium/hermes-identity-plugin.git"
|
|
||||||
container_name: hermes
|
container_name: hermes
|
||||||
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 \"$@\"",
|
|
||||||
"hermes-entrypoint"]
|
|
||||||
restart: always
|
restart: always
|
||||||
# Gateway run enables the internal API server on port 8642
|
# Gateway run enables the internal API server on port 8642
|
||||||
command: gateway run
|
command: gateway run
|
||||||
environment:
|
environment:
|
||||||
- OLLAMA_HOST=http://ollama:11434
|
- OLLAMA_HOST=http://ollama:11434
|
||||||
- HERMES_DASHBOARD=1
|
|
||||||
# Multi-profile: comma-separated list of profiles to run as gateways.
|
|
||||||
# The entrypoint reads this and starts one gateway per profile.
|
|
||||||
# Add profiles here when they exist on disk (e.g. default,researcher,writer)
|
|
||||||
- HERMES_PROFILES=ashley,claire,finn,matt,paul
|
|
||||||
- API_SERVER_ENABLED=true
|
- API_SERVER_ENABLED=true
|
||||||
- API_SERVER_PORT=8642
|
- API_SERVER_PORT=8642
|
||||||
- API_SERVER_HOST=0.0.0.0
|
- API_SERVER_HOST=0.0.0.0
|
||||||
@@ -59,10 +48,6 @@ services:
|
|||||||
- TZ=America/Montreal
|
- TZ=America/Montreal
|
||||||
volumes:
|
volumes:
|
||||||
- /mnt/HoardingCow_docker_data/Hermes/data:/opt/data
|
- /mnt/HoardingCow_docker_data/Hermes/data:/opt/data
|
||||||
# Syncthing-shared org files — read-only view of user's agenda
|
|
||||||
- /mnt/HoardingCow_docker_data/Syncthing/telos-ro:/opt/data/telos-ro:ro
|
|
||||||
# Syncthing-shared inbox — write tasks here, they sync to user's laptop
|
|
||||||
- /mnt/HoardingCow_docker_data/Syncthing/telos-rw:/opt/data/telos-rw:rw
|
|
||||||
devices:
|
devices:
|
||||||
- /dev/kfd:/dev/kfd
|
- /dev/kfd:/dev/kfd
|
||||||
- /dev/dri:/dev/dri
|
- /dev/dri:/dev/dri
|
||||||
@@ -71,59 +56,6 @@ services:
|
|||||||
- "26"
|
- "26"
|
||||||
networks:
|
networks:
|
||||||
- ai_backend
|
- ai_backend
|
||||||
- ai_net
|
|
||||||
labels:
|
|
||||||
- "traefik.enable=true"
|
|
||||||
- "traefik.docker.network=ai_net"
|
|
||||||
|
|
||||||
# Router for HTTP + redirection to HTTPS
|
|
||||||
- "traefik.http.routers.hermes-web-http.rule=Host(`hermes.lazyworkhorse.net`)"
|
|
||||||
- "traefik.http.routers.hermes-web-http.entrypoints=web"
|
|
||||||
- "traefik.http.routers.hermes-web-http.middlewares=redirect-to-https"
|
|
||||||
|
|
||||||
# Router for HTTPS with TLS — protected by Authelia
|
|
||||||
- "traefik.http.routers.hermes-web-https.rule=Host(`hermes.lazyworkhorse.net`)"
|
|
||||||
- "traefik.http.routers.hermes-web-https.entrypoints=websecure"
|
|
||||||
- "traefik.http.routers.hermes-web-https.tls=true"
|
|
||||||
- "traefik.http.routers.hermes-web-https.tls.certresolver=njalla"
|
|
||||||
- "traefik.http.routers.hermes-web-https.middlewares=hermes-auth"
|
|
||||||
|
|
||||||
# Authelia forwardAuth
|
|
||||||
- "traefik.http.middlewares.hermes-auth.forwardauth.address=http://authelia:9091/api/verify?rd=https://auth.lazyworkhorse.net/"
|
|
||||||
- "traefik.http.middlewares.hermes-auth.forwardauth.trustforwardheader=true"
|
|
||||||
- "traefik.http.middlewares.hermes-auth.forwardauth.authresponseheaders=X-Forwarded-User,X-Forwarded-Groups"
|
|
||||||
|
|
||||||
# Service Loadbalancer (dashboard port 9119)
|
|
||||||
- "traefik.http.services.hermes-web.loadbalancer.server.port=9119"
|
|
||||||
|
|
||||||
syncthing:
|
|
||||||
image: syncthing/syncthing:latest
|
|
||||||
container_name: syncthing
|
|
||||||
hostname: syncthing
|
|
||||||
restart: always
|
|
||||||
ports:
|
|
||||||
- "8384:8384"
|
|
||||||
- "22000:22000"
|
|
||||||
- "21027:21027/udp"
|
|
||||||
environment:
|
|
||||||
- TZ=America/Montreal
|
|
||||||
volumes:
|
|
||||||
- /mnt/HoardingCow_docker_data/Syncthing/config:/var/syncthing/config
|
|
||||||
- /mnt/HoardingCow_docker_data/Syncthing/telos-ro:/telos-ro
|
|
||||||
- /mnt/HoardingCow_docker_data/Syncthing/telos-rw:/telos-rw
|
|
||||||
networks:
|
|
||||||
- ai_backend
|
|
||||||
- ai_net
|
|
||||||
labels:
|
|
||||||
- "traefik.enable=true"
|
|
||||||
- "traefik.http.routers.syncthing-http.rule=Host(`syncthing.lazyworkhorse.net`)"
|
|
||||||
- "traefik.http.routers.syncthing-http.entrypoints=web"
|
|
||||||
- "traefik.http.routers.syncthing-http.middlewares=redirect-to-https"
|
|
||||||
- "traefik.http.routers.syncthing-https.rule=Host(`syncthing.lazyworkhorse.net`)"
|
|
||||||
- "traefik.http.routers.syncthing-https.entrypoints=websecure"
|
|
||||||
- "traefik.http.routers.syncthing-https.tls=true"
|
|
||||||
- "traefik.http.routers.syncthing-https.tls.certresolver=njalla"
|
|
||||||
- "traefik.http.services.syncthing.loadbalancer.server.port=8384"
|
|
||||||
|
|
||||||
ollama:
|
ollama:
|
||||||
build:
|
build:
|
||||||
|
|||||||
@@ -1,40 +1,50 @@
|
|||||||
# syntax=docker/dockerfile:1
|
# 1. On récupère la version la plus récente d'UV
|
||||||
# Hermes Agent -- official image + custom plugins layered on top.
|
FROM ghcr.io/astral-sh/uv:latest AS uv_source
|
||||||
# No fork needed — customizations are pip-installable plugins from Gitea.
|
|
||||||
# docker compose build hermes
|
|
||||||
# Or manually:
|
|
||||||
# DOCKER_BUILDKIT=1 docker build --build-arg HERMES_PLUGIN_URLS="url1 url2" -t hermes-agent:custom .
|
|
||||||
|
|
||||||
# ---------- Base: official Hermes image (system deps, npm, uv, Playwright) ----------
|
# 2. Image officielle Hermes Agent de NousResearch
|
||||||
|
# Contient déjà: Python, Node.js, npm, Playwright/Chromium, venv, tts_tool.py, etc.
|
||||||
FROM nousresearch/hermes-agent:latest
|
FROM nousresearch/hermes-agent:latest
|
||||||
|
|
||||||
# ---------- Plugin URLs (semicolon-separated, set via compose.yml build args) ----------
|
# ---------- System dependencies ----------
|
||||||
ARG HERMES_PLUGIN_URLS=""
|
# The official hermes-agent image already has: git, curl, ffmpeg, python3,
|
||||||
|
# gcc, build-essential, openssh-client, procps, tini, ripgrep, docker-cli,
|
||||||
# ---------- Extra system deps ----------
|
# libportaudio2, ca-certificates, etc.
|
||||||
|
#
|
||||||
|
# These extras we need to add back:
|
||||||
|
# - poppler-utils, imagemagick (PDF/image processing)
|
||||||
|
# - texlive-* (LaTeX typesetting for reports)
|
||||||
|
# - qemu-user-static, binfmt-support (QEMU cross-compilation)
|
||||||
|
# - emacs-nox (text editing in container)
|
||||||
USER root
|
USER root
|
||||||
RUN apt-get update && \
|
RUN apt-get update && \
|
||||||
apt-get install -y --no-install-recommends \
|
apt-get install -y --no-install-recommends \
|
||||||
libportaudio2 ca-certificates poppler-utils imagemagick \
|
libportaudio2 \
|
||||||
libolm-dev \
|
ca-certificates \
|
||||||
texlive-latex-base texlive-latex-extra texlive-fonts-recommended \
|
poppler-utils \
|
||||||
texlive-xetex texlive-science \
|
imagemagick \
|
||||||
qemu-user-static binfmt-support emacs-nox && \
|
texlive-latex-base \
|
||||||
|
texlive-latex-extra \
|
||||||
|
texlive-fonts-recommended \
|
||||||
|
texlive-xetex \
|
||||||
|
texlive-science \
|
||||||
|
qemu-user-static \
|
||||||
|
binfmt-support \
|
||||||
|
emacs-nox && \
|
||||||
rm -rf /var/lib/apt/lists/*
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
# ---------- UV ----------
|
# ---------- UV (hyperfast pip alternative) ----------
|
||||||
COPY --chmod=0755 --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/
|
COPY --chmod=0755 --from=uv_source /uv /usr/local/bin/
|
||||||
|
|
||||||
# ---------- Matrix bridge + extra pip deps ----------
|
WORKDIR /opt/hermes
|
||||||
|
|
||||||
|
# ---------- Piper TTS dans le venv existant ----------
|
||||||
|
# Le venv de l'image de base est root-owned, on doit installer en root aussi
|
||||||
RUN . /opt/hermes/.venv/bin/activate && \
|
RUN . /opt/hermes/.venv/bin/activate && \
|
||||||
uv pip install --no-cache-dir 'mautrix[encryption]' openai
|
uv pip install --no-cache-dir piper-tts sounddevice numpy
|
||||||
|
|
||||||
# ---------- Piper TTS ----------
|
# ---------- Télécharger la voix Piper Ryan (high quality) ----------
|
||||||
RUN . /opt/hermes/.venv/bin/activate && \
|
RUN mkdir -p /opt/hermes/.venv/share/piper/voices && \
|
||||||
uv pip install --no-cache-dir piper-tts sounddevice numpy && \
|
/opt/hermes/.venv/bin/python3 /dev/stdin << 'PYEOF'
|
||||||
mkdir -p /opt/hermes/.venv/share/piper/voices
|
|
||||||
|
|
||||||
RUN /opt/hermes/.venv/bin/python3 /dev/stdin << 'PYEOF'
|
|
||||||
import urllib.request
|
import urllib.request
|
||||||
base = '/opt/hermes/.venv/share/piper/voices'
|
base = '/opt/hermes/.venv/share/piper/voices'
|
||||||
url = 'https://huggingface.co/rhasspy/piper-voices/resolve/main/en/en_US/ryan/high/en_US-ryan-high.onnx'
|
url = 'https://huggingface.co/rhasspy/piper-voices/resolve/main/en/en_US/ryan/high/en_US-ryan-high.onnx'
|
||||||
@@ -42,47 +52,22 @@ urllib.request.urlretrieve(url, base + '/en_US-ryan-high.onnx')
|
|||||||
urllib.request.urlretrieve(url + '.json', base + '/en_US-ryan-high.onnx.json')
|
urllib.request.urlretrieve(url + '.json', base + '/en_US-ryan-high.onnx.json')
|
||||||
PYEOF
|
PYEOF
|
||||||
|
|
||||||
# ---------- Install Himalaya email CLI ----------
|
# ---------- Patch tts_tool.py: remplacer Edge TTS par Piper ----------
|
||||||
RUN /opt/hermes/.venv/bin/python3 /dev/stdin << 'PYEOF'
|
# Edge TTS appelle les serveurs Microsoft — on ne veut jamais ça.
|
||||||
import urllib.request, tarfile, os, shutil
|
# Piper roule localement sur CPU, aucun cloud, aucune donnée qui sort.
|
||||||
url = 'https://github.com/pimalaya/himalaya/releases/download/v1.2.0/himalaya.x86_64-linux.tgz'
|
COPY patch_tts_tool.py /tmp/patch_tts_tool.py
|
||||||
tgz = '/tmp/himalaya.tgz'
|
RUN /opt/hermes/.venv/bin/python3 /tmp/patch_tts_tool.py && rm /tmp/patch_tts_tool.py
|
||||||
urllib.request.urlretrieve(url, tgz)
|
|
||||||
with tarfile.open(tgz) as t:
|
|
||||||
t.extractall('/tmp')
|
|
||||||
shutil.move('/tmp/himalaya', '/usr/local/bin/himalaya')
|
|
||||||
os.chmod('/usr/local/bin/himalaya', 0o755)
|
|
||||||
os.remove(tgz)
|
|
||||||
print('himalaya v1.2.0 installed')
|
|
||||||
PYEOF
|
|
||||||
|
|
||||||
# ---------- Install custom plugins from URLs ----------
|
|
||||||
# HERMES_PLUGIN_URLS is a semicolon-separated list of pip-installable
|
|
||||||
# package URLs (e.g. git+https:// or direct .tar.gz archives from Gitea).
|
|
||||||
# Each plugin is installed into the Hermes venv.
|
|
||||||
RUN if [ -n "$HERMES_PLUGIN_URLS" ]; then \
|
|
||||||
. /opt/hermes/.venv/bin/activate && \
|
|
||||||
IFS=';' read -ra URLS <<< "$HERMES_PLUGIN_URLS" && \
|
|
||||||
for url in "${URLS[@]}"; do \
|
|
||||||
echo "Installing plugin: $url" && \
|
|
||||||
uv pip install --no-cache-dir "$url"; \
|
|
||||||
done; \
|
|
||||||
fi
|
|
||||||
|
|
||||||
# ---------- Install multi-gateway launcher ----------
|
|
||||||
# Launches one gateway process per profile (HERMES_PROFILES env var)
|
|
||||||
COPY --chmod=0755 run-multi-gateways.sh /usr/local/bin/run-multi-gateways.sh
|
|
||||||
|
|
||||||
# ---------- Runtime ----------
|
# ---------- Runtime ----------
|
||||||
|
# Retour à l'utilisateur non-root pour la sécurité
|
||||||
USER hermes
|
USER hermes
|
||||||
|
|
||||||
ENV HERMES_HOME=/opt/data
|
ENV HERMES_HOME=/opt/data
|
||||||
ENV PATH="/opt/data/.local/bin:${PATH}"
|
ENV PATH="/opt/data/.local/bin:${PATH}"
|
||||||
# Point browser tool to Playwright's Chromium (already in base image)
|
|
||||||
ENV CHROME_EXECUTABLE=/opt/hermes/.playwright/chromium/chrome-linux/chrome
|
|
||||||
|
|
||||||
# Ensure tools directory and toolsets.py are writable by the hermes runtime user
|
|
||||||
# so custom tools can be injected from the persistent volume at startup.
|
|
||||||
USER root
|
|
||||||
RUN chown -R hermes:hermes /opt/hermes/tools /opt/hermes/toolsets.py
|
|
||||||
|
|
||||||
VOLUME [ "/opt/data" ]
|
VOLUME [ "/opt/data" ]
|
||||||
|
|
||||||
|
# Script de réparation des permissions + patch TTS au démarrage
|
||||||
|
COPY --chmod=0755 fix-permissions.sh /opt/hermes/fix-permissions.sh
|
||||||
|
|
||||||
|
ENTRYPOINT [ "/usr/bin/tini", "-g", "--", "/opt/hermes/fix-permissions.sh" ]
|
||||||
|
|||||||
38
ai/hermes/fix-permissions.sh
Normal file
38
ai/hermes/fix-permissions.sh
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Startup permission fix + TTS patch.
|
||||||
|
# Runs as root before the entrypoint drops to the hermes user.
|
||||||
|
set -e
|
||||||
|
|
||||||
|
HERMES_HOME="${HERMES_HOME:-/opt/data}"
|
||||||
|
|
||||||
|
# Fix ownership on critical writable directories
|
||||||
|
chown -R hermes:hermes \
|
||||||
|
"$HERMES_HOME/sessions" \
|
||||||
|
"$HERMES_HOME/checkpoints" \
|
||||||
|
"$HERMES_HOME/skills" \
|
||||||
|
"$HERMES_HOME/memories" \
|
||||||
|
"$HERMES_HOME/workspace" \
|
||||||
|
"$HERMES_HOME/pastes" \
|
||||||
|
"$HERMES_HOME/logs" \
|
||||||
|
"$HERMES_HOME/cron" \
|
||||||
|
"$HERMES_HOME/plans" \
|
||||||
|
"$HERMES_HOME/hooks" \
|
||||||
|
"$HERMES_HOME/cache" \
|
||||||
|
2>/dev/null || true
|
||||||
|
|
||||||
|
# Fix data volume root ownership
|
||||||
|
if [ "$(stat -c %u "$HERMES_HOME" 2>/dev/null)" != "$(id -u hermes)" ]; then
|
||||||
|
chown hermes:hermes "$HERMES_HOME" 2>/dev/null || true
|
||||||
|
fi
|
||||||
|
|
||||||
|
# ---------- Patch tts_tool.py: replace Edge TTS with Piper ----------
|
||||||
|
# Fallback runtime patch in case the volume's site-packages differ from the image.
|
||||||
|
# Idempotent: if already patched, the script does nothing.
|
||||||
|
PATCH_SCRIPT="/opt/hermes/patch_tts_tool.py"
|
||||||
|
if [ -f "$PATCH_SCRIPT" ]; then
|
||||||
|
echo "Applying TTS patch (Piper only, no Edge fallback)..."
|
||||||
|
/opt/hermes/.venv/bin/python3 "$PATCH_SCRIPT" 2>&1 || true
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Chain to the official Hermes entrypoint
|
||||||
|
exec /opt/hermes/docker/entrypoint.sh "$@"
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
# Multi-gateway launcher for HERMES_PROFILES env var.
|
|
||||||
# Reads comma-separated profile names, spawns one gateway per profile.
|
|
||||||
# Designed to run before the main entrypoint — gateways run in background.
|
|
||||||
set -e
|
|
||||||
|
|
||||||
if [ -z "${HERMES_PROFILES}" ]; then
|
|
||||||
echo "HERMES_PROFILES not set — skipping multi-gateway launch"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Source venv to make 'hermes' available (entrypoint.sh sources it later,
|
|
||||||
# but we need it NOW for the background gateways)
|
|
||||||
HERMES_BIN="/opt/hermes/.venv/bin/hermes"
|
|
||||||
if [ ! -x "$HERMES_BIN" ]; then
|
|
||||||
echo "ERROR: hermes binary not found at $HERMES_BIN"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
mkdir -p /opt/data/logs
|
|
||||||
|
|
||||||
IFS=',' read -ra PROFILES <<< "${HERMES_PROFILES}"
|
|
||||||
for profile in "${PROFILES[@]}"; do
|
|
||||||
profile="$(echo "${profile}" | xargs)" # trim whitespace
|
|
||||||
[ -z "${profile}" ] && continue
|
|
||||||
|
|
||||||
echo "Starting gateway for profile: ${profile}"
|
|
||||||
nohup env API_SERVER_ENABLED=false API_SERVER_KEY= gosu hermes "$HERMES_BIN" --profile "${profile}" gateway run \
|
|
||||||
>> "/opt/data/logs/gateway-${profile}.log" 2>&1 &
|
|
||||||
done
|
|
||||||
|
|
||||||
echo "All gateways launched: ${HERMES_PROFILES}"
|
|
||||||
@@ -10,8 +10,6 @@ services:
|
|||||||
- GITEA__actions__ENABLED=true
|
- GITEA__actions__ENABLED=true
|
||||||
- SSH_PORT=2222
|
- SSH_PORT=2222
|
||||||
- SSH_LISTEN_PORT=2222
|
- SSH_LISTEN_PORT=2222
|
||||||
# Enable Gitea Actions (act_runner required on host)
|
|
||||||
- GITEA__actions__ENABLED=true
|
|
||||||
volumes:
|
volumes:
|
||||||
- /mnt/HoardingCow_docker_data/Gitea:/data
|
- /mnt/HoardingCow_docker_data/Gitea:/data
|
||||||
networks:
|
networks:
|
||||||
@@ -47,7 +45,7 @@ services:
|
|||||||
image: gitea/act_runner:latest
|
image: gitea/act_runner:latest
|
||||||
container_name: act_runner
|
container_name: act_runner
|
||||||
environment:
|
environment:
|
||||||
- GITEA_INSTANCE_URL=https://code.lazyworkhorse.net
|
- GITEA_INSTANCE_URL=http://gitea:3000
|
||||||
- GITEA_RUNNER_REGISTRATION_TOKEN=${GITEA_RUNNER_TOKEN}
|
- GITEA_RUNNER_REGISTRATION_TOKEN=${GITEA_RUNNER_TOKEN}
|
||||||
- GITEA_RUNNER_NAME=ai-host-runner
|
- GITEA_RUNNER_NAME=ai-host-runner
|
||||||
- GITEA_RUNNER_LABELS=ubuntu-latest:docker://catthehacker/ubuntu:full-22.04,nixos-builder:docker://nixos/nix
|
- GITEA_RUNNER_LABELS=ubuntu-latest:docker://catthehacker/ubuntu:full-22.04,nixos-builder:docker://nixos/nix
|
||||||
|
|||||||
@@ -1,9 +0,0 @@
|
|||||||
# Custom wg-easy with iptables-nft (nftables-backed iptables)
|
|
||||||
# Fixes crash-loop when host kernel lacks legacy iptable_nat module.
|
|
||||||
FROM ghcr.io/wg-easy/wg-easy:latest
|
|
||||||
|
|
||||||
# The upstream image registers only iptables-legacy with update-alternatives.
|
|
||||||
# iptables-nft binary exists but isn't registered as an alternative key.
|
|
||||||
# Override the alternatives-managed symlinks directly.
|
|
||||||
RUN ln -sf /usr/sbin/iptables-nft /usr/sbin/iptables && \
|
|
||||||
ln -sf /usr/sbin/ip6tables-nft /usr/sbin/ip6tables
|
|
||||||
@@ -2,10 +2,7 @@ version: "3.8"
|
|||||||
|
|
||||||
services:
|
services:
|
||||||
wireguard:
|
wireguard:
|
||||||
build:
|
image: weejewel/wg-easy:latest
|
||||||
context: .
|
|
||||||
dockerfile: Dockerfile
|
|
||||||
image: wg-easy-iptables-nft:latest
|
|
||||||
container_name: wireguard
|
container_name: wireguard
|
||||||
cap_add:
|
cap_add:
|
||||||
- NET_ADMIN
|
- NET_ADMIN
|
||||||
|
|||||||
Reference in New Issue
Block a user