Files

20 lines
767 B
Bash

set -u
echo "===== host file (has userbase) ====="
grep -c "userbase" /opt/docker/infra/Caddyfile
echo "===== container file BEFORE restart (expect 0) ====="
docker exec caddy grep -c "userbase" /etc/caddy/Caddyfile
echo
echo "===== restart caddy to re-bind the edited file ====="
docker restart caddy
echo "restart exit: $?"
sleep 6
echo
echo "===== container file AFTER restart (expect >0) ====="
docker exec caddy grep -c "userbase" /etc/caddy/Caddyfile
echo
echo "===== test routes ====="
for p in /userbase/ /userbase/index.html /userbase/static/js/ /userbase/api/x /userbase/login; do
code=$(curl -s -o /tmp/ub_body -w "%{http_code}" -H "Host: www.yunhaixingtong.com" "http://127.0.0.1$p")
echo "$p -> $code | $(head -c 100 /tmp/ub_body | tr -d '\n')"
done