Temporal's docker-compose is excellent for having a basic temporal server and UI to play around with while running its tutorials. Naturally, if you have your docker-compose in a project, copying the definition of temporal
, elasticsearch
and temporal-ui
containers will be good enough to make temporal part of your dev environment, especially if you use docker networks as follows:
networks:
temporal-network:
driver: bridge
name: temporal-network
Unfortunately is not my case. Due to some legacy complexity of my project, I have to use:
network_mode: host
This network move forbids me from using container names to do networking between containers in my docker-compose file. The temporal.io auto-setup docker image assumes you're running docker-compose networks, so it wrongly attempts to connect to temporal:7233
as part of the initialization of the temporal cluster.
To fix the situation, I added an environment variable to your temporal container as follows:
- BIND_ON_IP=127.0.0.1
My docker-compose definition looks like this:
temporal:
network_mode: host
depends_on:
- database
environment:
- DB=postgresql
- DB_PORT=5432
- POSTGRES_USER=temporal
- POSTGRES_PWD=temporal
- POSTGRES_SEEDS=localhost
- DYNAMIC_CONFIG_FILE_PATH=config/dynamicconfig/development-sql.yaml
- ENABLE_ES=true
- ES_SEEDS=localhost
- ES_VERSION=v7
# - TEMPORAL_CLI_ADDRESS=localhost:7233
- BIND_ON_IP=127.0.0.1
image: temporalio/auto-setup:1.17.1
ports:
- 7233:7233
volumes:
- ./scripts/temporal/dynamicconfig:/etc/temporal/config/dynamicconfig
temporal-admin-tools:
network_mode: host
depends_on:
- temporal
environment:
- TEMPORAL_CLI_ADDRESS=localhost:7233
image: temporalio/admin-tools:1.17.1
stdin_open: true
tty: true
elasticsearch:
network_mode: host
environment:
- cluster.routing.allocation.disk.threshold_enabled=true
- cluster.routing.allocation.disk.watermark.low=512mb
- cluster.routing.allocation.disk.watermark.high=256mb
- cluster.routing.allocation.disk.watermark.flood_stage=128mb
- discovery.type=single-node
- ES_JAVA_OPTS=-Xms256m -Xmx256m
- xpack.security.enabled=false
image: elasticsearch:7.16.2
expose:
- 9200
temporal-ui:
network_mode: host
depends_on:
- temporal
environment:
- TEMPORAL_ADDRESS=localhost:7233
- TEMPORAL_CORS_ORIGINS=http://localhost:3000
image: temporalio/ui:2.2.1
ports:
- 8080:8080
There are quite a few knobs in the initialization of a Temporal cluster. Unfortunately, the documentation still falls short in this area; I recommend you look at how auto-setup works works and read auto-setup.sh to learn some of the steps you have to do yourself outside docker-compose.
Happy temporal hacking!