github.com/smithx10/nomad@v0.9.1-rc1/e2e/terraform/shared/scripts/setup.sh (about) 1 #!/bin/bash 2 3 set -e 4 5 # Disable interactive apt prompts 6 export DEBIAN_FRONTEND=noninteractive 7 8 cd /ops 9 10 CONFIGDIR=/ops/shared/config 11 12 CONSULVERSION=1.4.0 13 CONSULDOWNLOAD=https://releases.hashicorp.com/consul/${CONSULVERSION}/consul_${CONSULVERSION}_linux_amd64.zip 14 CONSULCONFIGDIR=/etc/consul.d 15 CONSULDIR=/opt/consul 16 17 VAULTVERSION=0.11.4 18 VAULTDOWNLOAD=https://releases.hashicorp.com/vault/${VAULTVERSION}/vault_${VAULTVERSION}_linux_amd64.zip 19 VAULTCONFIGDIR=/etc/vault.d 20 VAULTDIR=/opt/vault 21 22 NOMADCONFIGDIR=/etc/nomad.d 23 NOMADDIR=/opt/nomad 24 25 HADOOP_VERSION=2.7.6 26 27 # Dependencies 28 sudo apt-get install -y software-properties-common 29 sudo apt-get update 30 sudo apt-get install -y unzip tree redis-tools jq curl tmux awscli 31 32 # Numpy (for Spark) 33 sudo apt-get install -y python-setuptools 34 sudo easy_install pip 35 sudo pip install numpy 36 37 # Disable the firewall 38 39 sudo ufw disable || echo "ufw not installed" 40 41 # Consul 42 43 curl -L $CONSULDOWNLOAD > consul.zip 44 45 ## Install 46 sudo unzip consul.zip -d /usr/local/bin 47 sudo chmod 0755 /usr/local/bin/consul 48 sudo chown root:root /usr/local/bin/consul 49 50 ## Configure 51 sudo mkdir -p $CONSULCONFIGDIR 52 sudo chmod 755 $CONSULCONFIGDIR 53 sudo mkdir -p $CONSULDIR 54 sudo chmod 755 $CONSULDIR 55 56 # Vault 57 58 curl -L $VAULTDOWNLOAD > vault.zip 59 60 ## Install 61 sudo unzip vault.zip -d /usr/local/bin 62 sudo chmod 0755 /usr/local/bin/vault 63 sudo chown root:root /usr/local/bin/vault 64 65 ## Configure 66 sudo mkdir -p $VAULTCONFIGDIR 67 sudo chmod 755 $VAULTCONFIGDIR 68 sudo mkdir -p $VAULTDIR 69 sudo chmod 755 $VAULTDIR 70 71 ## Install 72 sudo unzip nomad.zip -d /usr/local/bin 73 sudo chmod 0755 /usr/local/bin/nomad 74 sudo chown root:root /usr/local/bin/nomad 75 76 ## Configure 77 sudo mkdir -p $NOMADCONFIGDIR 78 sudo chmod 755 $NOMADCONFIGDIR 79 sudo mkdir -p $NOMADDIR 80 sudo chmod 755 $NOMADDIR 81 82 # Docker 83 distro=$(lsb_release -si | tr '[:upper:]' '[:lower:]') 84 sudo apt-get install -y apt-transport-https ca-certificates gnupg2 85 curl -fsSL https://download.docker.com/linux/debian/gpg | sudo apt-key add - 86 sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/${distro} $(lsb_release -cs) stable" 87 sudo apt-get update 88 sudo apt-get install -y docker-ce 89 90 # rkt 91 VERSION=1.29.0 92 DOWNLOAD=https://github.com/rkt/rkt/releases/download/v${VERSION}/rkt-v${VERSION}.tar.gz 93 94 function install_rkt() { 95 wget -q -O /tmp/rkt.tar.gz "${DOWNLOAD}" 96 tar -C /tmp -xvf /tmp/rkt.tar.gz 97 sudo mv /tmp/rkt-v${VERSION}/rkt /usr/local/bin 98 sudo mv /tmp/rkt-v${VERSION}/*.aci /usr/local/bin 99 } 100 101 function configure_rkt_networking() { 102 sudo mkdir -p /etc/rkt/net.d 103 sudo bash -c 'cat << EOT > /etc/rkt/net.d/99-network.conf 104 { 105 "name": "default", 106 "type": "ptp", 107 "ipMasq": false, 108 "ipam": { 109 "type": "host-local", 110 "subnet": "172.16.28.0/24", 111 "routes": [ 112 { 113 "dst": "0.0.0.0/0" 114 } 115 ] 116 } 117 } 118 EOT' 119 } 120 121 install_rkt 122 configure_rkt_networking 123 124 # Java 125 sudo add-apt-repository -y ppa:openjdk-r/ppa 126 sudo apt-get update 127 sudo apt-get install -y openjdk-8-jdk 128 JAVA_HOME=$(readlink -f /usr/bin/java | sed "s:bin/java::") 129 130 # Spark 131 sudo wget -P /ops/examples/spark https://s3.amazonaws.com/nomad-spark/spark-2.2.0-bin-nomad-0.7.0.tgz 132 sudo tar -xvf /ops/examples/spark/spark-2.2.0-bin-nomad-0.7.0.tgz --directory /ops/examples/spark 133 sudo mv /ops/examples/spark/spark-2.2.0-bin-nomad-0.7.0 /usr/local/bin/spark 134 sudo chown -R root:root /usr/local/bin/spark 135 136 # Hadoop (to enable the HDFS CLI) 137 wget -O - http://apache.mirror.iphh.net/hadoop/common/hadoop-${HADOOP_VERSION}/hadoop-${HADOOP_VERSION}.tar.gz | sudo tar xz -C /usr/local/