Skip to content

Commit 273c4a5

Browse files
committed
Updated the GCE walkthrough docs
1 parent ba8aeaf commit 273c4a5

File tree

1 file changed

+9
-58
lines changed

1 file changed

+9
-58
lines changed

docs/gce_walkthrough.md

Lines changed: 9 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,15 @@ Since GCE images are not publicly shareable it is necessary to configure a new i
66
* Keep track of the server hostname, location ID and location key for the configured test location
77
* Configure it with the following browser list in locations.ini:
88
* ```browser=Chrome,Chrome Beta,Chrome Canary,Firefox,Firefox Nightly```
9+
* There is a [sample locations.ini](https://github.com/WPO-Foundation/webpagetest/blob/master/www/settings/locations.ini.GCE-sample) pre-configured with all of the GCE regions as part of the project in github.
910

10-
## Launch a base instance
11+
## Launch a base Ubuntu 16.04 instance
1112
* Start at the Google Compute Engine console for the project you are creating the image for:
1213
* [https://console.cloud.google.com/compute/instances](https://console.cloud.google.com/compute/instances)
1314
* Create an instance
1415
* Name it something that you will recognize in the list (name doesn't matter)
1516
* Select a region near you. Once created the image can be deployed globally but selecting a region near you for configuration makes setup easier.
16-
* Select a 1 vCPU machine (the default - n1-standard-1)
17+
* Select a 2 vCPU machine (n1-standard-2)
1718
* The image can be deployed to any instance size after being configured though the shared CPU instances will have inconsistent performance and are not recommended.
1819
* Change the boot disk to "Ubuntu 16.04 LTS" from the "OS Images" list.
1920
* Leave the boot disk type as "standard persistent disk" and size at 10GB
@@ -34,65 +35,15 @@ Since GCE images are not publicly shareable it is necessary to configure a new i
3435
## Install the software
3536
* SSH into the newly-created instance as the user "ubuntu" with the SSH key you provided (using the "External IP" for the instance)
3637
* ```sss [email protected]```
37-
* Clone the wptagent code
38-
* ```git clone https://github.com/WPO-Foundation/wptagent.git```
39-
* Run the Ubuntu install script
40-
* ```wptagent/ubuntu_install.sh```
41-
* This will install all of the dependencies (including Lighthouse), Chrome and Firefox
42-
* Install any OS updates
43-
* ```sudo apt-get update && sudo apt-get -y dist-upgrade && sudo apt-get -y autoremove```
44-
* Create a shell script to run the agent
45-
* This script installs all OS and browser updates at startup (before running the agent) and every 24 hours after that. It also updates the agent code from Github hourly (modify it if you don't want to auto-update):
46-
* ```nano ~/agent.sh```
47-
* Paste the following script (ctrl-O to save, ctrl-X to exit after you're done):
48-
```sh
49-
#!/bin/sh
50-
cd ~/wptagent
51-
echo "Waiting for 30 second startup delay"
52-
sleep 30
53-
echo "Waiting for apt to become available"
54-
while fuser /var/lib/dpkg/lock >/dev/null 2>&1 ; do
55-
sleep 1
56-
done
57-
while :
58-
do
59-
echo "Updating OS"
60-
until sudo apt-get update
61-
do
62-
sleep 1
63-
done
64-
until sudo DEBIAN_FRONTEND=noninteractive apt-get -yq -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" dist-upgrade
65-
do
66-
sleep 1
67-
done
68-
sudo apt-get -y autoremove
69-
sudo npm i -g lighthouse
70-
for i in `seq 1 24`
71-
do
72-
git pull origin master
73-
python wptagent.py -vvvv --gce --xvfb --fps 30 --throttle --exit 60 --alive /tmp/wptagent
74-
echo "Exited, restarting"
75-
sleep 1
76-
done
77-
done
38+
* Run the [GCE install script](https://github.com/WPO-Foundation/wptagent-install#on-google-cloud)
39+
```bash
40+
wget https://raw.githubusercontent.com/WPO-Foundation/wptagent-install/master/gce_ubuntu.sh && \
41+
chmod +x gce_ubuntu.sh && \
42+
./gce_ubuntu.sh
7843
```
79-
* Create a shell script to launch the agent in a detached screen (makes it easy to ssh into an agent and ```screen -r``` to watch the agent activity as it runs
80-
* ```nano ~/startup.sh```
81-
* Paste the following script:
82-
```sh
83-
#!/bin/sh
84-
PATH=/home/ubuntu/bin:/home/ubuntu/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
85-
screen -dmS agent ~/agent.sh
86-
```
87-
* Make the scripts executable
88-
* ```chmod +x ~/*.sh```
89-
* Configure the startup script to run at boot time
90-
* ```crontab -e```
91-
* Add the following to the end of the cron file:
92-
* ```@reboot /home/ubuntu/startup.sh```
44+
The script will install all of the necessary software and reboot the instance when it is complete.
9345

9446
## Test the agent
95-
* Reboot the vm ```sudo reboot```
9647
* Submit some tests to the web UI for the test location and make sure tests run as expected (if not, ssh into the VM and connect to the screen session to see what it is doing)
9748

9849
## Create the image

0 commit comments

Comments
 (0)