I mentioned some time ago in the OpenIDM beginner series that although the built in OrientDB is more than sufficient for development purposes as soon as you start getting serious you will want to install a proper database backend.
This is a quick blog to talk you through how to install OpenIDM on a database. In my case I am going to use MySQL ( MariaDB specifically ), steps for installing other databases are broadly similar.
For this exercise please:
- Ensure there is a Java Development Kit (JDK) installed, and your environment path is set appropriately.
- Install or have access to an instance of MySQL.
- Download OpenIDM: https://forgerock.org/downloads/ or https://backstage.forgerock.com/downloads/OpenIDM
1. Create a directory for the environment, e.g. : /usr/local/env/demo
2. Unzip OpenIDM:
What we have here is a set of queries for the OOTB embedded OrientDB. We are going to replace this with a compatible SQL based version.
3. Run the following script to configure the OpenIDM schema:
mysql -u root -p < /usr/local/env/demo/openidm/db/mysql/scripts/openidm.sql
Here I run it for mysql against the root user. You will be asked for a password, please enter it. This script will create an openidm schema.
4. Next we need to run some additional scripts.
mysql -D openidm -u root -p < /opt/forgerock/openidm/db/mysql/scripts/activiti.mysql55.create.engine.sql mysql -D openidm -u root -p < /opt/forgerock/openidm/db/mysql/scripts/activiti.mysql55.create.history.sql mysql -D openidm -u root -p < /opt/forgerock/openidm/db/mysql/scripts/activiti.mysql.create.identity.sql
These scripts set up the Activiti BPMN workflow engine in the openidm database instance we just created.
5. Now lets remove the original repo.orientdb.json file. Don’t forget to do this step! I’d also suggest making a backup:
cd /usr/local/env/demo/openidm/conf mkdir backup mv repo.orientdb.json backup
6. Next we need to copy over the database specific configuration files:
cd /usr/local/env/demo/openidm cp db/mysql/conf/repo.jdbc.json conf cp db/mysql/conf/datasource.jdbc-default.json conf
Again, let’s take a quick look at these files , repo.jdbc.json:
You’ll notice that what we have is an SQL version of the repo file we looked at earlier, ready to execute queries against a MySQL like database. There is also one other notable difference:
The original repo did not have this line. Well, this line is used to specify the datasource to be used i.e. our MySQL database, and it refers to the second file we copied over datasource.jdbc-default.json:
8. Ensure that the useDataSource (default) value matches the datasource specification datasource.jdbc-default.json
9. Configure the datasource.jdbc-default.json file for your MySQL database. Specifically the jdbcUrl, databaseName, username and password.
10. Update workflow.json to use the same datasource i.e. default.
To be very clear, if you named your datasource specification datasource.jdbc-example.json then your useDataSource value should be example in the files above.
11. That’s it. You should be able to start openidm up normally:
This blog post was first published @ http://identity-implementation.blogspot.no/, included here with permission from the author.