Files
computer-playbook/roles/web-app-espocrm/files/shell/sidecar_boot.sh
kevinveenbirkenbachandClaude Opus 5 9bc0d834fe fix(espocrm): start the sidecars past a readiness gate that can never pass
espocrm_daemon and espocrm_websocket exited 0 every six seconds while the main
container sat healthy for thirty-nine minutes, so the deploy waited out its retries
on

    not converged: espocrm_daemon espocrm_websocket
      espocrm_daemon.1 desired=Shutdown current=Complete

The service log shows our own gate working -- "[entrypoint] Exec: docker-websocket.sh"
-- and upstream's failing right after it. docker-*.sh call exitIfNotReady, which runs
`bin/command app-check` and exits 0 when that fails. CommandManager resolves the name
to an AppCheck class, and espocrm/espocrm carries no AppCheck.php at 10.0.6, so the
gate can never pass. isLegacy does not spare us either: it returns true only when
/var/www/html is itself a mount point, and we mount three subdirectories.

Only the broken half is replaced. applyConfigEnv stays, because the websocket service
is the only carrier of ESPOCRM_CONFIG_WEB_SOCKET_*, and those reach the shared
config.php nowhere else. Readiness is the caller's job already: --wait-ready blocks on
the marker the main container writes once its install has finished, which is a
strictly better-informed signal than app-check.

The logic lives in files/shell/sidecar_boot.sh rather than a bash -c string, following
the route this role already uses for docker-entrypoint-custom.sh and seed_config.php:
copied into the build context, COPYed and chmod'ed in the Dockerfile, addressed
through ESPOCRM_SCRIPT_SIDECAR_DOCKER. That buys shellcheck and bash -n coverage the
embedded string never had, drops one layer of quoting, and turns a missing argument
into a named error instead of a php invocation with no script.

ESPOCRM_APP_DIR replaces the second hardcoded /var/www/html in vars.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-31 15:33:40 +02:00

18 lines
593 B
Bash

#!/bin/bash
# Usage:
# sidecar_boot.sh <php-script-name>
#
# Replaces upstream's docker-daemon.sh / docker-websocket.sh, whose readiness gate
# calls `bin/command app-check` -- a command the shipped application does not carry.
# applyConfigEnv is upstream's and must stay: it is the only place the websocket
# service's ESPOCRM_CONFIG_WEB_SOCKET_* variables reach the shared config.php.
set -eu
script="${1:?usage: sidecar_boot.sh <php-script-name>}"
# shellcheck source=/dev/null
source /usr/local/bin/entrypoint-utils.sh
applyConfigEnv
exec /usr/local/bin/php "/var/www/html/${script}"