Auto-start the web admin on every container start
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 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015X1jRGHwrvovz2qkhKfDZi
This commit is contained in:
+9
-2
@@ -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}" \
|
||||
|
||||
+12
@@ -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 "$@"
|
||||
|
||||
Reference in New Issue
Block a user