Hermes Agent Service
dweber2026
PROOP

3 days ago

Hello,

I am running a Hermes Agent service (project: Hermes Agent, service URL: hermes-agent-production-cb05.up.railway.app) and am experiencing an issue where Railway environment variables are not accessible inside s6-overlay cont-init.d scripts at container startup.

The Issue:

My service uses s6-overlay for process supervision. The startup hook at /etc/cont-init.d/01-hermes-setup (which runs docker/stage2-hook.sh) needs to read the LLM_MODEL environment variable to write it to a config file on the persistent volume. However, the variable shows as UNSET inside the script even though it is correctly set in the Railway Variables panel as LLM_MODEL=anthropic/claude-sonnet-4-6.

What I have confirmed:

  • LLM_MODEL is set correctly in Railway Variables
  • The script runs as root via s6-overlay cont-init.d
  • A diagnostic echo in the script shows: [stage2] LLM_MODEL env: UNSET
  • All other Railway-injected variables (TELEGRAM_BOT_TOKEN, OPENROUTER_API_KEY etc.) are also UNSET in the script
  • The Hermes gateway process itself also cannot see LLM_MODEL, which is why it sends an empty model string to OpenRouter and gets HTTP 400: No models provided

What I have tried:

  • Hardcoding the model directly in cli-config.yaml.example (works but requires a rebuild each time the model changes)
  • Using with-contenv in main-wrapper.sh (Chuck the agent fixed this for the gateway process but cont-init.d scripts run before main-wrapper.sh)
  • Writing LLM_MODEL directly to .env file in the hook script (the variable is UNSET so cannot be read)

My Question:

Is there a way to make Railway environment variables accessible inside s6-overlay cont-init.d scripts? Or is there a recommended pattern for passing Railway env vars into container init scripts that run before the main process starts?

Alternatively, is there a Railway-specific mechanism (like a pre-deploy script or build arg injection) that would allow me to write environment variables to a config file before the container starts?

Service details:

  • Project: Hermes Agent (independent project)
  • Service URL: hermes-agent-production-cb05.up.railway.app
  • GitHub repo: dweber2026/hermes-agent
  • Plan: Pro

Thank you for your help!

Solved$20 Bounty

0 Replies

Status changed to Open Railway 3 days ago


Status changed to Solved dweber2026 3 days ago


Welcome!

Sign in to your Railway account to join the conversation.

Loading...