Enterprises, small and medium businesses, as well as ISVs can now accelerate the development and deployments of their LOB applications on the managed Azure Database for PostgreSQL service. This helps shorten the time to market.
Let us see an example of how one can use the plv8 extension with Azure Database for PostgreSQL. In this example, we use xTuple, an open source ERP + CRM web application powered by PostgreSQL database with the plv8 extension. The xTuple platform, with the free PostBooks edition, provides a great starting point for business software in practically any industry. For your business, you can scale up and further add the functionality of commercial versions. xTuple’s solution on Github is an entire stack to work on top of and a lot of business objects such as invoices, currencies, tasks, contacts, and many more that you may want which are already implemented.
xTuple has an extensive step-by-step guide for installing and configuring PostgreSQL for running the xTuple PostBooks desktop client. With the managed Azure Database for PostgreSQL service, you can get up and running with the xTuple ERP + CRM platform in a few minutes.
Initializing PostgreSQL for xTuple
If you are not already familiar, use our QuickStart tutorial to provision a managed PostgreSQL server using the Azure portal or the Azure CLI. After the server is provisioned, connect to the server using “pgadmin” or “psql” with the server admin user role and initialize PostgreSQL for xTuple software as shown below.
CREATE ROLE xtrole WITH NOLOGIN; GRANT azure_pg_admin TO xtrole; CREATE ROLE admin WITH PASSWORD 'admin' NOSUPERUSER CREATEDB CREATEROLE LOGIN IN ROLE xtrole;
Disconnect server and then re-connect using the admin user created above to create a database for an xTuple application using UTF8 encoding, as shown below.
CREATE DATABASE xtupledb WITH OWNER = admin ENCODING = 'UTF8' LC_COLLATE = 'English_United States.1252' LC_CTYPE = 'English_United States.1252' CONNECTION LIMIT = -1;
Enabling the plv8 extension on Azure Database for PostgreSQL
Next, we enable the plv8 extension for the database and set the plv8.start_proc variable as shown below.
CREATE EXTENSION plv8; ALTER DATABASE xtupledb SET "plv8.start_proc" TO "xt.js_init";
Disconnect and then re-connect to establish a new session using the admin user to verify the value of plv8.start_proc parameter. This is required when setting the parameter value using “ALTER DATABASE SET” command as the specified value is set and reflected for all the subsequent new sessions.
SELECT plv8_version(); Show plv8.start_proc;
The database xtupledb is now ready to power the xTuple ERP solution. You can follow the guide to install the PostBooks database. After the database is restored, you are ready to install and browse the xTuple desktop app.
Please note, while restoring the database you might see some error messages or warnings which can be safely ignored as documented in the xTuple documentation.
You are now ready for business with an open source xTuple ERP solution running on the fully managed Azure Database for PostgreSQL.
We would encourage you to try and leverage the plv8 extension in Azure Database for PostgreSQL to unlock new scenarios and NoSQL capabilities of PostgreSQL. Get started and create your PostgreSQL servers today!
Learn more about Azure Database for PostgreSQL in the overview and supported extensions.
Please continue to provide feedback on the features and functionality that you want to see next. If you need any help or have questions, please check out the Azure Database for PostgreSQL documentation. Follow us on Twitter @AzureDBPostgreSQL for the latest news and announcements.
Special thanks to Ned Lilly and Perry Clark from xTuple, as well as Sunil Kamath, Rachel Agyemang, and Jim Toland for their contributions to this posting.