Objectives
Puppet is a configuration management software. It ensures consistency and reproducibility while deploying applications.
In this article we will present the bonita_bpm Puppet module created to manage Bonita BPM installations.
This module works on Ubuntu 14.04. It currently manages installations of Bonita BPM Community or Subscription editions in 6.4.0 and 6.4.1 releases.
In this post we will describe the use of the tool in standalone mode.
This means that we do not need to install a Puppet Master, and we will only launch the Puppet command on the target host.
We will see how to deploy Bonita BPM 6.4.1 in Community edition with PostgreSQL on Ubuntu 14.04.
Prerequisites
You should be running Ubuntu 14.04 and have already installed:
- unzip to extract and manage the tomcat bundle
- postgresql in order to create the Bonita database.
Benefits
The Puppet module will take care of everything and will automatically install the JRE (openjdk-7) and the application server (tomcat7).
Bonita war and libraries will automatically be pushed into tomcat7 standard paths:
-
configuration in /etc/tomcat7
-
war in /var/lib/tomcat7/webapps/
-
libraries in /var/lib/tomcat7/lib/bonita/
-
logs in /var/log/tomcat7/
The bonita home will be placed into /opt/bonita_home/
Installation
Retrieve the module from GitHub and place it on the host on which you want deploy Bonita BPM:
cd /var/tmp
wget https://github.com/Bonitasoft-Community/puppet-bonita-bpm/archive/v0.1.0.tar.gz
tar -xvzf v0.1.0.tar.gz
mkdir -p puppet/modules
mv puppet-bonita-bpm-0.1.0/ puppet/modules/bonita_bpm
Then, as described in the README.md you will need to set up some prerequisites.
- Create the archive which contains the bonita home, the libraries and the war file:
wget http://download.forge.ow2.org/bonita/BonitaBPMCommunity-6.4.1-Tomcat-7.0.55.zip
unzip BonitaBPMCommunity-6.4.1-Tomcat-7.0.55.zip
cd BonitaBPMCommunity-6.4.1-Tomcat-7.0.55
tar -czf BonitaBPMCommunity-6.4.1.tgz bonita/ lib/bonita/ webapps/bonita.war
- Move the archive into the Puppet module:
cp BonitaBPMCommunity-6.4.1.tgz /var/tmp/puppet/modules/bonita_bpm/files/archives/
- Create the Bonita BPM database and its corresponding user.
The following lines show how to launch the psql commands to create the user, the database and the privileges to use this database:
sudo -u postgres psql
CREATE USER bonitauser WITH PASSWORD 'bonitapass';
CREATE DATABASE bonitadb;
GRANT ALL PRIVILEGES ON DATABASE "bonitadb" to bonitauser;
\q
Note: This is an example and you change the password value ‘bonitapass’ to something only you know.
- If you want to add a Business database that you may access with the Datasource connector for example, you can launch the commands below following the same principles as above:
sudo -u postgres psql
CREATE USER businessuser WITH PASSWORD 'businesspass';
CREATE DATABASE businessdb;
GRANT ALL PRIVILEGES ON DATABASE "businessdb" to businessuser;
\q
- Next, describe the parameters which will be used to configure Bonita BPM. Create the file /var/tmp/init.pp with the following lines:
Exec { path => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin' }
# Bonita BPM
# mandatory parameters
$bonita_bpm_version = '6.4.1'
$bonita_bpm_edition = 'community'
$bonita_bpm_archive = 'BonitaBPMCommunity-6.4.1.tgz'
# database parameters used for bonitaDS and bonitaSequenceManagerDS
$bonita_bpm_db_vendor = 'postgres'
$bonita_bpm_db_name = 'bonitadb'
$bonita_bpm_db_user = 'bonitauser'
$bonita_bpm_db_pass = 'bonitapass'
$bonita_bpm_db_host = '127.0.0.1'
$bonita_bpm_db_port = '5432'
$bonita_bpm_bonitaDS_minIdle = '5'
$bonita_bpm_bonitaDS_maxActive = '31'
$bonita_bpm_bonitaSequenceManagerDS_minIdle = '1'
$bonita_bpm_bonitaSequenceManagerDS_maxActive = '3'
# optional datasource for business database
$bonita_bpm_businessDS_db_vendor = 'postgres'
$bonita_bpm_businessDS_name = 'businessdb'
$bonita_bpm_businessDS_user = 'businessuser'
$bonita_bpm_businessDS_pass = 'businesspass'
$bonita_bpm_businessDS_host = '127.0.0.1'
$bonita_bpm_businessDS_port = '5432'
$bonita_bpm_businessDS_minIdle = '5'
$bonita_bpm_businessDS_maxActive = '10'
# platform credentials
$bonita_bpm_platform_admin_user = 'platformadmin'
$bonita_bpm_platform_admin_pass = 'platformsecret'
# jvm and tomcat tuning
$bonita_bpm_java_opts = '-Djava.awt.headless=true -XX:+UseConcMarkSweepGC -Dfile.encoding=UTF-8 -Xshare:auto -Xms512m -Xmx512m -XX:MaxPermSize=128m -XX:+HeapDumpOnOutOfMemoryError'
$bonita_bpm_jmx_pass = 'jmxsecret'
$bonita_bpm_maxThreads = '150'
# bonita workers configuration
$bonita_bpm_corePoolSize = '8'
$bonita_bpm_maximumPoolSize = '8'
# quartz configuration
$bonita_bpm_quartz_threadCount = '5'
# tenants configuration
$bonita_bpm_tenants = [
{ id => '1',
user => 'tech_user',
pass => 'tenantsecret',
}
]
$bonita_bpm_logs_user = ‘logsuser’
$bonita_bpm_logs_pass = ‘logssecret’
deploy Bonita BPM
include bonita_bpm
deploy ROOT application
include bonita_bpm::root_application
deploy LOGS application
include bonita_bpm::logs_application
The file above shows the parameters to install Bonita BPM 6.4.1 Community with a PostgreSQL database.
It overrides the default platform and tenant credentials.
It configures the two datasources bonitaSequenceManagerDS and bonitaDS.
It also reveals how to tune the jvm parameters using $bonita_bpm_java_opts variable.
For more details about worker and quartz parameters you can take a look at Work service documentation and Scheduler service documentation.
Finally, we include the bonita_bpm class which will deploy Bonita BPM and we also add two more classes. The first one called bonita_bpm::root_application will simply permit to the root application to redirect calls on http://127.0.0.1:8080/ towards http://127.0.0.1:8080/bonita (note : replace the ip if needed).
The other one, called bonita_bpm::logs_application, will deploy an additional app to be able to browse tomcat logs on http://127.0.0.1:8080/logs.
- To install and configure Bonita using Puppet it’s now very simple. Install the puppet command and launch it with following parameters:
sudo apt-get update
sudo apt-get install puppet
sudo puppet apply --modulepath=/var/tmp/puppet/modules/ /var/tmp/init.pp
Note : Ignore the warning message “Config file /etc/puppet/hiera.yaml not found, using Hiera defaults”
-
Now you can access Bonita BPM Portal using http://127.0.0.1:8080/bonita with the login
tech_user
and the passwordtenantsecret
. -
If you want to check the logs for debugging, take a look at http://127.0.0.1:8080/logs with the login
logsuser
and the passwordlogssecret
.
To go further with the Subscription editions, take a look at bonita_bpm/tests/init_detailed.pp
Conclusion
Puppet and configuration management software in general are useful to automate deployments in order to avoid human errors. It’s an easy way to install and configure Bonita BPM by setting configuration parameters at a single point. In addition, it will allow you to reapply the same configuration tuning after a migration (for example from 6.4.0 to 6.4.1 with the current version).
Note : A migration implies an update to init.pp file by adapting $bonita_bpm_version and $bonita_bpm_archive variables accordingly. Before reapplying changes you can launch the command in a dry-run mode with the --noop option:
sudo puppet apply --noop --modulepath=/var/tmp/puppet/modules/ /var/tmp/init.pp
In a future blog post we will see how to mix AWS CloudFormation and Puppet to automate your deployments in the Cloud.