fix: flush edge caches after SSO changes
This commit is contained in:
parent
5c1a73ba2c
commit
da5a544f47
4
jeannie
4
jeannie
|
|
@ -108,6 +108,7 @@ Observability And GitOps
|
|||
gitops-status Print focused Argo CD health and sync status.
|
||||
platform Deploy platform stack only.
|
||||
edge Deploy/check the OCI edge stack only.
|
||||
edge-cache-flush Clear Nginx, Varnish, and Squid edge caches.
|
||||
promote {plan|validate|rollback APP} Run canary promotion gates and rollback plan.
|
||||
cert-check Check public DNS, TLS, and edge URL health.
|
||||
backup-status Check backup and restore-drill freshness.
|
||||
|
|
@ -245,6 +246,9 @@ case "${1:-}" in
|
|||
run_step "Edge OpenTofu apply" edge_apply
|
||||
echo "Log: ${JEANNIE_LOG_FILE}"
|
||||
;;
|
||||
edge-cache-flush)
|
||||
edge_flush_caches
|
||||
;;
|
||||
promote)
|
||||
promote "$@"
|
||||
;;
|
||||
|
|
|
|||
|
|
@ -897,10 +897,11 @@ sso() {
|
|||
;;
|
||||
apply)
|
||||
deploy_dex
|
||||
run_tofu_stack "bootstrap/edge"
|
||||
edge_apply
|
||||
configure_grafana_dex_secret
|
||||
run_tofu_stack "bootstrap/platform"
|
||||
configure_gitea_sso_source
|
||||
edge_flush_caches
|
||||
;;
|
||||
*)
|
||||
echo "Usage: ./jeannie sso {plan|apply}" >&2
|
||||
|
|
@ -5866,6 +5867,45 @@ edge_apply() {
|
|||
require_debian_server "edge"
|
||||
|
||||
run_tofu_stack "bootstrap/edge"
|
||||
edge_flush_caches
|
||||
}
|
||||
|
||||
edge_flush_caches() {
|
||||
local edge_host="${TF_VAR_edge_host:-${LAB_EDGE_HOST:-}}"
|
||||
local edge_user="${TF_VAR_edge_user:-${LAB_EDGE_USER:-ubuntu}}"
|
||||
local edge_key="${TF_VAR_edge_ssh_key_path:-${LAB_EDGE_SSH_KEY_PATH:-/home/jv/.ssh/id_ed25519}}"
|
||||
local edge_install_dir="${TF_VAR_edge_install_dir:-${LAB_EDGE_INSTALL_DIR:-/opt/homelab-edge}}"
|
||||
|
||||
require_debian_server "edge-cache-flush"
|
||||
|
||||
if [[ -z "${edge_host}" || "${edge_install_dir}" == *"'"* ]]; then
|
||||
echo "LAB_EDGE_HOST and LAB_EDGE_INSTALL_DIR are required to flush edge caches." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Flushing edge caches on ${edge_user}@${edge_host}:${edge_install_dir}..."
|
||||
ssh -i "${edge_key}" -o BatchMode=yes -o ConnectTimeout=10 -o IdentitiesOnly=yes -o StrictHostKeyChecking=accept-new "${edge_user}@${edge_host}" "set -eu
|
||||
cd '${edge_install_dir}'
|
||||
if ! sudo docker compose ps >/dev/null 2>&1; then
|
||||
echo 'Edge docker compose stack is not available.' >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if sudo docker compose ps --services --filter status=running | grep -qx nginx-dev; then
|
||||
sudo docker compose exec -T nginx-dev sh -lc 'find /var/cache/nginx /var/cache/nginx_dynamic -type f -delete 2>/dev/null || true'
|
||||
sudo docker compose exec -T nginx-dev nginx -s reload || sudo docker compose restart nginx-dev >/dev/null
|
||||
fi
|
||||
|
||||
if sudo docker compose ps --services --filter status=running | grep -qx varnish-dev; then
|
||||
sudo docker compose restart varnish-dev >/dev/null
|
||||
fi
|
||||
|
||||
if sudo docker compose ps --services --filter status=running | grep -qx squid-dev; then
|
||||
sudo docker compose exec -T squid-dev sh -lc 'find /var/spool/squid -type f -delete 2>/dev/null || true'
|
||||
sudo docker compose restart squid-dev >/dev/null
|
||||
fi
|
||||
"
|
||||
echo "Edge caches flushed."
|
||||
}
|
||||
|
||||
edge_haproxy_stats_password_valid() {
|
||||
|
|
|
|||
Loading…
Reference in New Issue