forked from docker-library/cassandra
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
108 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ language: bash | |
services: docker | ||
|
||
env: | ||
- VERSION=3.3 | ||
- VERSION=3.2 | ||
- VERSION=3.1 | ||
- VERSION=3.0 | ||
|
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,43 @@ | ||
# vim:set ft=dockerfile: | ||
FROM debian:jessie-backports | ||
|
||
# explicitly set user/group IDs | ||
RUN groupadd -r cassandra --gid=999 && useradd -r -g cassandra --uid=999 cassandra | ||
|
||
# grab gosu for easy step-down from root | ||
RUN gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 | ||
RUN 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/1.2/gosu-$(dpkg --print-architecture)" \ | ||
&& wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/1.2/gosu-$(dpkg --print-architecture).asc" \ | ||
&& gpg --verify /usr/local/bin/gosu.asc \ | ||
&& rm /usr/local/bin/gosu.asc \ | ||
&& chmod +x /usr/local/bin/gosu \ | ||
&& apt-get purge -y --auto-remove ca-certificates wget | ||
|
||
RUN apt-key adv --keyserver ha.pool.sks-keyservers.net --recv-keys 514A2AD631A57A16DD0047EC749D6EEC0353B12C | ||
|
||
RUN echo 'deb http://www.apache.org/dist/cassandra/debian 33x main' >> /etc/apt/sources.list.d/cassandra.list | ||
|
||
ENV CASSANDRA_VERSION 3.3 | ||
|
||
RUN apt-get update \ | ||
&& apt-get install -y cassandra="$CASSANDRA_VERSION" \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
ENV CASSANDRA_CONFIG /etc/cassandra | ||
|
||
COPY docker-entrypoint.sh /docker-entrypoint.sh | ||
ENTRYPOINT ["/docker-entrypoint.sh"] | ||
|
||
RUN mkdir -p /var/lib/cassandra "$CASSANDRA_CONFIG" \ | ||
&& chown -R cassandra:cassandra /var/lib/cassandra "$CASSANDRA_CONFIG" \ | ||
&& chmod 777 /var/lib/cassandra "$CASSANDRA_CONFIG" | ||
VOLUME /var/lib/cassandra | ||
|
||
# 7000: intra-node communication | ||
# 7001: TLS intra-node communication | ||
# 7199: JMX | ||
# 9042: CQL | ||
# 9160: thrift service | ||
EXPOSE 7000 7001 7199 9042 9160 | ||
CMD ["cassandra", "-f"] |
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,63 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
# first arg is `-f` or `--some-option` | ||
if [ "${1:0:1}" = '-' ]; then | ||
set -- cassandra -f "$@" | ||
fi | ||
|
||
# allow the container to be started with `--user` | ||
if [ "$1" = 'cassandra' -a "$(id -u)" = '0' ]; then | ||
chown -R cassandra /var/lib/cassandra "$CASSANDRA_CONFIG" | ||
exec gosu cassandra "$BASH_SOURCE" "$@" | ||
fi | ||
|
||
if [ "$1" = 'cassandra' ]; then | ||
: ${CASSANDRA_RPC_ADDRESS='0.0.0.0'} | ||
|
||
: ${CASSANDRA_LISTEN_ADDRESS='auto'} | ||
if [ "$CASSANDRA_LISTEN_ADDRESS" = 'auto' ]; then | ||
CASSANDRA_LISTEN_ADDRESS="$(hostname --ip-address)" | ||
fi | ||
|
||
: ${CASSANDRA_BROADCAST_ADDRESS="$CASSANDRA_LISTEN_ADDRESS"} | ||
|
||
if [ "$CASSANDRA_BROADCAST_ADDRESS" = 'auto' ]; then | ||
CASSANDRA_BROADCAST_ADDRESS="$(hostname --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 -ri 's/(- seeds:) "127.0.0.1"/\1 "'"$CASSANDRA_SEEDS"'"/' "$CASSANDRA_CONFIG/cassandra.yaml" | ||
|
||
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 -ri 's/^(# )?('"$yaml"':).*/\2 '"$val"'/' "$CASSANDRA_CONFIG/cassandra.yaml" | ||
fi | ||
done | ||
|
||
for rackdc in dc rack; do | ||
var="CASSANDRA_${rackdc^^}" | ||
val="${!var}" | ||
if [ "$val" ]; then | ||
sed -ri 's/^('"$rackdc"'=).*/\1 '"$val"'/' "$CASSANDRA_CONFIG/cassandra-rackdc.properties" | ||
fi | ||
done | ||
fi | ||
|
||
exec "$@" |
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