helpme-tips/deploy.sh
2026-09-21 22:15:43 +00:00

24 lines
942 B
Bash
Executable file

#!/usr/bin/env bash
# Build + sync docroot in place (hostPath pattern: never swap directories).
set -euo pipefail
cd "$(dirname "$0")"
BASE=/home/opc/zai-home-base
echo "==> building site"
python3 build.py
mkdir -p "$BASE/sites/helpme-tips"
if command -v getenforce >/dev/null 2>&1 && [ "$(getenforce)" = "Enforcing" ]; then
chcon -Rt container_file_t "$BASE/sites/helpme-tips" 2>/dev/null || true
fi
rsync -a --delete site/ "$BASE/sites/helpme-tips/"
echo "==> verifying through Traefik (origin)"
sleep 1
code=$(curl -sk -o /dev/null -w '%{http_code}' --resolve helpme.tips:443:127.0.0.1 https://helpme.tips/ --max-time 10)
echo " https://helpme.tips -> $code (origin)"
for asset in /static/style.css /static/main.js /sitemap.xml; do
out=$(curl -sk -o /dev/null -w '%{http_code} %{content_type}' --resolve helpme.tips:443:127.0.0.1 "https://helpme.tips$asset" --max-time 10)
echo " $asset -> $out"
done
echo "==> deploy complete"