Installation Appendices
Install Azure PostgreSQL Flexible Server
Prerequisites
The Azure PostgreSQL Flexible Server instance must be created using the Azure Portal. The steps to create the instance can be found at Create an Azure Database for PostgreSQL.
Set up a postgresql client in your environment from where you plan to run the ThingWorx database/schema setup scripts.
* 
It is recommended to have ThingWorx Server and Azure PostgreSQL Flexible Server at the same geographical location.
Setting up ThingWorx Database and Schema
1. Connect to the Azure PostgreSQL Flex Server using pgAdmin, the PostgreSQL admin tool installed as part of the prerequisites.
2. Create a new user role.
a. Select Create — Login/Group Role. On the general tab, in the Name field, enter the <PostgreSQL user role name> for PostgreSQL administration.
b. On the Privileges tab, select Yes for Can login?.
c. On the Definition tab, in the Password field, enter a unique and secure password for PostgreSQL.
d. Click OK.
3. Run the thingworxPostgresDBSetup.bat / thingworxPostgresDBSetup.sh script to create a ThingWorx database in your instance. If necessary, configure the script. Reference the options in the table below.
thingworxPostgresDBSetup Script Options
Option
Parameter
Default
Description
Example
t or -T
tablespace
thingworx
Tablespace name
-t thingworx
-p or -P
port
5432
Port number of PostgreSQL
-p 5432
-d or -D
database
thingworx
PostgreSQL Database name to create
-d thingworx
-l or -L
tablespace_location
/ThingworxPostgresqlStorage
Required in ThingWorx 9.3.0 and before. Location in the file system where the files representing database objects are stored. User needs to create this folder manually with permissions before executing the script and then specify the path, for example, -l D:\ThingworxPostgresqlStorage.
* 
The folder must have appropriate ownership and access rights. It should be owned by the same user who runs the PostgreSQL service and has Full Control assigned to that user. This user is generally NETWORK_SERVICE, but may differ in your environment.
-l or -L
-h or -H
host
localhost
Name of the host
-h localhost
-a or -A
adminusername
postgres
Administrator Name
-a postgres
-u or -U
thingworxusername
twadmin
User name that has permissions to write to the database.
-u twadmin
4. Run the thingworxPostgresSchemaSetup.bat / thingworxPostgresSchemaSetup.sh script to create ThingWorx model, property, and data schema in your ThingWorx database created in step 3. If necessary, configure the script. Reference the options in the table below.
thingworxPostgresSchemaSetup Script Options
Option
Parameter
Default
Description
Example
-h or -H
host
localhost
IP or host name of the database.
-h localhost
-p or -P
port
5432
Port number of PostgreSQL.
-p 5432
-d or -D
database
thingworx
Database name to use.
-d thingworx
-s or -S
schema
public
Schema name to use.
-s myschema
* 
If public or $user is not used, you must edit the postgresql.conf file and add SEARCH_PATH to your schema. For example, search_path = '"$user", public, "myschema"'
-u or -U
username
twadmin
Username to update the database schema
-u twadmin
-o or -O
option
all
There are three options:
all: Sets up the model and data provider schemas into the specified database.
model: Sets up the model provider schema into the specified database.
data: Sets up the data provider schema into the specified database.
-o data
Was this helpful?