猫のBLOG

Notes, essays and marginalia

Essays

A blog that is only files

The masthead banner
Everything below is a file on disk.

There is a particular kind of calm that comes from knowing your web server is only reading files. No interpreter is started, no connection pool is warmed, no template is compiled while a reader waits. The hard work happened earlier, on your own machine, at a moment you chose.

What the generator does

Every time you run blogctl build, the CMS asks MariaDB for the published posts and writes the entire site into a fresh directory:

  • the front page and its paginated continuations
  • one file per article, under posts/YYYY/MM/
  • one file per category, per tag, and per year
  • feed.xml, sitemap.xml, robots.txt and a themed 404.html

Only when the last file is written does the live symlink move. A reader either gets the old site or the new one, never a half-finished mixture.

The one exception

A search box cannot be a file. That single form posts to /search, which nginx hands to a small FastCGI process that queries the same database and renders the same template. Everything else on this page came off the disk.

The best way to make something fast is to do it in advance.

Rolling back

Because each build is its own directory, going back is a symlink move:

blogctl releases
blogctl rollback

No restore, no downtime, no database migration in reverse.