From f54f90be5b7fa426ed22c97b7dd25b4863c480fe Mon Sep 17 00:00:00 2001 From: Hermes Agent Date: Wed, 3 Jun 2026 12:24:08 +0200 Subject: [PATCH] fix: provision config.yaml/.env + systemd EnvironmentFile drop-in MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- install.sh | 37 ++++++++++++++++++++++++++++- templates/.env | 3 +++ templates/config.yaml | 39 +++++++++++++++++++++++++++++++ templates/hermes-gateway-env.conf | 5 ++++ 4 files changed, 83 insertions(+), 1 deletion(-) create mode 100644 templates/.env create mode 100644 templates/config.yaml create mode 100644 templates/hermes-gateway-env.conf diff --git a/install.sh b/install.sh index c597bab..1d468b8 100644 --- a/install.sh +++ b/install.sh @@ -42,6 +42,9 @@ load_lang() { [copying]="πŸ“ Copying plugin files…" [env_written]="πŸ”‘ Credentials written to %s" [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" [ollama_check]="πŸ” Checking Ollama..." [ollama_missing]="⚠️ Ollama not found. Install: curl -fsSL https://ollama.com/install.sh | sh" @@ -85,6 +88,9 @@ load_lang() { [copying]="πŸ“ Kopiere Plugin-Dateien…" [env_written]="πŸ”‘ Zugangsdaten gespeichert in %s" [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" [ollama_check]="πŸ” PrΓΌfe Ollama..." [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" 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 ──────────────────────────────────── -CONFIG="$HOME/.hermes/config.yaml" if [ -f "$CONFIG" ]; then # Ensure rocketchat-platform is in plugins.enabled if ! grep -q 'rocketchat-platform' "$CONFIG" 2>/dev/null; then @@ -450,6 +474,17 @@ fi # Install / refresh systemd user service $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) loginctl enable-linger 2>/dev/null || true diff --git a/templates/.env b/templates/.env new file mode 100644 index 0000000..f7b17ef --- /dev/null +++ b/templates/.env @@ -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 diff --git a/templates/config.yaml b/templates/config.yaml new file mode 100644 index 0000000..caed269 --- /dev/null +++ b/templates/config.yaml @@ -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 diff --git a/templates/hermes-gateway-env.conf b/templates/hermes-gateway-env.conf new file mode 100644 index 0000000..b0a79e0 --- /dev/null +++ b/templates/hermes-gateway-env.conf @@ -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