Updating ThingWorx Flow
Updating ThingWorx Flow manually is supported for the following versions:
From an older version of 8.4.x to a later version of 8.4.x.
From 8.4.x to 8.5.x.
From an older version of 8.5.x to a later version of 8.5.x.
For this procedure, let us assume that you are currently on <older-8.x.x> and you want to update to <newer-8.x.x>.
Prerequisites
Before you update ThingWorx Flow, ensure that you have set the following prerequisites:
You have the necessary privileges to modify all installed files for the services.
You have downloaded the appropriate ThingWorx Flow patch update <newer-8.x.x> version for your operating system from the PTC Software Downloads website.
Here are the main steps of the process:
Step 1: Stop the ThingWorx Foundation and ThingWorx Flow services
Depending on your operating system, use the service control tools, sc or Services for Windows and sysctl for Linux to stop the following services:
ThingWorxOrchestrationNginx or nginx
ThingWorx-Foundation
ThingWorx-Flow
RabbitMQ / rabbitmq.service
Ensure that all respective processes are completely stopped. Any running process may cause issues in later stages while updating the folders.
Step 2: Back up your existing installation
Back up your existing installation that includes, but is not limited to the following:
The ThingworxPlatform and ThingworxStorage folders in your ThingWorx Foundation installation folder
The ThingworxOrchestration folder where ThingWorx Flow components were installed
The ThingWorx Foundation and ThingWorx Flow databases
It is strongly recommended that you use the in built facilities to create backups with your database solution.
On PostgreSQL, use the pg_dump tool. On Microsoft SQL Server, use SQL Server Management Studio.
If you have installed ThingWorx Flow and/ or ThingWorx Foundation on virtual machines, use the native snapshot functionality to roll back an update. If you revert to the snapshot, you must restore your database backup if your database is hosted on a separate server or a virtual machine.
Step 3: Update ThingWorx Foundation to <newer–8.x.x>
If you are updating from 8.4.x to 8.5.x, refer to the section that is appropriate to your operating system and database type in the Upgrading to ThingWorx 8.5 guide.
If you are updating from an older version of 8.4.x to a newer version of 8.4.x, or an older version of 8.5.x to a newer version of 8.5.x, you might have to replace the Thingworx.war file only.
Step 4: Extract the ThingWorx Flow update tar contents to a temporary folder
1. Create a new folder, modules-<newer-8.x.x> in the /ThingworxOrchestration folder.
This modules-<newer-8.x.x> folder must be parallel to the existing modules folder.
2. Extract the contents of the flow-upgrade-<newer-8.x.x>.tar.gz patch update to the modules-<newer-8.x.x> folder.
After you extract the contents of the tar, the /ThingworxOrchestration/modules-<newer-8.x.x>/ folder must have the following folders:
configs
db_seed
engine
exchange
lookup
oauth
README.pdf
static-ux
symphony-cli
symphony-connectors
symphony-deploy
symphony-sdk
symphony-test-helper
trigger
tw-security-common-nodejs
ux
Step 5: Replace the ThingWorx Flow services with their patched versions
1. To merge the existing ThingWorx Flow configuration setup with the patched software, copy the following specific files or folders from the existing ThingWorxOrchestration/modules/ folder to the /ThingWorxOrchestration/modules-<newer-8.x.x> folder:
Copy from
Copy to
/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
Optional, only if it exists.
/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
Optional, only if it exists.
/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
Optional, only if it exists.
/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
Optional, only if it exists.
/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
Optional, only if it exists.
/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
Optional, only if it exists.
/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
Optional, only if it exists.
/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
Optional, only if it exists.
/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. Move the following folders and files from /ThingworxOrchestration/modules-<newer-8.x.x>/symphony-connectors/ to /ThingworxOrchestration/modules-<newer-8.x.x>/:
node_modules
package.json
package-lock.json
3. From /ThingworxOrchestration/modules-<newer-8.x.x>/, delete the empty symphony-connectors folder.
4. If you are upgrading from ThingWorx Flow 8.4.x to ThingWorx Flow 8.5.x, add the following lines to the deploymentConfig.json file under the /ThingworxOrchestration/modules-<newer-8.x.x>/engine/ folder:
"ENGINE_SIZE": "1802",
"KILL_WORKER_AFTER_RUN": "false",
"AVAILABLE_WORKER_CHECK_TRIES": "10",
"AVAILABLE_WORKER_CHECK_INTERVAL": "3000",
"WORKER_DISMISS_INTERVAL": "1800",
5. If you are upgrading from ThingWorx Flow 8.4.x to ThingWorx Flow 8.5.x, add the following lines to the deploymentConfig.json file under the /ThingworxOrchestration/modules-<newer-8.x.x>/ux/ folder:
"EXCHANGE": {
"HOST": "localhost",
"PORT": "7822"
},
"lookup": {
"host": "http://localhost:8077"
},
6. To update Flow Utilities, perform the following steps:
a. Delete the following folders from /ThingWorxOrchestration/packages:
symphony-cli
symphony-deploy
symphony-sdk
symphony-test-helper
b. Move the following folders from /ThingworxOrchestration/modules-<newer-8.x.x> to /ThingWorxOrchestration/packages:
symphony-cli
symphony-deploy
symphony-sdk
symphony-test-helper
c. Ensure that the user that installed ThingWorx Flow has complete ownership and permissions to all the Flow Utilities.
For example, navigate to the /ThingWorxOrchestration/packages folder and run the following command:
chown -R flowuser:flowuser symphony-cli
Replace flowuser with the user that ran the ThingWorx Flow installer.
7. (Linux only) Ensure that the user that installed ThingWorx Flow has complete ownership and permissions to the modules-<newer-8.x.x> folder.
Navigate to the ThingWorxOrchestration folder and run the following command:
chown -R flowuser:flowuser modules-<newer-8.x.x>
Replace flowuser with the user that ran the ThingWorx Flow installer.
8. (Windows only) Copy the RabbitMQ folder from the modules folder to the modules-<newer-8.x.x> folder.
9. After you have copied all the configuration settings, you must rename the following folders:
a. Rename the existing modules folder to modules-<older-8.x.x>.
b. Rename the modules-<newer-8.x.x> folder to modules.
* 
On Windows, before you proceed with renaming the folders, you must stop the epmd.exe process.
For example, to rename the folders on Linux, run the following commands:
a. mv /ThingworxOrchestration/modules /ThingworxOrchestration/modules-<older-8.x.x>
b. mv /ThingworxOrchestration/modules-<newer-8.x.x> /ThingworxOrchestration/modules
10. (Linux only) Navigate to the ThingWorxOrchestration folder and run the following command to set full permissions to the modules folder:
chmod -R 777 modules
11. (Linux only) Navigate to the ThingWorxOrchestration/modules folder and run the following command to set the correct security context to the static-ux folder:
chcon -R -t httpd_sys_content_t static-ux
12. Rename and move the following folders:
a. Rename the existing tw-security-common-nodejs folder at /ThingWorxOrchestration/cryptography to tw-security-common-nodejs_<older-8.x.x>.
b. Move the tw-security-common-nodejs folder from /ThingworxOrchestration/modules/ to /ThingWorxOrchestration/cryptography.
c. Ensure that the user that installed ThingWorx Flow has complete ownership and permissions to the tw-security-common-nodejs folder.
For example, navigate to the /ThingWorxOrchestration/cryptography folder and run the following command:
chown -R flowuser:flowuser tw-security-common-nodejs
Replace flowuser with the user that ran the ThingWorx Flow installer.
d. Navigate to the /ThingWorxOrchestration/cryptography/tw-security-common-nodejs folder and run the npm link command.
(Optional) Step 6: Make configuration changes to ThingWorx Foundation and ThingWorx Flow
If needed, proceed to make configuration changes to the ThingWorx Foundation and the ThingWorx Flow services.
This might be required if a patch introduces new configuration settings. Refer to the Release Notes for details on the new configuration settings and the files where they can be used.
Step 7: Reseed the database with the latest updates for ThingWorx Flow
Reseeding the ThingWorx Flow database does not affect any existing user-owned entities, such as workflows or triggers.
1. Launch Command Prompt and navigate to /ThingWorxOrchestration/modules/db_seed.
2. Execute the following command:
flow-deploy migrate -u <Flow DB username> -p <Flow DB password> -s <Flow installation Directory>
On Linux, run the flow-deploy command as a non-root user.
(Optional) Step 8: Deploy custom connectors
* 
Complete the steps in this section only if you have developed custom connectors using the ThingWorx Flow SDK.
1. Ensure that the source code is available on the same system.
2. Navigate to the root directory of the connector and run the flow-deploy connector command.
For more information, see Deploying Connectors.
3. Run the following command to seed the custom connector in the database:
flow-deploy migrate -u <Flow DB username> -p <Flow DB password> -s <Flow installation Directory>
Step 9: Start the services and verify their status
1. Start the services that were stopped in step 1 in the following order:
a. RabbitMQ / rabbitmq.service
* 
Check the RabbitMQ logs to verify that the RabbitMQ service has completely started before you start the next service.
Windows: /ThingworxOrchestration/modules/RabbitMQ/log/rabbit@{hostname}.log
Linux: /var/log/rabbitmq/rabbit@{hostname}.log
b. ThingWorx-Foundation
c. ThingWorx-Flow
d. ThingWorxOrchestrationNginx or nginx
2. Review the ThingWorx Foundation logs and verify that no unexpected errors or warnings occurred during the startup.
3. To verify that ThingWorx Flow is updated correctly, launch Command Prompt as administrator and run the following command:
pm2 ls
The status of the following ThingWorx Flow components must be ‘online’:
flow-api
flow-engine
flow-exchange
flow-lookup
flow-oauth-server
flow-trigger
To view logs of an individual service, run the pm2 logs <service name> command.
Step 10: Restart the Workflow Subsystem
1. Log in to ThingWorx Foundation.
2. Navigate to Subsystem > Workflow Subsystem.
3. Click Restart.
Step 11: Verify that functionality is working as expected
Test functionality in ThingWorx Foundation and ThingWorx Flow to verify that they are working as expected. Verify that you can compose workflows in ThingWorx Composer and the Workflow Editor. For example, you can perform the following tasks:
Log in to the ThingWorx Flow dashboard. To know how to access ThingWorx Flow and ThingWorx Composer, see Accessing ThingWorx Flow and ThingWorx Composer.
Create authorizations and connections for each connector that you want to use.
Step 12: Delete the tw-security-common-nodejs_<older-8.x.x> folder
From the /ThingWorxOrchestration/cryptography folder, delete the tw-security-common-nodejs_<older-8.x.x> folder.
(Optional) Step 13: Delete the modules-<older-8.x.x> folder
Once you validate and verify that the update was successful, and flows are running successfully (and the previous release is no longer needed), delete the modules-<older-8.x.x> folder.
You have successfully updated ThingWorx Flow.