Varnish 5.1 #2
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Can i use this lib in varnish 5.1?
Reassigned to @geoff
@truonglx-56 I'll take your question as an expression of interest in trying it with 5.1 and will bring it up to date.
mentioned in commit
eed3ff2e73@truonglx-56 there is now a branch 5.1 of the VMOD for compatibility with Varnish 5.1. The tagged version v0.5 passes all of the vtc tests in src/tests with versions 5.1.0 through 5.1.2.
The master branch is compatible with the current Varnish master branch (which will become Varnish 6.0 in September). It won't pass the tests with Varnish 5.1.
For completeness: there are now branches (and corresponding tags) for Varnish versions 4.1.0 through 4.1.3, 4.1.4 through 4.1.6, and 5.0.0.
Status changed to closed
@geoff Thank you so much for helping me!
And i have a question:
I have a shard manager to manage the backend, so my backends list is dynamic, so how do I load the list of backends and allocate them for my purposes?
And is this library the solution to my problem?
@truonglx-56 I take it you're referring to the shard director, which has been in standard Varnish since version 5.0?
If so, you add a backend to the director using pretty much the same idiom as with any of the other directors -- use the director's
add_backendmethod, as illustrated in some of the VMOD examples. The difference with the VMOD is that, rather than add a backend identified by its VCL symbol from a standard static configuration, you identify the dynamic backend with the VMOD'sby_namefunction:The string used in the
by_namefunction ("truongs_dynamic_backend"in the example) is the same one established earlier when the backend was created with thecreatefunction.When you say "load the list of backends": what you can do is execute the
createfunction in thevcl_initsubroutine to create your backends, then call theadd_backendmethod for the director to assign them to your director. Callingadd_directorinvcl_initis what usually has to be done with directors and backends anyway, whether static or dynamic.You may be touching on a problem that the VMOD has not solved yet. The VMOD makes it possible to add and remove backends at runtime, for example because of containers popping in and out of existence all over the place. This is an alternative to changing a static VCL declaration every time that happens, and then reloading VCL. But with the VMOD, the set of backends and their configurations are only known to the running instance of Varnish -- they're not persisted, so if Varnish is restarted, all of those backend configs are lost.
That's the idea behind the issue I added this morning as issue #3 here in the repo -- add a function to the VMOD that reads backend definitions from a file, so that the VMOD can manage them, and a function that writes the dynamic backend configs to a file, so that they can be read back in after a restart. That would solve the problem, but those functions have to be implemented.
Does that answer your questions?
If you try it, let me know how it goes (we can also be reached at varnish-support@uplex.de).