Last active
December 22, 2015 16:08
-
-
Save drewkerrigan/380ec7742f41eee8aa76 to your computer and use it in GitHub Desktop.
Vagrant + Mesos 0.26 + Erlang R16B02 + Marathon + ZK + Mesos-DNS
This file contains hidden or 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
{ | |
"zk": "zk://localhost:2181/mesos", | |
"masters": ["localhost:5050"], | |
"refreshSeconds": 60, | |
"ttl": 60, | |
"domain": "mesos", | |
"port": 53, | |
"resolvers": ["10.0.2.3"], | |
"timeout": 5, | |
"httpon": true, | |
"dnson": true, | |
"httpport": 8123, | |
"externalon": true, | |
"listener": "10.0.2.15", | |
"SOAMname": "ns1.mesos", | |
"SOARname": "root.ns1.mesos", | |
"SOARefresh": 60, | |
"SOARetry": 600, | |
"SOAExpire": 86400, | |
"SOAMinttl": 60, | |
"IPSources": ["netinfo", "mesos", "host"] | |
} |
This file contains hidden or 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
[{ | |
"id": "mesos-dns", | |
"cmd": "sudo /usr/local/mesos-dns/mesos-dns -config=/usr/local/mesos-dns/config.json", | |
"cpus": 1.0, | |
"instances": 1, | |
"mem": 1024 | |
}] |
This file contains hidden or 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
export DEBIAN_FRONTEND=noninteractive | |
export HOME=/home/vagrant | |
# Install mesos, marathon, zk, docker | |
apt-key adv --keyserver keyserver.ubuntu.com --recv E56151BF | |
DISTRO=$(lsb_release -is | tr '[:upper:]' '[:lower:]') | |
CODENAME=$(lsb_release -cs) | |
echo "deb http://repos.mesosphere.io/${DISTRO} ${CODENAME} main" | sudo tee /etc/apt/sources.list.d/mesosphere.list | |
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9 | |
echo "deb https://get.docker.io/ubuntu docker main" | sudo tee /etc/apt/sources.list.d/docker.list | |
apt-get -y update > /dev/null | |
apt-get -y upgrade > /dev/null | |
apt-get -y install software-properties-common | |
add-apt-repository -y ppa:openjdk-r/ppa | |
apt-get -y update > /dev/null | |
apt-get -y install make git gcc g++ curl | |
apt-get -y install python-dev libcppunit-dev libunwind8-dev autoconf autotools-dev libltdl-dev libtool autopoint libcurl4-openssl-dev libsasl2-dev | |
apt-get -y install openjdk-8-jdk default-jre python-setuptools python-protobuf | |
update-java-alternatives -s /usr/lib/jvm/java-1.8.0-openjdk-amd64 | |
apt-get -y install libprotobuf-dev protobuf-compiler | |
apt-get -y install mesos marathon | |
apt-get -y install lxc-docker | |
apt-get -y install resolvconf | |
# Configure mesos | |
echo "riak" > /etc/mesos-master/roles | |
echo "1" > /etc/mesos-master/quorum | |
echo "/var/lib/mesos" > /etc/mesos-master/work_dir | |
# Mesos DNS | |
mkdir -p /usr/local/mesos-dns/ | |
mv /vagrant/mesos-dns-config.json /usr/local/mesos-dns/config.json | |
mv /vagrant/mesos-dns-marathon.json /usr/local/mesos-dns/marathon.json | |
wget https://github.com/mesosphere/mesos-dns/releases/download/v0.5.1/mesos-dns-v0.5.1-linux-amd64 | |
mv mesos-dns-v0.5.1-linux-amd64 /usr/local/mesos-dns/mesos-dns | |
chmod 755 /usr/local/mesos-dns/mesos-dns | |
# Configure Resolvconf | |
echo "nameserver 10.0.2.15" > /etc/resolvconf/resolv.conf.d/head | |
resolvconf -u | |
service zookeeper restart | |
service mesos-slave restart | |
service mesos-master restart | |
service marathon restart | |
apt-get -y update | |
apt-get -y upgrade | |
apt-get -y install git s3cmd zip python-pip | |
# Install Erlang | |
apt-get -y update | |
apt-get -y upgrade | |
apt-get install -y build-essential autoconf libncurses5-dev openssl libssl-dev fop xsltproc unixodbc-dev libpam0g-dev | |
cd $HOME/bin | |
curl -O https://raw.githubusercontent.com/spawngrid/kerl/master/kerl | |
chmod a+x kerl | |
./kerl build git git://github.com/basho/otp.git OTP_R16B02_basho8 R16B02-basho8 | |
./kerl install R16B02-basho8 ~/erlang/R16B02-basho8 | |
. ~/erlang/R16B02-basho8/activate | |
echo '# Erlang' >> $HOME/.bashrc | |
echo '. $HOME/erlang/R16B02-basho8/activate' >> $HOME/.bashrc | |
echo 'export PATH=$PATH:$HOME/bin' >> $HOME/.bashrc | |
# Fix permissions | |
chown -R vagrant $HOME | |
chgrp -R vagrant $HOME | |
# Launch Mesos DNS | |
curl -v -XPUT -H 'Content-Type: application/json' http://localhost:8080/v2/apps -d @/usr/local/mesos-dns/marathon.json |
This file contains hidden or 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
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
# Install these plugins | |
# vagrant plugin install vagrant-hostmanager | |
VAGRANTFILE_API_VERSION = "2" | |
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| | |
#Setup hostmanager config to update the host files | |
config.hostmanager.enabled = true | |
config.hostmanager.manage_host = true | |
config.hostmanager.ignore_private_ip = false | |
config.hostmanager.include_offline = true | |
config.vm.provision :hostmanager | |
config.vm.define 'ubuntu' do |node| | |
node.vm.hostname = 'ubuntu' | |
node.vm.network :private_network, ip: '192.168.42.42' | |
node.hostmanager.aliases = %w(ubuntu.local) | |
end | |
config.vm.box = "ubuntu/trusty64" | |
config.vm.provider :virtualbox do |vb, override| | |
vb.customize ["modifyvm", :id, "--memory", 12000, "--cpus", "6"] | |
override.vm.network :forwarded_port, guest: 5050, host: 5050 | |
override.vm.network :forwarded_port, guest: 5051, host: 5051 | |
override.vm.network :forwarded_port, guest: 8080, host: 8080 | |
end | |
config.vm.provision 'shell', path: 'provision.sh', run: 'once' | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment