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

Undeprecated zookeeper #3

Open
wants to merge 1 commit 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
39 changes: 23 additions & 16 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,25 +1,32 @@
#FROM ubuntu:trusty
#FROM ubuntu:16.04
#FROM java:8
FROM openjdk:8-alpine
FROM java:8

MAINTAINER Juergen Jakobitsch <[email protected]>

#RUN apt-get update && apt-get install -y vim
# Install utilities
RUN DEBIAN_FRONTEND=noninteractive apt-get update && apt-get install -y netcat

RUN apk add --update bash && rm -rf /var/cache/apk/*
# Zookeeper version to be used
ENV ZK_VERSION zookeeper-3.4.11

ADD zookeeper-3.5.2-alpha.tar.gz /usr/local/apache-zookeeper/
# Download distribution
RUN wget -q http://ftp.halifax.rwth-aachen.de/apache/zookeeper/"$ZK_VERSION"/"$ZK_VERSION".tar.gz -O /tmp/"$ZK_VERSION".tar.gz \
&& tar xfz /tmp/"$ZK_VERSION".tar.gz -C /opt \
&& rm /tmp/"$ZK_VERSION".tar.gz

RUN ln -s /usr/local/apache-zookeeper/zookeeper-3.5.2-alpha /usr/local/apache-zookeeper/current
# The common installation dirname to use zookeeper
RUN ln -s /opt/"$ZK_VERSION" /opt/zookeeper

RUN rm -f /tmp/zookeeper-3.5.2-alpha.tar.gz
# Define the run configuration
RUN cd /opt/zookeeper/conf \
&& cp -p zoo_sample.cfg zoo.cfg

RUN ln -s /usr/local/apache-zookeeper/zookeeper-3.5.2-alpha /app
RUN ln -s /usr/local/apache-zookeeper/zookeeper-3.5.2-alpha/conf /config
EXPOSE 2181

COPY zk-config /app/bin
COPY startup /
#COPY wait-for-step.sh /
#COPY execute-step.sh /
#COPY finish-step.sh /
COPY wait-for-step.sh /
COPY execute-step.sh /
COPY finish-step.sh /

COPY healthcheck /
COPY zookeeper-startup.sh /

CMD [ "./zookeeper-startup.sh" ]
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Zookeeper Docker

Versions used in this docker image:
* Zookeeper Version: 3.5.2-alpha
* Java 1.8.0_72
* Zookeeper Version: 3.4.11
* Java 1.8.x

Image details:
* Installation directory: /app (i.e: /usr/local/apache-zookeeper/current)
Expand Down
13 changes: 13 additions & 0 deletions execute-step.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

if [[ $ENABLE_INIT_DAEMON = "true" ]]
then
echo "Execute step ${INIT_DAEMON_STEP} in pipeline"
while true; do
sleep 5
echo -n '.'
string=$(curl -w "%{http_code}" -X PUT $INIT_DAEMON_BASE_URI/execute?step=$INIT_DAEMON_STEP -d "")
[ "$string" = "204" ] && break
done
echo "Notified execution of step ${INIT_DAEMON_STEP}"
fi
13 changes: 13 additions & 0 deletions finish-step.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

if [[ $ENABLE_INIT_DAEMON = "true" ]]
then
echo "Finish step ${INIT_DAEMON_STEP} in pipeline"
while true; do
sleep 5
echo -n '.'
string=$(curl -w "%{http_code}" -X PUT $INIT_DAEMON_BASE_URI/finish?step=$INIT_DAEMON_STEP -d "")
[ "$string" = "204" ] && break
done
echo "Notified finish of step ${INIT_DAEMON_STEP}"
fi
10 changes: 10 additions & 0 deletions healthcheck
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash

set -e

export IMOK=$(echo ruok | nc localhost 2181)
if [[ "$IMOK" == "imok" ]]; then
exit 0
else
exit 1
fi
4 changes: 0 additions & 4 deletions startup

This file was deleted.

13 changes: 13 additions & 0 deletions wait-for-step.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

if [[ $ENABLE_INIT_DAEMON = "true" ]]
then
echo "Validating if step ${INIT_DAEMON_STEP} can start in pipeline"
while true; do
sleep 5
echo -n '.'
string=$(curl -s $INIT_DAEMON_BASE_URI/canStart?step=$INIT_DAEMON_STEP)
[ "$string" = "true" ] && break
done
echo "Can start step ${INIT_DAEMON_STEP}"
fi
68 changes: 0 additions & 68 deletions zk-config

This file was deleted.

Binary file removed zookeeper-3.5.2-alpha.tar.gz
Binary file not shown.
19 changes: 19 additions & 0 deletions zookeeper-startup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

set -e

echo `date` $0

/wait-for-step.sh
/execute-step.sh

if [[ $ENABLE_INIT_DAEMON = "true" ]] ;then
(
while ! ( /healthcheck ) ;do echo expect to become healthy; sleep 1; done
echo XXX $0 initialisation finished, service is healthy
/finish-step.sh
) &
fi

echo `date` $0 : zkServer.sh start-foreground
exec /opt/zookeeper/bin/zkServer.sh start-foreground