Lektor Serverless

September 30, 2018

SWIM should create a fork of Lektor that runs on a serverless AWS setup. The Lektor frontend is already a React app communicating to the backend via an API (I think, I’m not looking at the code at the moment, just going from memory). So it shouldn’t be too difficult, host the frontend on S3/Cloudfront, and let Lambda pass everything through to the monolithic Lektor backend (API Gateway passes all routes through to a single Lambda).

The filesystem is something to think about… Lektor is filesystem based. It’s probably too slow to try to load data from S3 when each Lambda starts, save to the filesystem on Lambda, and then dump to S3 before the Lambda ends. It sounds too resource intensive and I’m not sure it’s even possible.

Another possibility is re-writing Lektor to just use S3 directly. You still have to wait for S3 operations, but it sounds like a much more workable solution. There might also be a solution that uses EC2 volumes, so S3 data can be dumped to a volume and worked on there, so multiple Lambdas could connect to the same filesystem, instead of constantly trying to keep S3 in sync.

I’d definitely prefer a solution that swaps out a self-contained piece of Lektor to a solution that requires jumping through lots of AWS hoops.