Skip to content

A simple blog engine and static site generator written as an Azure Durable Functions code sample

License

Notifications You must be signed in to change notification settings

rcarmo/azure-durable-functions-node-blog-engine

Repository files navigation

azure-durable-functions-node-blog-engine

This is an Azure Functions sample that demonstrates how to build a static site generator with durable functions to take raw markup files and render them to a static Azure website:

diagram

All you need to do is upload your Markdown/Textile files to Azure storage, and they'll be rendered into a nicely formatted web site. You can even use OneDrive to do that automatically for you.

The current demo site is here (may be temporarily broken as I build this out).

Why

This was originally part of an "ETL" blob storage processing pipeline and intended to demonstrate how to process thousands of XML/CSV files in a scalable way and insert them into a database as they were uploaded.

But the general principle behind that kind of transformation pipeline is exactly the same as a static site generator, and handling text and image content also provides opportunity to incorporate Azure Cognitive Services and other fun things, so I turned the original pipeline into something of more general interest - i.e., a fully serverless static file generator.

Incidentally, you can run this completely inside the Azure Free Tier!

Setup

This sample currently assumes you've performed the following provisioning actions via the Azure Portal:

  • Set up a NodeJS Function App (on Windows or Linux - a free tier Function App will do just fine)
  • Upgraded the associated storage account to StorageV2 (general purpose v2)
  • Enabled the Static website feature and made sure the $web container has public access enabled
  • Gone into Function App Configuration -> All Settings -> Deployment Center and activated Local Git deployment via Kudu (re-visit that pane after configuration to get the Git URL and credentials)

Contributing/Roadmap/To Do

If you feel like contributing, this is a rough roadmap/To Do list that matches what I usually need from a static file generator and some Azure-specific features that I intend to implement given time:

  • Integration with Cognitive Services
  • Higher-level integration with Application Insights
  • Update diagram
  • Add renderTableActivity to render YAML data into nice tables
  • Azure Template for automated deployment
  • List of blog posts (ordered list of everything under /blog)
  • Add auxiliary Azure storage table for metadata lookup and building page listings using page front matter
  • Handle blob deletion using EventGrid - Good first contribution!
  • Set generated blob metadata (modification time, caching, etc.) from page front matter
  • Add screenshots on how to integrate with OneDrive using Flow/Logic Apps - Good first contribution!
  • Flesh out example content/documentation and formatting tests
  • Reformat asset links (images, stylesheets, etc.)
  • Split blob storage access from rendering (renderTemplateActivity)
  • Templating
  • Image processing
  • Simple rendering
  • Sample content tree
  • Basic engine

Monitoring

Since Azure Functions is usually deployed with Application Insights enabled, you can do real-time monitoring and tracing, as well as per-activity metrics:

appinsights