配置 Proxy 伺服器(非 OCP 安裝)

TA 可以配置成在 Proxy 伺服器後面執行,以支援負載平衡和強化的安全。
附註: 一旦配置成使用 Proxy 之後,將只支援 Proxy URL。 不再支援替代 URL(機器 IP 等)。

TA 配置

您需要將外部可存取的 URL 設定為 Proxy 伺服器的 URL。
您需要在 .env.env_orig 檔案中進行這些變更。

  • 移至安裝位置,並停止 TA_LOCAL
./launchTransformationAdvisor.sh
Choose Stop Transformation Advisor from the menu option
  • 現在更新配置
cd scripts
vi .env
  • 根據您的 Proxy 伺服器,以適當的值來更新下列變數
    • [PROXY_URL] :Proxy 伺服器正在接聽的 URL。 您必須針對這個位置保留元,輸入一值。
    • [PROXY_PORT] :Proxy 伺服器接聽所在的埠。 您必須針對這個位置保留元,輸入一值。
TA_LOCAL_PUBLIC_ACCESSIBLE_API_SERVER_URL=<protocol>://[PROXY_URL]:[PROXY_PORT]  
TA_PUBLIC_ACCESSIBLE_UI_URL=<protocol>://[PROXY_URL]:[PROXY_PORT]  
vi .env_orig
  • 根據您的 Proxy 伺服器,以適當的值來更新下列變數
    • [PROXY_URL] :Proxy 伺服器正在接聽的 URL。 您必須針對這個位置保留元,輸入一值。
    • [PROXY_PORT] :Proxy 伺服器接聽所在的埠。 您必須針對這個位置保留元,輸入一值。
TA_LOCAL_PUBLIC_ACCESSIBLE_API_SERVER_URL=<protocol>://[PROXY_URL]:[PROXY_PORT] 
TA_PUBLIC_ACCESSIBLE_UI_URL=<protocol>://[PROXY_URL]:[PROXY_PORT]  
  • 如果您已啟用鑑別,還需要更新回呼 URI
vi .security_config
TA_LOCAL_TA_AUTH_OIDC_CALLBACK_URI=<protocol>://[PROXY_URL]:[PROXY_PORT]/auth/callback
  • 現在啟動 TA_LOCAL
./launchTransformationAdvisor.sh
Choose Start Transformation Advisor from the menu option

Proxy 伺服器配置

您需要採取的特定步驟,取決於您使用的 Proxy 伺服器。
對於 TA_LOCAL,您需要確定 Proxy 伺服器支援下列項目:

  • Proxy 指向使用者介面的埠(3000 或 3443)和 Advisor 埠 (2220)
  • 檔案的上傳大小上限大到足以上傳您的資料,建議的預設值是 250MB
  • 使用者介面 Proxy 必須支援 Web Socket
  • 若有啟用 TLS,您必須支援 SSL,並將 Proxy 配置成使用適當的憑證

nginx 的配置範例

這裡提供配置範例,以顯示 ngnix 所需的最小配置。
應根據您的特定環境和需求,套用進一步的配置。
在此範例中:-Proxy 伺服器位於 proxy.example.com -TA_LOCAL 位於 ta.example.com

非 TLS 配置範例

server {
   listen       3000;
   server_name  proxy.example.com;
   client_max_body_size 250M; #Max upload size
   
   location /lands_advisor/ {
     proxy_pass     http://ta.example.com:2220;
   }

   location / {
     proxy_pass     http://ta.example.com:3000; 
     #Support websockets
     proxy_http_version 1.1;
     proxy_set_header Upgrade $http_upgrade;
     proxy_set_header Connection "upgrade";
   }
 }

TLS 配置範例

此範例假設 Proxy 已產生它自己儲存在 Snippet 中的自簽憑證

server {
   listen       3443 ssl;
   
   include snippets/self-signed.conf;
   
   server_name  proxy.example.com;
   client_max_body_size 250M; #Max upload size
   
   location /lands_advisor/ {
     proxy_pass     https://ta.example.com:2220;
   }

   location / {
     proxy_pass     https://ta.example.com:3443; 
     #Support websockets
     proxy_http_version 1.1;
     proxy_set_header Upgrade $http_upgrade;
     proxy_set_header Connection "upgrade";
   }
 }

self-signed.conf 檔案會參照憑證及金鑰的位置。
這是範例 self-signed.conf 檔案

ssl_certificate /etc/ssl/certs/nginx-selfsigned.crt;
ssl_certificate_key /etc/ssl/private/nginx-selfsigned.key;

.