Index: third_party/grpc/tools/gce/linux_worker_init.sh |
diff --git a/third_party/WebKit/LayoutTests/http/tests/websocket/workers/resources/echo_wsh.py b/third_party/grpc/tools/gce/linux_worker_init.sh |
old mode 100644 |
new mode 100755 |
similarity index 52% |
copy from third_party/WebKit/LayoutTests/http/tests/websocket/workers/resources/echo_wsh.py |
copy to third_party/grpc/tools/gce/linux_worker_init.sh |
index 429f58186e3fce43dc21e81e0f9d7e20c7e0bf70..f56cac0ce2f1601a431acf3174e3d27b96512171 |
--- a/third_party/WebKit/LayoutTests/http/tests/websocket/workers/resources/echo_wsh.py |
+++ b/third_party/grpc/tools/gce/linux_worker_init.sh |
@@ -1,4 +1,5 @@ |
-# Copyright 2010, Google Inc. |
+#!/bin/bash |
+# Copyright 2015-2016, Google Inc. |
# All rights reserved. |
# |
# Redistribution and use in source and binary forms, with or without |
@@ -27,20 +28,43 @@ |
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
+# Initializes a fresh GCE VM to become a jenkins linux worker. |
+# You shouldn't run this script on your own, use create_linux_worker.sh |
+# instead. |
-from mod_pywebsocket import msgutil |
+set -ex |
+sudo apt-get update |
-_GOODBYE_MESSAGE = 'Goodbye' |
+# Install JRE |
+sudo apt-get install -y openjdk-7-jre |
+sudo apt-get install -y unzip lsof |
+# Install Docker |
+curl -sSL https://get.docker.com/ | sh |
-def web_socket_do_extra_handshake(request): |
- pass # Always accept. |
+# Setup jenkins user (or the user will already exist bcuz magic) |
+sudo adduser jenkins --disabled-password || true |
+# Enable jenkins to use docker without sudo: |
+sudo usermod -aG docker jenkins |
-def web_socket_transfer_data(request): |
- while True: |
- line = msgutil.receive_message(request) |
- msgutil.send_message(request, line) |
- if line == _GOODBYE_MESSAGE: |
- return |
+# Use "overlay" storage driver for docker |
+# see https://github.com/grpc/grpc/issues/4988 |
+echo 'DOCKER_OPTS="${DOCKER_OPTS} --storage-driver=overlay"' | sudo tee --append /etc/default/docker |
+ |
+# Install RVM |
+# TODO(jtattermusch): why is RVM needed? |
+gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 |
+curl -sSL https://get.rvm.io | bash -s stable --ruby |
+ |
+# Add pubkey of jenkins@grpc-jenkins-master to authorized keys of jenkins@ |
+# This needs to happen as the last step to prevent Jenkins master from connecting |
+# to a machine that hasn't been properly setup yet. |
+cat jenkins_master.pub | sudo tee --append ~jenkins/.ssh/authorized_keys |
+ |
+# Restart for docker to pickup the config changes. |
+echo 'Successfully initialized the linux worker, going for reboot in 10 seconds' |
+sleep 10 |
+ |
+sudo reboot |