= Custom Deployment
:description: Bonita custom deployment

[WARNING]
====
This installation procedure only specifically targets the Java EE application Servers that have been installed under a single root folder (typically, from a .zip file).
Thus, for installations using native distribution packages (that more often than not split the binaries and the configuration files into separate folder hierarchies),
it would be up to you to adapt the documented steps to your very own folder layout.
====

[WARNING]
====
Remember that the recommended way of installing Bonita is to use the provided xref:tomcat-bundle.adoc[Tomcat] bundle. +
It saves you from doing all the following configuration at hand, as the setup tool included handles it automatically.
====

== Installation

. Download the Tomcat bundle file from the http://www.bonitasoft.com/downloads-v2[Bonitasoft download page] for the Community edition
or from the https://customer.bonitasoft.com/download/request[Customer Service Center] for Subscription editions.
. Unzip it into a temporary folder (`BUNDLE_DIRECTORY`).
. Follow the <<tomcat-installation,Tomcat bundle steps>>.

[#tomcat-installation]

== Tomcat installation

=== Install Bonita Platform in Tomcat

Copy, from the bundle into your Tomcat server (`TOMCAT_DIRECTORY`):

* `BUNDLE_DIRECTORY/server/bin/setenv.sh` or `BUNDLE_DIRECTORY/server/bin/setenv.bat`, depending if you are on Unix or Windows, to `TOMCAT_DIRECTORY/bin`
* The entirety of the bundle `BUNDLE_DIRECTORY/server/conf` folder to `TOMCAT_DIRECTORY/conf`
* The entirety of the bundle `BUNDLE_DIRECTORY/server/lib/bonita` folder to `TOMCAT_DIRECTORY/lib/bonita`
* The `BUNDLE_DIRECTORY/server/webapps/bonita.war` to `TOMCAT_DIRECTORY/webapps`
* The and `BUNDLE_DIRECTORY/webapps/ROOT/favicon.ico` to `TOMCAT_DIRECTORY/webapps/ROOT/`
* The entirety of the `BUNDLE_DIRECTORY/setup` directory at the root of your tomcat server `TOMCAT_DIRECTORY`.
* The entirety of the `BUNDLE_DIRECTORY/tools/request_key_utils-`. Includes script files to generate license request keys to `TOMCAT_DIRECTORY/tools/request_key_utils-`.

[WARNING]
====
Some of the libraries copied from the bundle `BUNDLE_DIRECTORY/server/lib/bonita` may already exist (albeit in a different version) in your Tomcat server `TOMCAT_DIRECTORY/lib` folder. e.g.:

* bundle (Tomcat 8.5.40): `server/lib/bonita/tomcat-dbcp-9.0.16.jar`
* Tomcat server (Tomcat 8.0.36): `lib/tomcat-dbcp-8.0.36.jar` and `lib/tomcat-dbcp.jar`

For such libraries, you should only keep the ones copied from the bundle under `TOMCAT_DIRECTORY/lib/bonita`, or else the Bonita server may encounter `NoSuchMethodError`-type of issues.
====

[WARNING]
====
Some configuration files from the bundle will overwrite some default tomcat configuration files. Proceed
with care in a tomcat where other applications are already installed.
====

[WARNING]
====
There is an https://bz.apache.org/bugzilla/show_bug.cgi?id=58999[issue on tomcat 8.0.32] preventing the portal Look & feel to be compiled. If you deploy bonita on an existing tomcat installation, make sure it is a different version of tomcat (preferably 8.5.x with x>=23).
====

=== Configure data sources

. Open the file `TOMCAT_DIRECTORY/conf/Catalina/localhost/bonita.xml`
. Remove or comment out the lines regarding the h2 database.
. Uncomment the lines matching your RDBMS.
. Update following attributes value:
 ** username: your RDBMS user name.
 ** password: your RDBMS password.
 ** url: the URL, including the RDBMS server address, RDBMS server port and database (schema) name.
. There are 4 datasources declared. Make sure you made the change for them all, named RawBonitaDS, bonitaSequenceManagerDS, RawBusinessDataDS, NotManagedBizDataDS.

=== Configure RDBMS vendor

. Open the file `TOMCAT_DIRECTORY/bin/setenv.sh` (Unix system) or `TOMCAT_DIRECTORY/bin/setenv.bat` (Windows system)
. Change the value of sysprop.bonita.db.vendor according to your RDBMS vendor
. Change the value of sysprop.bonita.bdm.db.vendor according to your RDBMS vendor

[#driver]
=== Add Jdbc driver

You need to add your jdbc driver in `TOMCAT_DIRECTORY/lib`.
MySQL, PostgreSQL, Oracle and Microsoft SQL Server drivers can be found in the Tomcat bundle under `BUNDLE_DIRECTORY/setup/lib` directory.

== License installation

If you are installing a Subscription edition, you need to xref:licenses.adoc[request a license].

When you receive your license, copy the file to the `TOMCAT_DIRECTORY/setup/platform_conf/licenses` folder of your application server.

== Database initialization

We assume here that the database has already been xref:database-configuration.adoc#database_creation[created and configured for Bonita].
Once created and configured you need to initialize it using the setup tool provided in the bundle.
This will create database schema and initial values.

. In `TOMCAT_DIRECTORY/setup` folder, edit the file `database.properties` with properties matching your rdbms. Beware of xref:bonita-bpm-platform-setup.adoc#backslash_support[backslash characters].
. In `TOMCAT_DIRECTORY/setup` folder, run `setup.(sh|bat) init`

== Next steps

You're done with Bonita installation. You can now start your application server as usual.
When you have finished installing the deploy bundle, xref:first-steps-after-setup.adoc[complete the setup] of your system by validating the installation, setting passwords, and creating the Administrator user.
