Hi,
Looks like the migration with the default H2 are still not working properly so I’m trying to configure external PostgreSQL database to be used for development server. I have the server running as a docker-container with port 5432 exposed and it works fine.
However, I’m having trouble configuring Confluence Server to use the PostgreSQL instead of the embedded H2-database.
By browsing the forums I found this kind of example that is supposed to work:
<dataSources>
<dataSource>
<jndi>jdbc/confluence</jndi>
<driver>org.postgresql.Driver</driver>
<libArtifacts>
<libArtifact>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.3.3</version>
</libArtifact>
</libArtifacts>
<defaultDatabase>jdbc:postgresql://localhost:5432/postgres</defaultDatabase>
<systemUsername>root</systemUsername>
<systemPassword>root_pass</systemPassword>
<url>jdbc:postgresql://localhost:5432/confdb</url>
<schema>public</schema>
<username>conf_user</username>
<password>conf_pass</password>
</dataSource>
</dataSources>
So I added the above section inside the <product>
-block in the amps-maven-plugin configuration in the pom.xml.
But, when starting the server, this configuration seems to be ignored and the server always initialises just the H2-database and of course then fails to run migrations on it.
This is the log entry that I always see which I would expect NOT to see with the above configuration:
[core.persistence.hibernate.ConfluenceHibernateConfig] getHibernateProperties
STARTED H2 database server at URL jdbc:h2:tcp://localhost:9092//Users/petri.riipinen/
src/confluence-plugin/packages/server/target/confluence/home/database/h2db
I’ve examined the decompiled source and seems to me that this piece of code causes that H2 server to be started:
protected boolean shouldRunH2Server(Properties prop) {
return this.isH2() && prop.getProperty("hibernate.connection.url") == null;
}
And isH2() returns true of the configured hibernate.dialect contains H2 in it. So… Should I somehow set some Hibernated-related property somewhere in order to force Confluence Server to use the external dataSource configuration instead of spinning up the H2?
Any ideas how to make this work properly?