Sunday, October 14, 2012

Installing WSO2 BPS on PostgreSQL

BPS requires two database schema's. One is for the registry and one for BPEL, Human Task engine. So we will need to create two database schema's on postgresql and grant permissions. Lets name the registry database as bpsRegistry and orchestration engine database as bps.
Step 1.
Install postgresql.
$ sudo apt-get install postgresql
Step 2.
Configure postgresql 
Edit postgresql.conf file located in /etc/postgresql/9.1/main directory and un-comment the following line
listen_addresses = 'localhost'

Step 3.
When postgres sql is installed, a user named postgres will be created. We need to login as this user in order to create our databases, add our default role to postgres and grant privileges.First login as root and then  change user to postgres user.
$ sudo su
$ su postgres

Step 4
Connect to the database and configure roles.
$ psql template1
Add default user to postgres.
template1=# CREATE USER nandika WITH PASSWORD 'password';

Step 5
Create the two databases.
template1=# CREATE DATABASE bps;
template1=# CREATE DATABASE bpsRegistry;
Now grant all privileges to database.
template1=# GRANT ALL PRIVILEGES ON DATABASE bps to nandika;
template1=# GRANT ALL PRIVILEGES ON DATABASE bpsRegistry to nandika;
you can use \q to quit.
Step 6.

Now, test the databases and run the db scripts found in wso2bps-3.0.0/dbscripts directory to create the db tables.
$ psql -d bpsregistry -U nandika;

Now run the postgresql.sql script to create the tables.
bpsRegistry=> \i /home/nandika/wso2bps-3.0.0/dbscripts/postgresql.sql
This should execute the sql script and create the database tables. 
Similarly, execute the postgres.sql in dbscripts/bps directory to create the bps database tables.

Note : you can use \? to view the available postgres sql commands.
Now we are done with configuring postgres sql. Lets configure bps db connection urls.
Step 7.

Go to repository/conf/datasources directory and edit master-datasources.xml and replace the existing H2 database configurations with corresponding postgresql configuration.
            <description>The datasource used for registry</description>
            <definition type="RDBMS">
                    <validationQuery>SELECT 1</validationQuery>
Next , open the file in repository/conf directory and all following.
synapse.datasources.bpsds.validationQuery=SELECT 1

Next, download and copy postgres sql driver to repository/components/lib directory. Now we have finished configurations. Go to bin directory and run to start BPS.

No comments:

Post a Comment