diff --git a/README.md b/README.md index ae4b20d..dc9e22a 100644 --- a/README.md +++ b/README.md @@ -3,8 +3,15 @@ A Markdown renderer on the Compute@Edge platform from Fastly. The main source file, `src/main.rs`, contains all the code for the renderer. -The header and footer files I use are included at `content/_header.md` and -`content/_footer.md` for easy inspection. +The content on the server is stored in `content/` for convenience. + +## Deploying Content + +Simply use `scp` to copy the files to the server: + +``` +scp -r ./content/* example.com:/var/www-html/edgeblog/ +``` ## Nginx Configuration diff --git a/content/author.md b/content/author.md new file mode 100644 index 0000000..cc894b8 --- /dev/null +++ b/content/author.md @@ -0,0 +1,9 @@ +# About the Author + +This very silly application was written by Leonora Tindall. +You can find her other work at [nora.codes](https://nora.codes), +or find her on [Twitter](https://twitter.com/NoraDotCodes) +and on the Fediverse at [Weirder Earth](https://weirder.earth/@noracodes). + + +Thanks for visiting! diff --git a/content/images/diagram.html b/content/images/diagram.html new file mode 100644 index 0000000..0b9cb1d --- /dev/null +++ b/content/images/diagram.html @@ -0,0 +1,11 @@ + + + + +with_cache + + +
+ + + \ No newline at end of file diff --git a/content/images/diagram.jpg b/content/images/diagram.jpg new file mode 100644 index 0000000..b832107 Binary files /dev/null and b/content/images/diagram.jpg differ diff --git a/content/index.md b/content/index.md new file mode 100644 index 0000000..24bb1e9 --- /dev/null +++ b/content/index.md @@ -0,0 +1,51 @@ +### What? + +This page is written in Markdown (actually in three Markdown files). + +These Markdown files are requested by Fastly's Compute@Edge engine and rendered into +HTML at the edge, on every request. + +You can check out the source code [here](https://git.nora.codes/nora/edgeblog). + +The only dependency of the service, other than the Fastly SDK, +is Raph Levien's [`pulldown-cmark`][pulldown_cmark]. +It's not an optimal choice, as it only supports one-shot rendering and requires buffering +the Markdown (though not the resulting HTML) in memory, but it's the best option available +at the moment. + +[pulldown_cmark]: https://github.com/raphlinus/pulldown-cmark + +[![A diagram showing the difference in pipeline between normal websites with a CDN and this monstrosity](images/diagram.jpg)](images/diagram.html) + +The renderer takes advantage of the fact that Markdown allows embedding raw HTML by embedding +anything with a "text" MIME type in the Markdown source, while passing through anything +without a "text" MIME type - images, binary data, and so forth - unchanged. + +That allows the above JPG image to embed properly, while also allowing the linked SVG image page +to be rendered as a component of a Markdown document. + + +### Why? + +I work on the Compute@Edge platform and wanted to get some hands on experience with it. +This is not a good use of the platform for various reasons; among other things, +it buffers all page content in memory for every request, which is ridiculous. + +A static site generator like [Hugo][hugo] or [Zola][zola] is an objectively better choice +for bulk rendering, while the C@E layer is better for filtering, editing, and dynamic content. + +[hugo]: https://gohugo.io/ +[zola]: https://www.getzola.org/ + +That said, this does demonstrate some interesting properties of the C@E platform. +For instance, the source files are hosted in [a subdirectory][source] of my webserver; +in theory, you could directory-traverse your way into my blog source, but in fact, +you can't. + +[source]: https://nora.codes/edgeblog/ + +I also have a [Clacks Overhead][clacks] set for my webserver, and the C@E platform +is set up to make passing through existing headers trivial even with entirely +synthetic responses like these, so that header is preserved. + +[clacks]: https://xclacksoverhead.org/home/about