init: UserBaseService (backend + deploy + scripts)
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
set -u
|
||||
CP=/opt/docker/infra/Caddyfile
|
||||
echo "===== before: line 70 ====="
|
||||
sed -n '70p' "$CP"
|
||||
echo "===== apply wildcard matcher (inode will change; restart re-binds) ====="
|
||||
sed -i 's#handle_path /userbase/ {#handle_path /userbase* {#' "$CP"
|
||||
echo "after:"; sed -n '70p' "$CP"
|
||||
echo
|
||||
echo "===== restart caddy to re-bind edited file ====="
|
||||
docker restart caddy
|
||||
echo "restart exit: $?"
|
||||
sleep 6
|
||||
echo "===== container sees fix? ====="
|
||||
docker exec caddy grep -n "handle_path /userbase" /etc/caddy/Caddyfile
|
||||
echo
|
||||
echo "===== extract a real JS asset from SPA and test it ====="
|
||||
html=$(curl -s -H "Host: www.yunhaixingtong.com" http://127.0.0.1/userbase/)
|
||||
echo "$html" | grep -oE 'src="[^"]+\.js"' | head -3
|
||||
asset=$(echo "$html" | grep -oE '/[A-Za-z0-9_./-]+\.js' | head -1)
|
||||
echo "first asset path: $asset"
|
||||
if [ -n "$asset" ]; then
|
||||
code=$(curl -s -o /dev/null -w "%{http_code}" -H "Host: www.yunhaixingtong.com" "http://127.0.0.1/userbase${asset}")
|
||||
echo "/userbase${asset} -> $code"
|
||||
fi
|
||||
echo
|
||||
echo "===== route tests ====="
|
||||
for p in /userbase/ /userbase/index.html "/userbase${asset:-/static/js/}"; do
|
||||
code=$(curl -s -o /tmp/b -w "%{http_code}" -H "Host: www.yunhaixingtong.com" "http://127.0.0.1$p")
|
||||
echo "$p -> $code | $(head -c 70 /tmp/b|tr -d '\n')"
|
||||
done
|
||||
echo
|
||||
echo "===== backend test ====="
|
||||
curl -s -o /dev/null -w "/userbase/api/x -> %{http_code}\n" -H "Host: www.yunhaixingtong.com" http://127.0.0.1/userbase/api/x
|
||||
Reference in New Issue
Block a user