Run Squid as a reverse caching proxy on port 80 and proxy the requests
to the server running on port 8000.
BUG=skia:
R=mtklein@google.com
Author: jcgregorio@google.com
Review URL: https://codereview.chromium.org/261023002
git-svn-id: http://skia.googlecode.com/svn/trunk@14515 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/experimental/webtry/DESIGN.md b/experimental/webtry/DESIGN.md
index c95d769..0bc2145 100644
--- a/experimental/webtry/DESIGN.md
+++ b/experimental/webtry/DESIGN.md
@@ -32,7 +32,6 @@
Architecture
------------
-
The server runs on GCE, and consists of a Go Web Server that calls out to the
c++ compiler and executes code in a chroot jail. See the diagram below:
@@ -203,6 +202,14 @@
N.B. If you need to change the MySQL password that webtry uses, you must change
it both in MySQL and the value stored in the metadata server.
+Squid
+-----
+
+Squid is configured to run on port 80 and run as an accelerator for the actual
+Go program which is running on port 8000. The config for the squid proxy is
+held in sys/webtry_squid, which is copied into place during installation and
+squid is kept running via monit.
+
Workspaces
----------
diff --git a/experimental/webtry/README.md b/experimental/webtry/README.md
index d2835d3..dea9ac0 100644
--- a/experimental/webtry/README.md
+++ b/experimental/webtry/README.md
@@ -30,6 +30,8 @@
--network=default --machine_type=n1-standard-1 --image=backports-debian-7-wheezy-v20140331 \
--persistent_boot_disk
+Make sure port 80 is accessible externally for the above instance.
+
SSH into the instance:
gcutil --project=google.com:skia-buildbots ssh --ssh_user=default skia-webtry-b
diff --git a/experimental/webtry/setup/webtry_setup.sh b/experimental/webtry/setup/webtry_setup.sh
index 6658ca8..34a8051 100755
--- a/experimental/webtry/setup/webtry_setup.sh
+++ b/experimental/webtry/setup/webtry_setup.sh
@@ -2,7 +2,7 @@
#
# Script to setup a GCE instance to run the webtry server.
# For full instructions see the README file.
-sudo apt-get install schroot debootstrap monit
+sudo apt-get install schroot debootstrap monit squid3
sudo apt-get install g++ libfreetype6 libfreetype6-dev libpng12-0 libpng12-dev libglu1-mesa-dev mesa-common-dev freeglut3-dev libgif-dev libfontconfig libfontconfig-dev
echo "Adding the webtry user account"
@@ -26,6 +26,7 @@
sudo cp /home/webtry/skia/experimental/webtry/sys/webtry_init /etc/init.d/webtry
sudo cp /home/webtry/skia/experimental/webtry/sys/webtry_monit /etc/monit/conf.d/webtry
+sudo cp /home/webtry/skia/experimental/webtry/sys/webtry_squid /etc/squid3/squid.conf
sudo chmod 744 /etc/init.d/webtry
# Confirm that monit is happy.
diff --git a/experimental/webtry/sys/webtry_monit b/experimental/webtry/sys/webtry_monit
index 5fccf8a..906b0a6 100644
--- a/experimental/webtry/sys/webtry_monit
+++ b/experimental/webtry/sys/webtry_monit
@@ -2,3 +2,6 @@
start program = "/etc/init.d/webtry start"
stop program = "/etc/init.d/webtry stop"
+check process squid3 with pidfile /var/run/squid3.pid
+ start program = "/etc/init.d/squid3 start"
+ stop program = "/etc/init.d/squid3 stop"
diff --git a/experimental/webtry/sys/webtry_squid b/experimental/webtry/sys/webtry_squid
new file mode 100644
index 0000000..8dd623b
--- /dev/null
+++ b/experimental/webtry/sys/webtry_squid
@@ -0,0 +1,6 @@
+http_port 80 accel defaultsite=skfiddle.com
+cache_peer 127.0.0.1 parent 8000 0 no-query originserver name=myAccel
+acl our_sites dstdomain skfiddle.com
+http_access allow our_sites
+cache_peer_access myAccel allow our_sites
+cache_peer_access myAccel deny all