after_project_update.sh runs on the remote at the end of every push to that remote, once all
services are up, with the target environment as its single argument: Production, Stage, or
Dev. It also runs locally, with Local as the argument, whenever the project’s website URL
changes in its configuration, since that’s another moment a domain-bearing config file needs
correcting. Its job is to fix up anything that lives in a config file (not the database) and is
environment-specific, primarily the application’s own domain.
Why this exists
A project’s domain is baked in at build time with the local domain. Two cases:
- Config file is committed (e.g. MediaWiki
LocalSettings.php, TYPO3 siteconfig.yaml, Flarumconfig.php, ProcessWiresite/config.php). It is pushed verbatim, so on the remote it still holds the local domain. - Config file is gitignored (the application
.envof Laravel/Symfony platforms)..envholds secrets (APP_KEY,APP_SECRET) so it is never committed. Waddle copies the localwebsite/src/.envto the remote during the push, see Domain Handling on Deploy, which means it arrives with the right secrets but the localAPP_URL.
Either way, the value that needs fixing is in a file, and the file is now on the remote. This hook rewrites it for the target environment.
Contract
Every implementation of this hook — shipped or custom — must follow the same contract, since Waddle invokes it identically regardless of platform:
#!/bin/sh -eu, POSIX-compliant, run from the project root (on the remote for a push, locally for a URL change).- One argument:
Local|Production|Stage|Dev. Exit non-zero on anything else, so a malformed call surfaces as a build failure instead of quietly leaving the config file stale. - Resolve the argument to a domain via the remote’s configured domain for that environment; exit cleanly (0) if that environment has no domain configured, so a push to, say, an unconfigured Stage remote doesn’t fail the whole deploy.
- Be idempotent: overwrite the target value rather than appending. The hook can run against the same file more than once (repeated pushes, or a local URL change right before a push), so appending would leave duplicate or conflicting entries.
How each shipped platform implements it
| Platform group | File | Value rewritten |
|---|---|---|
| Laravel (Bagisto, Krayin, FreeScout, WinterCMS) | website/src/.env |
APP_URL → <scheme>://<domain>, then artisan config:clear |
| Symfony (UVdesk) | website/src/.env |
APP_URL, then console cache:clear |
| Flarum | website/src/config.php |
'url', then flarum cache:clear |
| MediaWiki | website/src/LocalSettings.php |
$wgServer |
| TYPO3 | website/src/config/sites/*/config.yaml |
base:, then typo3 cache:flush |
| ProcessWire | website/src/site/config.php |
$config->httpHosts (host only) |
The scheme (http/https) follows the project’s HTTPS port setting, matching how the value was
rendered at build time.
Adding it to a custom project
The blueprint options Blank or Webstack are the only two
types with no fixed CMS or framework attached. Neither ships an after_project_update.sh
by default, so:
Create website/script/unix/blank/after_project_update.sh or
website/script/unix/webstack/after_project_update.sh, matching whichever blueprint your project
was created with. For example, say your app stores its canonical URL in
website/src/app-config.ini as base_url = .... The script could look like this:
#!/bin/sh -eu
ENV="${1:-}"
CONFIG_FILE="website/src/app-config.ini"
case "$ENV" in
Local) TARGET_DOMAIN="{{public.website.url}}" ;;
Production) TARGET_DOMAIN="{{public.remotes.production.domain}}" ;;
Stage) TARGET_DOMAIN="{{public.remotes.stage.domain}}" ;;
Dev) TARGET_DOMAIN="{{public.remotes.dev.domain}}" ;;
*) echo "Usage: $0 <Local|Production|Stage|Dev>" >&2; exit 1 ;;
esac
[ -z "$TARGET_DOMAIN" ] && exit 0
sed "s#^base_url = .*#base_url = https://${TARGET_DOMAIN}#" "$CONFIG_FILE" > "${CONFIG_FILE}.tmp"
mv "${CONFIG_FILE}.tmp" "$CONFIG_FILE"
Values stored in the database belong in The After-Database-Updated Script instead.