Skip to content

Commit 7190378

Browse files
committed
initial submission of files
1 parent e37d05c commit 7190378

File tree

9 files changed

+174
-0
lines changed

9 files changed

+174
-0
lines changed

cassandra/Dockerfile

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
FROM phusion/baseimage
2+
MAINTAINER Daniel Covello
3+
ENV DEBIAN_FRONTEND noninteractive
4+
5+
# Use baseimage-docker's init system
6+
CMD ["/sbin/my_init"]
7+
8+
# Add PPA for the necessary JDK
9+
RUN echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu precise main" | tee /etc/apt/sources.list.d/webupd8team-java.list
10+
RUN echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu precise main" | tee -a /etc/apt/sources.list.d/webupd8team-java.list
11+
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys EEA14886
12+
RUN apt-get update
13+
14+
# Install other packages
15+
RUN apt-get install -y curl
16+
17+
# Preemptively accept the Oracle License
18+
RUN echo "oracle-java7-installer shared/accepted-oracle-license-v1-1 boolean true" > /tmp/oracle-license-debconf
19+
RUN /usr/bin/debconf-set-selections /tmp/oracle-license-debconf
20+
RUN rm /tmp/oracle-license-debconf
21+
22+
# Install the JDK
23+
RUN apt-get install -y oracle-java8-installer oracle-java8-set-default
24+
RUN apt-get update
25+
26+
# Define Cassandra version
27+
RUN echo "deb http://debian.datastax.com/community stable main" | sudo tee -a /etc/apt/sources.list.d/datastax.sources.list
28+
RUN curl -L http://debian.datastax.com/debian/repo_key | sudo apt-key add -
29+
RUN apt-get update
30+
RUN apt-get install -y dsc22=2.2.3-1 cassandra=2.2.3 datastax-agent
31+
32+
# Copy Cassandra Startup Scripts
33+
RUN mkdir /etc/service/cassandra
34+
ADD src/start-cass.sh /etc/service/cassandra/run
35+
RUN chmod +x /etc/service/cassandra/run
36+
37+
# Copy Cassandra Startup Scripts
38+
RUN mkdir /etc/service/datastax_agent
39+
ADD src/start-agent.sh /etc/service/datastax_agent/run
40+
RUN chmod +x /etc/service/datastax_agent/run
41+
42+
# Expose Ports
43+
EXPOSE 7199 7000 7001 9160 9042
44+
45+
# Add Volumes
46+
VOLUME ["/var/lib/cassandra"]

cassandra/src/address.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
stomp_interface: %OPSCENTER_HOST%

cassandra/src/start-agent.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
3+
# Configure Datstax agent
4+
sed -i -e "s/%OPSCENTER_HOST%/$OPSCENTER_HOST/" /etc/datastax-agent/address.yaml
5+
6+
exec /usr/share/datastax-agent/bin/datastax-agent -f

cassandra/src/start-cass.sh

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/bin/bash
2+
3+
# Accept listen_address
4+
IP=${LISTEN_ADDRESS:-`hostname --ip-address`}
5+
# Cassandr aConfig location
6+
CONFIG=/etc/cassandra
7+
8+
# Setup Cassandra params
9+
sed -i -e "s/^listen_address.*/listen_address: $IP/" $CONFIG/cassandra.yaml
10+
sed -i -e "s/^rpc_address.*/rpc_address: $IP/" $CONFIG/cassandra.yaml
11+
sed -i -e "s/# broadcast_address.*/broadcast_address: $IP/" $CONFIG/cassandra.yaml
12+
sed -i -e "s/# broadcast_rpc_address.*/broadcast_rpc_address: $IP/" $CONFIG/cassandra.yaml
13+
sed -i -e "s/# native_transport_max_threads.*/native_transport_max_threads: 1024/" $CONFIG/cassandra.yaml
14+
sed -i -e "s/^commitlog_segment_size_in_mb.*/commitlog_segment_size_in_mb: 64/" $CONFIG/cassandra.yaml
15+
sed -i -e "s/- seeds: \"127.0.0.1\"/- seeds: \"$SEEDS\"/" $CONFIG/cassandra.yaml
16+
sed -i -e "s/incremental_backups: false/incremental_backups: $ENABLE_INCREMENTAL_BACKUPS/g" $CONFIG/cassandra.yaml
17+
sed -i -e "s/# JVM_OPTS=\"$JVM_OPTS -Djava.rmi.server.hostname=<public name>\"/ JVM_OPTS=\"$JVM_OPTS -Djava.rmi.server.hostname=$IP\"/" $CONFIG/cassandra-env.sh
18+
#sed -i -e "s/# initial_token:.*/initial_token: $INITIAL_TOKEN/" $CONFIG/cassandra.yaml
19+
sed -i -e "s/num_tokens.*/num_tokens: 256/" $CONFIG/cassandra.yaml
20+
sed -i -e "s/^\(\\s*\)<appender-ref ref=\"ASYNCDEBUGLOG\" \/>/\\1<\!--<appender-ref ref=\"ASYNCDEBUGLOG\" \/>-->/" $CONFIG/logback.xml
21+
22+
# SETUP CASSANDRA PORTS
23+
24+
sed -i -e "s/^storage_port.*/storage_port: $INTERNODE_PORT/" $CONFIG/cassandra.yaml
25+
sed -i -e "s/^rpc_port.*/rpc_port: $THRIFT_PORT/" $CONFIG/cassandra.yaml
26+
sed -i -e "s/^native_transport_port.*/native_transport_port: $NATIVE_TRANSPORT_PORT/" $CONFIG/cassandra.yaml
27+
sed -i -e "s/^JMX_PORT=\"7199\"/JMX_PORT=\"$JMXPORT\"/" $CONFIG/cassandra-env.sh
28+
29+
if [[ $SNITCH ]]; then
30+
sed -i -e "s/endpoint_snitch: SimpleSnitch/endpoint_snitch: $SNITCH/" $CONFIG/cassandra.yaml
31+
fi
32+
if [[ $DC && $RACK ]]; then
33+
echo "dc=$DC" > $CONFIG/cassandra-rackdc.properties
34+
echo "rack=$RACK" >> $CONFIG/cassandra-rackdc.properties
35+
fi
36+
37+
exec cassandra -f

