Skip to content

Commit

Permalink
Merge pull request #1 from Landoop/docker
Browse files Browse the repository at this point in the history
Add docker image for running Connect UI easily.
  • Loading branch information
jglambed authored Dec 2, 2016
2 parents 457b9b4 + d9c467a commit dd5acd5
Show file tree
Hide file tree
Showing 4 changed files with 91 additions and 0 deletions.
5 changes: 5 additions & 0 deletions docker/Caddyfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
0.0.0.0:8000
tls off

root /kafka-connect-ui
log /access.log
28 changes: 28 additions & 0 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
FROM alpine
MAINTAINER Marios Andreopoulos <marios@landoop.com>

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"]
22 changes: 22 additions & 0 deletions docker/README.md
Original file line number Diff line number Diff line change
@@ -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 <https://kafka-connect-ui.landoop.com>

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.
36 changes: 36 additions & 0 deletions docker/run.sh
Original file line number Diff line number Diff line change
@@ -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 <<EOF >>/caddy/Caddyfile
proxy /api/kafka-connect $CONNECT_URL {
without /api/kafka-connect
}
EOF

CONNECT_URL=/api/kafka-rest-proxy

cat <<EOF >/kafka-connect-ui/env.js
var clusters = [
{
NAME: "default",
KAFKA_CONNECT: "$CONNECT_PROXY"
}
]
EOF

echo

exec /caddy/caddy -conf /caddy/Caddyfile

0 comments on commit dd5acd5

Please sign in to comment.