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

Upgrading Cassandra and fixing Elasticsearch #6

Open
wants to merge 2 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
43 changes: 34 additions & 9 deletions ApacheCassandra/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
########## Linux on z Systems Dockerfile for Cassandra version 3.11.3 #########
########## Linux on z Systems Dockerfile for Cassandra version 3.11.4 #########
#
# This Dockerfile builds a basic installation of Cassandra.
#
Expand Down Expand Up @@ -29,8 +29,9 @@ ENV LANG="en_US.UTF-8"
ENV JAVA_TOOL_OPTIONS="-Dfile.encoding=UTF8"
ENV ANT_OPTS="-Xms4G -Xmx4G"
ENV JAVA_HOME=/usr/lib/jvm/java-8-openjdk-s390x
ENV PATH=$PATH:$ANT_HOME/bin:
ENV PATH=$PATH:$ANT_HOME/bin:$JAVA_HOME/bin

RUN groupadd -r cassandra --gid=999 && useradd -r -g cassandra --uid=999 cassandra

RUN apt-get update && apt-get install -y \
automake \
Expand Down Expand Up @@ -61,12 +62,14 @@ RUN apt-get update && apt-get install -y \
&& git checkout 4.2.2 \
&& ant \

# Build and install Apache Cassandra 3.11.3
# Build and install Apache Cassandra 3.11.4
&& cd $SOURCE_DIR \
&& git clone https://github.com/apache/cassandra.git \
&& cd cassandra \
&& git checkout cassandra-3.11.3 \
&& git checkout cassandra-3.11.4 \
&& sed -i ' s/Xss256k/Xss32m/' build.xml conf/jvm.options \
&& sed -i ' s/-XX:+UseNUMA//' conf/jvm.options \
&& sed -i ' s/JVM_OPTS="$JVM_OPTS -XX:+UseCondCardMark"//' conf/jvm.options \
&& touch ant.log \
&& nohup ant 2<&1 | tee ant.log \
&& wget http://downloads.jboss.org/byteman/3.0.3/byteman-download-3.0.3-bin.zip \
Expand All @@ -90,15 +93,37 @@ RUN apt-get update && apt-get install -y \
wget \
unzip \
&& apt autoremove -y \
&& apt-get clean && rm -rf /var/lib/apt/lists/*

# Expose Ports
EXPOSE 7000 7001 7199 9042 9160
&& apt-get clean && rm -rf /var/lib/apt/lists/* \
&& chown -R cassandra:cassandra /usr/share/cassandra \
&& chmod -R 777 /usr/share/cassandra

# grab gosu for easy step-down from root
ENV GOSU_VERSION 1.10
RUN set -x \
&& apt-get update && apt-get install -y --no-install-recommends ca-certificates wget && rm -rf /var/lib/apt/lists/* \
&& wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture)" \
&& wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture).asc" \
&& export GNUPGHOME="$(mktemp -d)" \
&& gpg --batch --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 \
&& gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu \
&& { command -v gpgconf && gpgconf --kill all || :; } \
&& rm -rf "$GNUPGHOME" /usr/local/bin/gosu.asc \
&& chmod +x /usr/local/bin/gosu \
&& gosu nobody true

COPY docker-entrypoint.sh /usr/local/bin/
RUN ln -s /usr/local/bin/docker-entrypoint.sh /docker-entrypoint.sh # backwards compat
RUN chmod 777 /usr/local/bin/docker-entrypoint.sh
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]

VOLUME [ "/usr/share/cassandra/data/" ]

# Set Path
ENV PATH $PATH:/usr/share/cassandra/bin
ENV CASSANDRA_CONFIG /usr/share/cassandra/conf

# Expose Ports
EXPOSE 7000 7001 7199 9042 9160

# Start Cassandra server
CMD ["cassandra", "-R"]
CMD ["cassandra", "-f"]
90 changes: 90 additions & 0 deletions ApacheCassandra/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
#!/bin/bash
set -e

# first arg is `-f` or `--some-option`
# or there are no args
if [ "$#" -eq 0 ] || [ "${1#-}" != "$1" ]; then
set -- cassandra -f "$@"
fi

# allow the container to be started with `--user`
if [ "$1" = 'cassandra' -a "$(id -u)" = '0' ]; then
find /usr/share/cassandra \
\! -user cassandra -exec chown cassandra '{}' +
exec gosu cassandra "$BASH_SOURCE" "$@"
fi

_ip_address() {
# scrape the first non-localhost IP address of the container
# in Swarm Mode, we often get two IPs -- the container IP, and the (shared) VIP, and the container IP should always be first
ip address | awk '
$1 == "inet" && $NF != "lo" {
gsub(/\/.+$/, "", $2)
print $2
exit
}
'
}

# "sed -i", but without "mv" (which doesn't work on a bind-mounted file, for example)
_sed-in-place() {
local filename="$1"; shift
local tempFile
tempFile="$(mktemp)"
sed "$@" "$filename" > "$tempFile"
cat "$tempFile" > "$filename"
rm "$tempFile"
}

if [ "$1" = 'cassandra' ]; then
: ${CASSANDRA_RPC_ADDRESS='0.0.0.0'}

: ${CASSANDRA_LISTEN_ADDRESS='auto'}
if [ "$CASSANDRA_LISTEN_ADDRESS" = 'auto' ]; then
CASSANDRA_LISTEN_ADDRESS="$(_ip_address)"
fi

: ${CASSANDRA_BROADCAST_ADDRESS="$CASSANDRA_LISTEN_ADDRESS"}

if [ "$CASSANDRA_BROADCAST_ADDRESS" = 'auto' ]; then
CASSANDRA_BROADCAST_ADDRESS="$(_ip_address)"
fi
: ${CASSANDRA_BROADCAST_RPC_ADDRESS:=$CASSANDRA_BROADCAST_ADDRESS}

if [ -n "${CASSANDRA_NAME:+1}" ]; then
: ${CASSANDRA_SEEDS:="cassandra"}
fi
: ${CASSANDRA_SEEDS:="$CASSANDRA_BROADCAST_ADDRESS"}

_sed-in-place "$CASSANDRA_CONFIG/cassandra.yaml" \
-r 's/(- seeds:).*/\1 "'"$CASSANDRA_SEEDS"'"/'

