Skip to content

Commit dd5acd5

Browse files
authored
Merge pull request #1 from Landoop/docker
Add docker image for running Connect UI easily.
2 parents 457b9b4 + d9c467a commit dd5acd5

File tree

4 files changed

+91
-0
lines changed

4 files changed

+91
-0
lines changed

docker/Caddyfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
0.0.0.0:8000
2+
tls off
3+
4+
root /kafka-connect-ui
5+
log /access.log

docker/Dockerfile

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
FROM alpine
2+
MAINTAINER Marios Andreopoulos <marios@landoop.com>
3+
4+
WORKDIR /
5+
# Add needed tools
6+
RUN apk add --no-cache ca-certificates wget \
7+
&& echo "progress = dot:giga" | tee /etc/wgetrc
8+
9+
# Add and Setup Caddy webserver
10+
RUN wget "https://caddyserver.com/download/build?os=linux&arch=amd64&features=" -O /caddy.tgz \
11+
&& mkdir caddy \
12+
&& tar xzf caddy.tgz -C /caddy \
13+
&& rm -f /caddy.tgz
14+
15+
# Add and Setup Kafka-Connect-Ui
16+
ARG CONNECT_UI_URL=https://github.com/Landoop/kafka-connect-ui/releases/download/v0.8.0/kafka-connect-ui-0.8.0.tar.gz
17+
RUN wget "${CONNECT_UI_URL}" -O /kafka-connect-ui.tar.gz \
18+
&& mkdir /kafka-connect-ui \
19+
&& tar xzf /kafka-connect-ui.tar.gz -C /kafka-connect-ui \
20+
&& rm -f /kafka-connect-ui.tar.gz
21+
22+
# Add configuration and runtime files
23+
ADD Caddyfile /caddy/
24+
ADD run.sh /
25+
RUN chmod +x /run.sh
26+
27+
EXPOSE 8000
28+
ENTRYPOINT ["/run.sh"]

docker/README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
## Kafka Connect UI ##
2+
3+
[![](https://images.microbadger.com/badges/image/landoop/kafka-connect-ui.svg)](http://microbadger.com/images/landoop/kafka-connect-ui)
4+
5+
This is a small docker image for Landoop's kafka-connect-ui.
6+
It serves the kafka-connect-ui from port 8000.
7+
A live version can be found at <https://kafka-connect-ui.landoop.com>
8+
9+
The software is stateless and the only necessary option is your Kafka Connect
10+
URL:
11+
12+
docker run --rm -it -p 8000:8000 \
13+
-e "CONNECT_URL=http://connect.distributed.url" \
14+
landoop/kafka-topics-ui
15+
16+
Visit http://localhost:8000 to see the UI.
17+
18+
Please note that because Connect does not send CORS headers, we have to proxy
19+
it. What this means for you, is that Connect, while running the container, is
20+
accessible via `http://your.address:8000/api/kafka-connect`. If this is a
21+
security issue for you, you should protect your machine via a firewall, or maybe
22+
do not expose the port and use the container's IP address to access the UI.

docker/run.sh

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/bin/sh
2+
3+
CONNECT_PROXY=/api/kafka-connect
4+
5+
if [[ -z "$CONNECT_URL" ]]; then
6+
echo "Kafka Connect URL was not set via CONNECT_URL environment variable."
7+
echo "We will fall back to default http://localhost:8083 which probably won't work."
8+
# We also change connect proxy in order to make it as visible as possible
9+
# that the configuration is bad.
10+
CONNECT_PROXY=http://localhost:8083
11+
fi
12+
13+
CONNECT_URL="${CONNECT_URL:-http://localhost:8083}"
14+
15+
echo
16+
echo "Enabling proxy because Connect doesn't send CORS headers yet."
17+
cat <<EOF >>/caddy/Caddyfile
18+
proxy /api/kafka-connect $CONNECT_URL {
19+
without /api/kafka-connect
20+
}
21+
EOF
22+
23+
CONNECT_URL=/api/kafka-rest-proxy
24+
25+
cat <<EOF >/kafka-connect-ui/env.js
26+
var clusters = [
27+
{
28+
NAME: "default",
29+
KAFKA_CONNECT: "$CONNECT_PROXY"
30+
}
31+
]
32+
EOF
33+
34+
echo
35+
36+
exec /caddy/caddy -conf /caddy/Caddyfile

0 commit comments

Comments
 (0)