Temporalio - Temporal/Server - Overwrite the 127.0.0.1:7233 IP address to something else

Hello,

I am trying to overwrite the default configuration that starts the temporal server on localhost:7233 , to start it on IP_ADDRESS:7233, since I am running this locally in some VMs, and if I create multiple VMs with multiple temporal servers, upon start up, they clash since they all bind to 127.0.0.1:7233.

I set up a configuration in /etc/temporal/config/docker.yaml, which works and it starts the following services at the address that I provided in there:

Example log
"{“level”:“info”,“ts”:“2020-08-27T20:29:41.665Z”,“msg”:“none”,“service”:“history”,“shard-id”:1,“address”:“10.0.0.3:7234”,“shard-item”:“0xc00072f680”,“component”:“history-engine”,“lifecycle”:“Starting”,“logging-call-at”:“historyEngine.go:363”}

{“level”:“info”,“ts”:“2020-08-27T20:29:41.784Z”,“msg”:“Starting service matching”,“logging-call-at”:“server.go:257”}

{“level”:“info”,“ts”:“2020-08-27T20:29:41.784Z”,“msg”:“Get dynamic config”,“name”:“matching.throttledLogRPS”,“value”:“20”,“default-value”:“20”,“logging-call-at”:“config.go:78”}

{“level”:“info”,“ts”:“2020-08-27T20:29:41.784Z”,“msg”:“Created gRPC listener”,“service”:“matching”,“address”:“10.0.0.3:7235”,“logging-call-at”:“rpc.go:134”}

{“level”:“info”,“ts”:“2020-08-27T20:29:41.785Z”,“msg”:“Get dynamic config”,“name”:“matching.persistenceGlobalMaxQPS”,“value”:“0”,“default-value”:“0”,“logging-call-at”:“config.go:78”}

{“level”:“info”,“ts”:“2020-08-27T20:29:41.785Z”,“msg”:“Get dynamic config”,“name”:“matching.persistenceMaxQPS”,“value”:“3000”,“default-value”:“3000”,“logging-call-at”:“config.go:78”}

{“level”:“info”,“ts”:“2020-08-27T20:29:42.451Z”,“msg”:“Updated dynamic config”,“service”:“frontend”,“logging-call-at”:“fileBasedClient.go:262”}

{“level”:“info”,“ts”:“2020-08-27T20:29:42.473Z”,“msg”:“matching starting”,“service”:“matching”,“logging-call-at”:“service.go:96”}

{“level”:“info”,“ts”:“2020-08-27T20:29:42.475Z”,“msg”:“Get dynamic config”,“name”:“matching.rps”,“value”:“1200”,“default-value”:“1200”,“logging-call-at”:“config.go:78”}

{“level”:“info”,“ts”:“2020-08-27T20:29:42.475Z”,“msg”:“RuntimeMetricsReporter started”,“service”:“matching”,“logging-call-at”:“runtime.go:173”}

{“level”:“info”,“ts”:“2020-08-27T20:29:42.476Z”,“msg”:“Get dynamic config”,“name”:“history.persistenceMaxQPS”,“value”:“3000”,“default-value”:“3000”,“logging-call-at”:“config.go:78”}

{“level”:“warn”,“ts”:“2020-08-27T20:29:42.482Z”,“msg”:“error in prometheus reporter”,“error”:“listen tcp 0.0.0.0:9090: bind: address already in use”,“logging-call-at”:“metrics.go:135”}

{“level”:“info”,“ts”:“2020-08-27T20:29:42.504Z”,“msg”:“Membership heartbeat upserted successfully”,“service”:“matching”,“address”:“10.0.0.3”,“port”:6935,“hostId”:“09c68f45-e8a4-11ea-a3f7-08002722dbd9”,“logging-call-at”:“rpMonitor.go:217”}

However I am still getting this:

  • echo ‘Default namespace default not found. Creating…’

  • sleep 1

  • tctl --ns default namespace register --rd 1 --desc ‘Default namespace for Temporal Server’

Error: Register namespace operation failed.

Error Details: last connection error: connection error: desc = “transport: Error while dialing dial tcp 127.0.1.1:7233: connect: connection refused”

(‘export TEMPORAL_CLI_SHOW_STACKS=1’ to see stack traces)

  • tctl --ns default namespace describe

Any ideas on how I can overwrite this to point to 10.0.0.3 instead of 127.0.0.1?

You can set the following environment variables to accomplish this:

  • BIND_ON_IP to change which IP your service listens to (you want to set it to 10.0.0.3 in this case)
  • PROMETHEUS_ENDPOINT to change the IP and port for the metrics reporter (10.0.0.3:9090 here)
  • PUBLIC_FRONTEND_ADDRESS to change the IP/hostname and port that the worker service uses to connect to frontend. (10.0.0.3:7233)

For simplicity and to make sure everything works above, I would recommend you run a replica of each service on both VMs. Let me know how this works for you and if you run into any issues!

after set env BIND_ON_IP=0.0.0.0, can’t start the service any more. the health check will fail.
Error: unable to health check “temporal.api.workflowservice.v1.WorkflowService” service: connection error: desc = “transport: Error while dialing: dial tcp 0.0.0.0:7233: connect: connection refused”. it’s so strange, why health check will try to connect 0.0.0.0. How can I fix this? Can you help me?

if BIND_ON_IP is setted, need set TEMPORAL_BROADCAST_ADDRESS too.