28 lines
1.1 KiB
Bash
Executable file
28 lines
1.1 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
# Build sites and sync docroots. Routing/TLS are handled by Traefik + cert-manager
|
|
# in the cluster, so content deploys need no pod reloads or restarts.
|
|
set -euo pipefail
|
|
cd "$(dirname "$0")"
|
|
BASE=/home/opc/zai-home-base
|
|
|
|
echo "==> building site"
|
|
python3 build.py
|
|
|
|
mkdir -p "$BASE/sites"
|
|
rm -rf "$BASE/sites/bestdadjokes.new"
|
|
cp -r site "$BASE/sites/bestdadjokes.new"
|
|
if command -v getenforce >/dev/null 2>&1 && [ "$(getenforce)" = "Enforcing" ]; then
|
|
chcon -Rt container_file_t "$BASE/sites/bestdadjokes.new" 2>/dev/null || true
|
|
fi
|
|
rm -rf "$BASE/sites/bestdadjokes.old"
|
|
[ -d "$BASE/sites/bestdadjokes" ] && mv "$BASE/sites/bestdadjokes" "$BASE/sites/bestdadjokes.old"
|
|
mv "$BASE/sites/bestdadjokes.new" "$BASE/sites/bestdadjokes"
|
|
rm -rf "$BASE/sites/bestdadjokes.old"
|
|
|
|
echo "==> verifying through Traefik (origin)"
|
|
sleep 1
|
|
for host in bestdadjokes.lol www.bestdadjokes.lol myadhd.dev; do
|
|
code=$(curl -sk -o /dev/null -w '%{http_code}' --resolve "$host:443:127.0.0.1" "https://$host/" --max-time 10)
|
|
echo " https://$host -> $code (origin)"
|
|
done
|
|
echo "==> deploy complete"
|