opscenter/Dockerfile

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
FROM phusion/baseimage
2+
MAINTAINER Daniel Covello
3+
ENV DEBIAN_FRONTEND noninteractive
4+
5+
# Use baseimage-docker's init system
6+
CMD ["/sbin/my_init"]
7+
8+
# Install Datastax Opscenter
9+
RUN echo "deb http://debian.datastax.com/community stable main" | sudo tee -a /etc/apt/sources.list.d/datastax.community.list \
10+
&& curl -L http://debian.datastax.com/debian/repo_key | sudo apt-key add - \
11+
&& apt-get update && apt-get -y install opscenter
12+
13+
# Add Opscenter Config File
14+
ADD opscenterd.conf /etc/opscenter/opscenterd.conf
15+
16+
# Add service starutp scripts
17+
RUN mkdir -p /etc/service/opscenter
18+
ADD start-opscenter.sh /etc/service/opscenter/run
19+
RUN chmod +x /etc/service/opscenter/run
20+
21+
# Expose Ports
22+
EXPOSE 8888 61620 50031
23+
24+
# Create Volumes
25+
VOLUME ["/var/log/opscenter"]

opscenter/opscenterd.conf

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
[webserver]
2+
port = 8888
3+
interface = 0.0.0.0
4+
# The following settings can be used to enable ssl support for the opscenter
5+
# web application. Change these values to point to the ssl certificate and key
6+
# that you wish to use for your OpsCenter install, as well as the port you would like
7+
# to serve ssl traffic from.
8+
#ssl_keyfile = /var/lib/opscenter/ssl/opscenter.key
9+
#ssl_certfile = /var/lib/opscenter/ssl/opscenter.pem
10+
#ssl_port = 8443
11+
12+
#[cassandra]
13+
#seed_hosts = 0.0.0.0
14+
15+
[logging]
16+
# level may be TRACE, DEBUG, INFO, WARN, or ERROR
17+
level = DEBUG
18+
log_path = /var/log/opscenter/opscenterd.log
19+
20+
[authentication]
21+
# Set this option to True to enable OpsCenter authentication. A default admin
22+
# account will be created with the username "admin" and password "admin".
23+
# Accounts and roles can then be created and modified from within the web UI.
24+
enabled = False
25+
26+
# To help us better understand the needs of users and to improve OpsCenter, OpsCenter
27+
# reports information about itself and the clusters it manages to a central DataStax
28+
# server. This information is reported anonymously, and potentially sensitive
29+
# information, such as IP addresses, are hashed in a non-reversible way:
30+
# http://www.datastax.com/documentation/opscenter/help/statsReporterProperties.html
31+
[stat_reporter]
32+
# The interval setting determines how often statistics are reported. To disable
33+
# reporting, set to 0
34+
# interval = 86400 # 24 hours
35+

opscenter/src/datastax.repo

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[datastax]
2+
name = DataStax Repo for Apache Cassandra
3+
baseurl = http://rpm.datastax.com/community
4+
enabled = 1
5+
gpgcheck = 0
6+

opscenter/src/start.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/env bash
2+
set -x
3+
4+
if [ -n ${!CASSANDRA_SEEDS} ]
5+
then
6+
echo ${!CASSANDRA_SEEDS}
7+
CASSANDRA_SEEDS=${!CASSANDRA_SEEDS}
8+
fi
9+
10+
IP=`hostname --ip-address`
11+
12+
sed -i -e "s/^interface.*/interface = $IP/" /etc/opscenter/opscenterd.conf
13+
# sed -i -e "s/^seed_hosts.*/seed_hosts = $CASSANDRA_SEEDS/" /etc/opscenter/opscenterd.conf
14+
15+
echo Starting OpsCenter on $IP...
16+
supervisord -n -c /etc/supervisor/supervisord.conf

opscenter/start-opscenter.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/bash
2+
exec /usr/share/opscenter/bin/opscenter -f

0 commit comments

Comments
 (0)