https://github.com/katef/vcl-static-site-generator
Convert a directory of files to VCL
https://github.com/katef/vcl-static-site-generator
fastly static-site static-site-generation static-site-generator static-website varnish vcl website-generation
Last synced: 3 months ago
JSON representation
Convert a directory of files to VCL
- Host: GitHub
- URL: https://github.com/katef/vcl-static-site-generator
- Owner: katef
- License: mit
- Created: 2019-05-12T05:11:33.000Z (over 6 years ago)
- Default Branch: main
- Last Pushed: 2020-06-14T00:56:34.000Z (over 5 years ago)
- Last Synced: 2025-03-18T21:52:37.444Z (7 months ago)
- Topics: fastly, static-site, static-site-generation, static-site-generator, static-website, varnish, vcl, website-generation
- Language: VCL
- Size: 5.86 KB
- Stars: 8
- Watchers: 2
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Kate's static website generator
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.## Features
- 404 page
- Default to /index.html
- Binary content not supported
- You need ``## What to do
1. Make a service, make an API key for that service
2. [Make a non-dynamic snippet](//docs.fastly.com/vcl/vcl-snippets/using-regular-vcl-snippets/#creating-a-regular-vcl-snippet) for [main.vcl](/main.vcl)
2. [Create a dynamic snippet](//docs.fastly.com/api/config#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.
3. Activate the service
4. Update whenever you feel like it:
```
; KEY=... SID=... SNIPPET=... ./update.sh /path/to/htdocs
```## FAQ
Q. Why not use edge dictionaries?
A. [The API](//docs.fastly.com/api/config#dictionary) 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.