I don't want to run a web server because my sites are such low traffic that they'd always be absent from cache, and need fetching every time. But code is free, so I made a static site generator to convert a directory of files to a VCL table, and index it by URL.
This isn't a generator so much as an uploader. You need to provide your own directory of files.
- 404 page
- Default to /index.html
- Binary content not supported
- You need
<base href="..."/>
- Make a service, make an API key for that service
- Make a non-dynamic snippet for main.vcl
- Create a dynamic snippet for the data:
; export SID= # service ID
; export KEY= # API key
; export VER= # unlocked (not yet activated) version
; curl -X POST -s https://api.fastly.com/service/$SID/version/$VER/snippet \
-H "Fastly-Key:$KEY" -H 'Content-Type: application/x-www-form-urlencoded' \
--data $'name=data&type=init&dynamic=1&content=table body {}\n'
{"name":"synth","type":"init","dynamic":1,"content":null,"service_id":"...",
"version":"...","deleted_at":null,"id":"...","updated_at":"...","priority":100,
"created_at":"..."}
Remember the snippet ID there - you'll need it for updates.
- Activate the service
- Update whenever you feel like it:
; KEY=... SID=... SNIPPET=... ./update.sh /path/to/htdocs
Q. Why not use edge dictionaries?
A. The API doesn't provide a “replace everything in one go” operation.
Also they render to VCL anyway; here I can generate the same VCL in the first place.