lensesio / fast-data-dev

Kafka Docker for development. Kafka, Zookeeper, Schema Registry, Kafka-Connect, Landoop Tools, 20+ connectors
https://lenses.io
Apache License 2.0
2.01k stars 330 forks source link

Enables kafka-connect REST API to listen on specified port #198

Open lukecampbell opened 3 weeks ago

lukecampbell commented 3 weeks ago

By default the Kafka Connect REST API listens on port 8083. According to the documentation, the port should be configurable by specifying CONNECT_REST_PORT, but for a reason I could not identify this environment variable is not respected by the running process. The server process that runs for Kafka Connect will only be available on port 8083 regardless of this environment variable.

Attempting to set CONNECT_PORT or CONNECT_REST_PORT in the container environment variables causes all dependent services and HTTP connections to point to the wrong port, because these processes respect the environment variable, but the actual service continues to run on port 8083.

After digging through online documentation I found the configuration property that specifies the REST API listeners.

https://docs.confluent.io/platform/current/connect/security.html#connect-rest-api-http

This commit appends the listener interface and port to the connect-avro-distributed.properties file.

To test the issue without this change, attempt to run the container by specifying -e CONNECT_PORT=4004 . After waiting an appropriate amount of time, it can be observed that no service ever listens on 4004 and inspecting the ports it can be observed that the kafka-connect service continues to listen on port 8083 despite the environment variable being specified.

After this change, the service will begin to listen on the specified port.

Author's note: I'm unsure if modifying this file in the way I've done is the preferred approach by the primary contributors. This PR is a gift of work, and I'm not funded to support in any way beyond this, so if the PR is unacceptable or needs modifications, I probably won't be able to support.

lukecampbell commented 2 weeks ago

Should fix https://github.com/lensesio/fast-data-dev/issues/197