Skip to content

feat: add deploy script and update composer dependencies for private setup#83

Merged
SimonvanWijhe merged 8 commits into
mainfrom
feat/private-setup
Apr 16, 2026
Merged

feat: add deploy script and update composer dependencies for private setup#83
SimonvanWijhe merged 8 commits into
mainfrom
feat/private-setup

Conversation

@SimonvanWijhe
Copy link
Copy Markdown
Member

@SimonvanWijhe SimonvanWijhe commented Mar 24, 2026

deploy.php en private repositories (satis, satispress) toegevoegd aan Brave

wp-deployer installeren: composer private-deployer

private packages installeren: composer private-packages

gemeente packages installeren: composer gemeente-packages

deployen:

dep deploy site=brave => https://brave.wpacc01.yard.nl

dep deploy site=gemeente => https://gemeente.wpacc01.yard.nl/

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 24, 2026

Composer package changes
Prod Packages Operation Base Target Link License
spatie/laravel-data Upgraded 4.21.0 4.22.0 Compare MIT
symfony/polyfill-ctype Upgraded v1.35.0 v1.36.0 Compare MIT
symfony/polyfill-intl-grapheme Upgraded v1.35.0 v1.36.0 Compare MIT
symfony/polyfill-intl-idn Upgraded v1.35.0 v1.36.0 Compare MIT
symfony/polyfill-intl-normalizer Upgraded v1.35.0 v1.36.0 Compare MIT
symfony/polyfill-mbstring Upgraded v1.35.0 v1.36.0 Compare MIT
symfony/polyfill-php80 Upgraded v1.35.0 v1.36.0 Compare MIT
symfony/polyfill-php83 Upgraded v1.35.0 v1.36.0 Compare MIT
wpackagist-plugin/cookie-law-info Upgraded 3.4.0 3.4.1
yard/brave-components Upgraded v1.3.2 v1.4.0 Compare MIT
yard/wp-cli-bundle New - v2.12.0 Compare MIT
composer/ca-bundle Removed 1.5.11 - Compare MIT
composer/class-map-generator Removed 1.7.2 - Compare MIT
composer/composer Removed 2.9.6 - Compare MIT
composer/metadata-minifier Removed 1.0.0 - Compare MIT
composer/pcre Removed 3.3.2 - Compare MIT
composer/spdx-licenses Removed 1.6.0 - Compare MIT
composer/xdebug-handler Removed 3.0.5 - Compare MIT
justinrainbow/json-schema Removed 6.8.0 - Compare MIT
marc-mabe/php-enum Removed v4.7.2 - Compare BSD-3-Clause
nb/oxymel Removed v0.1.0 - Compare MIT
react/promise Removed v3.3.0 - Compare MIT
seld/jsonlint Removed 1.11.0 - Compare MIT
seld/phar-utils Removed 1.2.1 - Compare MIT
seld/signal-handler Removed 2.0.2 - Compare MIT
symfony/filesystem Removed v7.4.8 - Compare MIT
symfony/polyfill-php73 Removed v1.35.0 - Compare MIT
symfony/polyfill-php81 Removed v1.35.0 - Compare MIT
symfony/polyfill-php84 Removed v1.35.0 - Compare MIT
wp-cli/checksum-command Removed v2.3.2 - Compare MIT
wp-cli/config-command Removed v2.4.0 - Compare MIT
wp-cli/cron-command Removed v2.3.2 - Compare MIT
wp-cli/embed-command Removed v2.1.0 - Compare MIT
wp-cli/eval-command Removed v2.2.9 - Compare MIT
wp-cli/export-command Removed v2.1.16 - Compare MIT
wp-cli/import-command Removed v2.0.16 - Compare MIT
wp-cli/package-command Removed v2.6.1 - Compare MIT
wp-cli/scaffold-command Removed v2.5.2 - Compare MIT
wp-cli/server-command Removed v2.0.15 - Compare MIT
wp-cli/shell-command Removed v2.0.16 - Compare MIT
wp-cli/widget-command Removed v2.2.1 - Compare MIT
wp-cli/wp-cli-bundle Removed v2.11.0 - Compare MIT
wp-cli/wp-config-transformer Removed v1.4.6 - Compare MIT
Dev Packages Operation Base Target Link License
composer/pcre New - 3.3.2 Compare MIT
composer/xdebug-handler New - 3.0.5 Compare MIT
react/promise New - v3.3.0 Compare MIT
symfony/filesystem New - v7.4.8 Compare MIT
symfony/polyfill-php81 New - v1.36.0 Compare MIT
symfony/polyfill-php84 New - v1.36.0 Compare MIT
yard/brave-scaffold Upgraded v2.0.1 v2.0.2 Compare MIT

