-
Notifications
You must be signed in to change notification settings - Fork 8.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge "[FAB-1657] enable zookeeper on POWER & s390x"
- Loading branch information
Showing
7 changed files
with
86 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
FROM hyperledger/fabric-baseimage:_BASE_TAG_ | ||
# Based on https://github.com/31z4/zookeeper-docker/blob/master/3.4.9/Dockerfile | ||
|
||
# Install su-exec | ||
RUN set -x \ | ||
&& git clone https://github.com/ncopa/su-exec /tmp/su-exec/ \ | ||
&& cd /tmp/su-exec \ | ||
&& make all \ | ||
&& cp su-exec /usr/bin/ | ||
|
||
ENV ZOO_USER=zookeeper \ | ||
ZOO_CONF_DIR=/conf \ | ||
ZOO_DATA_DIR=/data \ | ||
ZOO_DATA_LOG_DIR=/datalog \ | ||
ZOO_PORT=2181 \ | ||
ZOO_TICK_TIME=2000 \ | ||
ZOO_INIT_LIMIT=5 \ | ||
ZOO_SYNC_LIMIT=2 | ||
|
||
# Add a user and make dirs | ||
RUN set -x \ | ||
&& useradd "$ZOO_USER" \ | ||
&& mkdir -p "$ZOO_DATA_LOG_DIR" "$ZOO_DATA_DIR" "$ZOO_CONF_DIR" \ | ||
&& chown "$ZOO_USER:$ZOO_USER" "$ZOO_DATA_LOG_DIR" "$ZOO_DATA_DIR" "$ZOO_CONF_DIR" | ||
|
||
ARG GPG_KEY=C823E3E5B12AF29C67F81976F5CECB3CB5E9BD2D | ||
ARG DISTRO_NAME=zookeeper-3.4.9 | ||
|
||
# Download Apache Zookeeper, verify its PGP signature, untar and clean up | ||
RUN set -x \ | ||
&& cd / \ | ||
&& wget -q "http://www.apache.org/dist/zookeeper/$DISTRO_NAME/$DISTRO_NAME.tar.gz" \ | ||
&& tar -xzf "$DISTRO_NAME.tar.gz" \ | ||
&& mv "$DISTRO_NAME/conf/"* "$ZOO_CONF_DIR" \ | ||
&& rm -r "$DISTRO_NAME.tar.gz" | ||
|
||
WORKDIR $DISTRO_NAME | ||
VOLUME ["$ZOO_DATA_DIR", "$ZOO_DATA_LOG_DIR"] | ||
|
||
EXPOSE $ZOO_PORT 2888 3888 | ||
|
||
ENV PATH=$PATH:/$DISTRO_NAME/bin \ | ||
ZOOCFGDIR=$ZOO_CONF_DIR | ||
|
||
COPY payload/docker-entrypoint.sh / | ||
ENTRYPOINT ["/docker-entrypoint.sh"] | ||
CMD ["zkServer.sh", "start-foreground"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
# Allow the container to be started with `--user` | ||
if [ "$1" = 'zkServer.sh' -a "$(id -u)" = '0' ]; then | ||
chown -R "$ZOO_USER" "$ZOO_DATA_DIR" "$ZOO_DATA_LOG_DIR" | ||
exec su-exec "$ZOO_USER" "$0" "$@" | ||
fi | ||
|
||
# Generate the config only if it doesn't exist | ||
if [ ! -f "$ZOO_CONF_DIR/zoo.cfg" ]; then | ||
CONFIG="$ZOO_CONF_DIR/zoo.cfg" | ||
|
||
echo "clientPort=$ZOO_PORT" >> "$CONFIG" | ||
echo "dataDir=$ZOO_DATA_DIR" >> "$CONFIG" | ||
echo "dataLogDir=$ZOO_DATA_LOG_DIR" >> "$CONFIG" | ||
|
||
echo "tickTime=$ZOO_TICK_TIME" >> "$CONFIG" | ||
echo "initLimit=$ZOO_INIT_LIMIT" >> "$CONFIG" | ||
echo "syncLimit=$ZOO_SYNC_LIMIT" >> "$CONFIG" | ||
|
||
for server in $ZOO_SERVERS; do | ||
echo "$server" >> "$CONFIG" | ||
done | ||
fi | ||
|
||
# Write myid only if it doesn't exist | ||
if [ ! -f "$ZOO_DATA_DIR/myid" ]; then | ||
echo "${ZOO_MY_ID:-1}" > "$ZOO_DATA_DIR/myid" | ||
fi | ||
|
||
exec "$@" |