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,7 +32,6 @@ services:
32 postgres-db: 32 postgres-db:
33 container_name: chatbot-postgres 33 container_name: chatbot-postgres
34 image: postgres 34 image: postgres
35 - restart: always  
36 ports: 35 ports:
37 - "5432:5432" 36 - "5432:5432"
38 environment: 37 environment:
@@ -43,6 +42,5 @@ services: @@ -43,6 +42,5 @@ services:
43 adminer: 42 adminer:
44 container_name: adminer_dbmanagement 43 container_name: adminer_dbmanagement
45 image: adminer 44 image: adminer
46 - restart: always  
47 ports: 45 ports:
48 - "8081:8080" 46 - "8081:8080"
49 \ No newline at end of file 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,8 +4,8 @@ COPY standalone.xml /opt/jboss/wildfly/standalone/configuration/standalone.xml
4 4
5 #USER root 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 #ADD modules/postgresql-42.1.4.jar /opt/jboss/wildfly/modules/system/layers/base/org/postgres/main/postgresql-42.1.4.jar 10 #ADD modules/postgresql-42.1.4.jar /opt/jboss/wildfly/modules/system/layers/base/org/postgres/main/postgresql-42.1.4.jar
11 #ADD modules/module.xml /opt/jboss/wildfly/modules/system/layers/base/org/postgres/main/module.xml 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 <?xml version="1.0" encoding="UTF-8"?> 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 <resources> 3 <resources>
4 <!--https://jdbc.postgresql.org/download.html--> 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 </resources> 6 </resources>
7 <dependencies> 7 <dependencies>
8 <module name="javax.api"/> 8 <module name="javax.api"/>
9 <module name="javax.transaction.api"/> 9 <module name="javax.transaction.api"/>
  10 + <module name="javax.servlet.api" optional="true"/>
10 </dependencies> 11 </dependencies>
11 </module> 12 </module>
12 \ No newline at end of file 13 \ No newline at end of file
docker/wildfly/standalone.xml
@@ -420,21 +420,49 @@ @@ -420,21 +420,49 @@
420 420
421 <subsystem xmlns="urn:jboss:domain:datasources:2.0"> 421 <subsystem xmlns="urn:jboss:domain:datasources:2.0">
422 <datasources> 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 <connection-property name="databaseName">beuthbot</connection-property> 425 <connection-property name="databaseName">beuthbot</connection-property>
426 <driver>postgresql</driver> 426 <driver>postgresql</driver>
427 <security> 427 <security>
428 <user-name>beuthbot_app</user-name> 428 <user-name>beuthbot_app</user-name>
429 <password>VhS7WPVpdYEHYLpf</password> 429 <password>VhS7WPVpdYEHYLpf</password>
430 </security> 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 <validation> 437 <validation>
432 <valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLValidConnectionChecker"/> 438 <valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLValidConnectionChecker"/>
433 <exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLExceptionSorter"/> 439 <exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLExceptionSorter"/>
434 </validation> 440 </validation>
435 </datasource> 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 <drivers> 464 <drivers>
437 - <driver name="postgresql" module="postgresql"> 465 + <driver name="postgresql" module="org.postgres">
438 <driver-class>org.postgresql.Driver</driver-class> 466 <driver-class>org.postgresql.Driver</driver-class>
439 <xa-datasource-class>org.postgresql.xa.PGXADataSource</xa-datasource-class> 467 <xa-datasource-class>org.postgresql.xa.PGXADataSource</xa-datasource-class>
440 <datasource-class>org.postgresql.ds.PGSimpleDataSource</datasource-class> 468 <datasource-class>org.postgresql.ds.PGSimpleDataSource</datasource-class>