|
| 1 | +// SPDX-License-Identifier: PMPL-1.0-or-later |
| 2 | + |
| 3 | +# Sinople Theme — Dogfooding Lessons |
| 4 | + |
| 5 | +Learnings from deploying sinople to joshua.jewell.nexus, jonathan.jewell.nexus, |
| 6 | +and nuj-lcb.org.uk on Verpex shared hosting (LiteSpeed + cPanel, March 2026). |
| 7 | + |
| 8 | +## Deployment Environment |
| 9 | + |
| 10 | +| Property | Value | |
| 11 | +|----------|-------| |
| 12 | +| Web Server | LiteSpeed (native, not OLS) | |
| 13 | +| PHP | 8.2.29 via LSAPI | |
| 14 | +| OPcache | Enabled | |
| 15 | +| Redis/Memcached | Not available (shared hosting) | |
| 16 | +| APCu | Not available | |
| 17 | +| Imagick | Not available | |
| 18 | +| CDN | Cloudflare (proxied, Full Strict SSL) | |
| 19 | + |
| 20 | +## Corrective (Bugs Found) |
| 21 | + |
| 22 | +### C1: mu-plugin WP_DEBUG conflict (CRITICAL) |
| 23 | +**Problem:** First-run mu-plugin tried to `define('WP_DEBUG', ...)` which conflicts |
| 24 | +with wp-config.php's existing definition, causing a fatal error that blocks the |
| 25 | +WordPress installer entirely. |
| 26 | + |
| 27 | +**Fix:** Never define constants in mu-plugins that wp-config.php already defines. |
| 28 | +Use `defined()` guard or simply don't touch WP_DEBUG in plugins. |
| 29 | + |
| 30 | +**Action:** Add a guard to any generated mu-plugin code: |
| 31 | +```php |
| 32 | +if (!defined('WP_DEBUG')) { define('WP_DEBUG', false); } |
| 33 | +``` |
| 34 | + |
| 35 | +### C2: Self-signed SSL blocks Cloudflare Strict mode |
| 36 | +**Problem:** New cPanel accounts get self-signed SSL certs. Cloudflare's Full |
| 37 | +(Strict) mode rejects these, returning 526/suspended errors. AutoSSL takes |
| 38 | +~24 hours to issue Let's Encrypt certs. |
| 39 | + |
| 40 | +**Fix:** Temporarily set Cloudflare SSL to "Full" (not strict) for new domains. |
| 41 | +Switch back to "Strict" after AutoSSL completes. |
| 42 | + |
| 43 | +**Action:** Document this in the deployment runbook. Consider adding a Cloudflare |
| 44 | +API check to the deployment script that monitors AutoSSL status and switches |
| 45 | +SSL mode automatically. |
| 46 | + |
| 47 | +### C3: cPanel package limits block subdomain creation |
| 48 | +**Problem:** Default `experien_minimal` package had MAXSUB=1 and MAXSQL=1, |
| 49 | +blocking creation of multiple subdomains/databases on the same account. |
| 50 | + |
| 51 | +**Fix:** Updated package to MAXSUB=10, MAXSQL=10 via WHM API, then reapplied |
| 52 | +to the account with `changepackage`. |
| 53 | + |
| 54 | +**Action:** Set higher defaults in the package from the start. Add these limits |
| 55 | +to the deployment checklist. |
| 56 | + |
| 57 | +## Adaptive (Environment Differences) |
| 58 | + |
| 59 | +### A1: LiteSpeed vs Apache vs nginx |
| 60 | +The theme README says "Apache/nginx + PHP-FPM" but the Verpex shared hosting |
| 61 | +runs **LiteSpeed** with LSAPI. LiteSpeed Cache plugin works natively (not via |
| 62 | +.htaccess rewrite rules as with Apache). This is actually better performance |
| 63 | +but the documentation should reflect this. |
| 64 | + |
| 65 | +**Action:** Update CLAUDE.md deployment mode to mention LiteSpeed as a supported |
| 66 | +(and preferred) web server. LiteSpeed Cache plugin should be listed as a |
| 67 | +recommended plugin for LiteSpeed deployments. |
| 68 | + |
| 69 | +### A2: No object cache on shared hosting |
| 70 | +Redis/Memcached are unavailable on shared hosting. LiteSpeed Cache's object |
| 71 | +cache mode falls back to file-based. This is adequate for personal sites but |
| 72 | +the documentation should note the performance difference. |
| 73 | + |
| 74 | +**Action:** Add a "Hosting Requirements" section to README distinguishing |
| 75 | +"recommended" (Redis, PHP 8.3+, Imagick) from "minimum" (PHP 8.1+, OPcache). |
| 76 | + |
| 77 | +### A3: PHP 8.2 vs 8.4 |
| 78 | +Server runs PHP 8.2.29 (fine) but MultiPHP feature is disabled on the reseller. |
| 79 | +The theme's functions.php doesn't use any PHP 8.3+ features so this is safe, |
| 80 | +but we should note minimum PHP version explicitly. |
| 81 | + |
| 82 | +**Action:** Add `Requires PHP: 8.1` to style.css theme header. |
| 83 | + |
| 84 | +### A4: Cloudflare performance stack |
| 85 | +The full performance stack in production is: |
| 86 | +1. LiteSpeed Cache (page cache, CSS/JS combine, WebP, lazy load) |
| 87 | +2. Cloudflare (Brotli, minify, Rocket Loader, Early Hints, HTTP/3, aggressive caching) |
| 88 | +3. OPcache (bytecode cache) |
| 89 | + |
| 90 | +This three-layer approach delivers ~106ms TTFB on a shared host. Document this |
| 91 | +as the recommended production stack. |
| 92 | + |
| 93 | +## Perfective (Improvements) |
| 94 | + |
| 95 | +### P1: Theme file count |
| 96 | +The deployed sinople in lcb-website has 51 PHP files. The minimal version |
| 97 | +created for jewell.nexus sites has 9 files and still looks correct. Consider |
| 98 | +which of the 42 additional files are actually needed vs. aspirational. |
| 99 | + |
| 100 | +**Core files (9):** style.css, functions.php, header.php, footer.php, index.php, |
| 101 | +single.php, page.php, 404.php, sidebar.php |
| 102 | + |
| 103 | +**Nice-to-have:** archive.php, search.php, comments.php, template-parts/*, |
| 104 | +inc/custom-post-types.php, inc/semantic.php, inc/indieweb.php |
| 105 | + |
| 106 | +**Only needed for semantic features:** single-construct.php, |
| 107 | +single-entanglement.php, inc/taxonomies.php, WASM modules |
| 108 | + |
| 109 | +**Action:** Create a "sinople-lite" variant that ships only the 9 core files |
| 110 | +plus archive.php and search.php. The full semantic/IndieWeb/WASM stack remains |
| 111 | +in sinople-full. |
| 112 | + |
| 113 | +### P2: Automated deployment script |
| 114 | +The deployment process requires 6 separate cPanel API calls (create subdomain, |
| 115 | +create database, create user, grant privileges, upload WordPress, configure). |
| 116 | +This should be a single `just deploy-wordpress <domain>` recipe. |
| 117 | + |
| 118 | +**Action:** Create `scripts/deploy-wordpress.sh` that automates the full flow |
| 119 | +via WHM API. Include Cloudflare DNS record creation. |
| 120 | + |
| 121 | +### P3: Security hardening defaults |
| 122 | +The following settings should be baked into the theme's functions.php rather |
| 123 | +than requiring manual configuration: |
| 124 | +- Disable file editor (`DISALLOW_FILE_EDIT`) |
| 125 | +- Disable XML-RPC (unless needed) |
| 126 | +- Disable pingbacks and trackbacks |
| 127 | +- Close comments by default |
| 128 | +- Remove WordPress version from headers |
| 129 | + |
| 130 | +**Action:** Add these to functions.php as opt-out (enabled by default, can be |
| 131 | +disabled via theme customizer). |
| 132 | + |
| 133 | +### P4: LiteSpeed Cache optimal defaults |
| 134 | +Document the optimal LiteSpeed Cache settings as a deployable configuration: |
| 135 | +- Page cache: on |
| 136 | +- Browser cache: on |
| 137 | +- Mobile cache: on (separate) |
| 138 | +- CSS/JS minify + combine: on |
| 139 | +- Google Fonts async: on |
| 140 | +- Image lazy load: on |
| 141 | +- WebP replace: on |
| 142 | +- Crawler: on |
| 143 | +- Public TTL: 7 days |
| 144 | +- Feed TTL: 1 hour |
| 145 | + |
| 146 | +**Action:** Create `config/litespeed-cache.json` with these defaults that can |
| 147 | +be imported via the LiteSpeed Cache plugin's import feature. |
| 148 | + |
| 149 | +### P5: Cloudflare baseline settings |
| 150 | +Document and script the Cloudflare security + performance baseline: |
| 151 | + |
| 152 | +**Security:** SSL strict, TLS 1.2 min, Always HTTPS, HSTS (1yr, subdomains), |
| 153 | +TLS 1.3 0-RTT, security level high, browser integrity check, email obfuscation, |
| 154 | +hotlink protection. |
| 155 | + |
| 156 | +**Performance:** Brotli, auto minify (CSS+JS+HTML), Early Hints, HTTP/3, |
| 157 | +Rocket Loader, aggressive caching, respect origin cache headers. |
| 158 | + |
| 159 | +**Action:** Create `scripts/cloudflare-baseline.sh` that applies these settings |
| 160 | +to any zone via the Cloudflare API. |
| 161 | + |
| 162 | +## Performance Benchmarks (2026-03-16) |
| 163 | + |
| 164 | +| Site | TTFB | Total | Size | Notes | |
| 165 | +|------|------|-------|------|-------| |
| 166 | +| joshua.jewell.nexus | 106ms | 107ms | 3.1KB | Fresh install, no content | |
| 167 | +| jonathan.jewell.nexus | 116ms | 116ms | 3.1KB | Fresh install, no content | |
| 168 | +| nuj-lcb.org.uk | 150ms | 151ms | 1.0KB | Redirect (suspended?) | |
| 169 | + |
| 170 | +Benchmark conditions: curl via Cloudflare, HTTP/1.1, single request (no warm cache). |
| 171 | +LiteSpeed Cache crawler has not run yet — expect faster responses after crawl. |
0 commit comments