Modifying a Template

Edit a project's own template files directly, using WordPress's installer script as an example, and see how Waddle protects your edits later.

Every file Waddle renders into a project (Dockerfiles, Nginx config, a platform’s install script) starts out as a template file copied into that project’s own templates/ folder. You can edit those copies directly to customize a project beyond what its settings expose, and Waddle keeps your edit safe across future builds and template updates. This walkthrough adds a couple of harmless lines to WordPress’s installer script so you can see exactly how that works.

Edit the template, not the rendered file

Every template has two copies once a project exists:

  • [project]/templates/<path>, the template copy.
  • [project]/<path>, the rendered file a build actually uses.

Edit the copy under templates/. Waddle protects edits to either copy from being silently overwritten. You’ll always see a conflict on the build overview before anything gets replaced, and the default choice there is to keep your version. The difference is what happens afterward. Edit the template copy, and your change is recognized as a deliberate customization. Builds stay quiet about it unless the upstream template itself changes too, which is a real conflict worth seeing. Edit only the rendered file, and Waddle keeps flagging it as modified output on every build after that. This is by design, but is subject to change as we evaluate feedback from the community.

Add a couple of lines to WordPress’s installer script

Open templates/website/script/unix/wordpress/installer.sh in your editor.

This script runs locally on every build (not on remote deploys), right after your project’s PHP container comes up and before Nginx does. It downloads WP-CLI, then either installs WordPress for the first time or, on every build after that, leaves your installed site alone. Add a couple of lines right at the top, before any of that, so they run on every build regardless:

#!/bin/sh -eux

echo "[WADDLE NOTICE] Starting website installer."

# Added for this tutorial.
echo "Hello from the installer script!" > waddle-modification-demo.txt
mkdir -p waddle-modification-demo

# Update WP CLI.
echo "[WADDLE] Downloading WP CLI."

Save the file.

Rebuild and check the result

From the project list, start a build the same way you did in Create Your First Project. Once it finishes, check the project’s folder:

$ ls
docker-compose.yml  mariadb  nginx  php  templates  waddle-modification-demo
waddle-modification-demo.txt  website
$ cat waddle-modification-demo.txt
Hello from the installer script!

Both the file and the folder appear fresh every time you rebuild, since the script runs on every local build, not just the first one.

When this file updates later

If a future Waddle update changes installer.sh, say for a new WP-CLI version or a bug fix, your next build flags it as a conflict instead of picking a side on its own. You choose whether to keep your two added lines or take the update, the same choice described in How Render and Build Work.

Next: Share a Project with Your Team