Activiti 6 on Tomcat 8.5 with PostgreSQL 9.5
Instroduction
Let's configure an standalone Activiti on Tomcat for using PostgreSQL DB.
https://douglascrp.blogspot.com.es/2016/10/using-alfresco-activiti-enterprise-with.html
https://sites.google.com/site/nextthoughtlabs/engineering/postgres-installation-basics-for-activiti
Install PostgreSQL
Let's install PostgreSQL on Ubuntu 18.04:
sudo apt install postgresql
Note: if specific version is required (might not be supported by the OS version), just try:
sudo apt install postgresql-9.5
After installation message appears:
Success. You can now start the database server using:
/usr/lib/postgresql/9.5/bin/pg_ctl -D /var/lib/postgresql/9.5/main -l logfile start
Ver Cluster Port Status Owner Data directory Log file
9.5 main 5432 down postgres /var/lib/postgresql/9.5/main /var/log/postgresql/postgresql-9.5-main.log
Post-installation checks
Installing PostgreSQL on Ubuntu should start the service by default but check that it's running with:
systemctl status postgresql
If PostgreSQL is running, you'll see output that includes the text Active: active (exited)
.
If you see Active: inactive (dead)
, start the PostgreSQL service using the following command:
systemctl start postgresql
If PostgreSQL needs to be enabled to start on reboot. Do that with this command:
systemctl enable postgresql
Set PostgreSQL password
Let's use user postgres, password postgres:
$ sudo -u postgres psql postgres
psql (9.5.13)
Type "help" for help.
postgres=# \password
Enter new password:
Enter it again:
postgres=# \quit
Note: If using a new specific user for the database,
psql=# alter user <username> with encrypted password '<password>';
psql=# grant all privileges on database <dbname> to <username>;
Create a new PostgreSQL database
sudo -u postgres createdb -O postgres activiti
activiti-6.0.0/database/create$ sudo -u postgres psql -d activiti -a -f activiti.postgres.create.engine.sql
activiti-6.0.0/database/create$ sudo -u postgres psql -d activiti -a -f activiti.postgres.create.history.sql
activiti-6.0.0/database/create$ sudo -u postgres psql -d activiti -a -f activiti.postgres.create.identity.sql
JDBC postgresql
Let's download file "PostgreSQL JDBC 4.2 Driver, 42.2.2" from https://jdbc.postgresql.org/download.html
And place it in the directory: apache-tomcat-8.5.31/lib/
Configuration file > apache-tomcat-8.5.31/lib/activiti-app.properties
datasource.driver=org.postgresql.Driver
datasource.url=jdbc:postgresql://localhost:5432/activiti
datasource.username=postgres
datasource.password=postgres
datasource.preferred-test-query=select 1
hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
Testing
./apache-tomcat-8.5.31/bin/startup.sh
http://localhost:8080/activiti-app
Default user 'admin', pass 'test'
Now, any change is persisted in the PostgreSQL database and it's available after restarting Tomcat:
./apache-tomcat-8.5.31/bin/shutdown.sh
./apache-tomcat-8.5.31/bin/startup.sh