Files
computer-playbook/roles/web-app-espocrm/vars/main.yml
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

49 lines
3.1 KiB
YAML

---
application_id: "web-app-espocrm"
entity_name: "{{ application_id | get_entity_name }}"
swarm_stack_converge_retries: 600
websocket_port: "{{ lookup('config', application_id, 'services.espocrm.ports.local.websocket') }}"
ESPOCRM_VERSION: "{{ lookup('config', application_id, 'services.' ~ entity_name ~'.version') }}"
ESPOCRM_IMAGE: "{{ lookup('config', application_id, 'services.' ~ entity_name ~'.image') }}"
ESPOCRM_CONTAINER: "{{ lookup('config', application_id, 'services.' ~ entity_name ~'.name') }}"
ESPOCRM_SERVICE: "{{ entity_name }}"
ESPOCRM_BIN_DIR: "/usr/local/bin"
ESPOCRM_ENTRYPOINT_SCRIPT_FILE: "docker-entrypoint-custom.sh"
ESPOCRM_ENTRYPOINT_SCRIPT_HOST_ABS: "{{ [ lookup('container', application_id, 'directories.volumes'), ESPOCRM_ENTRYPOINT_SCRIPT_FILE ] | path_join }}"
ESPOCRM_ENTRYPOINT_SCRIPT_HOST_REL: "volumes/{{ ESPOCRM_ENTRYPOINT_SCRIPT_FILE }}"
ESPOCRM_ENTRYPOINT_SCRIPT_DOCKER: "{{ [ ESPOCRM_BIN_DIR, ESPOCRM_ENTRYPOINT_SCRIPT_FILE ] | path_join }}"
ESPOCRM_ENTRYPOINT_SCRIPT_ORIGINAL: "{{ [ ESPOCRM_BIN_DIR, 'docker-entrypoint.sh' ] | path_join }}"
ESPOCRM_APP_DIR: "/var/www/html"
ESPOCRM_SCRIPT_SIDECAR_FILE: "sidecar_boot.sh"
ESPOCRM_SCRIPT_SIDECAR_HOST_ABS: "{{ [ lookup('container', application_id, 'directories.volumes'), ESPOCRM_SCRIPT_SIDECAR_FILE ] | path_join }}"
ESPOCRM_SCRIPT_SIDECAR_HOST_REL: "volumes/{{ ESPOCRM_SCRIPT_SIDECAR_FILE }}"
ESPOCRM_SCRIPT_SIDECAR_DOCKER: "{{ [ ESPOCRM_BIN_DIR, ESPOCRM_SCRIPT_SIDECAR_FILE ] | path_join }}"
ESPOCRM_CONFIG_FILE_PRIVATE: "{{ [ ESPOCRM_APP_DIR, 'data/config-internal.php' ] | path_join }}"
ESPOCRM_LOG_DIR_RELATIVE: "data/logs"
ESPOCRM_LOG_PATH_RELATIVE: "{{ [ ESPOCRM_LOG_DIR_RELATIVE, 'espo.log' ] | path_join }}"
ESPOCRM_URL: "{{ lookup('tls', application_id, 'url.base') }}"
ESPOCRM_OIDC_ENABLED: "{{ lookup('config', application_id, 'services.sso.enabled') }}"
ESPOCRM_OIDC_ONION_ISSUER: "{{ lookup('tls', 'web-app-keycloak', 'domain').endswith('.onion') }}"
ESPOCRM_OIDC_SOCKS_PROXY: "{{ lookup('tor_socks_proxy') if ESPOCRM_OIDC_ONION_ISSUER | bool else '' }}"
ESPOCRM_LDAP_ENABLED: "{{ lookup('config', application_id, 'services.ldap.enabled') }}"
ESPOCRM_LDAP_AUTOCREATE: "{{ lookup('config', application_id, 'services.ldap.autocreate') }}"
ESPOCRM_USER: "www-data"
ESPOCRM_SCRIPT_SEED_FILE: "seed_config.php"
ESPOCRM_SCRIPT_SEED_HOST_ABS: "{{ [ lookup('container', application_id, 'directories.volumes'), ESPOCRM_SCRIPT_SEED_FILE ] | path_join }}"
ESPOCRM_SCRIPT_SEED_HOST_REL: "volumes/{{ ESPOCRM_SCRIPT_SEED_FILE }}"
ESPOCRM_SCRIPT_SEED_DOCKER: "{{ [ ESPOCRM_BIN_DIR, ESPOCRM_SCRIPT_SEED_FILE ] | path_join }}"
ESPOCRM_MAINTENANCE_MODE: "{{ lookup('config', application_id, 'services.espocrm.maintenance_mode') }}"
ESPOCRM_CRON_DISABLED: "{{ ESPOCRM_MAINTENANCE_MODE }}"
ESPOCRM_USE_CACHE: "{{ not ESPOCRM_MAINTENANCE_MODE }}"
ESPOCRM_RECAPTCHA_ENABLED: "{{ lookup('config', application_id, 'services.recaptcha.enabled') }}"
ESPOCRM_RECAPTCHA_KEY: "{{ lookup('config', application_id, 'secrets.credentials.recaptcha.key') }}"
ESPOCRM_RECAPTCHA_SECRET: "{{ lookup('config', application_id, 'secrets.credentials.recaptcha.secret') }}"