/vagrant_build.sh Secret
Last active
December 19, 2015 14:28
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
#!/bin/bash | |
VHOME="/home/vagrant" | |
cd $VHOME | |
if [ -f "$VHOME/.build_done" ]; then | |
echo 'Server already built. Continuing...' | |
cd riak | |
for d in dev/dev*; do | |
$d/bin/riak start | |
$d/bin/riak ping | |
done | |
exit | |
fi | |
# Update ulimits | |
sudo bash -c "echo '* soft nofile 65536' >> /etc/security/limits.conf" | |
sudo bash -c "echo '* hard nofile 65536' >> /etc/security/limits.conf" | |
sudo bash -c "echo 'ulimit -n 65536' >> /etc/default/vagrant" | |
# Update | |
sudo apt-get update | |
sudo apt-get -y upgrade | |
# Get ready for python | |
sudo apt-get install -y python-pip python-mysqldb python-protobuf git-core | |
sudo pip install ipython | |
sudo pip install git+https://github.com/basho/riak-python-client.git#egg=riak | |
# Get ready for Yokozuna install | |
sudo apt-get install -y erlang default-jre default-jdk | |
# Download and configure | |
#wget -q https://s3.amazonaws.com/yzami/pkgs/src/riak-yokozuna-0.7.0-src.tar.gz | |
#tar -zxvf riak-yokozuna-0.7.0-src.tar.gz | |
#mv riak-yokozuna-0.7.0-src yokozuna | |
git clone -b yz-merge-1.4.0 git://github.com/basho/riak.git | |
cd riak | |
make | |
# Stage it out | |
make stagedevrel | |
# Some app.config replacements | |
I=0 | |
for d in dev/dev*; do | |
if [ "$I" -eq 0 ]; then | |
# Enable Riak Control on the main server | |
sed -e '/{riak_control,/,/]}/{s/{enabled, false}/{enabled, true}/;}' -i.back $d/etc/app.config | |
sed -e '/{riak_control,/,/]}/{s/{auth, userlist}/{auth, none}/;}' -i.back $d/etc/app.config | |
sed -e '/{riak_control,/,/]}/{s/{userlist/%{userlist/;}' -i.back $d/etc/app.config | |
sed -e '/{riak_control,/,/]}/{s/ ]},/% ]},/;}' -i.back $d/etc/app.config | |
# Set the http/pb listener to be on the 0.0.0.0 port | |
sed -e '/{riak_api,/,/]}/{s/{"127.0.0.1", 10017 }/{"0.0.0.0", 10017 }/;}' -i.back $d/etc/app.config | |
sed -e '/{riak_core,/,/]}/{s/{"127.0.0.1", 10018 }/{"0.0.0.0", 10018 }/;}' -i.back $d/etc/app.config | |
fi | |
# Enable leveldb | |
sed -e '/{riak_kv,/,/]}/{s/{storage_backend, riak_kv_bitcask_backend}/{storage_backend, riak_kv_eleveldb_backend}/;}' -i.back $d/etc/app.config | |
# Enable solr, give it a second to start up, | |
# we're on not-so-much-RAM here. | |
sed -e '/{yokozuna,/,/]}/{s/{enabled, false},/{enabled, true},\n {solr_startup_wait, 2500},/;}' -i.back $d/etc/app.config | |
$d/bin/riak start | |
$d/bin/riak ping | |
if [ "$I" -gt 0 ]; then | |
$d/bin/riak-admin cluster join dev1@127.0.0.1 | |
fi | |
I=$[$I + 1] | |
done | |
# Cluster plan and commit | |
./dev/dev1/bin/riak-admin cluster plan | |
./dev/dev1/bin/riak-admin cluster commit | |
cd $VHOME | |
touch .build_done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Line #39 can be swapped between