How to set a PostgreSQL as a primary DB instead of H2
This tutorial is intended for those, who followed "Getting started" tutorial to run IdM as a local demo (for Linux server).
Prerequisities
1) Authentication method properly set in "pg_hba.conf" to be able to CzechIdM to connect.
2) DB dedicated to CzechIdM with proper owner - ideally named "czechidm"
3) PostgreSql up and running - check with
systemctl status postgresql.service -l
How to
1) Download jdbs postgresql driver for tomcat and place it into tomcat /lib
2) In tomcat /bin create "setenv.sh" file with
JAVA_OPTS="$JAVA_OPTS -Djava.awt.headless=true -Djava.security.egd=file:/dev/./urandom -Dorg.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH=true -Djavax.servlet.request.encoding=UTF-8 -Dspring.profiles.active=dev -Djava.util.Arrays.useLegacyMergeSort=true"
thus you specify spring profile as "dev"
3) Check file "/webapps/idm/WEB-INF/classes/application-dev.properties" in tomcat. There credentials must be set for the tomcat to connect to PostgreSQL, for example
spring.datasource.url=jdbc:postgresql://localhost:5432/czechidm spring.datasource.username=czechidm spring.datasource.password=TODOPASSWORD
If idm wasn't deployed yet (folder idm doesn't exist). The file *application-dev.properties* will be available in idm.war file. "idm.war/webapps/idm/WEB-INF/classes/application-dev.properties".
4) Now you can start tomcat as usual (startup.sh)