OLD | NEW |
---|---|
1 #!/bin/bash | 1 #!/bin/bash |
2 # | 2 # |
3 # Creates the compute instance for skia-perf. | 3 # Creates the compute instance for skia-perf |
tfarina
2015/11/26 21:01:17
why remove the end period from the sentence?
| |
4 # | 4 # |
5 set -x | 5 set -x |
6 | 6 |
7 source vm_config.sh | 7 source vm_config.sh |
8 | 8 |
9 MACHINE_TYPE=n1-highmem-8 | |
10 SOURCE_SNAPSHOT=skia-systemd-pushable-base | |
11 SCOPES='https://www.googleapis.com/auth/devstorage.full_control' | |
12 IP_ADDRESS=104.154.112.108 | |
13 | |
9 # Create a boot disk from the pushable base snapshot. | 14 # Create a boot disk from the pushable base snapshot. |
10 gcloud compute --project $PROJECT_ID disks create $INSTANCE_NAME \ | 15 gcloud compute --project $PROJECT_ID disks create $INSTANCE_NAME \ |
11 --zone $ZONE \ | 16 --zone $ZONE \ |
12 --source-snapshot $PERF_SOURCE_SNAPSHOT \ | 17 --source-snapshot $SOURCE_SNAPSHOT \ |
13 --type "pd-standard" | 18 --type "pd-standard" |
14 | 19 |
15 # Create a large data disk. | 20 # Create a large data disk. |
16 gcloud compute --project $PROJECT_ID disks create $INSTANCE_NAME"-data" \ | 21 gcloud compute --project $PROJECT_ID disks create $INSTANCE_NAME"-data" \ |
17 --size "1000" \ | 22 --size "20" \ |
18 --zone $ZONE \ | 23 --zone $ZONE \ |
19 --type "pd-standard" | 24 --type "pd-standard" |
20 | 25 |
21 # Create the instance with the two disks attahed. | 26 # Create the instance with the two disks attached. |
22 gcloud compute --project $PROJECT_ID instances create $INSTANCE_NAME \ | 27 gcloud compute --project $PROJECT_ID instances create $INSTANCE_NAME \ |
23 --zone $ZONE \ | 28 --zone $ZONE \ |
24 --machine-type $PERF_MACHINE_TYPE \ | 29 --machine-type $MACHINE_TYPE \ |
25 --network "default" \ | 30 --network "default" \ |
26 --maintenance-policy "MIGRATE" \ | 31 --maintenance-policy "MIGRATE" \ |
27 --scopes $PERF_SCOPES \ | 32 --scopes $SCOPES \ |
28 --tags "http-server" "https-server" \ | 33 --tags "http-server" "https-server" \ |
29 --metadata-from-file "startup-script=startup-script.sh" \ | 34 --metadata-from-file "startup-script=startup-script.sh" \ |
30 --disk name=${INSTANCE_NAME} device-name=${INSTANCE_NAME} "mode=rw" "boot=yes" "auto-delete=yes" \ | 35 --disk name=${INSTANCE_NAME} device-name=${INSTANCE_NAME} "mode=rw" "boot=yes" "auto-delete=yes" \ |
31 --disk name=${INSTANCE_NAME}-data device-name=${INSTANCE_NAME}-data "mode=rw" "boot=no" \ | 36 --disk name=${INSTANCE_NAME}-data device-name=${INSTANCE_NAME}-data "mode=rw" "boot=no" \ |
32 --address=$PERF_IP_ADDRESS | 37 --address=$IP_ADDRESS |
33 | 38 |
39 WAIT_TIME_AFTER_CREATION_SECS=600 | |
40 echo | |
41 echo "===== Wait $WAIT_TIME_AFTER_CREATION_SECS secs for instance to" \ | |
42 "complete startup script. =====" | |
43 echo | |
44 sleep $WAIT_TIME_AFTER_CREATION_SECS | |
45 | |
46 # The instance believes it is skia-systemd-snapshot-maker until it is rebooted. | |
47 echo | |
48 echo "===== Rebooting the instance ======" | |
49 # Using "shutdown -r +1" rather than "reboot" so that the connection isn't | |
50 # terminated immediately, which causes a non-zero exit code. | |
51 gcloud compute --project $PROJECT_ID ssh $PROJECT_USER@$INSTANCE_NAME \ | |
52 --zone $ZONE \ | |
53 --command "sudo shutdown -r +1" \ | |
54 || echo "Reboot failed; please reboot the instance manually." | |
OLD | NEW |