更新 ThingWorx Flow
下列版本支援手動更新 ThingWorx Flow
從 8.4.x 的較舊版本到 8.4.x 的較新版本。
從 8.4.x 到 8.5.x。
從 8.5.x 的較舊版本到 8.5.x 的較新版本。
* 
無法從 ThingWorx Flow 8.4.x 的全新安裝手動升級至 9.x。如果您想要從 ThingWorx Flow 8.4.x 的全新安裝升級至 9.x,必須 移轉 ThingWorx Flow
* 
如果您想要從 ThingWorx Flow 8.5. x 及更新版本的全新安裝升級至 9.x,必須使用 ThingWorx Flow 自動升級安裝程式
針對此程序,讓我們假設您目前正使用 <older-8.x.x>,且您想要更新至 <newer-8.x.x>
先決條件
在您更新 ThingWorx Flow 之前,請確保已設定下列先決條件:
您具備修改服務所有已安裝檔案的必要權限。
您已從 PTC 軟體下載網站下載適用於您作業系統的適當 ThingWorx Flow 修補程式更新 <newer-8.x.x>
以下是流程的主要步驟:
步驟 1:停止 ThingWorx FoundationThingWorx Flow 服務
根據您的作業系統,使用服務控制工具 (適用於 Windows 的 sc 或服務,與適用於 Linux 的 sysctl) 停止下列服務:
ThingWorxOrchestrationNginx 或 nginx
ThingWorx-Foundation
ThingWorx-Flow
RabbitMQ / rabbitmq.service
請確保所有個別流程都會完全停止。在更新資料夾時,任何執行中的流程都可能會導致後面的階段發生問題。
步驟 2:備份現有安裝
請備份您的現有安裝,其中包括但不限於下列內容:
ThingWorx Foundation 安裝資料夾中的 ThingworxPlatformThingworxStorage 資料夾
安裝 ThingWorx Flow 元件的 ThingworxOrchestration 資料夾
ThingWorx FoundationThingWorx Flow 資料庫
強烈建議您使用內建設備建立具有資料庫解決方案的備份。
在 PostgreSQL 中,使用 pg_dump 工具。在 Microsoft SQL Server 中,使用 SQL Server Management Studio。
如果您已在虛擬機器中安裝 ThingWorx Flow 與/或 ThingWorx Foundation,請使用原生快照功能回復更新。如果您的資料庫裝載在單獨的伺服器或虛擬機器上,若您回復為快照,必須還原資料庫備份。
步驟3:將 ThingWorx Foundation 更新至 <newer–8.x.x>
如果您要從 8.4.x 更新至 8.5.x,請參閱 升級至 ThingWorx 8.5 指南中適用於您的作業系統與資料庫類型的一節。
如果您要從 8.4.x 的較舊版本更新到 8.4.x 的較新版本,或從 8.5.x 的較舊版本更新到 8.5.x 的較新版本,您可能必須僅取代 Thingworx.war 檔案。
步驟 4:將 ThingWorx Flow 更新 tar 內容解壓縮至暫存資料夾
1. /ThingworxOrchestration 資料夾中建立一個新資料夾 modules-<newer-8.x.x>
modules-<newer-8.x.x> 資料夾必須與現有 modules 資料夾處於同一層級。
2. flow-upgrade-<newer-8.x.x>.tar.gz 修補程式更新的內容解壓縮至 modules-<newer-8.x.x> 資料夾。
在解壓縮 tar 的內容之後,/ThingworxOrchestration/modules-<newer-8.x.x>/ 資料夾必須包含下列資料夾:
configs
db_seed
engine
exchange
lookup
oauth
8.4.12 及更新版本、8.5.8 及更新版本 - ptc-flow-pm2 / pm2
README.pdf
static-ux
symphony-cli
symphony-connectors
symphony-deploy
symphony-sdk
symphony-test-helper
trigger
tw-security-common-nodejs
ux
(僅限 Windows) 8.4.12 及更新版本、8.5.8 及更新版本 - nginx-1.18.0.zip
(僅限 Windows) 8.4.12 及更新版本、8.5.8 及更新版本 - node-v12.16.3-win-x64.tar.gz
8.4.15 及更新版本、8.5.11 及更新版本 - node-v12.19.0-win-x64.tar.gz
步驟 5:將 ThingWorx Flow 服務取代為其修正版本
1. 欲將現有 ThingWorx Flow 組態設定與已修補的軟體合併,請將下列特定檔案或資料夾從現有 ThingWorxOrchestration/modules/ 資料夾複製到 /ThingWorxOrchestration/modules-<newer-8.x.x> 資料夾:
複製來源
複製目標
/ThingworxOrchestration/modules/db_seed/config
/ThingworxOrchestration/modules-<newer-8.x.x>/db_seed/
/ThingworxOrchestration/modules/db_seed/migration_config.json
/ThingworxOrchestration/modules-<newer-8.x.x>/db_seed/
/ThingworxOrchestration/modules/db_seed/SHA1
選用,只有在存在時。
/ThingworxOrchestration/modules-<newer-8.x.x>/db_seed/
/ThingworxOrchestration/modules/engine/config
/ThingworxOrchestration/modules-<newer-8.x.x>/engine/
/ThingworxOrchestration/modules/engine/deploymentConfig.json
/ThingworxOrchestration/modules-<newer-8.x.x>/engine/
/ThingworxOrchestration/modules/engine/SHA1
選用,只有在存在時。
/ThingworxOrchestration/modules-<newer-8.x.x>/engine/
/ThingworxOrchestration/modules/exchange/config
/ThingworxOrchestration/modules-<newer-8.x.x>/exchange/
/ThingworxOrchestration/modules/exchange/deploymentConfig.json
/ThingworxOrchestration/modules-<newer-8.x.x>/exchange/
/ThingworxOrchestration/modules/exchange/SHA1
選用,只有在存在時。
/ThingworxOrchestration/modules-<newer-8.x.x>/exchange/
/ThingworxOrchestration/modules/lookup/config
/ThingworxOrchestration/modules-<newer-8.x.x>/lookup/
/ThingworxOrchestration/modules/lookup/deploymentConfig.json
/ThingworxOrchestration/modules-<newer-8.x.x>/lookup/
/ThingworxOrchestration/modules/lookup/SHA1
選用,只有在存在時。
/ThingworxOrchestration/modules-<newer-8.x.x>/lookup/
/ThingworxOrchestration/modules/oauth/config
/ThingworxOrchestration/modules-<newer-8.x.x>/oauth/
/ThingworxOrchestration/modules/oauth/deploymentConfig.json
/ThingworxOrchestration/modules-<newer-8.x.x>/oauth/
/ThingworxOrchestration/modules/oauth/SHA1
選用,只有在存在時。
/ThingworxOrchestration/modules-<newer-8.x.x>/oauth/
/ThingworxOrchestration/modules/static-ux/config
/ThingworxOrchestration/modules-<newer-8.x.x>/static-ux/
/ThingworxOrchestration/modules/static-ux/SHA1
選用,只有在存在時。
/ThingworxOrchestration/modules-<newer-8.x.x>/static-ux/
/ThingworxOrchestration/modules/trigger/config
/ThingworxOrchestration/modules-<newer-8.x.x>/trigger/
/ThingworxOrchestration/modules/trigger/deploymentConfig.json
/ThingworxOrchestration/modules-<newer-8.x.x>/trigger/
/ThingworxOrchestration/modules/trigger/SHA1
選用,只有在存在時。
/ThingworxOrchestration/modules-<newer-8.x.x>/trigger/
/ThingworxOrchestration/modules/ux/config
/ThingworxOrchestration/modules-<newer-8.x.x>/ux/
/ThingworxOrchestration/modules/ux/deploymentConfig.json
/ThingworxOrchestration/modules-<newer-8.x.x>/ux/
/ThingworxOrchestration/modules/ux/SHA1
選用,只有在存在時。
/ThingworxOrchestration/modules-<newer-8.x.x>/ux/
/ThingworxOrchestration/modules/orchestration.pm2.json
/ThingworxOrchestration/modules-<newer-8.x.x>/
/ThingworxOrchestration/modules/cache
/ThingworxOrchestration/modules-<newer-8.x.x>/
/ThingworxOrchestration/modules/node_modules/config
/ThingworxOrchestration/modules-<newer-8.x.x>/symphony-connectors/node_modules/
2. 將下列資料夾與檔案從 /ThingworxOrchestration/modules-<newer-8.x.x>/symphony-connectors/ 移至 /ThingworxOrchestration/modules-<newer-8.x.x>/
node_modules
package.json
package-lock.json
3. /ThingworxOrchestration/modules-<newer-8.x.x>/ 中,刪除空的 symphony-connectors 資料夾。
4. 如果您要從 ThingWorx Flow 8.4.x 升級至 ThingWorx Flow 8.5.x,請將下列行新增至 /ThingworxOrchestration/modules-<newer-8.x.x>/engine/ 資料夾下的 deploymentConfig.json 檔案:
"ENGINE_SIZE": "1802",
"KILL_WORKER_AFTER_RUN": "false",
"AVAILABLE_WORKER_CHECK_TRIES": "10",
"AVAILABLE_WORKER_CHECK_INTERVAL": "3000",
"WORKER_DISMISS_INTERVAL": "1800",
5. 如果您要從 ThingWorx Flow 8.4.x 升級至 ThingWorx Flow 8.5.x,請將下列行新增至 /ThingworxOrchestration/modules-<newer-8.x.x>/ux/ 資料夾下的 deploymentConfig.json 檔案:
"EXCHANGE": {
"HOST": "localhost",
"PORT": "7822"
},
"lookup": {
"host": "http://localhost:8077"
},
6. 欲更新「Flow 公用程式」,請執行下列步驟:
a. /ThingWorxOrchestration/packages 刪除下列資料夾:
symphony-cli
symphony-deploy
symphony-sdk
symphony-test-helper
b. 將下列資料夾從 /ThingworxOrchestration/modules-<newer-8.x.x> 移至 /ThingWorxOrchestration/packages
symphony-cli
symphony-deploy
symphony-sdk
symphony-test-helper
c. 確保安裝 ThingWorx Flow 的使用者擁有所有「Flow 公用程式」的完整擁有權與權限。
例如,導覽至 /ThingWorxOrchestration/packages 資料夾並執行下列指令:
chown -R flowuser:flowuser symphony-cli
flowuser 取代為執行 ThingWorx Flow 安裝程式的使用者。
7. (僅限 Linux) 請確保安裝了 ThingWorx Flow 的使用者擁有 modules-<newer-8.x.x> 資料夾的完整擁有權與權限。
導覽至 ThingWorxOrchestration 資料夾並執行下列指令:
chown -R flowuser:flowuser modules-<newer-8.x.x>
flowuser 取代為執行 ThingWorx Flow 安裝程式的使用者。
8. (僅限 Windows) 將 RabbitMQ 資料夾從 modules 資料夾複製到 modules-<newer-8.x.x> 資料夾。
9. 在您複製所有組態設定之後,必須重新命名下列資料夾:
a. 將現有 modules 資料夾重新命名為 modules-<older-8.x.x>
b. modules-<newer-8.x.x> 資料夾重新命名為 modules
* 
在 Windows 中,您必須先停止 epmd.exe 流程,然後才能繼續重新命名資料夾。
例如,欲在 Linux 中重新命名資料夾,請執行下列指令:
a. mv /ThingworxOrchestration/modules /ThingworxOrchestration/modules-<older-8.x.x>
b. mv /ThingworxOrchestration/modules-<newer-8.x.x> /ThingworxOrchestration/modules
10. (僅限 Linux) 導覽至 ThingWorxOrchestration 資料夾,並執行下列指令來設定 modules 資料夾的完整權限:
chmod -R 777 modules
11. (僅限 Linux) 導覽至 ThingWorxOrchestration/modules 資料夾,並執行下列指令來將正確的安全性前後關聯設定為 static-ux 資料夾:
chcon -R -t httpd_sys_content_t static-ux
12. 重新命名並移動下列資料夾:
a. /ThingWorxOrchestration/cryptography 中的現有 tw-security-common-nodejs 資料夾重新命名為 tw-security-common-nodejs_<older-8.x.x>
b. tw-security-common-nodejs 資料夾從 /ThingworxOrchestration/modules/ 移至 /ThingWorxOrchestration/cryptography
c. 確保安裝 ThingWorx Flow 的使用者擁有 tw-security-common-nodejs 資料夾的完整擁有權與權限。
例如,導覽至 /ThingWorxOrchestration/cryptography 資料夾並執行下列指令:
chown -R flowuser:flowuser tw-security-common-nodejs
flowuser 取代為執行 ThingWorx Flow 安裝程式的使用者。
d. 如果您要更新至 8.4.x,請導覽至 /ThingWorxOrchestration/cryptography/tw-security-common-nodejs 資料夾,並執行下列指令:
在 Windows 上,執行 npm install
在 Linux 上,執行 sudo npm install
在 Linux 上,執行 sudo chown -R flowuser:flowuser node_modules
flowuser 取代為執行 ThingWorx Flow 安裝程式的使用者。
步驟 6:更新 Nginx、PM2 與 NodeJS,如果尚未更新 (8.4.12 及更新版本、8.5.8 及更新版本)
如果您已使用下列版本,請跳過此步驟:
Nginx-1.18.0
PM2-4.4.0
NodeJS-12.19.x
* 
如果您跳過此步驟,請從 modules 資料夾中刪除下列資料夾:
ptc-flow-pm2 / pm2
nginx-1.18.0.zip
node-v12.19.0-win-x64.tar.gz
Nginx
視窗
1. C:\Program Files\nginx-1.13.12 重新命名為 C:\Program Files\nginx-1.13.12_old
2. <Flow 安裝目錄>\modules 中,解壓縮 C:\Program Files 下的 nginx-1.18.0.zip。核對您是否可以看到 C:\Program Files\nginx-1.18.0\nginx.exe
3. C:\Program Files\nginx-1.18.0 重新命名為 C:\Program Files\nginx-1.13.12
4. C:\Program Files\nginx-1.13.12\conf\nginx.conf 檔案取代為 C:\Program Files\nginx-1.13.12_old\conf\nginx.conf 檔案。
5. C:\Program Files\nginx-1.13.12_old\conf\conf.d 檔案複製到 C:\Program Files\nginx-1.13.12\conf\
6. <Flow 安裝目錄>\modules 中,刪除 nginx-1.18.0.zip
Linux
1. 使用下列內容建立 /etc/yum.repos.d/nginx.repo 檔案:
[nginx-stable]
name=nginx stable repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=1
enabled=1
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true
2. 執行 sudo yum upgrade nginx 指令。
PM2
視窗
1. 備份 <Flow 安裝目錄>\packages\ptc-flow-pm2\node_modules\pm2-windows-service-nosetup\src\daemon 資料夾。
如果您使用 ThingWorx Flow 8.4.x,則 ptc-flow-pm2 資料夾稱為 pm2
2. <Flow 安裝目錄>\packages\ptc-flow-pm2 資料夾重新命名為 ptc-flow-pm2_old
如果您使用 ThingWorx Flow 8.4,請將 pm2 重新命名為 pm2_old
3. 如果您要從 8.4.x 更新,請執行下列操作:
a. pm2 資料夾從 <Flow 安裝目錄>\modules 移至 <Flow 安裝目錄>\packages,並將其重新命名為 pm2
b. 編輯 <Flow 安裝目錄 >\packages\pm2\node_modules\pm2-windows-service-nosetup\src\daemon\thingworxflow.xml 檔案,以使下列路徑有效:
<argument>C:\ThingWorxOrchestration\packages\pm2\node_modules\node-windows\lib\wrapper.js</argument>
c. 將下列內容新增至 Path 環境變數:
C:\ThingWorxOrchestration\packages\pm2\node_modules\.bin
d. 新增下列環境變數:
PM2_SERVICE_PM2_DIR = C:\ThingWorxOrchestration\packages\pm2\node_modules\pm2
4. 如果您要從 8.5.x 更新,請將 <Flow 安裝目錄>\packages\ptc-flow-pm2 取代為 <Flow 安裝目錄>\modules 中的 ptc-flow-pm2 資料夾。
5. 將備份 Daemon 目錄複寫到 <Flow 安裝目錄>\packages\ptc-flow-pm2\node_module\pm2-windows-service-nosetup\src
如果您使用 ThingWorx Flow 8.4.x,則 ptc-flow-pm2 資料夾稱為 pm2
Linux
1. <Flow 安裝目錄>/packages/ptc-flow-pm2 取代為 <Flow 安裝目錄>\modules 中的 ptc-flow-pm2 資料夾。
如果您使用 ThingWorx Flow 8.4.x,則在 packages 下,ptc-flow-pm2 資料夾稱為 pm2
2. 如果您要從 8.4.x 更新,請執行下列操作:
a. <Flow 安裝目錄>/packages/pm2 資料夾重新命名為 pm2_old
b. ptc-flow-pm2 資料夾從 <Flow 安裝目錄>/modules 移至 <Flow 安裝目錄>/packages,並將其重新命名為 pm2
NodeJS
視窗
1. <Flow 安裝目錄>\modules 中,解壓縮 node-v12.19.0-win-x64.tar.gz
2. <Flow 安裝目錄>\node 資料夾取代為解壓縮的資料夾。
3. <Flow 安裝目錄>\modules 中,刪除 node-v12.19.0-win-x64.tar.gz
Linux
執行下列指令:
1. sudo su
2. sudo curl -sL https://rpm.nodesource.com/setup_12.x | bash
3. sudo yum install nodejs
4. sudo yum remove rh-nodejs8
5. sudo rm -R /opt/rh
步驟 7:將 Nginx 中的上載大小限制於 1 GB (僅從 8.4.x 升級至 8.5.x)
1. <Nginx config 目錄>\conf.d\vhost-flow.conf 檔案中,尋找以下這一行:
client_max_body_size 18M;
2. 將值從 18M 更新為 1000M。
3. 核對結果看起來是否像這樣:
client_max_body_size 1000M;
步驟 8:加密 Nginx 私密金鑰 (8.4.14 及更新版本、8.5.10 及更新版本)
下一節描述您需要執行來加密現成金鑰檔案的步驟。如果您使用的是不同的 .key 檔案,請將所有 orchestration.key 參考取代為您的金鑰檔案名稱。
1. <Flow 安裝目錄>\SSL 資料夾下,建立包含已加密私密金鑰密碼的 nginx-keyfile 檔案。
2. 使用 openssl 公用程式執行下列指令:
<openssl_cmd> rsa -aes256 -passout pass:<在 nginx 金鑰檔案中定義的相同密碼> -in "<Flow 安裝目錄>\SSL\orchestration.key" -out "<Flow 安裝目錄>\SSL\orchestration_enc.key"
其中,在 Windows 中,<openssl_cmd> - 執行 cd C:/opscode/chef/embedded/bin、鍵入 openssl,並執行上述指令。
在 Linux 中,<openssl_cmd> - 鍵入 openssl 並執行上述指令。
3. 刪除 orchestration.key 並將 orchestration_enc.key 重新命名為 orchestration.key
4. <Nginx config 目錄>\conf.d\vhost-flow.conf 檔案中,在 ssl_certificate_key 參數後新增以下這一行:
ssl_password_file "<Flow 安裝目錄>\SSL\nginx-keyfile";
其中,在 Windows 中,<Nginx config 目錄>C:\Program Files\nginx-1.18.0\conf,在 Linux 中是 /etc/nginx
5. (僅限 Linux) 執行下列指令:
a. sudo chown flowuser:flowuser <Flow 安裝目錄>\SSL\orchestration.key,其中 flowuser 是執行 ThingWorx Flow 安裝程式的使用者。
b. sudo chcon -t httpd_sys_content_t <Flow 安裝目錄>\SSL\orchestration.key
c. sudo chown flowuser:flowuser <Flow 安裝目錄>\SSL\nginx-keyfile,其中 flowuser 是執行 ThingWorx Flow 安裝程式的使用者。
d. sudo chcon -t httpd_sys_content_t <Flow 安裝目錄>\SSL\nginx-keyfile
步驟 9:在 Nginx configuration (8.4.14 及更新版本、8.5.10 及更新版本) 中進行安全性變更
1. 更新 <Nginx config 目錄>\nginx.conf 檔案,以防止暴力攻擊並開啟 Nginx 中的速率限制機制。這會限制從特定 IP 位址執行的請求數。
a. 找到下列各行:
# limit_req_zone $limit_key zone=by_ip:10m rate=100r/s;
# limit_req_zone $limit_method zone=post:10m rate=20r/s;
# limit_req_zone $request_uri zone=by_uri:10m rate=500r/m;
# # limit_req_zone "$binary_remote_addr$request_uri" zone=by_uri_ip:10m rate=2r/s;
# # limit_req_zone $http_authorization zone=by_oauth_token:100m rate=1r/m;
# limit_req_status 429;
b. 取消第一行與最後一行的註解。
c. 在第一行中,將速率修改為 500r/s
* 
您可以將速率 (每秒請求數) 設定為其他數字。但是,500r/s 是非法用戶端無法到達的合理每秒請求數。
d. 核對結果看起來是否像這樣:
limit_req_zone $limit_key zone=by_ip:10m rate=500r/s;
# limit_req_zone $limit_method zone=post:10m rate=20r/s;
# limit_req_zone $request_uri zone=by_uri:10m rate=500r/m;
# # limit_req_zone "$binary_remote_addr$request_uri" zone=by_uri_ip:10m rate=2r/s;
# # limit_req_zone $http_authorization zone=by_oauth_token:100m rate=1r/m;
limit_req_status 429;
2. 更新 <Nginx config 目錄>\nginx.conf 檔案,以將快取控制標題設定為 no-cache:
a. 找到以下這一行:
map $sent_http_content_type $expires {
b. text/html 的值變更為 -1
c. 核對結果看起來是否像這樣:
map $sent_http_content_type $expires {
default off;
text/html -1;
text/css 30d;
application/javascript 7d;
~image/ 30d;
}
3. 更新 <Nginx config 目錄>\conf.d\vhost-flow.conf 檔案,以封鎖 HEAD HTTP 方法:
a. 找到下列各行:
if ($scheme = "https") {
set $secure_var "secure";
}
b. 在上述幾行前面新增下列幾行:
# block 'head' http method for security reasons
if ($request_method = 'HEAD') {
return 405;
}
c. 核對結果看起來是否像這樣:
set $proxy_scheme $scheme;
# block 'head' http method for security reasons
if ($request_method = 'HEAD') {
return 405;
}
if ($scheme = "https") {
set $secure_var "secure";
}
4. 更新 <Nginx config 目錄>\conf.d\vhost-flow.conf 檔案,以避免外部重新導向至 location ~ ^(/config|/js|/locales|/resources)
a. 找到下列各行:
location /Thingworx/Flow {
rewrite /Thingworx/Flow/(.*) /$1 break;
try_files $uri $uri/ @flow_api;
}
b. try_files $uri $uri/ @flow_api; 變更為 try_files $uri @flow_api;
c. 在上述幾行後面新增下列幾行:
# avoid external redirects for bellow locations
location ~ ^(/config|/js|/locales|/resources) {
internal;
}
d. 核對結果看起來是否像這樣:
location /Thingworx/Flow {
rewrite /Thingworx/Flow/(.*) /$1 break;
try_files $uri @flow_api;
}
# avoid external redirects for bellow locations
location ~ ^(/config|/js|/locales|/resources) {
internal;
}
location @flow_api {
5. <Nginx config 目錄>\conf.d\vhost-flow.conf 檔案更新為封鎖 options HTTP 方法,並為下列位置新增暴力攻擊防護的速率限制:
位置
步驟 1:尋找位置
步驟 2:在位置之後新增指定內容
步驟 3:取消指定行的註解
步驟 4:將指定的內容新增至取消註解的行
步驟 5:核對結果
location /Thingworx/Oauths
location /Thingworx/Oauths {
# limit_req zone=by_ip;
# limit_conn addr 500;
# block 'options' http method for security reasons
if ($request_method = 'OPTIONS') {
return 405;
}
# limit_req zone=by_ip;
burst=10 nodelay
location /Thingworx/Oauths {
# block 'options' http method for security reasons
if ($request_method = 'OPTIONS') {
return 405;
}
limit_req zone=by_ip burst=10 nodelay;
# limit_conn addr 500;
location /Thingworx/Triggers
location /Thingworx/Triggers {
# limit_req zone=by_ip;
# limit_conn addr 500;
# block 'options' http method for security reasons
if ($request_method = 'OPTIONS') {
return 405;
}
# limit_req zone=by_ip;
burst=10 nodelay
location /Thingworx/Triggers {
# block 'options' http method for security reasons
if ($request_method = 'OPTIONS') {
return 405;
}
limit_req zone=by_ip burst=10 nodelay;
# limit_conn addr 500;
location @flow_api
location @flow_api {
# limit_req zone=by_ip;
# limit_conn addr 500;
# block 'options' http method for security reasons
if ($request_method = 'OPTIONS') {
return 405;
}
# limit_req zone=by_ip;
burst=10 nodelay
location @flow_api {
# block 'options' http method for security reasons
if ($request_method = 'OPTIONS') {
return 405;
}
limit_req zone=by_ip burst=10 nodelay;
# limit_conn addr 500;
6. <Nginx config 目錄>\conf.d\vhost-flow.conf 檔案更新為為下列位置新增暴力攻擊防護的速率限制:
位置
步驟 1:尋找位置
步驟 2:取消指定行的註解
步驟 3:將指定的內容新增至取消註解的行
步驟 4:核對結果
location /Thingworx/Composer/apps/flow
location /Thingworx/Composer/apps/flow {
rewrite /Thingworx/Composer/apps/flow/(.*) /$1 break;
# limit_req zone=by_ip;
# limit_conn addr 500;
# limit_req zone=by_ip;
burst=10 nodelay
location /Thingworx/Composer/apps/flow {
rewrite /Thingworx/Composer/apps/flow/(.*) /$1 break;
limit_req zone=by_ip burst=10 nodelay;
# limit_conn addr 500;
location ~* \.(jpg|jpeg|png|gif|ico|css|js|svg|woff2?)$
location ~* \.(jpg|jpeg|png|gif|ico|css|js|svg|woff2?)$ {
rewrite /Thingworx/Composer/apps/flow/(.*) /$1 break;
# limit_req zone=by_ip burst=10 nodelay;
expires $expires;
# limit_req zone=by_ip burst=10 nodelay;
location ~* \.(jpg|jpeg|png|gif|ico|css|js|svg|woff2?)$ {
rewrite /Thingworx/Composer/apps/flow/(.*) /$1 break;
limit_req zone=by_ip burst=10 nodelay;
expires $expires;
location /Thingworx/Lookups
location /Thingworx/Lookups {
# limit_req zone=by_ip;
burst=10 nodelay
location /Thingworx/Lookups {
add_header 'Access-Control-Allow-Credentials' 'true';
add_header 'Access-Control-Allow-Methods' 'GET,POST,PUT,DELETE,OPTIONS,HEAD';
add_header 'Access-Control-Allow-Headers' 'Authorization, Content-Length, X-Requested-With, application_uid, application_id, application_api_key, authtoken, Content-Type';
add_header 'Access-Control-Max-Age' '1728000';
if ($request_method = 'OPTIONS') {
return 200;
}
limit_req zone=by_ip burst=10 nodelay;
# limit_conn addr 500;
location /Thingworx/WS
location /Thingworx/WS {
# limit_req zone=by_ip;
burst=10 nodelay
location /Thingworx/WS {
limit_req zone=by_ip burst=10 nodelay;
# limit_conn addr 500;
location /Thingworx/RemoteTunnel
location /Thingworx/RemoteTunnel {
# limit_req zone=by_ip;
burst=10 nodelay
location /Thingworx/RemoteTunnel {
limit_req zone=by_ip burst=10 nodelay;
# limit_conn addr 500;
location /Thingworx/WSTunnelClient/
location /Thingworx/WSTunnelClient/ {
# limit_req zone=by_ip;
burst=10 nodelay
location /Thingworx/WSTunnelClient/ {
limit_req zone=by_ip burst=10 nodelay;
# limit_conn addr 500;
location /Thingworx/WSTunnelServer/
location /Thingworx/WSTunnelServer/ {
# limit_req zone=by_ip;
burst=10 nodelay
location /Thingworx/WSTunnelServer/ {
limit_req zone=by_ip burst=10 nodelay;
# limit_conn addr 500;
location /Thingworx
location /Thingworx {
# limit_req zone=by_ip;
burst=10 nodelay
location /Thingworx {
limit_req zone=by_ip burst=10 nodelay;
# limit_conn addr 500;
(選用) 步驟 10:對 ThingWorx FoundationThingWorx Flow 進行組態變更
如果需要,請繼續對 ThingWorx FoundationThingWorx Flow 服務進行組態變更。
如果修補程式引入了新的組態設定,可能需要執行此操作。如需有關新組態設定和可以使用這些設定的檔案的詳細資訊,請參閱 發行版本說明
步驟 11:以 ThingWorx Flow 的最新更新重新植入資料庫
重新植入 ThingWorx Flow 資料庫不會影響任何現有使用者擁有的實體,例如工作流程或觸發器。
1. 啟動指令提示並導覽至 /ThingWorxOrchestration/modules/db_seed
2. 執行下列指令:
flow-deploy migrate -u <Flow 資料庫使用者名稱> -p <Flow 資料庫密碼> -s <Flow 安裝目錄>
在 Linux 中,以非根使用者的身份執行 flow-deploy 指令。
(選用) 步驟 12:部署自訂連接器
* 
請僅在您已使用 ThingWorx Flow 接器 SDK 部署自訂連接器的情下,完成此部份的步驟。
1. 確保來源程式碼可在相同系統使用。
2. 導覽至連接器的根目錄並執行 flow-deploy connector 指令。
如需詳細資訊,請參閱 部署連接器
3. 執行下列指令以在資料庫中植入自訂連接器:
flow-deploy migrate -u <Flow 資料庫使用者名稱> -p <Flow 資料庫密碼> -s <Flow 安裝目錄>
步驟 13:啟動服務並核對其狀況
1. 以下列順序啟動在步驟 1 中停止的服務:
a. RabbitMQ / rabbitmq.service
* 
檢查 RabbitMQ 記錄檔,以在您啟動下一個服務之前,確認 RabbitMQ 服務是否已完全啟動。
Windows:/ThingworxOrchestration/modules/RabbitMQ/log/rabbit@{hostname}.log
Linux:/var/log/rabbitmq/rabbit@{hostname}.log
b. ThingWorx-Foundation
c. ThingWorx-Flow
d. ThingWorxOrchestrationNginx 或 nginx
2. 檢閱 ThingWorx Foundation 記錄檔,並確認在啟動期間沒有發生意外錯誤或警告。
3. 若要核對 ThingWorx Flow 是否已正確更新,請以管理員身份啟動指令提示並執行下列指令:
pm2 ls
下列 ThingWorx Flow 元件的狀況必須為 'online':
flow-api
flow-engine
flow-exchange
flow-lookup
flow-oauth-server
flow-trigger
欲檢視個別服務的記錄檔,請執行 pm2 logs <服務名稱> 指令。
步驟 14:重新啟動「工作流程子系統」
1. 登入 ThingWorx Foundation
2. 導覽至「子系統」 > 「工作流程子系統」
3. 按一下「重新啟動」
步驟 15:核對功能是否如預期運作
測試 ThingWorx FoundationThingWorx Flow 中的功能,確定其是否如預期般運作。確定您是否可以在 ThingWorx Composer 與「工作流程編輯器」中撰寫工作流程。例如,您可以執行下列任務:
登入 ThingWorx Flow 儀表板。如需瞭解如何存取 ThingWorx FlowThingWorx Composer ,請參閱 存取 ThingWorx Flow 與 ThingWorx Composer
為您要使用的每個連接器建立 授權連線
步驟 16:刪除 tw-security-common-nodejs_<較早-8.x.x> 資料夾
/ThingWorxOrchestration/cryptography 資料夾中,刪除 tw-security-common-nodejs_<older-8.x.x> 資料夾。
(選用) 步驟 17:刪除 modules-<較早-8.x.x> 資料夾
在您驗證並確認更新已成功且工作流程成功執行 (且不再需要之前的發行版本) 之後,刪除 modules-<older-8.x.x> 資料夾。
您已成功更新 ThingWorx Flow
* 
如果引擎中的工作流程執行過程突然停止,請遵循 疑難排解 ThingWorx Flow 安裝中的步驟。