PostgreSQL is a powerful, open-source relational database management system (RDBMS) known for its extensibility, robustness, and adherence to SQL standards. It provides advanced features such as support for complex data types, indexing, transactions, and concurrency control.
PostgreSQL is designed to handle largeĀ of data and is often chosen for mission-critical applications, offering a high level of data integrity and reliability. It supports various programming languages and has a thriving community that contributes to its ongoing development and enhancement. Additionally, PostgreSQL is known for its extensibility, allowing users to define custom data types, operators, and functions.
For these reasons, its use in the ctrlX Ecosystem can really power up our applications.
In the following picture you can see what the system structure looks like:
The functionalities showed in this How-To have been tested in ctrlX COREvirtualĀ and ctrlX CORE X7.Ā This guide is simply a demo example, feel free to keep playing with it!
1. InstallationĀ
In your Engineering PC you need to download PgAdmin4, you can do it from the official PgAdmin website. Choose your operating system. The functionality showed in this How-To has been tested in Windows 10 and Ubuntu 22.04 as host system in the Engineering PC.
Install the PostgreSQL runtime in your ctrlX CORE. You need to compile it yourself following the instructions that you can find in the attached zip.file (ctrlx_postgresql-main.zip).
2. Configuration
The PostgreSQL runtime uses the files found in the attached zip.file under ctrlx_postgresql/shcripts/data :Ā
- configuration/ : it contains all the neccesary configuration files for PostgreSQL to work.
- data_postgresql/ : it contains the information data.
3. Connect PgAdmin4 with ctrlX OS
Connect the Engineering PC and the CORE in the same network. If you are using ctrlX COREvirtual, do not forget to fordward the port in which the runtime is accesible (5432 by default).
Open PgAdmin4 and add a new server.
4. Test to publish something to PostgreSQL using Node-RED
There exists a Node-RED palette to communicate with PostgreSQL. You can download it as seen in the following images. The CORE must be connected to the internet.
We have prepared some examples to publish to the data base from Node-RED. Find them attached to this How-to (flows_PostgreSQL.zip). To import it, open the "Flow Editor" from Node-RED and proceed as shown in the following pictures:
You must import both flows (.json) in that .zip:
Products: Working in the background, you do not need to interactuate with this. It simulates a product object that would be later publish to the database.
After creating the table from Node-RED, you need to refresh the table list as shown in the following picture.Ā
After that you can visualize the rows in such table as follows:
To refresh the visualization you can query again by clicking on the play button on the top.Ā You can also export the data in a csv.file by clicking in the download arrow on top of the table.
Have fun!