From 52db0fa92163a593c973373ff43cb09d11158446 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 20 Jul 2026 18:13:39 +0000 Subject: [PATCH] Auto-start the web admin on every container start MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The web admin script (/usr/local/bin/easy-asterisk-webadmin) is generated on demand by the interactive CLI, but only ever lived in the container's writable layer — not baked into the image, not bind-mounted. Every docker compose down/up wiped it, and the entrypoint's start logic only ran "if the file already exists", so it silently never started again until someone manually ran the CLI's Web Admin menu once per recreate. Added a --write-web-admin-script non-interactive entry point (same pattern as --rebuild-dialplan) and call it unconditionally before the existence check, so the web admin comes back on its own every time the container starts. Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_015X1jRGHwrvovz2qkhKfDZi --- vendor/easy-asterisk/docker/entrypoint.sh | 11 +++++++++-- vendor/easy-asterisk/easy-asterisk-v0.10.0.sh | 12 ++++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/vendor/easy-asterisk/docker/entrypoint.sh b/vendor/easy-asterisk/docker/entrypoint.sh index 1cadc6d..943b3d6 100755 --- a/vendor/easy-asterisk/docker/entrypoint.sh +++ b/vendor/easy-asterisk/docker/entrypoint.sh @@ -431,8 +431,15 @@ fi chown -R asterisk:asterisk /etc/asterisk /var/lib/asterisk /var/log/asterisk /var/spool/asterisk /var/run/asterisk 2>/dev/null || true # ── 10. Start Web Admin in background ───────────────────────── -# The web admin script is generated by the 'easy-asterisk' management tool. -# On first run: docker exec -it easy-asterisk easy-asterisk → Web Admin menu → Start +# The web admin script is generated by the 'easy-asterisk' management tool, +# but it only lives in the container's writable layer (not baked into the +# image or bind-mounted), so it's gone every time the container is +# recreated. Regenerate it unconditionally instead of only starting it if +# it happens to already exist — otherwise the web admin never comes back +# on its own after a restart, requiring a manual CLI trip every time. +if [[ -x /usr/local/bin/easy-asterisk ]]; then + /usr/local/bin/easy-asterisk --write-web-admin-script >/dev/null 2>&1 || true +fi if [[ -f "$WEB_ADMIN_SCRIPT" ]]; then log_info "Starting Web Admin on port ${WEB_ADMIN_PORT:-8080}..." WEBADMIN_PORT="${WEB_ADMIN_PORT:-8080}" \ diff --git a/vendor/easy-asterisk/easy-asterisk-v0.10.0.sh b/vendor/easy-asterisk/easy-asterisk-v0.10.0.sh index 3cd0981..4aad948 100755 --- a/vendor/easy-asterisk/easy-asterisk-v0.10.0.sh +++ b/vendor/easy-asterisk/easy-asterisk-v0.10.0.sh @@ -7024,4 +7024,16 @@ if [[ "${1:-}" == "--rebuild-dialplan" ]]; then exit 0 fi +# Non-interactive entry point used by the container entrypoint on every +# start. create_web_admin_script() writes /usr/local/bin/easy-asterisk- +# webadmin, but that file lives only in the container's writable layer — +# it isn't baked into the image or bind-mounted anywhere — so it's wiped +# on every recreate. Without regenerating it here, the web admin only +# ever starts after someone manually runs it once from the interactive +# CLI menu, which defeats the point of it auto-starting at all. +if [[ "${1:-}" == "--write-web-admin-script" ]]; then + create_web_admin_script + exit 0 +fi + main "$@"