Maintenance mode, or multiple backends but just one used

Cosimo Streppone cosimo at streppone.it
Wed Dec 1 14:57:51 CET 2010


Hi,

This is varnish 2.0.4. I have a VCL where I define a backend like:

   backend nginx {
     .host = "127.0.0.1";
     .port = "8080";
   }

and then later in vcl_recv:

   set req.backend = nginx;

Then I modified the VCL to add another backend,
to test it as downtime/maintenance service, so
that all requests coming in will just display a
"we're upgrading/we're offline" static page:

   backend oops {
      .host = "1.2.3.4";
      .port = "80";
   }

At the same time I modified req.backend to be "oops".
Now, I'm using only one backend.
If the backend that gets to be used in req.backend is
the last defined one, then everything's fine.

If the used backend is any other than the last one,
I get this VCC error:

   Message from VCC-compiler:
   Unused backend oopsy, defined:
   (input Line 24 Pos 9)
   backend oops {
   --------#####--
   Running VCC-compiler failed, exit 1
   VCL compilation failed

This came as a surprise... Is there a way around it?

I'll probably setup a different "maintenance.vcl"
and alternate the VCL configs between "main.vcl" and "maintenance.vcl"
when I need to.

Any better alternatives?

-- 
Cosimo




More information about the varnish-misc mailing list