https://github.com/livingdocsio/varnish-purge
https://github.com/livingdocsio/varnish-purge
Last synced: 14 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/livingdocsio/varnish-purge
- Owner: livingdocsIO
- Created: 2020-11-16T16:29:43.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-12-15T05:15:49.000Z (over 2 years ago)
- Last Synced: 2025-10-19T05:03:09.787Z (9 months ago)
- Language: JavaScript
- Size: 47.9 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# varnish-purge
Polls document publication events from livingdocs and triggers a ban or x-cache-tags purge based on the event type.
It also requests the new document right after invalidating the cache, so pages get prerendered.
There are two operation modes.
- We can use one central instance, which operates against multiple varnish instances.
To enable that, please use the `VARNISH_MULTIPURGE=true` environment variable.
- Then in the regular operation mode, it only operates against one varnish instance,
so the service can be installed as sidecar to varnish.
To start fetching the publication events and actively ban pages based on updates, just start the process:
```
process.env.TOKEN = 'eyJhb...'
process.env.API_URL = 'http://livingdocs-server:9090'
process.env.VARNISH_URL = 'http://frontend:80/'
process.env.FRONTEND_URL = 'https://livingdocs.io/'
process.env.VARNISH_MULTIPURGE = 'true'
node index.js
```
To precache existing pages, you can run the same process using a `--precache` argument.
E.g. to precache all the pages published or updated within the last 2 weeks, execute that command:
```
node index.js --precache --duration=2w --documentType=page
```