blob: 4270f5cbfb656ca4e830fb1665471628ad438149 [file] [log] [blame]
Jan Tattermuscha30fc5d2016-03-25 14:00:23 -07001#!/bin/bash
Jan Tattermusch7897ae92017-06-07 22:57:36 +02002# Copyright 2015 gRPC authors.
Jan Tattermuscha30fc5d2016-03-25 14:00:23 -07003#
Jan Tattermusch7897ae92017-06-07 22:57:36 +02004# 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 Tattermuscha30fc5d2016-03-25 14:00:23 -07007#
Jan Tattermusch7897ae92017-06-07 22:57:36 +02008# http://www.apache.org/licenses/LICENSE-2.0
Jan Tattermuscha30fc5d2016-03-25 14:00:23 -07009#
Jan Tattermusch7897ae92017-06-07 22:57:36 +020010# 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 Tattermuscha30fc5d2016-03-25 14:00:23 -070015
16# Creates a performance worker on GCE.
Jan Tattermuschb19b62c2016-03-31 17:18:54 -070017# 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 Tattermuscha30fc5d2016-03-25 14:00:23 -070021
22set -ex
23
24cd $(dirname $0)
25
26CLOUD_PROJECT=grpc-testing
27ZONE=us-central1-b # this zone allows 32core machines
28
Jan Tattermuschb19b62c2016-03-31 17:18:54 -070029INSTANCE_NAME="${1:-grpc-performance-server1}"
Matt Kwong6ae91752017-04-26 19:03:18 -070030MACHINE_TYPE=n1-standard-32
Jan Tattermuscha30fc5d2016-03-25 14:00:23 -070031
32gcloud compute instances create $INSTANCE_NAME \
33 --project="$CLOUD_PROJECT" \
34 --zone "$ZONE" \
35 --machine-type $MACHINE_TYPE \
Jan Tattermusch11522922016-10-14 16:40:39 +020036 --image-project ubuntu-os-cloud \
Jan Tattermusch0ebdc162017-09-05 09:46:52 +020037 --image-family ubuntu-1704 \
Jan Tattermusch15d29792016-05-09 23:27:05 -070038 --boot-disk-size 300 \
Matt Kwong43830492017-09-13 18:27:55 -070039 --scopes https://www.googleapis.com/auth/bigquery \
40 --tags=allow-ssh
Jan Tattermuscha30fc5d2016-03-25 14:00:23 -070041
42echo 'Created GCE instance, waiting 60 seconds for it to come online.'
43sleep 60
44
45gcloud compute copy-files \
46 --project="$CLOUD_PROJECT" \
47 --zone "$ZONE" \
Jan Tattermuschb19b62c2016-03-31 17:18:54 -070048 jenkins_master.pub linux_performance_worker_init.sh jenkins@${INSTANCE_NAME}:~
Jan Tattermuscha30fc5d2016-03-25 14:00:23 -070049
50gcloud compute ssh \
51 --project="$CLOUD_PROJECT" \
52 --zone "$ZONE" \
Jan Tattermuschb19b62c2016-03-31 17:18:54 -070053 jenkins@${INSTANCE_NAME} --command "./linux_performance_worker_init.sh"