Files

19 lines
916 B
Bash

#!/usr/bin/env bash
set -Eeuo pipefail
root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
env_file="${1:-$root/deploy/aliyun.env}"
compose_file="$root/deploy/docker-compose.aliyun.yml"
[[ -f "$env_file" ]] || { echo "Missing environment file: $env_file" >&2; exit 2; }
docker compose --env-file "$env_file" -f "$compose_file" config --quiet
docker compose --env-file "$env_file" -f "$compose_file" pull
docker compose --env-file "$env_file" -f "$compose_file" up -d --wait
docker compose --env-file "$env_file" -f "$compose_file" ps
frontend_port="$(sed -n 's/^FRONTEND_PORT=//p' "$env_file" | tail -1)"
backend_port="$(sed -n 's/^BACKEND_PORT=//p' "$env_file" | tail -1)"
curl --fail --show-error --silent "http://127.0.0.1:${frontend_port:-80}/" >/dev/null
curl --fail --show-error --silent "http://127.0.0.1:${backend_port:-8002}/api/xingbang/health" >/dev/null
echo "Alibaba Cloud deployment is healthy"