Public Website web2
The public-facing Macaroni KID site — server-rendered PHP serving every town on its own subdomain.
macaroni-kid-2.web2node-sass)php:7.4.33-apache-bullseye; mod_rewrite enabled; serves on port 80*.macaronikid.com (per-town subdomains)/var/www/htmlHow it works
Entry is index.php, which loads settings.php, then includes/functions.php and includes/router.php. The router resolves the town from the subdomain and dispatches to a page template in includes/ (home, articles, events, business directory, guides, contact, static pages, 404, etc.). Each template pulls its data from the REST API and renders HTML server-side.
API configuration
settings.php selects the API base by environment:
API_ROOT = https://api.macaronikid.com/api/v1API_ROOT = https://api.macaronikidlab.com/api/v1Pageview tracking
On render, pages call the API's own tracker. includes/functions.php (internalTrack()) and js/general.js hit api/v1/statistic/trackView?slug=<subdomain>&type=<device>, which records the hit into the TownViewCount collection. This — not any third-party analytics — is what feeds the pageview figures in the admin panel.
Newsletters & weather
Email templates live in email_templates/. The dynamic newsletter (dynamic-newsletter.php) calls AccuWeather's dataservice.accuweather.com to look up a town's location by ZIP and embed a 5-day forecast.
Deployment
The repo ships a Dockerfile (Apache + PHP, installs mysqli/pdo_mysql extensions) and a GitHub Actions workflow (.github/workflows/docker.yml) that builds the image. A legacy webhook deploy script, git-deploy.php, also exists — it pulls the latest code on push and is restricted to a GitHub IP allow-list (plus one developer IP).
web2. The older production Docker Compose file still references an earlier macaroni-kid-2.web; web2 is the current public site. See Environments & Deployment.
Key paths
| Path | Purpose |
|---|---|
index.php | Front controller |
settings.php | Environment config, API roots, CAPTCHA & API keys |
includes/router.php | Subdomain → template routing |
includes/functions.php | Shared helpers, API calls, internalTrack() |
includes/template-*.php | Page templates (home, articles, events, directory, …) |
email_templates/ | Newsletter HTML (incl. AccuWeather forecast) |
js/general.js | Front-end JS incl. pageview tracking |
git-deploy.php | Legacy webhook deploy (IP-restricted) |