blob: 328b00f63210c4e2bf0de6eb769a586feb2d45ca [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 Liutikas3a57f0e2022-01-24 16:56:58 -08009* In the search box type in and select `VM Instances`.
Rahul Ravikumar8777e6e2019-11-19 13:52:49 -080010
Aurimas Liutikas3a57f0e2022-01-24 16:56:58 -080011* Click on an existing node to see details page, then use `Create Similar` to create a new node.
Rahul Ravikumar8777e6e2019-11-19 13:52:49 -080012 *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
Aurimas Liutikas3a57f0e2022-01-24 16:56:58 -080033# Install some prerequisite packages
34sudo apt update
35sudo apt upgrade
36sudo apt install openjdk-11-jdk tmux wget
Aurimas Liutikasb073af5e02020-08-07 22:59:28 +000037# Create a folder `Workspace` in the home directory.
38mkdir Workspace
39cd Workspace
Aurimas Liutikas3a57f0e2022-01-24 16:56:58 -080040mkdir -p data/conf
Aurimas Liutikasb073af5e02020-08-07 22:59:28 +000041# using the template in this checkout create config.yaml
Aurimas Liutikas3a57f0e2022-01-24 16:56:58 -080042vi data/conf/config.yaml
Aurimas Liutikasb073af5e02020-08-07 22:59:28 +000043# using the template in this checkout create run_node, replace YOURUSERNAME with your username
44vi run_node
45chmod +x run_node
Aurimas Liutikasb073af5e02020-08-07 22:59:28 +000046mkdir gradle-node
Aurimas Liutikas3a57f0e2022-01-24 16:56:58 -080047wget https://docs.gradle.com/build-cache-node/jar/build-cache-node-11.1.jar -P gradle-node
Aurimas Liutikasb073af5e02020-08-07 22:59:28 +000048# Create a `tmux` session
49tmux new -s gradle
Aurimas Liutikas3a57f0e2022-01-24 16:56:58 -080050sudo ./run_node &
Aurimas Liutikasb073af5e02020-08-07 22:59:28 +000051# Detach from the tmux session ctrl+b then d
52exit
53```
Rahul Ravikumar8777e6e2019-11-19 13:52:49 -080054
55## Update the `gradle-remote-cache-group` instance group.
56
Aurimas Liutikasb073af5e02020-08-07 22:59:28 +000057* Open `Instance groups` in gcloud console
58* Click on `gradle-remote-cache-group` and select `Edit Group`.
59* Select the new node(s), from the drop-down list.
60* Remove old nodes from the list
Rahul Ravikumar8777e6e2019-11-19 13:52:49 -080061* Click `Save`.