In an earlier post I wrote about settling on a blogging platform. At that point I had decided to use Jekyll, but were still some rough spots. I didn’t want to maintain a VPS, and I wanted better draft previewing.
Recently Amazon (AWS) started previewing their AWS Lambda platform. From their description:
AWS Lambda is a compute service that runs your code in response to events and automatically manages the compute resources for you, making it easy to build applications that respond quickly to new information. AWS Lambda starts running your code within milliseconds of an event such as an image upload, in-app activity, website click, or output from a connected device.
My thought was to host the Jekyll engine on Lambda and deploy the website to Amazon S3. Now my workflow would be:
Editor -> Amazon S3 -> Jekyll (on Lambda) -> Amazon S3 static website
I love new technologies, and Lambda seems pretty awesome. Although, new technologies often have limits that need to be worked around, and Lambda is no different. The main issue is Lambda only supports Node.js apps1 for now. Jekyll is written in Ruby, so it’s a no go on Lambda.2
A survey of Node based static site generators turned up several possibilities, including Metalsmith.io.
An extremely simple, pluggable static site generator.
Metalsmith works in three simple steps:
1. Read all the files in a source directory.
2. Invoke a series of plugins that manipulate the files.
3. Write the results to a destination directory!
There are a lot of Metalsmith plug-ins available that made it a straight-forward migration from Jekyll to Metalsmith. And, the resulting website looked identical!
Now the workflow is:
Editor -> Amazon S3 -> Metalsmith (on Lambda) -> Amazon S3 static website
The Metalsmith function on Lambda is triggered by a write to S3. When I upload a new post to S3 the website is automatically regenerated and deployed.4
Things are still pretty rough, but the basics are there and working. Some smoothing should result in an efficient workflow. I got rid of the VPS, but draft previewing is still missing. I have some ideas and will post updates.
7/2/2015 UPDATE: I have moved back to Jekyll for nonlinear.zone static site generation.
- Binaries can be uploaded and executed if they are called from a Node app. ↩
- Here is an example of a Ruby app running on Lambda using mruby, but I didn’t want to experiment with Jekyll on mruby. Others have PHP binaries running on Lambda. ↩
- This was a cool opportunity to learn Node. ↩
- For reference the metalsmith build process for nonlinear.zone is on Github. ↩