Vegetable
Vegetable15mo ago

Self-hosted- Mounting volume into docker-compose

Hi Windmill, first time posting here. I am looking to use Windmill to fetch a file download from an API with Python. Then I remembered Windmill self-hosted runs in containers and can't access the OS filesystem. I see in the compose file a windmill_server and windmill_worker. I would imagine these are the two containers I need to add a volume to? Possibly not even the server, just the worker since from the naming of the container, I gather it likely runs the scripts/flows etc. If this has already been asked or there is a documentation page that answerers precisely that, please tell me to go RTFM but I could not find any lol. Thanks guys!
1 Reply
Vegetable
Vegetable15mo ago
For anyone who searches for this after the fact. Below at the bottom, just add your mount here and the python interpreter can os.listdir('/mnt/data') just as it would.
windmill_worker:
image: ${WM_IMAGE}
pull_policy: always
deploy:
replicas: 3
restart: unless-stopped
environment:
- DATABASE_URL=${DATABASE_URL}
- BASE_URL=${WM_BASE_URL}
- RUST_LOG=info
- DISABLE_SERVER=true
- KEEP_JOB_DIR=false
- METRICS_ADDR=false
# To handle all tags, remove the env variable altogether. If you do so, you can remove the windmill_worker_native containers.
- WORKER_TAGS=deno,python3,go,bash,dependency,flow,hub,other,bun
# LICENSE_KEY is only needed for the enterprise edition
- LICENSE_KEY=${WM_LICENSE_KEY}
depends_on:
db:
condition: service_healthy
# to mount the worker folder to debug, KEEP_JOB_DIR=true and mount /tmp/windmill
volumes:
# mount the docker socket to allow to run docker containers from within the workers
- /var/run/docker.sock:/var/run/docker.sock
# See Oauth (https://docs.windmill.dev/docs/misc/setup_oauth)
- ./oauth.json:/usr/src/app/oauth.json
- worker_dependency_cache:/tmp/windmill/cache
- /mnt/data:/mnt/data ########### ADDED THIS HERE ######
windmill_worker:
image: ${WM_IMAGE}
pull_policy: always
deploy:
replicas: 3
restart: unless-stopped
environment:
- DATABASE_URL=${DATABASE_URL}
- BASE_URL=${WM_BASE_URL}
- RUST_LOG=info
- DISABLE_SERVER=true
- KEEP_JOB_DIR=false
- METRICS_ADDR=false
# To handle all tags, remove the env variable altogether. If you do so, you can remove the windmill_worker_native containers.
- WORKER_TAGS=deno,python3,go,bash,dependency,flow,hub,other,bun
# LICENSE_KEY is only needed for the enterprise edition
- LICENSE_KEY=${WM_LICENSE_KEY}
depends_on:
db:
condition: service_healthy
# to mount the worker folder to debug, KEEP_JOB_DIR=true and mount /tmp/windmill
volumes:
# mount the docker socket to allow to run docker containers from within the workers
- /var/run/docker.sock:/var/run/docker.sock
# See Oauth (https://docs.windmill.dev/docs/misc/setup_oauth)
- ./oauth.json:/usr/src/app/oauth.json
- worker_dependency_cache:/tmp/windmill/cache
- /mnt/data:/mnt/data ########### ADDED THIS HERE ######