diff --git a/docker/Caddyfile b/docker/Caddyfile new file mode 100644 index 0000000..09ec21c --- /dev/null +++ b/docker/Caddyfile @@ -0,0 +1,5 @@ +0.0.0.0:8000 +tls off + +root /kafka-connect-ui +log /access.log diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000..d9dc581 --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,28 @@ +FROM alpine +MAINTAINER Marios Andreopoulos + +WORKDIR / +# Add needed tools +RUN apk add --no-cache ca-certificates wget \ + && echo "progress = dot:giga" | tee /etc/wgetrc + +# Add and Setup Caddy webserver +RUN wget "https://caddyserver.com/download/build?os=linux&arch=amd64&features=" -O /caddy.tgz \ + && mkdir caddy \ + && tar xzf caddy.tgz -C /caddy \ + && rm -f /caddy.tgz + +# Add and Setup Kafka-Connect-Ui +ARG CONNECT_UI_URL=https://github.com/Landoop/kafka-connect-ui/releases/download/v0.8.0/kafka-connect-ui-0.8.0.tar.gz +RUN wget "${CONNECT_UI_URL}" -O /kafka-connect-ui.tar.gz \ + && mkdir /kafka-connect-ui \ + && tar xzf /kafka-connect-ui.tar.gz -C /kafka-connect-ui \ + && rm -f /kafka-connect-ui.tar.gz + +# Add configuration and runtime files +ADD Caddyfile /caddy/ +ADD run.sh / +RUN chmod +x /run.sh + +EXPOSE 8000 +ENTRYPOINT ["/run.sh"] diff --git a/docker/README.md b/docker/README.md new file mode 100644 index 0000000..a9d7c8c --- /dev/null +++ b/docker/README.md @@ -0,0 +1,22 @@ +## Kafka Connect UI ## + +[![](https://images.microbadger.com/badges/image/landoop/kafka-connect-ui.svg)](http://microbadger.com/images/landoop/kafka-connect-ui) + +This is a small docker image for Landoop's kafka-connect-ui. +It serves the kafka-connect-ui from port 8000. +A live version can be found at + +The software is stateless and the only necessary option is your Kafka Connect +URL: + + docker run --rm -it -p 8000:8000 \ + -e "CONNECT_URL=http://connect.distributed.url" \ + landoop/kafka-topics-ui + +Visit http://localhost:8000 to see the UI. + +Please note that because Connect does not send CORS headers, we have to proxy +it. What this means for you, is that Connect, while running the container, is +accessible via `http://your.address:8000/api/kafka-connect`. If this is a +security issue for you, you should protect your machine via a firewall, or maybe +do not expose the port and use the container's IP address to access the UI. diff --git a/docker/run.sh b/docker/run.sh new file mode 100755 index 0000000..de506aa --- /dev/null +++ b/docker/run.sh @@ -0,0 +1,36 @@ +#!/bin/sh + +CONNECT_PROXY=/api/kafka-connect + +if [[ -z "$CONNECT_URL" ]]; then + echo "Kafka Connect URL was not set via CONNECT_URL environment variable." + echo "We will fall back to default http://localhost:8083 which probably won't work." + # We also change connect proxy in order to make it as visible as possible + # that the configuration is bad. + CONNECT_PROXY=http://localhost:8083 +fi + +CONNECT_URL="${CONNECT_URL:-http://localhost:8083}" + +echo +echo "Enabling proxy because Connect doesn't send CORS headers yet." +cat <>/caddy/Caddyfile +proxy /api/kafka-connect $CONNECT_URL { + without /api/kafka-connect +} +EOF + +CONNECT_URL=/api/kafka-rest-proxy + +cat </kafka-connect-ui/env.js +var clusters = [ + { + NAME: "default", + KAFKA_CONNECT: "$CONNECT_PROXY" + } +] +EOF + +echo + +exec /caddy/caddy -conf /caddy/Caddyfile