Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade and adapt config to Caddy v2++ #172

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions docker/Caddyfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
0.0.0.0:8000
tls off

root /kafka-topics-ui
log stdout
http://localhost:8000
root * /kafka-topics-ui
file_server
log {
output stdout
}
2 changes: 1 addition & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ RUN apk add --no-cache ca-certificates wget \
&& echo "progress = dot:giga" | tee /etc/wgetrc

# Add and Setup Caddy webserver
RUN wget "https://github.com/mholt/caddy/releases/download/v0.10.11/caddy_v0.10.11_linux_amd64.tar.gz" -O /caddy.tgz \
RUN wget "https://github.com/caddyserver/caddy/releases/download/v2.4.6/caddy_2.4.6_linux_amd64.tar.gz" -O /caddy.tgz \
&& mkdir caddy \
&& tar xzf caddy.tgz -C /caddy --no-same-owner \
&& rm -f /caddy.tgz
Expand Down
3 changes: 3 additions & 0 deletions docker/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/usr/bin/env bash

docker build -t tfs.mfin/kafka-topics-ui:0.9.4.01 .
13 changes: 7 additions & 6 deletions docker/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ INSECURE_PROXY=""
CADDY_OPTIONS="${CADDY_OPTIONS:-}"
EXPERIMENTAL_PROXY_URL="${EXPERIMENTAL_PROXY_URL:-false}"
PORT="${PORT:-8000}"

UI_HOST="${UI_HOST:-localhost}"
{
echo "Lenses.io Kafka Topics UI ${KAFKA_TOPICS_UI_VERSION}"
echo "Visit <https://github.com/lensesio/kafka-topics-ui/tree/master/docker>"
echo "to find more about how you can configure this container."
echo

cat /caddy/Caddyfile.template \
| sed -e "s/8000/$PORT/" > /tmp/Caddyfile
| sed -e "s/8000/$PORT/g; s/localhost/$UI_HOST/g" > /tmp/Caddyfile

if echo "$PROXY_SKIP_VERIFY" | egrep -sq "true|TRUE|y|Y|yes|YES|1"; then
INSECURE_PROXY=insecure_skip_verify
Expand All @@ -26,10 +26,11 @@ PORT="${PORT:-8000}"
&& [[ ! -z "$KAFKA_REST_PROXY_URL" ]]; then
echo "Enabling proxy."
cat <<EOF >>/tmp/Caddyfile
proxy /api/kafka-rest-proxy $KAFKA_REST_PROXY_URL {
without /api/kafka-rest-proxy
$INSECURE_PROXY
handle_path /api/kafka-rest-proxy/* {
rewrite * {path}
reverse_proxy $KAFKA_REST_PROXY_URL
}

EOF
if echo "$EXPERIMENTAL_PROXY_URL" | egrep -sq "true|TRUE|y|Y|yes|YES|1"; then
KAFKA_REST_PROXY_URL=api/kafka-rest-proxy
Expand Down Expand Up @@ -78,4 +79,4 @@ http://0.0.0.0:$PORT"
EOF
} 1>&2

exec /caddy/caddy -conf /tmp/Caddyfile -quiet
exec /caddy/caddy run -config /tmp/Caddyfile