[cassandra] Creating a Cassandra image that works with titan-gremlin and Titan Browser

This commit is contained in:
Geoff Bourne 2015-02-16 14:48:42 +00:00
parent 3059282c7a
commit 78d82b334b
3 changed files with 66 additions and 0 deletions

30
cassandra/Dockerfile Normal file
View file

@ -0,0 +1,30 @@
FROM itzg/ubuntu-openjdk-7
MAINTAINER itzg
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y wget && \
apt-get clean
ENV CASSANDRA_VERSION 2.0.12
RUN wget -qO /tmp/apache-cassandra.tgz http://mirrors.ibiblio.org/apache/cassandra/$CASSANDRA_VERSION/apache-cassandra-$CASSANDRA_VERSION-bin.tar.gz
RUN tar -C /opt -zxvf /tmp/apache-cassandra.tgz && \
rm /tmp/apache-cassandra.tgz
RUN mv /opt/apache-cassandra-$CASSANDRA_VERSION /opt/cassandra
ENV CASSANDRA_HOME /opt/cassandra
ENV CASSANDRA_CONF /conf
ENV CASSANDRA_DATA /data
WORKDIR $CASSANDRA_HOME
RUN ln -s $CASSANDRA_HOME/bin/* /usr/local/bin
VOLUME ["/data","/conf"]
EXPOSE 9042 9160 7000 7001
ADD cassandra.in.sh $CASSANDRA_HOME/cassandra.in.sh
RUN mv $CASSANDRA_HOME/bin/cassandra.in.sh $CASSANDRA_HOME/bin/orig.cassandra.in.sh
CMD ["/opt/cassandra/bin/cassandra", "-f"]

9
cassandra/README.md Normal file
View file

@ -0,0 +1,9 @@
Yet another Cassandra image, but this one got container and non-container access right.
# Basic Usage
To support access from both Docker containers and external, non-Docker clients:
docker run -d --name cassandra -e PUBLISH_AS=192.168.59.103 -p 9160:9160 itzg/cassandra
replacing `192.168.59.103` with your Docker host's LAN IP address.

27
cassandra/cassandra.in.sh Executable file
View file

@ -0,0 +1,27 @@
#!/bin/bash
sed -i -e 's/log4j.rootLogger=.*/log4j.rootLogger=INFO,stdout/' $CASSANDRA_HOME/conf/log4j-server.properties
cassYml=$CASSANDRA_HOME/conf/cassandra.yaml
privateAddr=$(hostname -i)
seeds=${SEEDS:-${PUBLISH_AS:-$privateAddr}}
sed -i -e "s/- seeds:.*/- seeds: \"$seeds\"/" $cassYml
sed -i -e "s/listen_address:.*/listen_address: $privateAddr/" $cassYml
sed -i -e "s/rpc_address:.*/rpc_address: $privateAddr/" $cassYml
sed -i -e "s#- /var/lib/cassandra/data#- $CASSANDRA_DATA#" $cassYml
if [ -n "$PUBLISH_AS" ]; then
sed -i -e "s/\(\s*#\)\?\s*broadcast_address:.*/broadcast_address: $PUBLISH_AS/" $cassYml
fi
# Copy over our tweaked files, but non-clobbering to let user have ultimate control
cp -rn $CASSANDRA_HOME/conf/* $CASSANDRA_CONF
# source the original
. $CASSANDRA_HOME/bin/orig.cassandra.in.sh