Skip to content
This repository has been archived by the owner on Apr 23, 2022. It is now read-only.

Commit

Permalink
Install cassnadra 3.4 and riak 2.1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
yangkookkim committed Apr 4, 2016
1 parent c623c6c commit 346ad5b
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 6 deletions.
12 changes: 9 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ ADD circleci-provision-scripts/postgres.sh /opt/circleci-provision-scripts/postg
RUN circleci-install postgres
RUN circleci-install postgres_ext_postgis

# Installing java early beacuse a few things have the dependency to java (i.g. cassandra)
ADD circleci-provision-scripts/java.sh /opt/circleci-provision-scripts/java.sh
RUN circleci-install java oraclejdk8
RUN circleci-install java openjdk8

ADD circleci-provision-scripts/misc.sh /opt/circleci-provision-scripts/misc.sh
RUN circleci-install sysadmin
RUN circleci-install devtools
Expand All @@ -34,6 +39,8 @@ RUN circleci-install rabbitmq
RUN circleci-install neo4j
RUN circleci-install elasticsearch
RUN circleci-install beanstalkd
RUN circleci-install cassandra
RUN circleci-install riak

# Browsers
ADD circleci-provision-scripts/firefox.sh /opt/circleci-provision-scripts/firefox.sh
Expand Down Expand Up @@ -105,8 +112,7 @@ RUN circleci-install nodejs 5.7.0
# TODO: make this more robust
RUN sudo -H -u ubuntu bash -c "source ~/.circlerc; nvm alias default 4.2.6"

ADD circleci-provision-scripts/java.sh /opt/circleci-provision-scripts/java.sh
RUN circleci-install java


ADD circleci-provision-scripts/go.sh /opt/circleci-provision-scripts/go.sh
RUN circleci-install golang 1.6
Expand Down Expand Up @@ -138,7 +144,7 @@ ADD circleci-provision-scripts/scala.sh /opt/circleci-provision-scripts/scala.sh
RUN circleci-install scala

# Dislabe services by default
RUN for s in apache2 redis-server memcached rabbitmq-server neo4j neo4j-service elasticsearch beanstalkd; do sysv-rc-conf $s off; done
RUN for s in apache2 redis-server memcached rabbitmq-server neo4j neo4j-service elasticsearch beanstalkd cassandra riak; do sysv-rc-conf $s off; done

# Docker have be last - to utilize cache better
ADD circleci-provision-scripts/docker.sh /opt/circleci-provision-scripts/docker.sh
Expand Down
15 changes: 12 additions & 3 deletions circleci-provision-scripts/java.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,19 @@ function install_oraclejdk8() {
rm -rf $JAVA_TMP
}

function install_openjdk8() {
add-apt-repository -y ppa:openjdk-r/ppa
apt-get update
apt-get install openjdk-8-jdk
}

function install_java() {
[[ -e /usr/lib/jvm/jdk/1.8.0 ]] || install_oraclejdk8
type mvn &>/dev/null || install_maven
type gradle &>/dev/null || install_gradle
local VERSION=$1

install_$VERSION

[[ -e /usr/local/apache-maven/bin/mvn ]] || install_maven
[[ -e /usr/local/gradle-1.10 ]] || install_gradle
}


Expand Down
23 changes: 23 additions & 0 deletions circleci-provision-scripts/misc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,29 @@ function install_elasticsearch() {
echo 'index.number_of_replicas: 0' >> $CONFIG_FILE
}

function install_cassandra() {
local VERSION=34
echo "deb http://www.apache.org/dist/cassandra/debian ${VERSION}x main" | sudo tee -a /etc/apt/sources.list.d/cassandra.sources.list

apt-get update
apt-get install cassandra

# Supressing ulimit error because of the lack of permission
sed -i 's/ulimit/#ulimit/' /etc/init.d/cassandra

# Putting resource restriction
sed -i 's/system_memory_in_mb=.*/system_memory_in_mb=2048/' /etc/cassandra/cassandra-env.sh
sed -i 's/system_cpu_cores=.*/system_cpu_cores=1/' /etc/cassandra/cassandra-env.sh
sed -i 's/JVM_OPTS="$JVM_OPTS -Xms${MAX_HEAP_SIZE}"/JVM_OPTS="$JVM_OPTS -Xms256M"/' /etc/cassandra/cassandra-env.sh
}

function install_riak() {
local VERSION=2.1.3

curl -s https://packagecloud.io/install/repositories/basho/riak/script.deb.sh | sudo bash
sudo apt-get install riak=${VERSION}-1
}


function install_sysadmin() {
apt-get install htop
Expand Down
19 changes: 19 additions & 0 deletions scripts/wait-for-cassandra.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash
echo "describe cluster;" > /tmp/dc
for i in 1 2 3 4 5; do
echo Attempt $i
if nodetool status | grep "^UN"; then
exit 0
else
sleep 10
fi
done

echo ""
echo "Cassandra failed to start!!"
echo ""
echo "------ Cassandra info -------"
bash -x -c "ps ax | grep -i cassandra"
bash -x -c "sudo lsof -i4TCP:9042"
echo ""
exit 1

0 comments on commit 346ad5b

Please sign in to comment.