blob: 5ea9050c85d08e2f3322c4c6252a04895be0604b [file] [log] [blame] [view]
Rahul Ravikumar8777e6e2019-11-19 13:52:49 -08001# Setting up the Gradle Build Cache Node on Google Cloud Platform.
2
3To setup the [Gradle Remote Cache](https://docs.gradle.com/build-cache-node) you need to do the following:
4
5## Create a new Instance
6
7* Open the Cloud Platform [console](https://console.cloud.google.com/home/dashboard?project=fetch-licenses).
8
Aurimas Liutikasb073af5e02020-08-07 22:59:28 +00009* Select `VM Instances`.
Rahul Ravikumar8777e6e2019-11-19 13:52:49 -080010
11* Click on an existing node, and use `Create Similar` to create a new node.
12 *Note*: This node has to be tagged with a network tag called `gradle-remote-cache-node`
13 for it to be picked up by the load balancer. Make sure you create the node in the zone `us-east-1-b`.
14
15* Click `Allow HTTP Traffic` and `Allow HTTPs Traffic`. By doing do, you are allowing UberProxy access
16 to the remote cache. The load balancer is only available when you are on a corp network.
17
18* Connect to the newly created node using an SSH session. You can use the `gcloud` CLI for this.
19 *Note*: Use the `external` IP of the newly created node to SSH.
20
21```bash
Rahul Ravikumar34d5f482020-02-28 14:10:31 -080022# Note: To switch projects use `gcloud config set project fetch-licenses`
Rahul Ravikumar8777e6e2019-11-19 13:52:49 -080023# Will show the newly created instance
24gcloud compute instances list
25# Will setup ssh configurations
26gcloud compute config-ssh
Aurimas Liutikasb073af5e02020-08-07 22:59:28 +000027ssh 123.123.123.123
Rahul Ravikumar8777e6e2019-11-19 13:52:49 -080028```
29
30## Starting the Gradle Remote Cache Node
31
Aurimas Liutikasb073af5e02020-08-07 22:59:28 +000032```bash
33# Create a folder `Workspace` in the home directory.
34mkdir Workspace
35cd Workspace
36# using the template in this checkout create config.yaml
37vi config.yaml
38# using the template in this checkout create run_node, replace YOURUSERNAME with your username
39vi run_node
40chmod +x run_node
41mkdir data
42mkdir gradle-node
43wget https://docs.gradle.com/build-cache-node/jar/build-cache-node-9.3.jar -p gradle-node
44sudo apt install openjdk-11-jdk tmux
45# Create a `tmux` session
46tmux new -s gradle
47sudo ./run_node
48# Detach from the tmux session ctrl+b then d
49exit
50```
Rahul Ravikumar8777e6e2019-11-19 13:52:49 -080051
52## Update the `gradle-remote-cache-group` instance group.
53
Aurimas Liutikasb073af5e02020-08-07 22:59:28 +000054* Open `Instance groups` in gcloud console
55* Click on `gradle-remote-cache-group` and select `Edit Group`.
56* Select the new node(s), from the drop-down list.
57* Remove old nodes from the list
Rahul Ravikumar8777e6e2019-11-19 13:52:49 -080058* Click `Save`.