From 977aab3335d20d587a9f5730795a5540a8eef7df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laure=CE=B7t?= Date: Thu, 21 Apr 2022 15:35:45 +0200 Subject: [PATCH] =?UTF-8?q?feat:=20connection=20de=20wildly=20=C3=A0=20mar?= =?UTF-8?q?iadb?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.gradle | 4 ++-- docker-compose.yml | 22 ++++++++++++++++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 150b40c..54a06a2 100644 --- a/build.gradle +++ b/build.gradle @@ -23,8 +23,8 @@ dependencies { // Pour pouvoir parser le JSON implementation 'com.google.code.gson:gson:2.8.6' - // implementation 'org.hibernate:hibernate-core:5.4.30.Final' - // implementation 'mysql:mysql-connector-java:8.0.24' + implementation 'org.hibernate:hibernate-core:5.4.30.Final' + implementation 'mysql:mysql-connector-java:8.0.24' // des fonctions pratiques implementation 'org.apache.commons:commons-lang3:3.0' diff --git a/docker-compose.yml b/docker-compose.yml index ee1dc89..0b0e609 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -11,9 +11,31 @@ services: volumes: - ./build/libs/:/opt/jboss/wildfly/standalone/deployments/ environment: + - WILDFLY_USERNAME=admin - WILDFLY_PASSWORD=password - DB_PORT=3306 - DB_HOST=mariadb + command: > + bash -c ' + + ( + sleep 15 && + /opt/jboss/wildfly/bin/jboss-cli.sh \ + --connect controller=127.0.0.1 \ + --command=" \ + data-source add \ + --jndi-name=java:/MySqlDS \ + --name=MySQLDS \ + --connection-url=jdbc:mysql://$$DB_HOST:$$DB_PORT/mydatabase \ + --driver-name=backend.war_com.mysql.cj.jdbc.Driver_8_0 \ + --user-name=$$WILDFLY_USERNAME \ + --password=$$WILDFLY_PASSWORD \ + " + )& + + /opt/jboss/wildfly/bin/add-user.sh admin password --silent && + + /opt/jboss/wildfly/bin/standalone.sh -b 0.0.0.0 -bmanagement 0.0.0.0' depends_on: mariadb: condition: service_healthy