#understanding Gateway, Messaging, CLI, and Docker Volume Mounts

1 messages · Page 1 of 1 (latest)

worthy elm
#

I'm trying to understand how Hermes writes files in mounted volumes in cron job executions. I have my terminal set to this:

terminal:
backend: docker
cwd: .
timeout: 180
env_passthrough: []
docker_image: nikolaik/python-nodejs:python3.11-nodejs20
docker_forward_env: []
singularity_image: docker://nikolaik/python-nodejs:python3.11-nodejs20
modal_image: nikolaik/python-nodejs:python3.11-nodejs20
daytona_image: nikolaik/python-nodejs:python3.11-nodejs20
container_cpu: 2.0
container_memory: 5120
container_disk: 10240
container_persistent: true
docker_volumes: []
docker_mount_cwd_to_workspace: true
persistent_shell: true
lifetime_seconds: 300

when I run the CLI in some folder like ~/test , hermes can write to that folder. but for the gateway cron job executions how does it know which folder to read and write from? does it have to be explicitly told where to write files per job? using the Docker terminal backend, will it mount the right folder based on the cron job? im not understanding how to properly delegate local folders to be mounted volumes during cron job executions.

old fulcrum
#

The short answer: cron jobs inherit the gateway's TERMINAL_CWD, which defaults to your home directory. There's no per-job working directory override.

Here's the chain:

CLI mode (cd ~/test && hermes):

  • TERMINAL_CWD = ~/test (your current directory)
  • With docker_mount_cwd_to_workspace: true → Docker mounts ~/test as /workspace
  • Everything works because you explicitly cd'd there

Gateway/cron mode:

  • Gateway startup sets TERMINAL_CWD = MESSAGING_CWD env var, or $HOME if unset
  • Cron jobs run inside the gateway process and inherit that env
  • With docker_mount_cwd_to_workspace: true → Docker mounts your HOME as /workspace
  • The cron job has no mechanism to say "this job works in ~/test"
#

So the options for cron jobs that need a specific folder:

① Set MESSAGING_CWD=/home/youruser/test in ~/.hermes/.env — but this changes the working directory for ALL gateway and cron operations, not just one job.

② Use explicit volume mounts in config.yaml instead of docker_mount_cwd_to_workspace:

terminal:
  docker_mount_cwd_to_workspace: false
  docker_volumes:
    - "/home/youruser/test:/workspace"

Same caveat — this is global config, affects all Docker sessions.

③ Include the path in the cron prompt itself: "Read and write files in /workspace/test/..." — but this only works if that path exists inside the container (i.e. the parent directory is mounted).

There's no per-cron-job cwd field today. That would be a reasonable feature request if they need different cron jobs targeting different directories.

#

@worthy elm