WebDeveloper2017
WebDeveloper2017

Reputation: 83

Retrieve Host IP and port number in Docker - Schema Registry

We are trying to setup 2 instances of schema registry on docker. Our docker build and publish is auomated and hence will assign any available worker node/port number for the containers.

How can we update the advertised listener configuration on schema registry properties file dynamically? It should be updated by the worker node name and port assigned.

We can't use confluent docker image. So we are creating one. I was able to pass the worker node name through environment variable. Now i need to set it as rest.advertised.host.name. I tried adding the env variable in the property file. It didnt work. Is there any way i can set the property dynamicalyl?

Upvotes: 1

Views: 210

Answers (1)

OneCricketeer
OneCricketeer

Reputation: 191983

I tried adding the env variable in the property file

Not clear how you tried. You can use envsubst to populate this file

For example

echo 'rest.advertised.host.name=$SCHEMA_REGISTRY_REST_ADVERTISTED_HOST_NAME' >> tmp.properties 

export SCHEMA_REGISTRY_REST_ADVERTISTED_HOST_NAME=foobar

envsubst < tmp.properties > schema-registry.properties

...

cat schema-registry.properties | grep rest
rest.advertised.host.name=foobar

Upvotes: 1

Related Questions