Skip to content
Janclab Matija Janc · Platform & AI engineer
Web · ongoing

PH Site Factory

A productized site-build and deploy pipeline whose production deploys snapshot files and database first, then roll back automatically on failure.

Live, in your browser — not a screenshot.

Template repo → one git repo per site
DB + file snapshot before every deploy
auto-rollback on failed deploy or health check
10 snapshots retained per environment

Problem

A small-site business only works if each site build is repeatable and safe to hand over. The highest-risk moment is an unattended production deploy: a failed push must never leave a client's live site broken.

What I built

A template repository becomes an independent git repo per site. Bespoke themes use three lean in-house plugins for editable content without heavyweight plugin lock-in. Docker preview and CI validation gate production; the deploy owns only its theme, plugins and content paths, leaving the CMS core, uploads and unrelated plugins untouched.

The hard part

Before changing anything, the remote script snapshots the database and every owned file outside the web root. An ERR trap restores both if any deploy step fails. Fast renames minimise the interval in which a live path is unavailable.

A second layer handles “successful” deploys that still return a server error: GitHub Actions checks the real URL and invokes rollback on persistent 5xx or an unreachable origin. It deliberately does not roll back on 4xx, because CDN bot rules can return 403 for a healthy site. The recovery system is designed to avoid becoming the outage.

Results

The skeleton has produced multiple independent sites. Its test suite, idempotent content sync and snapshot-backed deploy pipeline let changes ship unattended while retaining the ten most recent recovery points.