33 lines
725 B
Bash
Executable File
33 lines
725 B
Bash
Executable File
#!/bin/bash
|
|
set -euo pipefail
|
|
|
|
if [ "$#" -ne 1 ]; then
|
|
echo "usage: $0 /opt/lisglosips/releases/<release-id>" >&2
|
|
exit 64
|
|
fi
|
|
|
|
target="$1"
|
|
case "$target" in
|
|
/opt/lisglosips/releases/*) ;;
|
|
*)
|
|
echo "target must be under /opt/lisglosips/releases" >&2
|
|
exit 64
|
|
;;
|
|
esac
|
|
|
|
target="$(readlink -f "$target")"
|
|
test -d "$target"
|
|
test -f "$target/package.json"
|
|
|
|
previous="$(readlink -f /opt/lisglosips/current)"
|
|
echo "previous=$previous"
|
|
echo "target=$target"
|
|
|
|
ln -sfn "$target" /opt/lisglosips/current
|
|
systemctl restart lisglosips@api lisglosips@cdr-worker lisglosips@recording-worker
|
|
nginx -t
|
|
systemctl reload nginx
|
|
curl --max-time 10 --fail --silent http://127.0.0.1:3000/api/v2/health/ready
|
|
echo
|
|
echo "rollback ok"
|