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)
Raw data
{
"_id": null,
"home_page": "https://forge.extranet.logilab.fr/cubicweb/cubes/cubicweb-varnish",
"name": "cubicweb-varnish",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "",
"author": "LOGILAB S.A. (Paris, FRANCE)",
"author_email": "contact@logilab.fr",
"download_url": "https://files.pythonhosted.org/packages/75/a9/c0095277e542e8fa15eff2df315bec8d53a576568cdc27ae70f9ef4818b4/cubicweb-varnish-1.0.0.tar.gz",
"platform": null,
"description": "Summary\n-------\n\nThis cubes enables a purge mechanism for a cubicweb website that is\nsitting behind a varnish cache.\n\nInternals\n---------\n\nThe purge mechanism consists of sending purge commands to the\nadministration backend of varnish (by default\nlocalhost:6082). Generally it is recommended to protect this\nmanagement port with a secret file which can be configured in this\ncube. Multiple backends can be controlled in this manner in a\ndistributed setup.\n\nOut of the box, this cube will not purge any URLs. The logic of which\npages should be \"purged\" has to be implemented in content cubes.\n\nTo configure which urls to purge, you have to implement an\n`IVarnishAdapter`, for example ::\n\n.. sourcecode:: python\n\n from cubes.varnish.entities import IVarnishAdapter\n\n class BlogEntryVarnishAdapter(IVarnishAdapter):\n __select__ = is_instance('BlogEntry')\n\n def urls_to_purge(self):\n return ('/', #frontpage\n self.entity.absolute_url(), #URL of blog post\n '/BlogEntry' # list of blog entries)\n\nDebugging : cubicweb-varnish will not crash when it cannot connect to\nthe administrative port, it will silently log an error in the log.\n\nDocker & Kubernetes\n-------------------\n\nWhen deploying on docker or kubernetes, you can configure this with :\n\n* `CW_VARNISHCLI_HOSTS=fqdn:6082,IP:PORT` (csv with host:port)\n* `CW_VARNISH_SECRETS=/etc/varnish_shared_secret_token` (filename with token in\n it)\n\nDependencies\n------------\n\nhttp://www.varnish-cache.org/\n\nor apt-get install varnish (for debian derived distributions)\n",
"bugtrack_url": null,
"license": "LGPL-2.1",
"summary": "cubicweb varnish helper",
"version": "1.0.0",
"project_urls": {
"Homepage": "https://forge.extranet.logilab.fr/cubicweb/cubes/cubicweb-varnish"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "53715a5c514bcbb193342c15b7376aa716575e1acdd94a0e7cb9ec8cb3fc8bb1",
"md5": "3cf0abc7ea5b7e47286763ad48d9917c",
"sha256": "20022b33639a9ac960aa02cbebb6fa1cfce8191860d3f9c3cb6930950a75bf94"
},
"downloads": -1,
"filename": "cubicweb_varnish-1.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "3cf0abc7ea5b7e47286763ad48d9917c",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 9841,
"upload_time": "2023-07-11T08:02:08",
"upload_time_iso_8601": "2023-07-11T08:02:08.801148Z",
"url": "https://files.pythonhosted.org/packages/53/71/5a5c514bcbb193342c15b7376aa716575e1acdd94a0e7cb9ec8cb3fc8bb1/cubicweb_varnish-1.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "75a9c0095277e542e8fa15eff2df315bec8d53a576568cdc27ae70f9ef4818b4",
"md5": "46b6b81a66ea709dbe6d7dca18791fac",
"sha256": "5821f15caab078c1ae1169ddabf5cb7a28ed38494254e919d43de6c9388cb146"
},
"downloads": -1,
"filename": "cubicweb-varnish-1.0.0.tar.gz",
"has_sig": false,
"md5_digest": "46b6b81a66ea709dbe6d7dca18791fac",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 9148,
"upload_time": "2023-07-11T08:02:10",
"upload_time_iso_8601": "2023-07-11T08:02:10.336819Z",
"url": "https://files.pythonhosted.org/packages/75/a9/c0095277e542e8fa15eff2df315bec8d53a576568cdc27ae70f9ef4818b4/cubicweb-varnish-1.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-07-11 08:02:10",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "cubicweb-varnish"
}