ThingWorx Flow > Updating ThingWorx Flow
  
Updating ThingWorx Flow
You can update ThingWorx Flow from an older version of 8.4.x to a newer version of 8.4.x manually. Here are the main steps of the process:
Step 1: Stop the ThingWorx Foundation and ThingWorx Flow services.
Step 2: Back up your existing installation.
Step 3: Deploy the new version of the Thingworx.war file.
Step 4: Extract the ThingWorx Flow update tar contents to a temporary folder.
Step 5: Replace the ThingWorx Flow services with their patched versions.
(Optional) Step 6: Make configuration changes to ThingWorx Foundation and ThingWorx Flow.
Step 7: Reseed the database with the latest updates for ThingWorx Flow.
Step 8: Deploy custom connectors.
Step 9: Start the services and verify their status.
Step 10: Restart the Workflow Subsystem.
Step 11: Verify that functionality is working as expected.
Step 12: Delete the tw-security-common-nodejs_<older-8.4.x> folder.
(Optional) Step 13: Delete the modules-<older-8.4.x> folder.
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 patch update 8.4.x version from the PTC Software Downloads website.
You have downloaded the appropriate ThingWorx Flow patch update 8.4.x version from the PTC Software Downloads website.
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 inbuilt 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: Deploy the new version of the Thingworx.war file
1. Extract the contents of the ThingWorx-Platform-<DB_Type>-<8.4.x>.zip patch update that you downloaded from the PTC Support website.
2. Replace the existing Thingworx.war file in the tomcat/apache-tomcat-<version>/webapps folder under your ThingWorx Foundation installation with the new Thingworx.war file from the patch update.
3. Delete the Thingworx folder to trigger reinstallation of the Thingworx web application.
4. (Linux only) After you replace the Thingworx.war file, you may need to update the file permissions for the Thingworx.war file. Run the following command to ensure that the user that ran the ThingWorx Foundation installer owns the Thingworx.war file:
Navigate to the /ThingworxFoundation/tomcat/apache-tomcat-<version>/webapps folder and run the following command:
chown twxuser:twxuser Thingworx.war
Replace twxuser with the user that ran the older ThingWorx Foundation 8.4.x installer.
Step 4: Extract the ThingWorx Flow update tar contents to a temporary folder
1. Create a new folder, modules-<8.4.x> in the /ThingworxOrchestration folder.
This modules-<8.4.x> folder must be parallel to the existing modules folder.
2. Extract the contents of the flow-upgrade-<8.4.x>.tar.gz patch update to the modules-<8.4.x> folder.
After you extract the contents of the zip, the /ThingworxOrchestration/modules-<8.4.x>/ folder must have the following folders:
configs
db_seed
engine
exchange
lookup
node_modules
oauth
static-ux
symphony-cli
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. Copy configuration settings from the existing ThingWorxOrchestration/modules folder to the modules-<8.4.x> folder. For each subfolder in the modules folder, copy the following files or folders to the modules-<8.4.x> folder.
* 
Not all modules contain configurations.
Configuration File Path
Type
/ThingworxOrchestration/modules/<app>/config
Folder
/ThingworxOrchestration/modules/<app>/deploymentConfig.json
File
/ThingworxOrchestration/modules/<app>/SHA1
File
/ThingworxOrchestration/modules/db_seed/migration_config.json
File
/ThingworxOrchestration/modules/orchestration.pm2.json
File
/ThingworxOrchestration/modules/cache
Folder
/ThingworxOrchestration/modules/node_modules/config
Folder
For example, to copy the configurations settings from the ux folder on Linux, run the following commands:
cp -R /ThingworxOrchestration/modules/ux/config /ThingworxOrchestration/modules-<8.4.x>/ux/
cp /ThingworxOrchestration/modules/ux/deploymentConfig.json /ThingworxOrchestration/modules-<8.4.x>/ux/
cp /ThingworxOrchestration/modules/ux/SHA1 /ThingworxOrchestration/modules-<8.4.x>/ux/
2. 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-<8.4.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 older ThingWorx Flow 8.4.x installer.
d. Run the npm rebuild command to rebuild each of the copied modules.
For example, go to the /ThingworxOrchestration/packages/symphony-cli directory, launch Command Prompt, and run npm rebuild.
3. (Linux only) Ensure that the user that installed ThingWorx Flow has complete ownership and permissions to the modules-<8.4.x> folder.
Navigate to the ThingWorxOrchestration folder and run the following command:
chown -R flowuser:flowuser modules-<8.4.x>
Replace flowuser with the user that ran the older ThingWorx Flow 8.4.x installer.
4. (Windows only) Copy the RabbitMQ folder from the modules folder to the modules-<8.4.x> folder.
5. After you have copied all the configuration settings, you must rename the following folders:
a. Rename the existing modules folder to modules-<older-8.4.x>.
b. Rename the modules-<8.4.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.4.x>
b. mv /ThingworxOrchestration/modules-<8.4.x> /Thingworx/Orchestration/modules
6. 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.4.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 older ThingWorx Flow 8.4.x 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. For more information, see ThingWorx Flow Engine Tuning and Scaling.
This might be required if a patch introduces new configuration settings. Refer to the patch 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.
Step 8: Deploy custom connectors
* 
Complete the steps in this section only if you have developed custom connectors using the ThingWorx Flow Connector 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
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 Flow Editor. For example, you can perform the following tasks:
Log in to the ThingWorx Flow server.
Create and execute a workflow.
Create a workflow that uses a trigger.
Add an action that uses an OAuth-based connection.
Step 12: Delete the tw-security-common-nodejs_<older-8.4.x> folder
From the /ThingWorxOrchestration/cryptography folder, delete the tw-security-common-nodejs_<older-8.4.x> folder.
(Optional) Step 13: Delete the modules-<older-8.4.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.4.x> folder.
You have successfully updated ThingWorx Flow.