2017-05-15 18:56:41 +00:00
|
|
|
#!/bin/bash
|
2017-06-25 18:54:56 +00:00
|
|
|
|
2017-05-15 18:56:41 +00:00
|
|
|
set -e
|
|
|
|
|
|
|
|
cd /ops
|
|
|
|
|
|
|
|
CONFIGDIR=/ops/shared/config
|
|
|
|
|
2017-07-26 22:34:34 +00:00
|
|
|
CONSULVERSION=0.9.0
|
2017-05-15 18:56:41 +00:00
|
|
|
CONSULDOWNLOAD=https://releases.hashicorp.com/consul/${CONSULVERSION}/consul_${CONSULVERSION}_linux_amd64.zip
|
|
|
|
CONSULCONFIGDIR=/etc/consul.d
|
|
|
|
CONSULDIR=/opt/consul
|
|
|
|
|
2017-06-15 22:47:46 +00:00
|
|
|
VAULTVERSION=0.7.3
|
2017-05-15 18:56:41 +00:00
|
|
|
VAULTDOWNLOAD=https://releases.hashicorp.com/vault/${VAULTVERSION}/vault_${VAULTVERSION}_linux_amd64.zip
|
|
|
|
VAULTCONFIGDIR=/etc/vault.d
|
|
|
|
VAULTDIR=/opt/vault
|
|
|
|
|
2017-07-26 22:34:34 +00:00
|
|
|
NOMADVERSION=0.6.0
|
2017-05-15 18:56:41 +00:00
|
|
|
NOMADDOWNLOAD=https://releases.hashicorp.com/nomad/${NOMADVERSION}/nomad_${NOMADVERSION}_linux_amd64.zip
|
|
|
|
NOMADCONFIGDIR=/etc/nomad.d
|
|
|
|
NOMADDIR=/opt/nomad
|
|
|
|
|
2017-06-25 18:54:56 +00:00
|
|
|
HADOOP_VERSION=2.7.3
|
|
|
|
|
|
|
|
# Dependencies
|
2017-05-15 18:56:41 +00:00
|
|
|
sudo apt-get install -y software-properties-common
|
|
|
|
sudo apt-get update
|
2017-06-24 23:25:46 +00:00
|
|
|
sudo apt-get install -y unzip tree redis-tools jq
|
|
|
|
sudo apt-get install -y upstart-sysv
|
|
|
|
sudo update-initramfs -u
|
2017-05-15 18:56:41 +00:00
|
|
|
|
2017-06-24 23:25:46 +00:00
|
|
|
# Numpy (for Spark)
|
2017-05-15 18:56:41 +00:00
|
|
|
sudo apt-get install -y python-setuptools
|
|
|
|
sudo easy_install pip
|
|
|
|
sudo pip install numpy
|
|
|
|
|
|
|
|
# Disable the firewall
|
|
|
|
|
|
|
|
sudo ufw disable
|
|
|
|
|
2017-06-25 18:54:56 +00:00
|
|
|
# Consul
|
2017-05-15 18:56:41 +00:00
|
|
|
|
|
|
|
curl -L $CONSULDOWNLOAD > consul.zip
|
|
|
|
|
2017-06-25 18:54:56 +00:00
|
|
|
## Install
|
2017-05-15 18:56:41 +00:00
|
|
|
sudo unzip consul.zip -d /usr/local/bin
|
|
|
|
sudo chmod 0755 /usr/local/bin/consul
|
|
|
|
sudo chown root:root /usr/local/bin/consul
|
|
|
|
|
2017-06-25 18:54:56 +00:00
|
|
|
## Configure
|
2017-05-15 18:56:41 +00:00
|
|
|
sudo mkdir -p $CONSULCONFIGDIR
|
|
|
|
sudo chmod 755 $CONSULCONFIGDIR
|
|
|
|
sudo mkdir -p $CONSULDIR
|
|
|
|
sudo chmod 755 $CONSULDIR
|
|
|
|
|
2017-06-25 18:54:56 +00:00
|
|
|
# Vault
|
2017-05-15 18:56:41 +00:00
|
|
|
|
|
|
|
curl -L $VAULTDOWNLOAD > vault.zip
|
|
|
|
|
2017-06-25 18:54:56 +00:00
|
|
|
## Install
|
2017-05-15 18:56:41 +00:00
|
|
|
sudo unzip vault.zip -d /usr/local/bin
|
|
|
|
sudo chmod 0755 /usr/local/bin/vault
|
|
|
|
sudo chown root:root /usr/local/bin/vault
|
|
|
|
|
2017-06-25 18:54:56 +00:00
|
|
|
## Configure
|
2017-05-15 18:56:41 +00:00
|
|
|
sudo mkdir -p $VAULTCONFIGDIR
|
|
|
|
sudo chmod 755 $VAULTCONFIGDIR
|
|
|
|
sudo mkdir -p $VAULTDIR
|
|
|
|
sudo chmod 755 $VAULTDIR
|
|
|
|
|
2017-06-25 18:54:56 +00:00
|
|
|
# Nomad
|
2017-05-15 18:56:41 +00:00
|
|
|
|
|
|
|
curl -L $NOMADDOWNLOAD > nomad.zip
|
|
|
|
|
2017-06-25 18:54:56 +00:00
|
|
|
## Install
|
2017-05-15 18:56:41 +00:00
|
|
|
sudo unzip nomad.zip -d /usr/local/bin
|
|
|
|
sudo chmod 0755 /usr/local/bin/nomad
|
|
|
|
sudo chown root:root /usr/local/bin/nomad
|
|
|
|
|
2017-06-25 18:54:56 +00:00
|
|
|
## Configure
|
2017-05-15 18:56:41 +00:00
|
|
|
sudo mkdir -p $NOMADCONFIGDIR
|
|
|
|
sudo chmod 755 $NOMADCONFIGDIR
|
|
|
|
sudo mkdir -p $NOMADDIR
|
|
|
|
sudo chmod 755 $NOMADDIR
|
|
|
|
|
2017-06-25 18:54:56 +00:00
|
|
|
# Docker
|
2017-05-15 18:56:41 +00:00
|
|
|
echo deb https://apt.dockerproject.org/repo ubuntu-`lsb_release -c | awk '{print $2}'` main | sudo tee /etc/apt/sources.list.d/docker.list
|
|
|
|
sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
|
|
|
|
sudo apt-get update
|
|
|
|
sudo apt-get install -y docker-engine
|
|
|
|
|
2017-06-25 18:54:56 +00:00
|
|
|
# Java
|
2017-05-15 18:56:41 +00:00
|
|
|
sudo add-apt-repository -y ppa:openjdk-r/ppa
|
|
|
|
sudo apt-get update
|
|
|
|
sudo apt-get install -y openjdk-8-jdk
|
|
|
|
JAVA_HOME=$(readlink -f /usr/bin/java | sed "s:bin/java::")
|
|
|
|
|
2017-06-25 18:54:56 +00:00
|
|
|
# Spark
|
2017-07-08 05:29:21 +00:00
|
|
|
sudo wget -P /ops/examples/spark https://s3.amazonaws.com/nomad-spark/spark-2.1.0-bin-nomad.tgz
|
|
|
|
sudo tar -xvf /ops/examples/spark/spark-2.1.0-bin-nomad.tgz --directory /ops/examples/spark
|
|
|
|
sudo mv /ops/examples/spark/spark-2.1.0-bin-nomad /usr/local/bin/spark
|
2017-06-24 23:25:46 +00:00
|
|
|
sudo chown -R root:root /usr/local/bin/spark
|
|
|
|
|
2017-06-25 18:54:56 +00:00
|
|
|
# Hadoop (to enable the HDFS CLI)
|
2017-06-24 23:25:46 +00:00
|
|
|
wget -O - http://apache.mirror.iphh.net/hadoop/common/hadoop-$HADOOP_VERSION/hadoop-$HADOOP_VERSION.tar.gz | sudo tar xz -C /usr/local/
|