Skip to main content

Summary

This cubes enables a purge mechanism for a cubicweb website that is sitting behind a varnish cache.

Internals

The purge mechanism consists of sending purge commands to the administration backend of varnish (by default localhost:6082). Generally it is recommended to protect this management port with a secret file which can be configured in this cube. Multiple backends can be controlled in this manner in a distributed setup.

Out of the box, this cube will not purge any URLs. The logic of which pages should be “purged” has to be implemented in content cubes.

To configure which urls to purge, you have to implement an IVarnishAdapter, for example

.. sourcecode:: python

from cubes.varnish.entities import IVarnishAdapter

class BlogEntryVarnishAdapter(IVarnishAdapter):

__select__ = is_instance(‘BlogEntry’)

def urls_to_purge(self):
return (‘/’, #frontpage

self.entity.absolute_url(), #URL of blog post ‘/BlogEntry’ # list of blog entries)

Debugging : cubicweb-varnish will not crash when it cannot connect to the administrative port, it will silently log an error in the log.

Docker & Kubernetes

When deploying on docker or kubernetes, you can configure this with :

  • CW_VARNISHCLI_HOSTS=fqdn:6082,IP:PORT (csv with host:port)

  • CW_VARNISH_SECRETS=/etc/varnish_shared_secret_token (filename with token in it)

Dependencies

http://www.varnish-cache.org/

or apt-get install varnish (for debian derived distributions)

Release files for cubicweb-varnish 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cubicweb-varnish 1.0.0
File Size Uploaded
cubicweb-varnish-1.0.0.tar.gz 9.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cubicweb-varnish 1.0.0
File Interpreter ABI Platform
cubicweb_varnish-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 19.0 kB

Release files / cubicweb-varnish-1.0.0.tar.gz

Download URL cubicweb-varnish-1.0.0.tar.gz
Size 9.1 kB
Tags Source
SHA-256 checksum
How to use checksums
5821f15caab078c1ae1169ddabf5cb7a28ed38494254e919d43de6c9388cb146
BLAKE2b-256 checksum
How to use checksums
75a9c0095277e542e8fa15eff2df315bec8d53a576568cdc27ae70f9ef4818b4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.2

Release files / cubicweb_varnish-1.0.0-py3-none-any.whl

Download URL cubicweb_varnish-1.0.0-py3-none-any.whl
Size 9.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
20022b33639a9ac960aa02cbebb6fa1cfce8191860d3f9c3cb6930950a75bf94
BLAKE2b-256 checksum
How to use checksums
53715a5c514bcbb193342c15b7376aa716575e1acdd94a0e7cb9ec8cb3fc8bb1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.2

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

0.8.0

2 release files

0.7.0

2 release files

0.6.0

2 release files

0.5.1

1 release file

0.4.1

1 release file

0.4.0

1 release file

0.3.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page