How to install Activiti Explorer with Alfresco Community?
This week, I wanted to install the latest Alfresco Community on my local and do some tests. One of the test was about testing a custom workflow. Because I'm always working on Alfresco Enterprise, I use very often the embedded Activiti Explorer to re-deploy a workflow or to delete some instances. And I realized that the Activiti Explorer was not provided by Alfresco. The only available tool is the workflow console which is almost impossible to use. Because Activiti is open-source, I wanted to check if I was able to install the Activiti Explorer in an other webapp and connect it to Alfresco. The answer is YES, and here is how I did it.
First, I'm using Alfresco Community v5.1.0. If you are using an other version, the instructions may differ. The first thing is to get the Activiti version bundled in Alfresco. I connected to my database and run this command:
mysql> SELECT * FROM ACT_GE_PROPERTY WHERE NAME_ = 'schema.version'; +----------------+----------+------+ | NAME_ | VALUE_ | REV_ | +----------------+----------+------+ | schema.version | 126.96.36.199 | 1 | +----------------+----------+------+ 1 row in set (0.00 sec)
I opened the Activiti Download page (http://activiti.org/download.html) and I downloaded the version 188.8.131.52. I unzipped it and I moved the file "activiti-explorer.war" (from the folder "wars") in my webapps folder. Before to restart it, I updated 2 files:
db=mysql jdbc.driver=org.gjt.mm.mysql.Driver jdbc.url=jdbc:mysql://127.0.0.1:8889/alfresco jdbc.username=alfresco jdbc.password=alfresco
# demo data properties create.demo.users=false create.demo.definitions=false create.demo.models=false create.demo.reports=false # engine properties engine.schema.update=false engine.activate.jobexecutor=false engine.asyncexecutor.enabled=true engine.asyncexecutor.activate=true engine.history.level=full
And I restarted my Tomcat instance. But, my log file was showing an exception:
version mismatch: activiti library version is '184.108.40.206', db version is 220.127.116.11 Hint: Set <property name="databaseSchemaUpdate" to value="true" or value="create-drop" (use create-drop for testing only!) in
The only option that I had was to update the Activiti database. It represents a high risk, because this is the same database as the one used internally in Alfresco. So, I checked the different migration scripts available in the folder "database/upgrade" from the ZIP file. I checked the 2 relevant files "activiti.mysql.upgradestep.52000.to.52001.engine.sql" and "activiti.mysql.upgradestep.52001.to.52002.engine.sql". The SQL code seems harmless. I changed the property "engine.schema.update" to "true" in the file "engine.properties" and I restarted. The database has been updated, and now, it's time to start if I can login.
Because the explorer embedded in Alfresco is fully integrated, I can just use Alfresco username and password. Obviously, in my case, it doesn't work like that. So, I created 2 groups and one user in the database manually by executing these queries:
INSERT INTO `ACT_ID_GROUP` (`ID_`, `REV_`, `NAME_`, `TYPE_`) VALUES ('admin', NULL, 'ADMIN', 'security-role'), ('user', NULL, 'USER', 'security-role');
INSERT INTO `ACT_ID_USER` (`ID_`, `REV_`, `FIRST_`, `LAST_`, `EMAIL_`, `PWD_`, `PICTURE_ID_`) VALUES ('ben', NULL, 'Ben', 'Chevallereau', 'email@example.com', 'password', NULL);
INSERT INTO `ACT_ID_MEMBERSHIP` (`USER_ID_`, `GROUP_ID_`) VALUES ('ben', 'admin'), ('ben', 'user');
And that's it! Then, I was able to login to Activiti Explorer using ben / password. I have access to the "Manage" page where I can re-deploy my workflows. You'll notice that the UI is completely different. You have to be aware as well that everything won't work as expected. So, this kind of installation has to be used very carefully.