File tree Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+
3+ # create a machine for the Rancher server
4+ docker-machine create -d scaleway --scaleway-name=rancher-server rancher-server || exit 1
5+
6+ # configure shell to use rancher-server
7+ eval $( docker-machine env rancher-server)
8+
9+ # create a machine for a Rancher host
10+ docker-machine create -d scaleway --scaleway-name=rancher-host-1 rancher-host-1 || exit 1 &
11+
12+ # start a Rancher Server on rancher-server
13+ docker run -d --restart=always -p 8080:8080 rancher/server || exit 1
14+
15+ false
16+ while [ " $? " != " 0" ]
17+ do
18+ # wait for Rancher Server installation
19+ docker logs $( docker ps -q) | grep " Startup Succeeded"
20+ done
21+
22+ # wait for background tasks
23+ wait ` jobs -p` || true
24+
25+ IP=$( docker-machine ip rancher-server)
26+
27+ sleep 10
28+
29+ # generate a token
30+ curl ' http://' $IP ' :8080/v1/registrationtoken' -H ' x-api-project-id: 1a5' -H ' Accept: application/json' --data-binary ' {"type":"registrationToken"}' --compressed > /dev/null
31+ sleep 5
32+ CMD=$( curl ' http://' $IP ' :8080/v1/registrationtokens?state=active&limit=-1' -H ' x-api-project-id: 1a5' -H ' Accept: application/json' --compressed | jq ' .data[0].command' | sed ' s/sudo//g' | tr -d ' "' )
33+
34+ # start a Rancher Agent on rancher-server
35+ $CMD || exit 1
36+
37+ # configure shell to use rancher-host-1
38+ eval $( docker-machine env rancher-host-1)
39+
40+ # start a Rancher Agent on rancher-host-1
41+ $CMD || exit 1
42+
43+ echo " Open your browser at http://" $IP " :8080"
You can’t perform that action at this time.
0 commit comments