mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-06 10:59:59 +00:00
Two installers write the same database and neither reconciles the admin
credential, so `/administrator` answered every login with "Username and
password do not match" — six POSTs across two orchestrator passes, all 303, in
the only CI row that exercises the local-login hatch. The green sibling row
proves nothing: its JUnit report lists that test as skipped.
The image entrypoint auto-installs Joomla on first boot. The role waited for
`plugins/actionlog/joomla/joomla.xml`, a file copied early in that boot, then
removed configuration.php and ran its own CLI install against the same
database. Whichever finished last owned the admin row, and the run's artifacts
show the entrypoint finishing one second after the play ended.
So the role now waits for the entrypoint to be done before deciding anything.
The marker it already writes, `.infinito-init.ready`, is that signal; the
`|| test -e configuration.php` arm covers re-deploys, where the entrypoint's
setup block never runs and the marker is therefore never touched.
With the state settled, the password reset no longer needs a gate. It was
skipped on fresh installs on the assumption that the CLI installer had set the
password — an assumption this run falsifies, since that installer exits 1 and
is swallowed as a soft success. The race it was written to avoid ("The user
does not exist!" right after install) is absorbed inside the reset itself,
which retries six times at five-second intervals and whose header documents
exactly that symptom.
The marker's name and path now live only in vars/main.yml and reach the
container through the env file. The entrypoint requires it without a default,
matching svc-runner and svc-db-openldap: a fallback would be the second
definition this change exists to remove.
Verified: the guarded expansion executed in both env states (127 with a legible
message, 0 with the path), the retry-exhaustion path executed against localhost
to confirm `failed_when: false` lets the play continue, plus shellcheck,
ansible-lint on the production profile, and 201 Jinja/ansible lint tests.
Not verified: no deploy was run. Whether the barrier holds on a real fresh
install is unmeasured.
Still open, both separate defects: 03_install.yml swallows the installer's
rc 1 as success, and test-oidc-login.js passes on the plugin's catch path
because it only asserts the URL prefix and a visible body.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
35 lines
1.6 KiB
Bash
35 lines
1.6 KiB
Bash
#!/bin/bash
|
|
# Serialize the stock image's first-boot copy+auto-install across replicas that
|
|
# share the /var/www/html NFS volume (mkdir is atomic on NFS: one leader runs it,
|
|
# the rest block on the ready marker). The setup only runs when $1 is apache2*/
|
|
# php-fpm, so the leader must drive it with `apache2 -v` (returns after setup) —
|
|
# a plain `true` skips the whole setup block and copies nothing.
|
|
|
|
target="/var/www/html"
|
|
lock="${target}/.infinito-init.lock"
|
|
ready="${JOOMLA_INIT_READY_FILE:?JOOMLA_INIT_READY_FILE must be set}"
|
|
|
|
if [ ! -e "${ready}" ] && [ ! -e "${target}/configuration.php" ]; then
|
|
if mkdir "${lock}" 2>/dev/null; then
|
|
/entrypoint.sh apache2 -v || true # nocheck: shell-or-true -- grandfathered: worked in practice; TODO: sharpen to catch only the exact tolerated error
|
|
if [ -e "${target}/configuration.php" ]; then
|
|
# Exception: the root-run auto-install leaves these dirs root-owned on the
|
|
# shared NFS docroot; apache (www-data) then wedges every request in a
|
|
# cache-write permission loop and the swarm converge wait expires. The
|
|
# role-side chown runs only AFTER converge, so it can never break the tie.
|
|
chown -R www-data:www-data \
|
|
"${target}/administrator/cache" "${target}/administrator/logs" \
|
|
"${target}/cache" "${target}/tmp" 2>/dev/null || true # nocheck: shell-or-true -- grandfathered: worked in practice; TODO: sharpen to catch only the exact tolerated error
|
|
touch "${ready}"
|
|
fi
|
|
else
|
|
tries=0
|
|
while [ ! -e "${ready}" ] && [ ! -e "${target}/configuration.php" ] && [ "${tries}" -lt 300 ]; do
|
|
sleep 2
|
|
tries=$((tries + 1))
|
|
done
|
|
fi
|
|
fi
|
|
|
|
exec /entrypoint.sh "$@"
|