Commit 20f8f0f12736fdc0f30f44e35fb2e96b97440b8b

Authored by Benjamin Rühl
1 parent 8a9e8de4

Add persistence pool and a few maybe-fixes to standalone.xml

docker/docker-compose.yml
... ... @@ -32,7 +32,6 @@ services:
32 32 postgres-db:
33 33 container_name: chatbot-postgres
34 34 image: postgres
35   - restart: always
36 35 ports:
37 36 - "5432:5432"
38 37 environment:
... ... @@ -43,6 +42,5 @@ services:
43 42 adminer:
44 43 container_name: adminer_dbmanagement
45 44 image: adminer
46   - restart: always
47 45 ports:
48 46 - "8081:8080"
49 47 \ No newline at end of file
... ...
docker/wildfly/Dockerfile
... ... @@ -4,8 +4,8 @@ COPY standalone.xml /opt/jboss/wildfly/standalone/configuration/standalone.xml
4 4  
5 5 #USER root
6 6  
7   -ADD modules/postgresql-42.1.4.jar /opt/jboss/wildfly/modules/org/postgres/main/postgresql-42.1.4.jar
8   -ADD modules/module.xml /opt/jboss/wildfly/modules/org/postgres/main/module.xml
  7 +ADD modules/org/postgres/main/postgresql-42.1.4.jar /opt/jboss/wildfly/modules/org/postgres/main/postgresql-42.1.4.jar
  8 +ADD modules/org/postgres/main/module.xml /opt/jboss/wildfly/modules/org/postgres/main/module.xml
9 9  
10 10 #ADD modules/postgresql-42.1.4.jar /opt/jboss/wildfly/modules/system/layers/base/org/postgres/main/postgresql-42.1.4.jar
11 11 #ADD modules/module.xml /opt/jboss/wildfly/modules/system/layers/base/org/postgres/main/module.xml
... ...
docker/wildfly/modules/module.xml renamed to docker/wildfly/modules/org/postgres/main/module.xml
1 1 <?xml version="1.0" encoding="UTF-8"?>
2   -<module xmlns="urn:jboss:module:1.0" name="postgresql">
  2 +<module xmlns="urn:jboss:module:1.1" name="org.postgres">
3 3 <resources>
4 4 <!--https://jdbc.postgresql.org/download.html-->
5   - <resource-root path="postgresql-9.3-1104.jdbc41.jar"/>
  5 + <resource-root path="postgresql-42.1.4.jar"/>
6 6 </resources>
7 7 <dependencies>
8 8 <module name="javax.api"/>
9 9 <module name="javax.transaction.api"/>
  10 + <module name="javax.servlet.api" optional="true"/>
10 11 </dependencies>
11 12 </module>
12 13 \ No newline at end of file
... ...
docker/wildfly/standalone.xml
... ... @@ -420,21 +420,49 @@
420 420  
421 421 <subsystem xmlns="urn:jboss:domain:datasources:2.0">
422 422 <datasources>
423   - <datasource jta="true" jndi-name="java:jboss/datasources/PostgreSQLDS" pool-name="postgresql" enabled="true" use-java-context="true">
424   - <connection-url>jdbc:postgresql://localhost:5432/beuthbot</connection-url>
  423 + <datasource jta="true" jndi-name="java:jboss/datasources/PostgreSQLDS" pool-name="PostgreSQLDS" enabled="true" use-java-context="true">
  424 + <connection-url>jdbc:postgresql://postgres-db:5432/beuthbot</connection-url>
425 425 <connection-property name="databaseName">beuthbot</connection-property>
426 426 <driver>postgresql</driver>
427 427 <security>
428 428 <user-name>beuthbot_app</user-name>
429 429 <password>VhS7WPVpdYEHYLpf</password>
430 430 </security>
  431 + <pool>
  432 + <min-pool-size>5</min-pool-size>
  433 + <initial-pool-size>5</initial-pool-size>
  434 + <max-pool-size>100</max-pool-size>
  435 + <prefill>true</prefill>
  436 + </pool>
431 437 <validation>
432 438 <valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLValidConnectionChecker"/>
433 439 <exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLExceptionSorter"/>
434 440 </validation>
435 441 </datasource>
  442 +
  443 + <xa-datasource jndi-name="java:jboss/datasources/PgDsXaWildFlyDb" pool-name="PgDsXaWildflyDb" enabled="true" use-java-context="true">
  444 + <driver>postgresql</driver>
  445 + <xa-datasource-property name="ServerName">postgres-db</xa-datasource-property>
  446 + <xa-datasource-property name="PortNumber">5432</xa-datasource-property>
  447 + <xa-datasource-property name="DatabaseName">beuthbot</xa-datasource-property>
  448 + <xa-pool>
  449 + <min-pool-size>5</min-pool-size>
  450 + <initial-pool-size>5</initial-pool-size>
  451 + <max-pool-size>100</max-pool-size>
  452 + <prefill>true</prefill>
  453 + </xa-pool>
  454 + <validation>
  455 + <valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLValidConnectionChecker"/>
  456 + <exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLExceptionSorter"/>
  457 + </validation>
  458 + <security>
  459 + <user-name>beuthbot_app</user-name>
  460 + <password>VhS7WPVpdYEHYLpf</password>
  461 + </security>
  462 + </xa-datasource>
  463 +
436 464 <drivers>
437   - <driver name="postgresql" module="postgresql">
  465 + <driver name="postgresql" module="org.postgres">
438 466 <driver-class>org.postgresql.Driver</driver-class>
439 467 <xa-datasource-class>org.postgresql.xa.PGXADataSource</xa-datasource-class>
440 468 <datasource-class>org.postgresql.ds.PGSimpleDataSource</datasource-class>
... ...