Geolocation without compiling Varnish from source
spam at onlineconcepts.com
Thu Mar 28 20:44:29 CET 2013
I received this advice off-list.
> You need the varnish sources to compile the vmod (like
> https://github.com/leed25d/geoip-vmod), but you can use it from your
> packaged varnish version.
That convinced me that it was possible to do what I wanted. Now I have
geolocation up and running in Varnish!
I hit a number of surprising snags, chiefly around version issues. I
followed this process (mostly based on
* Download Varnish source code
* Download the VMOD source code
* Compile VMOD against the Varnish source
* Copy VMOD to Varnish's vmod directory on Test server
On my system running RHEL 6.2, the location was:
The VMOD was *very* particular about which version of the Varnish source
git clone https://github.com/varnish/Varnish-Cache.git
On my system, running "git checkout varnish-3.0.2" was not specific
enough. I ran "git log" to see the recent commit history. As of late March
2013, the current version was Varnish 3.0.2 670f56f, where 670f56f refers
to the most recent Git commit. I ran this on my server:
It reported "varnishd (varnish-3.0.2 revision 55e70a4)." So the current
source was one commit ahead of the binary version of Varnish binaries that
were already deployed. I saw what was happening, but on a lark, I deployed
in Dev a version of the VMOD that matched commit 670f56f. That produced
this error when starting Varnish: "ABI mismatch, expected <Varnish 3.0.2
55e70a4>, got <Varnish 3.0.2 670f56f>"
Start over again, and instead of running "git checkout varnish-3.0.2" run:
git checkout 55e70a4
You have to check out the version at the correct commit because you'll get
an error if you compile your VMOD against the wrong code version.
Thankfully, all my relevant servers run the same version of Varnish. I'm
worried what will happen the next time a server admin runs:
"yum update-minimal --security"
I'm sure that could overwrite the Varnish binaries. Then my VMOD would be
out of sync with the binaries, and my website would go offline until I
* Recompiled the VMOD; or
* Commented out the VCL code that includes the VMOD.
This seems a little fragile to me, but maybe I have been working too long
with scripting languages and APIs.
If the group considers it useful, I can document this further for the
Varnish community. Would this go in the wiki?
More information about the varnish-misc