41 lines
904 B
Bash
Executable File
41 lines
904 B
Bash
Executable File
#!/bin/bash
|
|
set -euo pipefail
|
|
|
|
health_url="${LISGLOSIPS_HEALTH_URL:-http://127.0.0.1:3000/api/v2/health/ready}"
|
|
services=(
|
|
mysql
|
|
redis-server
|
|
nginx
|
|
lisglosips@api
|
|
lisglosips@cdr-worker
|
|
lisglosips@recording-worker
|
|
heplify-server
|
|
lisglosips-prometheus.service
|
|
grafana-server
|
|
)
|
|
|
|
echo "== release =="
|
|
readlink -f /opt/lisglosips/current
|
|
test -L /opt/lisglosips/current
|
|
test -d "$(readlink -f /opt/lisglosips/current)"
|
|
|
|
echo "== services =="
|
|
for service in "${services[@]}"; do
|
|
state="$(systemctl is-active "$service" || true)"
|
|
printf '%s\t%s\n' "$service" "$state"
|
|
test "$state" = active
|
|
done
|
|
|
|
echo "== api =="
|
|
curl --max-time 5 --fail --silent "$health_url"
|
|
echo
|
|
|
|
echo "== nginx =="
|
|
nginx -t
|
|
|
|
echo "== backups =="
|
|
find /data/backups/mysql -mindepth 1 -maxdepth 1 -type d | sort | tail -1
|
|
find /data/backups/redis -mindepth 1 -maxdepth 1 -type d | sort | tail -1
|
|
|
|
echo "preflight ok"
|