fix and update
This commit is contained in:
30
install.sh
30
install.sh
@@ -33,6 +33,7 @@ INSTALL_LOCAL=0
|
||||
INSTALL_INTRANET=0
|
||||
OFFLINE="${OFFLINE:-0}"
|
||||
NGINX_MODE="${NGINX_MODE:-auto}"
|
||||
IDP_API_GATEWAY_IP="${IDP_API_GATEWAY_IP:-172.28.50.10}"
|
||||
SKIP_DOCKER_PRUNE="${SKIP_DOCKER_PRUNE:-0}"
|
||||
DOCKER_PRUNE_AGGRESSIVE="${DOCKER_PRUNE_AGGRESSIVE:-0}"
|
||||
# Принудительный Docker Nginx (контейнер lendry-id-nginx) — включается в --fix-all
|
||||
@@ -1565,8 +1566,16 @@ ensure_host_upstreams() {
|
||||
nginx_upstream() {
|
||||
case "$1" in
|
||||
api)
|
||||
# container_name стабильнее service name при пересоздании compose-стека
|
||||
[[ "$NGINX_MODE" == "docker" ]] && echo "http://lendry-id-api-gateway:3000" || echo "http://127.0.0.1:3000"
|
||||
if [[ "$NGINX_MODE" == "docker" ]]; then
|
||||
# Статический IP — nginx не кеширует DNS; переживает recreate api-gateway без reload.
|
||||
if [[ -n "${IDP_API_GATEWAY_IP:-}" ]]; then
|
||||
echo "http://${IDP_API_GATEWAY_IP}:3000"
|
||||
else
|
||||
echo "http://lendry-id-api-gateway:3000"
|
||||
fi
|
||||
else
|
||||
echo "http://127.0.0.1:3000"
|
||||
fi
|
||||
;;
|
||||
frontend)
|
||||
[[ "$NGINX_MODE" == "docker" ]] && echo "http://lendry-id-frontend:3000" || echo "http://127.0.0.1:3002"
|
||||
@@ -1991,13 +2000,20 @@ nginx_upstream_var() {
|
||||
printf 'idp_up_%s' "$(printf '%s' "$1" | tr -c 'A-Za-z0-9' '_')"
|
||||
}
|
||||
|
||||
nginx_api_uses_static_ip() {
|
||||
[[ "$NGINX_MODE" == "docker" && -n "${IDP_API_GATEWAY_IP:-}" ]]
|
||||
}
|
||||
|
||||
# proxy_pass к КОРНЮ апстрима ($request_uri сохраняет путь и query).
|
||||
# docker: через resolver+переменную (переживает смену IP контейнера).
|
||||
# host: статический proxy_pass на 127.0.0.1 (DNS-кеша нет, IP не меняется).
|
||||
# docker + IDP_API_GATEWAY_IP: прямой proxy_pass без DNS (надёжно после recreate).
|
||||
# docker без static IP: resolver+переменная.
|
||||
# host: статический proxy_pass на 127.0.0.1.
|
||||
render_proxy_root() {
|
||||
local key="$1" up var
|
||||
up="$(nginx_upstream "$key")"
|
||||
if [[ "$NGINX_MODE" == "docker" ]]; then
|
||||
if nginx_api_uses_static_ip && [[ "$key" == "api" ]]; then
|
||||
printf ' proxy_pass %s$request_uri;' "$up"
|
||||
elif [[ "$NGINX_MODE" == "docker" ]]; then
|
||||
var="$(nginx_upstream_var "$key")"
|
||||
printf '%s\n set $%s %s;\n proxy_pass $%s$request_uri;' \
|
||||
"$NGINX_DOCKER_RESOLVER" "$var" "$up" "$var"
|
||||
@@ -2024,7 +2040,9 @@ render_proxy_rewrite() {
|
||||
render_proxy_idp_api() {
|
||||
local key="api" up var
|
||||
up="$(nginx_upstream "$key")"
|
||||
if [[ "$NGINX_MODE" == "docker" ]]; then
|
||||
if nginx_api_uses_static_ip; then
|
||||
printf ' rewrite ^/idp-api/?(.*)$ /$1 break;\n proxy_pass %s;' "$up"
|
||||
elif [[ "$NGINX_MODE" == "docker" ]]; then
|
||||
var="$(nginx_upstream_var "$key")"
|
||||
printf '%s\n set $%s %s;\n rewrite ^/idp-api/?(.*)$ /$1 break;\n proxy_pass $%s;' \
|
||||
"$NGINX_DOCKER_RESOLVER" "$var" "$up" "$var"
|
||||
|
||||
Reference in New Issue
Block a user