• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/bash
2# Copyright 2015 gRPC authors.
3#
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
7#
8#     http://www.apache.org/licenses/LICENSE-2.0
9#
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.
15
16# Creates a performance worker on GCE.
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.
21
22set -ex
23
24cd "$(dirname "$0")"
25
26CLOUD_PROJECT=grpc-testing
27ZONE=us-central1-b  # this zone allows 32core machines
28
29INSTANCE_NAME="${1:-grpc-performance-server1}"
30MACHINE_TYPE=n1-standard-32
31
32gcloud compute instances create "$INSTANCE_NAME" \
33    --project="$CLOUD_PROJECT" \
34    --zone "$ZONE" \
35    --machine-type $MACHINE_TYPE \
36    --image-project ubuntu-os-cloud \
37    --image-family ubuntu-1710 \
38    --boot-disk-size 300 \
39    --scopes https://www.googleapis.com/auth/bigquery \
40    --tags=allow-ssh
41
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" \
48    jenkins_master.pub linux_performance_worker_init.sh "jenkins@${INSTANCE_NAME}":~
49
50gcloud compute ssh \
51    --project="$CLOUD_PROJECT" \
52    --zone "$ZONE" \
53    "jenkins@${INSTANCE_NAME}" --command "./linux_performance_worker_init.sh"
54