2
votes

I have a simple program for adding and removing backends for varnish 3.x. It's done in a simple way: there is a python program that accepts HTTP requests for adding and removing backends for named services. It adds and removes backends for specific directors using VCL configuration and then reloads config for varnish.

Now I wonder how to implement such a scheme for new (4.x) Varnish-cache. I see from documentation directors have moved from VCL modules to VMOD loadables. As I see it, now it's impossible to add new backend or director on-fly without restarting the whole varnish. Or am I wrong?

So the questions are:

  1. Does Varnish-cache 4.x have any external [to varnish itself] API for managing configurations and directors in particular?
  2. What's the best way to manage directors in Varnish 4.x in automatic way without varnish restart?
1

1 Answers

2
votes

Moving directors to VMODs is a step on the way to make the API service you ask about it #1.

Your software that writes VCL and loads it on changes can continue to operate as before. It is just the notation/syntax that have changed in 4.0. Use vcl.load / vcl.discard with varnishadm as usual to do #2.