@SimonvanWijhe SimonvanWijhe requested review from a team, Rovasch, ShunLuk, dtakken, ictbeheer, mvdhoek1 and rivanuff and removed request for a team March 27, 2026 15:02
@SimonvanWijhe SimonvanWijhe marked this pull request as ready for review March 27, 2026 15:02
@SimonvanWijhe SimonvanWijhe requested review from a team as code owners March 27, 2026 15:02
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a Deployer-based deployment entrypoint and updates Composer configuration/dependencies to support installing Yard/private packages (via satis/satispress) and deploying “brave” and “gemeente” accept demo sites.

Changes:

  • Added a root-level deploy.php configured for Yard wp-deployer, with two WPACC01 accept hosts and post-vendors hooks.
  • Updated composer.json to include satis/satispress repositories, switch to yard/wp-cli-bundle, add helper scripts, and add yard/wp-deployer.
  • Refreshed composer.lock accordingly (new/updated dependencies including Deployer + Yard packages).

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 6 comments.

File Description
deploy.php Introduces Deployer config (repo + hosts) and post-install provisioning steps.
composer.json Adds private Composer repositories and scripts for installing deployer/private packages.
composer.lock Locks updated dependency graph including Yard wp-deployer and related packages.

Comment thread composer.json Outdated
Comment thread composer.json
Comment thread composer.json Outdated
Comment thread deploy.php
Comment thread deploy.php
Comment thread deploy.php Outdated
Comment thread deploy.php Outdated
Comment thread deploy.php Outdated
@SimonvanWijhe SimonvanWijhe force-pushed the feat/private-setup branch 2 times, most recently from 0235c2f to 5b58ef2 Compare April 2, 2026 13:04
Comment thread deploy.php
Comment thread deploy.php
Comment thread deploy.php
Comment thread composer.json
@SimonvanWijhe
Copy link
Copy Markdown
Member Author

@claude review

Comment thread deploy.php
Comment thread deploy.php
@SimonvanWijhe SimonvanWijhe merged commit 6d3c0b7 into main Apr 16, 2026
@SimonvanWijhe SimonvanWijhe deleted the feat/private-setup branch April 16, 2026 13:49
Comment thread deploy.php
Comment on lines +44 to +50
host(Host::WPACC01)
->setDeployPath('/data/www/accept-sites/yard/brave')
->setLabels(['stage' => Stage::ACCEPT, 'site' => 'brave']);

host(Host::WPACC01)
->setDeployPath('/data/www/accept-sites/yard/gemeente')
->setLabels(['stage' => Stage::ACCEPT, 'site' => 'gemeente']);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔴 Both host entries in deploy.php (lines 44–50) call host(Host::WPACC01) with the same constant, so in Deployer 7.x the second call retrieves and mutates the same Host object, overwriting the brave deploy path and labels with gemeente config. After boot, only one host exists with site=gemeente; running dep deploy site=brave finds zero matching hosts and fails entirely. Fix: use distinct aliases — host('brave')->setHostname(Host::WPACC01) and host('gemeente')->setHostname(Host::WPACC01).

Extended reasoning...

What the bug is

In Deployer 7.x, the host() function uses its first argument as the host alias (the unique key in the hosts collection). When called a second time with an alias that already exists, the function explicitly returns the existing Host object rather than creating a new one. The relevant logic from Deployer's src/functions.php is:

if (count($hostname) === 1 && $deployer->hosts->has($hostname[0])) {
    return $deployer->hosts->get($hostname[0]);
}

The specific code path

Lines 44–50 of the newly added deploy.php:

host(Host::WPACC01)
    ->setDeployPath('/data/www/accept-sites/yard/brave')
    ->setLabels(['stage' => Stage::ACCEPT, 'site' => 'brave']);

host(Host::WPACC01)
    ->setDeployPath('/data/www/accept-sites/yard/gemeente')
    ->setLabels(['stage' => Stage::ACCEPT, 'site' => 'gemeente']);

Host::WPACC01 is the same constant string both times (e.g., 'wpacc01.yard.nl'). The second call to host(Host::WPACC01) retrieves the Host object created by the first call and mutates it in place with setDeployPath and setLabels.

Why existing code doesn't prevent it

There is no guard or uniqueness check in the call sites. Both calls look syntactically valid and the developer's intent is clear (two logical sites on one physical server), but the Deployer API requires distinct aliases — not distinct hostnames — to register two separate host entries.

Impact

After both host() calls execute during dep init, Deployer's host registry contains exactly one entry: the brave host object, now carrying gemeente's deploy path (/data/www/accept-sites/yard/gemeente) and label (site=gemeente). The brave configuration is permanently lost in memory. Running dep deploy site=brave selects hosts by label site=brave, finds zero matches, and exits with No hosts selected. The brave deployment is completely broken.

