summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjakefeasel <jfeasel@gmail.com>2015-02-26 14:09:42 -0800
committerjakefeasel <jfeasel@gmail.com>2015-02-26 14:09:42 -0800
commit3539c61bafb5628b626d3f97e5291db5fae3b0d3 (patch)
treed34bcead181b70e1422832b1697edfefa9d72980
parent474d9b39120d97c04fec42ba134a8c42828a8f2d (diff)
downloadsqlfiddle2-3539c61bafb5628b626d3f97e5291db5fae3b0d3.zip
sqlfiddle2-3539c61bafb5628b626d3f97e5291db5fae3b0d3.tar.gz
sqlfiddle2-3539c61bafb5628b626d3f97e5291db5fae3b0d3.tar.bz2
Improving the varnish configuration to remap requests to the backend
-rw-r--r--README.md2
-rw-r--r--src/main/resources/varnish/default.vcl15
-rwxr-xr-xvagrant_scripts/idm_bootstrap.sh2
-rw-r--r--vagrant_scripts/idm_startup.sh3
4 files changed, 20 insertions, 2 deletions
diff --git a/README.md b/README.md
index 6e183c0..df12403 100644
--- a/README.md
+++ b/README.md
@@ -13,7 +13,7 @@ You are going to need [Vagrant](http://www.vagrantup.com/) and [VirtualBox](http
vagrant up
-This will take a while to download the base image and all of the many dependencies. Once it has finished, you will have the software running in a set of VMs. You can now access your local server at [localhost:18080/sqlfiddle](http://localhost:18080/sqlfiddle).
+This will take a while to download the base image and all of the many dependencies. Once it has finished, you will have the software running in a set of VMs. You can now access your local server at [localhost:6081](http://localhost:6081/).
Note for Windows users - be sure that you run "vagrant up" as an administrator.
diff --git a/src/main/resources/varnish/default.vcl b/src/main/resources/varnish/default.vcl
new file mode 100644
index 0000000..5cb8ccc
--- /dev/null
+++ b/src/main/resources/varnish/default.vcl
@@ -0,0 +1,15 @@
+backend default {
+ .host = "127.0.0.1";
+ .port = "8080";
+}
+
+ sub vcl_recv {
+
+ if (! (req.url ~ "^/openidm/") ) {
+ set req.url = regsub(req.url, "^/", "/sqlfiddle/");
+ }
+
+ if ( req.url == "/sqlfiddle/") {
+ set req.url = "/sqlfiddle/index.html";
+ }
+ }
diff --git a/vagrant_scripts/idm_bootstrap.sh b/vagrant_scripts/idm_bootstrap.sh
index 60ba1eb..f98a9f0 100755
--- a/vagrant_scripts/idm_bootstrap.sh
+++ b/vagrant_scripts/idm_bootstrap.sh
@@ -13,7 +13,9 @@ echo "192.168.50.6 SQLSERVER2014_HOST" >> /etc/hosts
apt-get --yes update
apt-get --yes upgrade
+
apt-get --yes --force-yes install openjdk-7-jdk maven npm varnish
+cp -R /vagrant/src/main/resources/varnish /etc
ln -s /usr/bin/nodejs /usr/bin/node
npm install -g grunt-cli
diff --git a/vagrant_scripts/idm_startup.sh b/vagrant_scripts/idm_startup.sh
index 9328acf..b4e8f03 100644
--- a/vagrant_scripts/idm_startup.sh
+++ b/vagrant_scripts/idm_startup.sh
@@ -1,3 +1,4 @@
cd /vagrant
nohup grunt > target/grunt.log &
-service openidm start \ No newline at end of file
+service openidm start
+service varnish restart \ No newline at end of file