Jan Tattermusch | a30fc5d | 2016-03-25 14:00:23 -0700 | [diff] [blame] | 1 | #!/bin/bash |
Jan Tattermusch | 7897ae9 | 2017-06-07 22:57:36 +0200 | [diff] [blame] | 2 | # Copyright 2015 gRPC authors. |
Jan Tattermusch | a30fc5d | 2016-03-25 14:00:23 -0700 | [diff] [blame] | 3 | # |
Jan Tattermusch | 7897ae9 | 2017-06-07 22:57:36 +0200 | [diff] [blame] | 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | # you may not use this file except in compliance with the License. |
| 6 | # You may obtain a copy of the License at |
Jan Tattermusch | a30fc5d | 2016-03-25 14:00:23 -0700 | [diff] [blame] | 7 | # |
Jan Tattermusch | 7897ae9 | 2017-06-07 22:57:36 +0200 | [diff] [blame] | 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
Jan Tattermusch | a30fc5d | 2016-03-25 14:00:23 -0700 | [diff] [blame] | 9 | # |
Jan Tattermusch | 7897ae9 | 2017-06-07 22:57:36 +0200 | [diff] [blame] | 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | # See the License for the specific language governing permissions and |
| 14 | # limitations under the License. |
Jan Tattermusch | a30fc5d | 2016-03-25 14:00:23 -0700 | [diff] [blame] | 15 | |
| 16 | # Creates a performance worker on GCE. |
Jan Tattermusch | b19b62c | 2016-03-31 17:18:54 -0700 | [diff] [blame] | 17 | # IMPORTANT: After creating the worker, one needs to manually add the pubkey |
| 18 | # of jenkins@the-machine-where-jenkins-starts-perf-tests |
| 19 | # to ~/.ssh/authorized_keys so that multi-machine scenarios can work. |
| 20 | # See tools/run_tests/run_performance_tests.py for details. |
Jan Tattermusch | a30fc5d | 2016-03-25 14:00:23 -0700 | [diff] [blame] | 21 | |
| 22 | set -ex |
| 23 | |
| 24 | cd $(dirname $0) |
| 25 | |
| 26 | CLOUD_PROJECT=grpc-testing |
| 27 | ZONE=us-central1-b # this zone allows 32core machines |
| 28 | |
Jan Tattermusch | b19b62c | 2016-03-31 17:18:54 -0700 | [diff] [blame] | 29 | INSTANCE_NAME="${1:-grpc-performance-server1}" |
Matt Kwong | 6ae9175 | 2017-04-26 19:03:18 -0700 | [diff] [blame] | 30 | MACHINE_TYPE=n1-standard-32 |
Jan Tattermusch | a30fc5d | 2016-03-25 14:00:23 -0700 | [diff] [blame] | 31 | |
| 32 | gcloud compute instances create $INSTANCE_NAME \ |
| 33 | --project="$CLOUD_PROJECT" \ |
| 34 | --zone "$ZONE" \ |
| 35 | --machine-type $MACHINE_TYPE \ |
Jan Tattermusch | 1152292 | 2016-10-14 16:40:39 +0200 | [diff] [blame] | 36 | --image-project ubuntu-os-cloud \ |
Jan Tattermusch | 0ebdc16 | 2017-09-05 09:46:52 +0200 | [diff] [blame] | 37 | --image-family ubuntu-1704 \ |
Jan Tattermusch | 15d2979 | 2016-05-09 23:27:05 -0700 | [diff] [blame] | 38 | --boot-disk-size 300 \ |
Matt Kwong | 4383049 | 2017-09-13 18:27:55 -0700 | [diff] [blame] | 39 | --scopes https://www.googleapis.com/auth/bigquery \ |
| 40 | --tags=allow-ssh |
Jan Tattermusch | a30fc5d | 2016-03-25 14:00:23 -0700 | [diff] [blame] | 41 | |
| 42 | echo 'Created GCE instance, waiting 60 seconds for it to come online.' |
| 43 | sleep 60 |
| 44 | |
| 45 | gcloud compute copy-files \ |
| 46 | --project="$CLOUD_PROJECT" \ |
| 47 | --zone "$ZONE" \ |
Jan Tattermusch | b19b62c | 2016-03-31 17:18:54 -0700 | [diff] [blame] | 48 | jenkins_master.pub linux_performance_worker_init.sh jenkins@${INSTANCE_NAME}:~ |
Jan Tattermusch | a30fc5d | 2016-03-25 14:00:23 -0700 | [diff] [blame] | 49 | |
| 50 | gcloud compute ssh \ |
| 51 | --project="$CLOUD_PROJECT" \ |
| 52 | --zone "$ZONE" \ |
Jan Tattermusch | b19b62c | 2016-03-31 17:18:54 -0700 | [diff] [blame] | 53 | jenkins@${INSTANCE_NAME} --command "./linux_performance_worker_init.sh" |