Porting my website to Workers Sites and Zola
words.steveklabnik.com
words.steveklabnik.com
They now have a KV storage and a CDN, but you still have to write and upload a <20 line script to connect the two, instead of being able to just select a KV namespace on the CDN from which to serve a static site.
EDIT: The KV store does have a REST endpoint for reading values, though.. I wonder if you could use the CDN to point a domain to /storage/kv/namespaces/[site-namespace]/values/ and use Page Rules to pass the authentication headers. I'd try it, but I'd rather burn the fiver on a glass of Port.
You have to start somewhere. We would like to make this even easier in the future. Can’t promise specifics or times for that, though.
It's like a pc shop that sells you a nice pre-built desktop and monitor, but instead of a VGA/HDMI cable there's a paper with instructions on where to buy one :)
If someone springs up and starts making money providing a static site hosting solution built on top of CloudFlare, that sounds to me like a success for CF, not a missed opportunity.
Today I moved my frontend over to a Worker, and deleted my GitHub page repo. This is much simpler. Now I don't have to worry about cache rules, and I can use the same deployment tooling for the backend and frontend.
(I am a Cloudflare employee on a totally different team, and the project is a plaintext screenplay renderer https://screenplay.page)
5$/month plan is kinda open ended, you pay for each request above included in the plan (0.5$ for 1 million requests)
With a high-perfomance language like Golang for example, I could write a script that's making 500req/second to your site. That would cost you 20$/day.
With Github Pages it wouldn't cost you anything (or they might disable your page if it costs too much bandwidth, not sure)
> 5$/month plan is kinda open ended, you pay for each request above included in the plan (0.5$ for 1 million requests)
> With a high-perfomance language like Golang for example, I could write a script that's making 500req/second to your site. That would cost you 20$/day.
> With Github Pages it wouldn't cost you anything (or they might disable your page if it costs too much bandwidth, not sure)
500req/s would result in you being ratelimited by the global worker ratelimit though unless you distributed these requests across multiple IPs.
[0]: https://andrewzah.com/posts/automatically-deploy-your-blog-v...
Things like AWS fargate allow you to run containers without running the underlying server though.
But regardless, different tools are good in different circumstances. Nobody is always the best thing all the time.
Oh yes! I'm playing with Hugo today and maybe Zola tomorrow. Now I'm on Dokuwiki, before that other CMSes.
I always thought of that as a weakness, not being able to be content with something, but the way you phrase it lifts my spirits.
Most "redirect" stuff is "point a DNS record somewhere"; so I have the 'www' subdomain pointing at Cloudflare, the 'words' subdomain pointing at Svbtle, I think 'blog' is pointing at... heroku? Before I moved www to Cloudflare, it was pointed at Netlify, and then gh-pages before that.
I've been meaning to check out the new Cloudflare registrar, but there's only so many hours in the day :)
Depending on the frameworks used and how big your application's own code base is, webpack and other build systems can easily produce artifacts above 2mb, not even to mention that images can also reach above 2mb in size.
FD: I worked on a Workers-based file hosting project before this first-party solution came out; my system does file splitting and stitching, making it more expensive for files >2mb but possible. https://github.com/judge2020/cloudflare-file-hosting
I am very interested in this feature, but the limit is a bit concerning right now.
One clarification:
> Additionally, you need to have a $5/month subscription to Workers, to get access to Workers KV. I want us to offer a free tier of KV in the future, but we’re not there yet. That $5/month gets you a lot more than one site, to be clear, but this isn’t a completely free solution today.
Just to be clear, since I misunderstood at first: there is a free tier of Workers (which is absolutely worth trying). It's the KV store that adds cost. I think you are saying that, but it also could be read that Workers by itself costs $5/mo.
But conceivably, you could host your blog on the free tier, right, by compiling the static content into the hosted app?
> But conceivably, you could host your blog on the free tier, right, by compiling the static content into the hosted app?
Yes, you could! There's a size limit to a worker though, so for a large site you may not be able to.
- https://lazy.invoice.workers.dev
- https://web.scraper.workers.dev
Both are powered in part by a worker which generates CSS on the fly for whatever components you need, e.g:
This part caught my eye:
"The +++s are like --- in Jekyll, and the metadata is in TOML instead of YAML"
Why does it seem like every other day a new mark-up comes around, with its own syntax, often (in this case) the exact opposite symbols. I mean, I guess "markup is hard" or something along those lines, but it doesn't appear to be to me.
[1] --- is the explicit document start marker. Most frontmatter should probably be more accurately using ... which is the actual explicit document end marker and doesn't imply another YAML document follows, but the symmetry of using --- on both sides is cleaner.
I agree with you that it's cute to be able to parse YAML frontmatter by streaming the file to a YAML parser that's been instructed to stop after the first document... but it makes me all the more uneasy about frontmatter as a concept. Call me old fashioned, but I want my files to contain just one kind of syntax.
Though HTTP does have an "at rest" relative, the META tag in HTML. Similarly, reStructuredText has always had "Field Lists" and even a history of using the first field list in a file as "frontmatter" and the docutils API even returns it as a separate metadata stream if asked. (Sphinx, for instance, checks for some fields there.) It's maybe just Markdown here that's deficient in having a first-class metadata syntax of its own. (reStructuredText and docutils also have a first-class concept of a document title made available by API to tools but maybe not intended for direct output in rendered contents, which is the number 1 reason for YAML front-matter in most Markdown documents I've seen.)
I’m super happy with this setup and think it should be way more popular.