fix: provision config.yaml/.env + systemd EnvironmentFile drop-in
Fixes #9 (custom_providers missing — fresh installs had no config.yaml/.env, so gateway had no provider to connect to) and #10 (systemd unit had no EnvironmentFile, so gateway couldn't read rocketchat.env/.env → crash-loop). Templates provisioned on first install only (no overwrites): - templates/config.yaml: minimal working config with ollama-cloud provider - templates/.env: API key placeholder - templates/hermes-gateway-env.conf: systemd drop-in wiring rocketchat.env + .env
This commit is contained in:
+36
-1
@@ -42,6 +42,9 @@ load_lang() {
|
|||||||
[copying]="📁 Copying plugin files…"
|
[copying]="📁 Copying plugin files…"
|
||||||
[env_written]="🔑 Credentials written to %s"
|
[env_written]="🔑 Credentials written to %s"
|
||||||
[config_updated]="⚙️ config.yaml updated"
|
[config_updated]="⚙️ config.yaml updated"
|
||||||
|
[config_provisioned]="📄 Provisioned minimal config.yaml"
|
||||||
|
[env_provisioned]="🔧 Provisioned .env template"
|
||||||
|
[env_dropin]="🔌 Systemd EnvironmentFile drop-in installed"
|
||||||
[copied]="📁 Copied %d plugin files"
|
[copied]="📁 Copied %d plugin files"
|
||||||
[ollama_check]="🔍 Checking Ollama..."
|
[ollama_check]="🔍 Checking Ollama..."
|
||||||
[ollama_missing]="⚠️ Ollama not found. Install: curl -fsSL https://ollama.com/install.sh | sh"
|
[ollama_missing]="⚠️ Ollama not found. Install: curl -fsSL https://ollama.com/install.sh | sh"
|
||||||
@@ -85,6 +88,9 @@ load_lang() {
|
|||||||
[copying]="📁 Kopiere Plugin-Dateien…"
|
[copying]="📁 Kopiere Plugin-Dateien…"
|
||||||
[env_written]="🔑 Zugangsdaten gespeichert in %s"
|
[env_written]="🔑 Zugangsdaten gespeichert in %s"
|
||||||
[config_updated]="⚙️ config.yaml aktualisiert"
|
[config_updated]="⚙️ config.yaml aktualisiert"
|
||||||
|
[config_provisioned]="📄 Minimale config.yaml bereitgestellt"
|
||||||
|
[env_provisioned]="🔧 .env-Vorlage bereitgestellt"
|
||||||
|
[env_dropin]="🔌 Systemd EnvironmentFile-Drop-in installiert"
|
||||||
[copied]="📁 %d Plugin-Dateien kopiert"
|
[copied]="📁 %d Plugin-Dateien kopiert"
|
||||||
[ollama_check]="🔍 Prüfe Ollama..."
|
[ollama_check]="🔍 Prüfe Ollama..."
|
||||||
[ollama_missing]="⚠️ Ollama nicht gefunden. Installation: curl -fsSL https://ollama.com/install.sh | sh"
|
[ollama_missing]="⚠️ Ollama nicht gefunden. Installation: curl -fsSL https://ollama.com/install.sh | sh"
|
||||||
@@ -419,8 +425,26 @@ if [ -d "$SCRIPT_DIR/plugin" ]; then
|
|||||||
msg copied "$copied_count"
|
msg copied "$copied_count"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# ─── Fix #9: Provision minimal config.yaml + .env ──────────
|
||||||
|
# Only when hermes has NO config yet (fresh install, no setup run)
|
||||||
|
HERMES_HOME="$HOME/.hermes"
|
||||||
|
CONFIG="$HERMES_HOME/config.yaml"
|
||||||
|
ENVFILE="$HERMES_HOME/.env"
|
||||||
|
|
||||||
|
if [ ! -f "$CONFIG" ]; then
|
||||||
|
mkdir -p "$HERMES_HOME"
|
||||||
|
if [ -f "$SCRIPT_DIR/templates/config.yaml" ]; then
|
||||||
|
cp "$SCRIPT_DIR/templates/config.yaml" "$CONFIG"
|
||||||
|
msg config_provisioned
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if [ ! -f "$ENVFILE" ] && [ -f "$SCRIPT_DIR/templates/.env" ]; then
|
||||||
|
cp "$SCRIPT_DIR/templates/.env" "$ENVFILE"
|
||||||
|
chmod 600 "$ENVFILE"
|
||||||
|
msg env_provisioned
|
||||||
|
fi
|
||||||
|
|
||||||
# ─── Patch config.yaml ────────────────────────────────────
|
# ─── Patch config.yaml ────────────────────────────────────
|
||||||
CONFIG="$HOME/.hermes/config.yaml"
|
|
||||||
if [ -f "$CONFIG" ]; then
|
if [ -f "$CONFIG" ]; then
|
||||||
# Ensure rocketchat-platform is in plugins.enabled
|
# Ensure rocketchat-platform is in plugins.enabled
|
||||||
if ! grep -q 'rocketchat-platform' "$CONFIG" 2>/dev/null; then
|
if ! grep -q 'rocketchat-platform' "$CONFIG" 2>/dev/null; then
|
||||||
@@ -450,6 +474,17 @@ fi
|
|||||||
# Install / refresh systemd user service
|
# Install / refresh systemd user service
|
||||||
$PYTHON -m hermes_cli.main gateway install 2>/dev/null || true
|
$PYTHON -m hermes_cli.main gateway install 2>/dev/null || true
|
||||||
|
|
||||||
|
# ─── Fix #10: systemd EnvironmentFile drop-in ─────────────
|
||||||
|
# Gateway needs rocketchat.env + .env — hermes gateway install
|
||||||
|
# does not wire them automatically.
|
||||||
|
DROPDIN_DIR="$HOME/.config/systemd/user/hermes-gateway.service.d"
|
||||||
|
DROPDIN_FILE="$DROPDIN_DIR/env.conf"
|
||||||
|
mkdir -p "$DROPDIN_DIR"
|
||||||
|
if [ -f "$SCRIPT_DIR/templates/hermes-gateway-env.conf" ]; then
|
||||||
|
cp "$SCRIPT_DIR/templates/hermes-gateway-env.conf" "$DROPDIN_FILE"
|
||||||
|
msg env_dropin
|
||||||
|
fi
|
||||||
|
|
||||||
# Ensure lingering is enabled (may need sudo — best-effort)
|
# Ensure lingering is enabled (may need sudo — best-effort)
|
||||||
loginctl enable-linger 2>/dev/null || true
|
loginctl enable-linger 2>/dev/null || true
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
# Hermes Agent — API keys (generated by Rocket.Chat Plugin installer)
|
||||||
|
# Add your HERMES_API_KEY below — get it from your Hermes provider
|
||||||
|
HERMES_API_KEY=change-me
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
# Hermes Agent — minimal working configuration
|
||||||
|
# Generated by Rocket.Chat Plugin installer
|
||||||
|
# Expand with: hermes setup
|
||||||
|
|
||||||
|
model:
|
||||||
|
default: deepseek-v4-pro
|
||||||
|
provider: ollama-cloud
|
||||||
|
base_url: https://api.openai.com/v1
|
||||||
|
|
||||||
|
fallback_providers:
|
||||||
|
- ollama-cloud
|
||||||
|
|
||||||
|
custom_providers:
|
||||||
|
- name: ollama-cloud
|
||||||
|
base_url: https://api.openai.com/v1
|
||||||
|
api_key_env: HERMES_API_KEY
|
||||||
|
|
||||||
|
toolsets:
|
||||||
|
- hermes-cli
|
||||||
|
|
||||||
|
plugins:
|
||||||
|
enabled:
|
||||||
|
- rocketchat-platform
|
||||||
|
|
||||||
|
agent:
|
||||||
|
max_turns: 90
|
||||||
|
gateway_timeout: 1800
|
||||||
|
|
||||||
|
terminal:
|
||||||
|
backend: local
|
||||||
|
|
||||||
|
display:
|
||||||
|
language: de
|
||||||
|
|
||||||
|
gateway:
|
||||||
|
enabled: true
|
||||||
|
platforms:
|
||||||
|
rocketchat:
|
||||||
|
enabled: true
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
# Rocket.Chat Plugin — environment file hook for hermes-gateway
|
||||||
|
# Generated by install.sh — do not edit manually
|
||||||
|
[Service]
|
||||||
|
EnvironmentFile=%h/.config/hermes/rocketchat.env
|
||||||
|
EnvironmentFile=%h/.hermes/.env
|
||||||
Reference in New Issue
Block a user