Step-by-step proof

  1. PHP loads deploy.php. Line 44 calls host(Host::WPACC01) — a new Host is created with alias wpacc01.yard.nl and added to the hosts collection. setDeployPath('/data/www/accept-sites/yard/brave') and setLabels(['site' => 'brave']) are applied.
  2. Line 48 calls host(Host::WPACC01) again. Deployer sees the alias already exists and returns the same Host object.
  3. setDeployPath('/data/www/accept-sites/yard/gemeente') overwrites the path on the existing object.
  4. setLabels(['site' => 'gemeente']) overwrites the labels on the existing object.
  5. Host registry now: one entry — alias wpacc01.yard.nl, deploy path gemeente, label site=gemeente.
  6. Developer runs dep deploy site=brave. Deployer filters hosts where site=brave — zero matches.
  7. Deploy exits: No hosts selected.

How to fix it

Use distinct aliases and set the physical hostname separately:

host('brave')
    ->setHostname(Host::WPACC01)
    ->setDeployPath('/data/www/accept-sites/yard/brave')
    ->setLabels(['stage' => Stage::ACCEPT, 'site' => 'brave']);

host('gemeente')
    ->setHostname(Host::WPACC01)
    ->setDeployPath('/data/www/accept-sites/yard/gemeente')
    ->setLabels(['stage' => Stage::ACCEPT, 'site' => 'gemeente']);

This registers two distinct entries in the hosts collection, both pointing to the same physical server, each with its own deploy path and labels.

Comment thread composer.json
Comment on lines +121 to +123
"private-deployer": [
"composer require yard/wp-deployer --dev"
],
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 The private-deployer script runs composer require yard/wp-deployer --dev with no version constraint, meaning each developer gets whatever version is latest at install time. If yard/wp-deployer releases a major version (e.g. v2.0) that changes the Host, Loader, Stage, or wp() API used in deploy.php, the deploy tool will silently break for anyone who installs the newer version. Fix by pinning to a semver range, e.g. composer require yard/wp-deployer:^1.5 --dev.

Extended reasoning...

What the bug is

The private-deployer Composer script (composer.json lines 121–123) runs:

"composer require yard/wp-deployer --dev"

No version constraint is specified. While Composer will add a caret constraint based on the currently-available major version when resolving, this means the constraint written into composer.json and composer.lock depends entirely on what version is published at the moment each developer runs the script. Developer A running it today gets ^1.5, developer B running it after a future major release gets ^2.0 — with incompatible API.

The specific code path

deploy.php directly imports and uses the Yard Deployer API:

use Yard\Deployer\Host;
use Yard\Deployer\Loader;
use Yard\Deployer\Stage;
use function Yard\Deployer\wp;

If any of these classes or the wp() function signature changes between major versions, deploy.php will throw a fatal error or silently misbehave on hosts where the newer major version was installed via this unconstrained script.

Why existing code doesn't prevent it

yard/wp-deployer is NOT listed in the require-dev section of composer.json — the private-deployer script is the only installation mechanism. Unlike private-packages and gemeente-packages which run with --no-interaction, this script has no version guard at all. The previous iteration of the code pinned yard/wp-deployer to a feature branch (dev-feat/migrate-to-localhost), which Copilot flagged as brittle. This PR replaced the branch pin with no constraint at all — arguably a step backwards in reproducibility.

Impact

This is a developer setup script, not part of the automated CI/CD pipeline, so it won't cause immediate failures. However, in a boilerplate/template repo shared across a team, running composer private-deployer at different points in time will produce divergent composer.json and composer.lock states. A future yard/wp-deployer v2.0 release with API changes would silently break deploys for any team member who ran the script after the major release, while others on v1.x continue to work.

Step-by-step proof

  1. Developer A runs composer private-deployer today — gets yard/wp-deployer: ^1.5 written to their composer.json + composer.lock.
  2. yard/wp-deployer v2.0 is published, with a renamed Loader class or changed wp() signature.
  3. Developer B runs composer private-deployer next week — gets yard/wp-deployer: ^2.0 written to their files.
  4. Developer B's dep deploy fails with a fatal PHP error because deploy.php still uses the v1.x API.
  5. Meanwhile Developer A's setup continues to work, making the bug hard to reproduce and diagnose.

How to fix

Pin to the version that is confirmed working (v1.5.3 per composer.lock):

"private-deployer": [
    "composer require yard/wp-deployer:^1.5 --dev"
]

This allows patch and minor updates (non-breaking per semver) while protecting against a future major-version API break.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants