Docs: 9router + Hermes Agent local AI stack with Telegram (9router routes model via combo)
This commit is contained in:
5
files/.env.example
Normal file
5
files/.env.example
Normal file
@@ -0,0 +1,5 @@
|
||||
# Telegram credentials for Hermes gateway
|
||||
# Copy to /home/ubuntu/.hermes/.env and chmod 600
|
||||
TELEGRAM_BOT_TOKEN=REPLACE_WITH_BOT_TOKEN
|
||||
TELEGRAM_ALLOWED_USERS=REPLACE_WITH_USER_ID
|
||||
TELEGRAM_HOME_CHANNEL=REPLACE_WITH_USER_ID
|
||||
14
files/config.yaml
Normal file
14
files/config.yaml
Normal file
@@ -0,0 +1,14 @@
|
||||
model:
|
||||
default: "free" # 9router combo name — 9router picks the model
|
||||
provider: "custom"
|
||||
base_url: "http://127.0.0.1:20128/v1"
|
||||
api_key: "REPLACE_WITH_9ROUTER_API_KEY" # from 9router dashboard → API section
|
||||
|
||||
messaging:
|
||||
telegram:
|
||||
enabled: true
|
||||
token: "REPLACE_WITH_TELEGRAM_BOT_TOKEN"
|
||||
allowed_user_ids:
|
||||
- "REPLACE_WITH_TELEGRAM_USER_ID"
|
||||
home_channel: telegram
|
||||
deliver: telegram
|
||||
30
files/hermes-gateway.service
Normal file
30
files/hermes-gateway.service
Normal file
@@ -0,0 +1,30 @@
|
||||
[Unit]
|
||||
Description=Hermes Agent Gateway - Messaging Platform Integration
|
||||
After=network-online.target
|
||||
Wants=network-online.target
|
||||
StartLimitIntervalSec=0
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStart=/home/ubuntu/.hermes/hermes-agent/venv/bin/python -m hermes_cli.main gateway run
|
||||
WorkingDirectory=/home/ubuntu/.hermes
|
||||
Environment="PATH=/home/ubuntu/.hermes/hermes-agent/venv/bin:/home/ubuntu/.hermes/hermes-agent/node_modules/.bin:/usr/bin:/home/ubuntu/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
|
||||
Environment="VIRTUAL_ENV=/home/ubuntu/.hermes/hermes-agent/venv"
|
||||
Environment="HERMES_HOME=/home/ubuntu/.hermes"
|
||||
# REQUIRED: gateway reads Telegram creds from .env — without this line the
|
||||
# platform stays disabled ("No messaging platforms enabled").
|
||||
EnvironmentFile=%h/.hermes/.env
|
||||
Restart=always
|
||||
RestartSec=5
|
||||
RestartForceExitStatus=75
|
||||
RestartPreventExitStatus=78
|
||||
KillMode=mixed
|
||||
KillSignal=SIGTERM
|
||||
ExecReload=/bin/kill -USR1 $MAINPID
|
||||
ExecStopPost=-/home/ubuntu/.hermes/hermes-agent/venv/bin/python -m gateway.cgroup_cleanup
|
||||
TimeoutStopSec=60
|
||||
StandardOutput=journal
|
||||
StandardError=journal
|
||||
|
||||
[Install]
|
||||
WantedBy=default.target
|
||||
29
files/setup-9router.sh
Normal file
29
files/setup-9router.sh
Normal file
@@ -0,0 +1,29 @@
|
||||
#!/bin/sh
|
||||
# setup-9router.sh — connect Ollama + create combo "free" on a running 9router.
|
||||
# Usage: ./setup-9router.sh <dashboard_password> <ollama_api_key>
|
||||
# Requires 9router already listening on http://127.0.0.1:20128
|
||||
set -e
|
||||
|
||||
PASS="$1"
|
||||
OLLAMA_KEY="$2"
|
||||
BASE=http://127.0.0.1:20128
|
||||
CK=/tmp/9r-ck.txt
|
||||
|
||||
[ -z "$PASS" ] && { echo "usage: $0 <dashboard_password> <ollama_api_key>"; exit 1; }
|
||||
[ -z "$OLLAMA_KEY" ] && { echo "usage: $0 <dashboard_password> <ollama_api_key>"; exit 1; }
|
||||
|
||||
echo "==> login"
|
||||
curl -s -c "$CK" -X POST "$BASE/api/auth/login" \
|
||||
-H "Content-Type: application/json" -d "{\"password\":\"$PASS\"}" >/dev/null
|
||||
|
||||
echo "==> connect Ollama"
|
||||
curl -s -b "$CK" -X POST "$BASE/api/providers" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{\"provider\":\"ollama\",\"authType\":\"apiKey\",\"apiKey\":\"$OLLAMA_KEY\"}"
|
||||
|
||||
echo "==> create combo 'free' (fallback gpt-oss:120b + minimax-m3)"
|
||||
curl -s -b "$CK" -X POST "$BASE/api/combos" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"name":"free","kind":"fallback","models":["ollama/gpt-oss:120b","ollama/minimax-m3"]}'
|
||||
|
||||
echo "==> done. Hermes should use model: \"free\""
|
||||
15
files/start-9router.sh
Normal file
15
files/start-9router.sh
Normal file
@@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
# Detached 9router launcher for @reboot cron.
|
||||
# Run as root crontab; drops privileges to user 'ubuntu' via runuser.
|
||||
# Uses absolute paths (cron @reboot has minimal PATH).
|
||||
SETSID=/usr/bin/setsid
|
||||
RUNUSER=/usr/sbin/runuser
|
||||
BIN=/usr/local/bin/9router
|
||||
USER=ubuntu
|
||||
LOG=/home/ubuntu/9router.log
|
||||
|
||||
if [ "$(id -u)" -eq 0 ]; then
|
||||
exec $SETSID $RUNUSER -u $USER -- $BIN -t -n --host 127.0.0.1 --port 20128 >> "$LOG" 2>&1 < /dev/null
|
||||
else
|
||||
exec $SETSID $BIN -t -n --host 127.0.0.1 --port 20128 >> "$LOG" 2>&1 < /dev/null
|
||||
fi
|
||||
Reference in New Issue
Block a user