for yaml in \
broadcast_address \
broadcast_rpc_address \
cluster_name \
endpoint_snitch \
listen_address \
num_tokens \
rpc_address \
start_rpc \
; do
var="CASSANDRA_${yaml^^}"
val="${!var}"
if [ "$val" ]; then
_sed-in-place "$CASSANDRA_CONFIG/cassandra.yaml" \
-r 's/^(# )?('"$yaml"':).*/\2 '"$val"'/'
fi
done

for rackdc in dc rack; do
var="CASSANDRA_${rackdc^^}"
val="${!var}"
if [ "$val" ]; then
_sed-in-place "$CASSANDRA_CONFIG/cassandra-rackdc.properties" \
-r 's/^('"$rackdc"'=).*/\1 '"$val"'/'
fi
done
fi

exec "$@"
2 changes: 1 addition & 1 deletion Elasticsearch/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ MAINTAINER LoZ Open Source Ecosystem (https://www.ibm.com/developerworks/communi

# Set Environment Variables

ENV LANG="en_US.UTF-8" JAVA_TOOL_OPTIONS="-Dfile.encoding=UTF8" _JAVA_OPTIONS="-Xmx10g" SOURCE_DIR="/tmp/"
ENV LANG="en_US.UTF-8" JAVA_TOOL_OPTIONS="-Dfile.encoding=UTF8" JAVA_OPTIONS="-Xmx5g" JAVA_OPTS="-Xmx5g" SOURCE_DIR="/tmp/"
ENV JAVA_HOME=/usr/share/jdk-11.0.2+7
ENV PATH=$JAVA_HOME/bin:$PATH
WORKDIR $SOURCE_DIR
Expand Down