Add functions to serialize/deserialize backend configs so that Varnish can be safely restarted. #3

Open
opened 2017-06-26 01:28:25 +00:00 by geoff · 2 comments
geoff commented 2017-06-26 01:28:25 +00:00 (Migrated from code.uplex.de)

Something like this:

# Write the current backend config to a file
backend_dyn.to_file(VCL_PRIV, "/path/to/backend.cfg");

sub vcl_init {
    # Read any previous dynamic config from a file
    # This restores any dynamic config that may have been written before Varnish stopped previously
    backend_dyn.from_file(VCL_PRIV, "/path/to/backend.cfg");
}

The serialization format may or may not be identical to standard VCL syntax for static backend declarations. If it is, then an initial config can be saved in the file
before initial startup as standard VCL. This would have the advantage that statically declared backend configs could be manipulated by the VMOD after all (it's just that this particular VCL source is not used as the Varnish -f arg, nor is it included the -f arg or anything that it includes).

Something like this: ``` # Write the current backend config to a file backend_dyn.to_file(VCL_PRIV, "/path/to/backend.cfg"); sub vcl_init { # Read any previous dynamic config from a file # This restores any dynamic config that may have been written before Varnish stopped previously backend_dyn.from_file(VCL_PRIV, "/path/to/backend.cfg"); } ``` The serialization format may or may not be identical to standard VCL syntax for static backend declarations. If it is, then an initial config can be saved in the file before initial startup as standard VCL. This would have the advantage that statically declared backend configs could be manipulated by the VMOD after all (it's just that this particular VCL source is not used as the Varnish ``-f`` arg, nor is it included the ``-f`` arg or anything that it includes).
geoff commented 2017-06-26 01:29:30 +00:00 (Migrated from code.uplex.de)

Reassigned to @geoff

Reassigned to @geoff
geoff commented 2017-06-26 09:36:24 +00:00 (Migrated from code.uplex.de)

mentioned in issue #2

mentioned in issue #2
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
uplex-varnish/libvmod-backend_dyn#3
No description provided.