Files
project57-x/docker-entrypoint.d/40-a-upstream.sh
T
mdszxy 1ffb91509c
CI Pipeline / check-commit (push) Successful in 5s
CI Pipeline / deploy-only (push) Has been skipped
CI Pipeline / build (push) Successful in 20s
CI Pipeline / deploy (push) Successful in 17s
feat: proxy admin and Next assets via cluster service [deploy]
2026-10-06 00:22:55 +08:00

24 lines
690 B
Bash
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/sh
set -eu
CONF=/etc/nginx/conf.d/default.conf
# 集群内真实 Service:project57-svc:80(不是 project57-deploy:3000)
A_UPSTREAM="${A_UPSTREAM:-http://project57-svc.ns-project57.svc.cluster.local:80}"
A_UPSTREAM="${A_UPSTREAM%/}"
A_PUBLIC="${A_PUBLIC:-https://project57.website-build.org}"
A_PUBLIC="${A_PUBLIC%/}"
NS="$(awk '/^nameserver/{print $2; exit}' /etc/resolv.conf || true)"
if [ -z "${NS}" ]; then
NS=kube-dns.kube-system.svc.cluster.local
fi
sed -i \
-e "s|__RESOLVER__|${NS}|g" \
-e "s|__A_UPSTREAM__|${A_UPSTREAM}|g" \
-e "s|__A_PUBLIC__|${A_PUBLIC}|g" \
"${CONF}"
echo "nginx upstream: ${A_UPSTREAM} (resolver ${NS}, public ${A_PUBLIC})"
nginx -t