Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Postgresql database in development docker-compose #20

Closed
3 tasks done
MLenterman opened this issue Feb 2, 2023 · 1 comment · Fixed by #107
Closed
3 tasks done

Use Postgresql database in development docker-compose #20

MLenterman opened this issue Feb 2, 2023 · 1 comment · Fixed by #107
Assignees
Labels
test test

Comments

@MLenterman
Copy link
Collaborator

MLenterman commented Feb 2, 2023

  • Add postgresql service to docker-compose
  • Create context.xml for postgresql with ${variables} that can be given to JVM with -Dparam ()
  • Mount context.xml in zaakbrug container
@MLenterman MLenterman added the feature New feature or request label Feb 2, 2023
@philipsens
Copy link
Member

I've used this one for FaaS in the past:

<?xml version="1.0" encoding="UTF-8"?>
<Context>
    <JarScanner scanClassPath="false" scanAllFiles="false" scanAllDirectories="false"/>

    <Resource name="jdbc/${database.instance.name}" auth="Container"
              type="javax.sql.DataSource"
              driverClassName="org.postgresql.Driver"
              url="jdbc:postgresql://${database.host}:${database.port:-5432}/${database.name}"
              username="${database/username:-postgres}"
              password="${database/password}"
              maxTotal="50"
              maxWaitMillis="5000"
    />
</Context>

But it might be outdated. This is the one I use in the Helm Chart, note that this is the XA variant and you should enable a transaction manager in Tomcat.

<Resource 
              name="{{ .name | default (printf "jdbc/%s" $.Values.frank.instance.name) | lower }}" 
              factory="org.apache.naming.factory.BeanFactory"
              type="org.postgresql.xa.PGXADataSource" 
              URL="jdbc:postgresql://{{ .host }}:{{ .port | default 5432}}/{{ .database | default $.Values.frank.instance.name }}"
              user="{{ .username }}"
              password="{{ .password }}"
              sslMode="{{ ternary "REQUIRE" "DISABLE" (.ssl | default false)}}"
            />

To enable the transaction manager, add this property: application.server.type.custom: NARAYANA

@RayetSena RayetSena self-assigned this Jun 5, 2023
@MLenterman MLenterman linked a pull request Jun 8, 2023 that will close this issue
@RayetSena RayetSena linked a pull request Jun 14, 2023 that will close this issue
@MLenterman MLenterman added test test and removed feature New feature or request labels Jun 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
test test
Projects
None yet
3 participants