~frbayart/charms/trusty/mesos-master/trunk

« back to all changes in this revision

Viewing changes to hooks/install

  • Committer: Francois Bayart
  • Date: 2016-04-07 18:34:21 UTC
  • Revision ID: francois.bayart@data-fellas.guru-20160407183421-nm09uhq4qbwanjq5
InitialĀ FORKEDĀ charm

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/bash
 
2
 
 
3
set -ex
 
4
 
 
5
# Install is guaranteed to run once per rootfs
 
6
 
 
7
juju-log "Installing mesos-master on $JUJU_UNIT_NAME"
 
8
status-set maintenance "Fetching and installing Mesos"
 
9
 
 
10
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv E56151BF
 
11
DISTRO=$(lsb_release -is | tr '[:upper:]' '[:lower:]')
 
12
CODENAME=$(lsb_release -cs)
 
13
 
 
14
# Add the repository
 
15
echo "deb http://repos.mesosphere.com/${DISTRO} ${CODENAME} main" | sudo tee /etc/apt/sources.list.d/mesosphere.list
 
16
sudo apt-get -y update
 
17
sudo apt-get -y install mesos marathon=0.10.1-1.0.416.ubuntu1404 wget git-core make
 
18
 
 
19
# Install docker
 
20
wget -qO- https://get.docker.com/ | sh
 
21
sudo usermod -aG docker ubuntu
 
22
 
 
23
# Install mesos-dns
 
24
juju-log "Installing mesos-dns on $JUJU_UNIT_NAME"
 
25
 
 
26
wget https://storage.googleapis.com/golang/go1.4.linux-amd64.tar.gz
 
27
tar xzf go*
 
28
sudo mv go /usr/local/.
 
29
export PATH=$PATH:/usr/local/go/bin
 
30
export GOROOT=/usr/local/go
 
31
export PATH=$PATH:$GOROOT/bin
 
32
export GOPATH=/home/ubuntu/go
 
33
go get github.com/tools/godep
 
34
export PATH=$PATH:$GOPATH/bin
 
35
 
 
36
go get github.com/gogo/protobuf/proto
 
37
 
 
38
mkdir -p $GOPATH/src/github.com/mesos
 
39
cd $GOPATH/src/github.com/mesos
 
40
rm -rf $GOPATH/src/github.com/mesos/mesos-go
 
41
 
 
42
git clone https://github.com/mesos/mesos-go
 
43
cd $GOPATH/src/github.com/mesos/mesos-go
 
44
#stable version
 
45
git checkout  b164c06f346af1e93aecb6502f83d31dbacdbb91
 
46
go build github.com/mesos/mesos-go/mesosproto
 
47
 
 
48
mkdir -p $GOPATH/src/github.com/mesosphere
 
49
cd $GOPATH/src/github.com/mesosphere
 
50
git clone https://github.com/mesosphere/mesos-dns
 
51
cd $GOPATH/src/github.com/mesosphere/mesos-dns
 
52
git checkout tags/v0.3.0
 
53
 
 
54
go get github.com/mesosphere/mesos-dns
 
55
cd $GOPATH/src/github.com/mesosphere/mesos-dns
 
56
 
 
57
#make all
 
58
 
 
59
godep go build ./...
 
60
godep go install
 
61
 
 
62
sudo mkdir /usr/local/mesos-dns
 
63
sudo mv $GOPATH/bin/mesos-dns /usr/local/mesos-dns
 
64
 
 
65
cat > /etc/init/mesos-dns.conf <<EOL
 
66
description "mesos dns"
 
67
 
 
68
start on stopped rc RUNLEVEL=[2345]
 
69
respawn
 
70
 
 
71
exec /usr/local/mesos-dns/mesos-dns -config=/usr/local/mesos-dns/config.json
 
72
EOL
 
73
 
 
74
sudo cp /etc/resolv.conf /etc/resolv.conf.backup
 
75
 
 
76
sudo sh -c "echo `config-get zookeeper` > /etc/mesos/zk"
 
77
sudo sh -c "echo `config-get quorum` > /etc/mesos-master/quorum"