-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdcos-bootstrap
111 lines (110 loc) · 3.11 KB
/
dcos-bootstrap
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
( curl -s https://downloads.mesosphere.com/dcos-enterprise/stable/dcos_generate_config.ee.sh -o /root/dcos/dcos_generate_config.ee.sh &
curl -s https://downloads.dcos.io/binaries/cli/linux/x86-64/dcos-1.13/dcos -o /usr/bin/dcos &
yum install -y docker unzip ipset
systemctl enable docker
systemctl restart docker
docker pull nginx:alpine &
[ "$version" ] || version=$(curl -fsSL "https://install.portworx.com/?type=dock&stork=false" | awk -F: '/image: / {print $3}')
mkdir /root/dcos/genconf
if [ $journal = true ]; then
while : ; do
journal_args="-j /dev/$(ssh -oConnectTimeout=1 -oStrictHostKeyChecking=no node-$c-1 lsblk | grep 3G | tail -f | cut -f 1 -d ' ')"
[ $? -eq 0 ] && break
sleep 5
done
fi
cat <<EOF >/root/dcos/genconf/ip-detect
#!/bin/sh
hostname -i
EOF
superuser_password_hash='$6$rounds=656000$8CXbMqwuglDt3Yai$ZkLEj8zS.GmPGWt.dhwAv0.XsjYXwVHuS9aHh3DMcfGaz45OpGxC5oQPXUUpFLMkqlXCfhXMloIzE0Xh8VwHJ.'
cat <<EOF >/root/dcos/genconf/config.yaml
bootstrap_url: http://bootstrap-$c
cluster_name: dcos_test
exhibitor_storage_backend: static
master_discovery: static
master_list:
- 192.168.$[100+$c].90
resolvers:
- 8.8.8.8
- 8.8.4.4
dns_search: None
superuser_username: admin
superuser_password_hash: $superuser_password_hash
license_key_contents: $dcos_license
security: permissive
fault_domain_enabled: false
EOF
cat <<EOF >/root/config-px.json
{
"service": {
"name": "portworx",
"user": "root",
"principal": "",
"pre_reserved_role": "",
"secret_name": "",
"mesos_api_version": "V1",
"task_failure_timeout_minutes": 5
},
"node": {
"portworx_cluster": "portworx-dcos",
"portworx_image": "portworx/px-enterprise:$version",
"portworx_port_range_start": 9001,
"portworx_options": "-a -x mesos $journal_args",
"internal_kvdb": false,
"kvdb_servers": "",
"container_parameters": "",
"count": 3,
"placement_constraint": "hostname:UNIQUE"
},
"secrets": {
"enabled": false,
"base_path": "",
"dcos_username_secret": "portworx/dcos_username",
"dcos_password_secret": "portworx/dcos_password"
},
"etcd": {
"enabled": true,
"proxy_enabled": false,
"placement_constraint": "hostname:UNIQUE",
"image": "mesosphere/etcd-mesos:latest",
"cpus": 0.3,
"mem": 1024,
"disk_type": "ROOT",
"disk_size": 5120,
"node_advertise_port": 1026,
"node_peer_port": 1027,
"proxy_advertise_port": 2379
},
"lighthouse": {
"enabled": false,
"placement_constraint": "",
"public_agent": true,
"cpus": 0.3,
"mem": 1024,
"image": "portworx/px-lighthouse:2.0.4",
"webui_port": 8085,
"company_name": "Portworx",
"admin_username": "admin"
}
}
EOF
wait %1
cd /root/dcos
bash dcos_generate_config.ee.sh
wait %3
docker run -d -p 80:80 -v /root/dcos/genconf/serve:/usr/share/nginx/html:ro nginx:alpine
wait %2
chmod 755 /usr/bin/dcos
while : ; do
dcos cluster setup http://master-$c --username admin --password admin
[ $? -eq 0 ] && break
sleep 5
done
while : ; do
dcos package install --options=/root/config-px.json portworx --yes
[ $? -eq 0 ] && break
sleep 5
done
echo End
) &>/var/log/vagrant.bootstrap &