Improve error handling in deployment and stopping commands in panelctl.sh

Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
Jakub Dorfman 2026-04-26 22:58:09 +02:00
parent 57776ab029
commit 8ace80a19f

View file

@ -276,7 +276,7 @@ cmd_render_route() {
maybe_reload_caddy() { maybe_reload_caddy() {
if [[ -x /run/current-system/sw/bin/caddy && -f /etc/caddy/Caddyfile ]]; then if [[ -x /run/current-system/sw/bin/caddy && -f /etc/caddy/Caddyfile ]]; then
/run/current-system/sw/bin/caddy validate --config /etc/caddy/Caddyfile --adapter caddyfile /run/current-system/sw/bin/caddy validate --config /etc/caddy/Caddyfile --adapter caddyfile || echo "warning: caddy validation failed" >&2
fi fi
if [[ "${EUID}" -eq 0 ]]; then if [[ "${EUID}" -eq 0 ]]; then
@ -300,7 +300,7 @@ cmd_deploy() {
load_app "${name}" load_app "${name}"
cmd_render_route "${name}" cmd_render_route "${name}"
run_compose -f "${APP_COMPOSE_FILE}" up -d run_compose -f "${APP_COMPOSE_FILE}" up -d || fail "compose up failed"
maybe_reload_caddy maybe_reload_caddy
echo "deployed app '${name}'" echo "deployed app '${name}'"
@ -311,7 +311,7 @@ cmd_stop() {
validate_name "${name}" validate_name "${name}"
load_app "${name}" load_app "${name}"
run_compose -f "${APP_COMPOSE_FILE}" down run_compose -f "${APP_COMPOSE_FILE}" down || fail "compose down failed"
echo "stopped app '${name}'" echo "stopped app '${name}'"
} }
@ -321,7 +321,7 @@ cmd_remove() {
validate_name "${name}" validate_name "${name}"
load_app "${name}" load_app "${name}"
run_compose -f "${APP_COMPOSE_FILE}" down || true run_compose -f "${APP_COMPOSE_FILE}" down 2>/dev/null || true
# Remove this app's block from the aggregate routes file. # Remove this app's block from the aggregate routes file.
if [[ -f "${APP_ROUTE_FILE}" ]]; then if [[ -f "${APP_ROUTE_FILE}" ]]; then