更新 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 自动升级安装程序
在此过程中,我们假定您当前使用的是 <较旧版本-8.x.x>,并且您想要更新为 <较新版本-8.x.x>
先决条件
在更新 ThingWorx Flow 之前,请确保已设置了以下先决条件:
您具有修改服务的所有已安装文件的必要权限。
已从 PTC 软件下载网站下载适用于您的操作系统的 ThingWorx Flow 补丁更新 <较新版本-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 更新为 <较新版本-8.x.x>
如果要从 8.4.x 更新为 8.5.x,请参阅 Upgrading to ThingWorx 8.5 指南中适用于您的操作系统和数据库类型的部分。
如果要从较旧版本 8.4.x 更新为较新版本 8.4.x,或从较旧版本 8.5.x 更新为较新版本 8.5.x,则必要的操作可能仅为替换 Thingworx.war 文件。
步骤 4:将 ThingWorx Flow 更新 tar 内容提取到临时文件夹中
1. /ThingworxOrchestration 文件夹中创建新的文件夹 modules-<较新版本-8.x.x>
modules-<较新版本-8.x.x> 文件夹必须与现有 modules 文件夹处于同一级别。
2. flow-upgrade-<较新版本-8.x.x>.tar.gz 补丁更新的内容提取到 modules-<较新版本-8.x.x> 文件夹中。
提取 tar 的内容后,/ThingworxOrchestration/modules-<较新版本-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-<较新版本-8.x.x> 文件夹:
复制自
复制到
/ThingworxOrchestration/modules/db_seed/config
/ThingworxOrchestration/modules-<较新版本-8.x.x>/db_seed/
/ThingworxOrchestration/modules/db_seed/migration_config.json
/ThingworxOrchestration/modules-<较新版本-8.x.x>/db_seed/
/ThingworxOrchestration/modules/db_seed/SHA1
(可选) 仅当其存在时。
/ThingworxOrchestration/modules-<较新版本-8.x.x>/db_seed/
/ThingworxOrchestration/modules/engine/config
/ThingworxOrchestration/modules-<较新版本-8.x.x>/engine/
/ThingworxOrchestration/modules/engine/deploymentConfig.json
/ThingworxOrchestration/modules-<较新版本-8.x.x>/engine/
/ThingworxOrchestration/modules/engine/SHA1
(可选) 仅当其存在时。
/ThingworxOrchestration/modules-<较新版本-8.x.x>/engine/
/ThingworxOrchestration/modules/exchange/config
/ThingworxOrchestration/modules-<较新版本-8.x.x>/exchange/
/ThingworxOrchestration/modules/exchange/deploymentConfig.json
/ThingworxOrchestration/modules-<较新版本-8.x.x>/exchange/
/ThingworxOrchestration/modules/exchange/SHA1
(可选) 仅当其存在时。
/ThingworxOrchestration/modules-<较新版本-8.x.x>/exchange/
/ThingworxOrchestration/modules/lookup/config
/ThingworxOrchestration/modules-<较新版本-8.x.x>/lookup/
/ThingworxOrchestration/modules/lookup/deploymentConfig.json
/ThingworxOrchestration/modules-<较新版本-8.x.x>/lookup/
/ThingworxOrchestration/modules/lookup/SHA1
(可选) 仅当其存在时。
/ThingworxOrchestration/modules-<较新版本-8.x.x>/lookup/
/ThingworxOrchestration/modules/oauth/config
/ThingworxOrchestration/modules-<较新版本-8.x.x>/oauth/
/ThingworxOrchestration/modules/oauth/deploymentConfig.json
/ThingworxOrchestration/modules-<较新版本-8.x.x>/oauth/
/ThingworxOrchestration/modules/oauth/SHA1
(可选) 仅当其存在时。
/ThingworxOrchestration/modules-<较新版本-8.x.x>/oauth/
/ThingworxOrchestration/modules/static-ux/config
/ThingworxOrchestration/modules-<较新版本-8.x.x>/static-ux/
/ThingworxOrchestration/modules/static-ux/SHA1
(可选) 仅当其存在时。
/ThingworxOrchestration/modules-<较新版本-8.x.x>/static-ux/
/ThingworxOrchestration/modules/trigger/config
/ThingworxOrchestration/modules-<较新版本-8.x.x>/trigger/
/ThingworxOrchestration/modules/trigger/deploymentConfig.json
/ThingworxOrchestration/modules-<较新版本-8.x.x>/trigger/
/ThingworxOrchestration/modules/trigger/SHA1
(可选) 仅当其存在时。
/ThingworxOrchestration/modules-<较新版本-8.x.x>/trigger/
/ThingworxOrchestration/modules/ux/config
/ThingworxOrchestration/modules-<较新版本-8.x.x>/ux/
/ThingworxOrchestration/modules/ux/deploymentConfig.json
/ThingworxOrchestration/modules-<较新版本-8.x.x>/ux/
/ThingworxOrchestration/modules/ux/SHA1
(可选) 仅当其存在时。
/ThingworxOrchestration/modules-<较新版本-8.x.x>/ux/
/ThingworxOrchestration/modules/orchestration.pm2.json
/ThingworxOrchestration/modules-<较新版本-8.x.x>/
/ThingworxOrchestration/modules/cache
/ThingworxOrchestration/modules-<较新版本-8.x.x>/
/ThingworxOrchestration/modules/node_modules/config
/ThingworxOrchestration/modules-<较新版本-8.x.x>/symphony-connectors/node_modules/
2. 将以下文件夹和文件从 /ThingworxOrchestration/modules-<较新版本-8.x.x>/symphony-connectors/ 移至 /ThingworxOrchestration/modules-<较新版本-8.x.x>/
node_modules
package.json
package-lock.json
3. /ThingworxOrchestration/modules-<较新版本-8.x.x>/ 中,删除空文件夹 symphony-connectors
4. 如果要从 ThingWorx Flow 8.4.x 升级至 ThingWorx Flow 8.5.x,将以下行添加至 deploymentConfig.json 文件,该文件位于 /ThingworxOrchestration/modules-<较新版本-8.x.x>/engine/ 文件夹中:
"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,将以下行添加至 deploymentConfig.json 文件,该文件位于/ThingworxOrchestration/modules-<较新版本-8.x.x>/ux/ 文件夹中。
"EXCHANGE": {
"HOST": "localhost",
"PORT": "7822"
},
"lookup": {
"host": "http://localhost:8077"
},
6. 要更新工作流实用程序,请执行以下步骤:
a. /ThingWorxOrchestration/packages 删除以下文件夹:
symphony-cli
symphony-deploy
symphony-sdk
symphony-test-helper
b. 将以下文件夹从 /ThingworxOrchestration/modules-<较新版本-8.x.x> 移至 /ThingWorxOrchestration/packages
symphony-cli
symphony-deploy
symphony-sdk
symphony-test-helper
c. 请确保安装 ThingWorx Flow 的用户拥有所有工作流实用程序的完整所有权和权限。
例如,导航至 /ThingWorxOrchestration/packages 文件夹并运行以下命令:
chown -R flowuser:flowuser symphony-cli
flowuser 替换为运行 ThingWorx Flow 安装程序的用户。
7. (仅限 Linux) 确保已安装 ThingWorx Flow 的用户对 modules-<较新版本-8.x.x> 文件夹具有完整所有权和权限。
导航至 ThingWorxOrchestration 文件夹,并运行以下命令:
chown -R flowuser:flowuser modules-<较新版本-8.x.x>
flowuser 替换为运行 ThingWorx Flow 安装程序的用户。
8. (仅限 Windows) 将 RabbitMQ 文件夹从 modules 文件夹复制到 modules-<较新版本-8.x.x> 文件夹。
9. 所有配置设置均复制完毕后,必须重命名以下文件夹:
a. 将现有 modules 文件夹重命名为 modules-<较旧版本-8.x.x>
b. modules-<较新版本-8.x.x> 文件夹重命名为 modules
* 
对于 Windows 系统,在继续重命名文件夹之前,必须先停止 epmd.exe 进程。
例如,要重命名 Linux 系统中的文件夹,请运行以下命令:
a. mv /ThingworxOrchestration/modules /ThingworxOrchestration/modules-<较旧版本-8.x.x>
b. mv /ThingworxOrchestration/modules-<较新版本-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_<较旧版本-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
Windows
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
Windows
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.x,则将 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 安装目录>\modules 中将 <Flow 安装目录>\packages\ptc-flow-pm2 替换为 ptc-flow-pm2 文件夹。
5. 将备份的监控程序目录复制到 <Flow 安装目录>\packages\ptc-flow-pm2\node_module\pm2-windows-service-nosetup\src
如果您使用的是 ThingWorx Flow 8.4.x,则 ptc-flow-pm2 文件夹名为 pm2
Linux
1. <Flow 安装目录>\modules 中,将 <Flow 安装目录>/packages/ptc-flow-pm2 替换为 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
Windows
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 配置目录>\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-keyfile 中定义的密码相同> -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 配置目录>\conf.d\vhost-flow.conf file 中,于 ssl_certificate_key 参数后添加以下行:
ssl_password_file "<Flow 安装目录>\SSL\nginx-keyfile";
其中,<Nginx 配置目录> 在 Windows 上为 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 配置中进行安全更改 (8.4.14 及更高版本,8.5.10 及更高版本)
1. 更新 <Nginx 配置目录>\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 配置目录>\nginx.conf 文件,以将缓存控制标题设置为无缓存:
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 配置目录>\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 配置目录>\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 配置目录>\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 配置目录>\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 <工作流数据库用户名> -p <工作流数据库密码> -s <工作流安装目录>
在 Linux 系统中,以非 root 用户身份运行 flow-deploy 命令。
(可选) 步骤 12:部署自定义连接器
* 
只有在您使用 ThingWorx Flow SDK 开发了自定义连接器后,才需要完成本部分的各个步骤。
1. 确保源代码在同一系统中可用。
2. 导航至连接器的根目录,然后运行 flow-deploy connector 命令。
有关详细信息,请参阅 部署连接器
3. 运行以下命令,以在数据库中设定自定义连接器的种子:
flow-deploy migrate -u <工作流数据库用户名> -p <工作流数据库密码> -s <工作流安装目录>
步骤 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 组件的状态必须为“在线”:
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_<较旧版本-8.x.x> 文件夹。
(可选) 步骤 17:删除 modules-<较旧版本-8.x.x> 文件夹。
在验证并确认更新成功且工作流成功运行 (不再需要先前版本) 后,删除 modules-<较旧版本-8.x.x> 文件夹。
您已成功更新 ThingWorx Flow
* 
如果引擎中的工作流执行突然停止,请安装 排除 ThingWorx Flow 安装故障中的步骤进行故障排除。