Published on: 17th February 2025
With Astro development going well, I wondered about the other sort of scaling. What if two people wanted to contribute to the site? Or five? Or fifty? Blog posts have to be similarly laid out to work as part of a collection, and it’s all too easy to get it wrong and see an error during the build process. I’ve done that enough times already…
The solution I came up with was to keep my original post management system, the one built using CakePHP backed by MariaDB. All of that runs at home, safe from hacking and completely isolated from the internet behind a firewall (the ‘curtain’ from the tagline, also a quotation from The Wizard of Oz).
CakePHP can look after post validation and image management, and in theory could handle hundreds of people submitting posts. Of course there won’t be hundreds of people in my house writing posts, but this solution does scale to organisations. A company could manage its website design internally, with authentication and private-only access etc. then update the site once per week / day / hour to a publicly-viewable location. The company gets a secure design environment and the public get faster load times. Win win!
All I needed to do was write a new action that read all of the posts from the database and created an Astro-friendly collection ready for building. This turned out to be easier than I’d feared (really!). With CakePHP already enforcing a structure of sorts it was easy to output the posts with field information between Astro code fences and the body of the article beneath. All of the saved files can be copied to the Astro build zone and built into an updated static site. The site can then be coped up to the pi on the web, overwriting whatever was there already.
I still need to automate the process and/or link the steps together more efficiently, but it’s a start.