rdelval closed pull request #7: vagrant example on exoscale Open Cloud
URL: https://github.com/apache/aurora/pull/7
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/Vagrantfile.exoscale b/Vagrantfile.exoscale
new file mode 100644
index 000000000..56f4bb2ba
--- /dev/null
+++ b/Vagrantfile.exoscale
@@ -0,0 +1,84 @@
+#
+#-*- mode: ruby -*-
+# vi: set ft=ruby :
+#
+# Copyright 2013 Apache Software Foundation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# Vagrantfile API/syntax version. Don't touch unless you know what you're 
doing!
+VAGRANTFILE_API_VERSION = "2"
+
+Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
+  config.vm.box = "Linux-Ubuntu-12.04-64-bit-10-GB-Disk"
+  config.ssh.username = "root"
+  config.ssh.private_key_path = "/path/to/your/.ssh/id_rsa.mesos"
+  config.hostmanager.enabled = true
+  config.hostmanager.manage_host = true
+
+  config.vm.provider :cloudstack do |cloudstack, override|
+      cloudstack.api_key = "APIKEY"
+      cloudstack.secret_key = "SECRETKEY"
+      cloudstack.service_offering_id = "71004023-bb72-4a97-b1e9-bc66dfce9470"
+      cloudstack.keypair = "mesos" # for SSH boxes the name of the public key 
pushed to the machine
+      cloudstack.security_groups = [{
+          :name         => "mesos", 
+          :description  => "created in the Mesos Vagrantfile", 
+          :rules        => [ 
+              {:type => "ingress", :protocol => "TCP", :startport => 22, 
:endport => 22, :cidrlist => "0.0.0.0/0"}, 
+              {:type => "ingress", :protocol => "TCP", :startport => 1338, 
:endport => 1338, :cidrlist => "0.0.0.0/0"}, 
+              {:type => "ingress", :protocol => "TCP", :startport => 2181, 
:endport => 2181, :cidrlist => "0.0.0.0/0"}, 
+              {:type => "ingress", :protocol => "TCP", :startport => 5050, 
:endport => 5050, :cidrlist => "0.0.0.0/0"}, 
+              {:type => "ingress", :protocol => "TCP", :startport => 8081, 
:endport => 8083, :cidrlist => "0.0.0.0/0"}
+              ] }]
+  end
+
+
+  config.vm.define "devtools" do |devtools|
+    devtools.vm.provision "shell", inline: "hostname devtools"
+    devtools.vm.hostname = "devtools"
+    devtools.vm.provision "shell", path: 
"examples/vagrant-exoscale/provision-dev-environment.sh"
+  end
+
+  config.vm.define "zookeeper" do |zookeeper|
+    zookeeper.vm.provision "shell", inline: "hostname zookeeper"
+    zookeeper.vm.hostname = "zookeeper"
+    zookeeper.vm.provision "shell", path: 
"examples/vagrant-exoscale/provision-zookeeper.sh"
+  end
+
+  config.vm.define "mesos-master" do |master|
+    master.vm.provision "shell", inline: "hostname master"
+    master.vm.hostname = "master"
+    master.vm.provision "shell", path: 
"examples/vagrant-exoscale/provision-mesos-master.sh"
+  end
+
+  config.vm.define "mesos-slave1" do |slave|
+    slave.vm.provision "shell", inline: "hostname slave1"
+    slave.vm.hostname = "slave1"
+    slave.vm.provision "shell", path: 
"examples/vagrant-exoscale/provision-mesos-slave.sh"
+  end
+
+  config.vm.define "mesos-slave2" do |slave|
+    slave.vm.provision "shell", inline: "hostname slave2"
+    slave.vm.hostname = "slave2"
+    slave.vm.provision "shell", path: 
"examples/vagrant-exoscale/provision-mesos-slave.sh"
+  end
+
+  config.vm.define "aurora-scheduler" do |scheduler|
+    scheduler.vm.provision "shell", inline: "hostname aurora"
+    scheduler.vm.hostname = "aurora"
+    scheduler.vm.provision "shell", path: 
"examples/vagrant-exoscale/provision-aurora-scheduler.sh"
+  end
+end
+
diff --git a/examples/vagrant-exoscale/provision-aurora-scheduler.sh 
b/examples/vagrant-exoscale/provision-aurora-scheduler.sh
new file mode 100755
index 000000000..2f98f50de
--- /dev/null
+++ b/examples/vagrant-exoscale/provision-aurora-scheduler.sh
@@ -0,0 +1,99 @@
+#!/bin/bash -ex
+# TODO(ksweeney): Use public and versioned URLs instead of local artifacts.
+AURORA_VERSION=$(cat /vagrant/.auroraversion | tr '[a-z]' '[A-Z]')
+
+tar xvf /vagrant/dist/distributions/aurora-scheduler-$AURORA_VERSION.tar -C 
/usr/local
+install -m 755 /vagrant/dist/aurora_client.pex /usr/local/bin/aurora
+install -m 755 /vagrant/dist/aurora_admin.pex /usr/local/bin/aurora_admin
+
+apt-get update
+apt-get -y install java7-runtime-headless curl
+wget -c 
http://downloads.mesosphere.io/master/ubuntu/12.04/mesos_0.15.0_amd64.deb
+dpkg --install mesos_0.15.0_amd64.deb
+
+# Get the IP address; eth0 is the net interface we care about.
+export AURORA_IP_ADDRESS=$(ip addr show eth0 | grep 'inet ' | cut -d'/' -f 1 | 
cut -c '10-')
+
+# TODO(ksweeney): Make this a be part of the Aurora distribution tarball.
+# Location where aurora-scheduler.zip was unpacked.
+AURORA_SCHEDULER_HOME=/usr/local/aurora-scheduler-$AURORA_VERSION
+cat > /usr/local/sbin/aurora-scheduler.sh <<EOF
+#!/usr/bin/env bash
+# An example scheduler launch script that works with the included Vagrantfile.
+
+
+# Flags that control the behavior of the JVM.
+JAVA_OPTS=(
+  -server
+  -Xmx1g
+  -Xms1g
+
+  # Location of libmesos-0.15.0.so / libmesos-0.15.0.dylib
+  -Djava.library.path=/usr/local/lib
+)
+
+# Flags control the behavior of the Aurora scheduler.
+# For a full list of available flags, run bin/aurora-scheduler -help
+AURORA_FLAGS=(
+  -cluster_name=example
+
+  # Ports to listen on.
+  -http_port=8081
+  -thrift_port=8082
+
+  -native_log_quorum_size=1
+
+  -zk_endpoints=zookeeper:2181
+  -mesos_master_address=zk://zookeeper:2181/mesos/master
+
+  -serverset_path=/aurora/scheduler
+
+  -native_log_zk_group_path=/aurora/replicated-log
+
+  -native_log_file_path="$AURORA_SCHEDULER_HOME/db"
+  -backup_dir="$AURORA_SCHEDULER_HOME/backups"
+
+  -thermos_executor_path=/usr/local/bin/thermos_executor
+  -gc_executor_path=/usr/local/bin/gc_executor
+
+  -vlog=INFO
+  -logtostderr
+)
+
+# Environment variables control the behavior of the Mesos scheduler driver 
(libmesos).
+export GLOG_v=0
+export LIBPROCESS_PORT=8083
+export LIBPROCESS_IP=$AURORA_IP_ADDRESS
+
+
+(
+  while true
+  do
+    JAVA_OPTS="\${JAVA_OPTS[*]}" exec 
"$AURORA_SCHEDULER_HOME/bin/aurora-scheduler" \\
+      "\${AURORA_FLAGS[@]}"
+  done
+) &
+EOF
+chmod +x /usr/local/sbin/aurora-scheduler.sh
+
+mkdir -p /etc/aurora
+cat > /etc/aurora/clusters.json <<EOF
+[{
+  "name": "example",
+  "zk": "zookeeper",
+  "scheduler_zk_path": "/aurora/scheduler",
+  "auth_mechanism": "UNAUTHENTICATED",
+  "slave_run_directory": "latest",
+  "slave_root": "/var/lib/mesos"
+}]
+EOF
+
+cat > /etc/rc.local <<EOF
+#!/bin/sh -e
+/usr/local/sbin/aurora-scheduler.sh \
+  1> /var/log/aurora-scheduler-stdout.log \
+  2> /var/log/aurora-scheduler-stderr.log
+EOF
+chmod +x /etc/rc.local
+
+/etc/rc.local
diff --git a/examples/vagrant-exoscale/provision-dev-environment.sh 
b/examples/vagrant-exoscale/provision-dev-environment.sh
new file mode 100755
index 000000000..c7739847d
--- /dev/null
+++ b/examples/vagrant-exoscale/provision-dev-environment.sh
@@ -0,0 +1,51 @@
+apt-get update
+apt-get -y install \
+    git automake libtool g++ java7-runtime-headless curl \
+    openjdk-7-jdk python-dev libsasl2-dev libcurl4-openssl-dev \
+    make
+
+if [ ! -d aurora ]; then
+  echo Cloning aurora repo
+  git clone /vagrant aurora
+fi
+
+pushd aurora
+  AURORA_VERSION=$(cat .auroraversion | tr '[a-z]' '[A-Z]')
+  mkdir -p third_party
+  pushd third_party
+    wget -c 
http://downloads.mesosphere.io/master/ubuntu/12.04/mesos_0.15.0_amd64.egg \
+      -O mesos-0.15.0-py2.7-linux-x86_64.egg
+  popd
+  git pull
+
+  # build scheduler
+  ./gradlew distTar
+
+  # build clients
+  ./pants src/main/python/apache/aurora/client/bin:aurora_admin
+  ./pants src/main/python/apache/aurora/client/bin:aurora_client
+
+  # build executors/observers
+  ./pants src/main/python/apache/aurora/executor/bin:gc_executor
+  ./pants src/main/python/apache/aurora/executor/bin:thermos_executor
+  ./pants src/main/python/apache/aurora/executor/bin:thermos_runner
+  ./pants src/main/python/apache/thermos/observer/bin:thermos_observer
+
+  # package runner w/in executor
+  python <<EOF
+import contextlib
+import zipfile
+with contextlib.closing(zipfile.ZipFile('dist/thermos_executor.pex', 'a')) as 
zf:
+  zf.writestr('apache/aurora/executor/resources/__init__.py', '')
+  zf.write('dist/thermos_runner.pex', 
'apache/aurora/executor/resources/thermos_runner.pex')
+EOF
+
+  mkdir -p /vagrant/dist/distributions
+  cp dist/distributions/aurora-scheduler-$AURORA_VERSION.tar 
/vagrant/dist/distributions
+
+  for pex in aurora_admin aurora_client gc_executor thermos_executor 
thermos_observer; do
+    cp dist/$pex.pex /vagrant/dist
+  done
+popd
+
+#sudo chown -R vagrant:vagrant aurora
diff --git a/examples/vagrant-exoscale/provision-mesos-master.sh 
b/examples/vagrant-exoscale/provision-mesos-master.sh
new file mode 100755
index 000000000..64ec1237e
--- /dev/null
+++ b/examples/vagrant-exoscale/provision-mesos-master.sh
@@ -0,0 +1,28 @@
+#!/bin/bash -x
+apt-get update
+apt-get -y install java7-runtime-headless curl
+wget -c 
http://downloads.mesosphere.io/master/ubuntu/12.04/mesos_0.15.0_amd64.deb
+dpkg --install mesos_0.15.0_amd64.deb
+# Get the IP address; eth0 is the net interface we care about.
+export MASTER_IP_ADDRESS=$(ip addr show eth0 | grep 'inet ' | cut -d'/' -f 1 | 
cut -c '10-')
+cat > /usr/local/sbin/mesos-master.sh <<EOF
+
+#!/bin/bash
+export LD_LIBRARY_PATH=/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/amd64/server
+(
+  while true
+  do
+    /usr/local/sbin/mesos-master --zk=zk://zookeeper:2181/mesos/master 
--ip=$MASTER_IP_ADDRESS
+    echo "Master exited with $?, restarting."
+  done
+) & disown
+EOF
+chmod +x /usr/local/sbin/mesos-master.sh
+
+cat > /etc/rc.local <<EOF
+#!/bin/sh -e
+/usr/local/sbin/mesos-master.sh >/var/log/mesos-master-stdout.log 
2>/var/log/mesos-master-stderr.log
+EOF
+chmod +x /etc/rc.local
+
+/etc/rc.local
diff --git a/examples/vagrant-exoscale/provision-mesos-slave.sh 
b/examples/vagrant-exoscale/provision-mesos-slave.sh
new file mode 100755
index 000000000..bf3484712
--- /dev/null
+++ b/examples/vagrant-exoscale/provision-mesos-slave.sh
@@ -0,0 +1,54 @@
+#!/bin/bash -x
+apt-get update
+apt-get -y install java7-runtime-headless curl
+wget -c 
http://downloads.mesosphere.io/master/ubuntu/12.04/mesos_0.15.0_amd64.deb
+dpkg --install mesos_0.15.0_amd64.deb
+
+# Get the IP address; eth0 is the net interface we care about.
+export SLAVE_IP_ADDRESS=$(ip addr show eth0 | grep 'inet ' | cut -d'/' -f 1 | 
cut -c '10-')
+cat> /usr/local/sbin/mesos-slave.sh <<EOF
+#!/bin/bash
+export LD_LIBRARY_PATH=/usr/lib/jvm/java-7-openjdk-amd64/jre/lib/amd64/server
+(
+  while true
+  do
+    # TODO(ksweeney): Scheduler assumes 'rack' and 'host' are present. Make 
them optional.
+    /usr/local/sbin/mesos-slave --master=zk://zookeeper:2181/mesos/master 
--ip=$SLAVE_IP_ADDRESS \
+      --attributes='host:$SLAVE_IP_ADDRESS;rack:a' 
--resources="cpus:4;mem:1024;disk:20000"
+    echo "Master exited with \$?, restarting."
+  done
+) & disown
+EOF
+chmod +x /usr/local/sbin/mesos-slave.sh
+
+cat > /usr/local/bin/thermos_observer.sh <<"EOF"
+#!/bin/bash
+(
+  while true
+  do
+    /usr/local/bin/thermos_observer \
+         --root=/var/run/thermos \
+         --port=1338 \
+         --log_to_disk=NONE \
+         --log_to_stderr=google:INFO
+    echo "Observer exited with $?, restarting."
+    sleep 10
+  done
+) & disown
+EOF
+chmod +x /usr/local/bin/thermos_observer.sh
+
+
+# TODO(ksweeney): Replace with public and versioned URLs.
+install -m 755 /vagrant/dist/gc_executor.pex /usr/local/bin/gc_executor
+install -m 755 /vagrant/dist/thermos_executor.pex 
/usr/local/bin/thermos_executor
+install -m 755 /vagrant/dist/thermos_observer.pex 
/usr/local/bin/thermos_observer
+
+cat > /etc/rc.local <<EOF
+#!/bin/sh -e
+/usr/local/sbin/mesos-slave.sh >/var/log/mesos-slave-stdout.log 
2>/var/log/mesos-slave-stderr.log
+/usr/local/bin/thermos_observer.sh >/var/log/thermos-observer.log 2>&1
+EOF
+chmod +x /etc/rc.local
+
+/etc/rc.local
diff --git a/examples/vagrant-exoscale/provision-zookeeper.sh 
b/examples/vagrant-exoscale/provision-zookeeper.sh
new file mode 100755
index 000000000..b68e801be
--- /dev/null
+++ b/examples/vagrant-exoscale/provision-zookeeper.sh
@@ -0,0 +1,10 @@
+#!/bin/bash
+apt-get update
+apt-get -y install zookeeper
+echo "JVMFLAGS=\"-Djava.net.preferIPv4Stack=true\"" >> 
/etc/zookeeper/conf/environment
+cat > /etc/rc.local <<EOF
+#!/bin/sh -e
+/usr/share/zookeeper/bin/zkServer.sh start
+EOF
+chmod +x /etc/rc.local
+/etc/rc.local


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to