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 health check to detect mariadb startup and skip volume modifier on M1 #25805

Merged
merged 1 commit into from
May 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 21 additions & 5 deletions build-parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@
<!-- Antlr is used by the PanacheQL parser-->
<antlr.version>4.9.2</antlr.version>

<!-- SELinux access label, used when mounting local volumes into containers in tests -->
<volume.access.modifier>:Z</volume.access.modifier>

<!-- Defaults for integration tests -->
<elasticsearch-server.version>7.16.3</elasticsearch-server.version>
<elasticsearch.image>docker.io/elastic/elasticsearch:${elasticsearch-server.version}</elasticsearch.image>
Expand Down Expand Up @@ -102,7 +105,7 @@
<keycloak.version>18.0.0</keycloak.version>
<keycloak.docker.image>quay.io/keycloak/keycloak:${keycloak.version}</keycloak.docker.image>
<keycloak.docker.legacy.image>quay.io/keycloak/keycloak:${keycloak.version}-legacy</keycloak.docker.legacy.image>

<unboundid-ldap.version>6.0.5</unboundid-ldap.version>

<assertj.version>3.22.0</assertj.version>
Expand Down Expand Up @@ -141,7 +144,7 @@
<build-helper-plugin.version>1.9.1</build-helper-plugin.version>
<revapi-reporter-text.version>0.14.5</revapi-reporter-text.version>
<revapi-reporter-json.version>0.4.5</revapi-reporter-json.version>
<!-- Latest release to be used by api-compatibility-check to check backwards compatibility of the Quarkus API. -->
<!-- Latest release to be used by api-compatibility-check to check backwards compatibility of the Quarkus API. -->
<revapi.oldVersion>1.6.0.Final</revapi.oldVersion>
<revapi.newVersion>${project.version}</revapi.newVersion>
<!-- severity Possible values: equivalent, nonBreaking, potentiallyBreaking, breaking -->
Expand Down Expand Up @@ -363,8 +366,8 @@
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.apache.activemq</groupId>
<artifactId>artemis-server</artifactId>
<groupId>org.apache.activemq</groupId>
<artifactId>artemis-server</artifactId>
</exclusion>
<!-- Excluding the API jar as the impl jar also contains the API -->
<exclusion>
Expand Down Expand Up @@ -673,7 +676,7 @@
<groupId>io.quarkus</groupId>
<version>${project.version}</version>
</dependency>
</dependencies>
</dependencies>
<configuration>
<!-- store outside of target to speed up formatting when mvn clean is used -->
<cachedir>.cache/formatter-maven-plugin-${formatter-maven-plugin.version}</cachedir>
Expand Down Expand Up @@ -1228,6 +1231,19 @@
</properties>
</profile>

<profile>
<id>mac-m1</id>
<activation>
<os>
<arch>aarch64</arch>
</os>
</activation>
<properties>
<!-- Podman compatibility. Currently, mac file systems based on Plan 9 does not support SELinux labeling z and Z should not be used. When they transition to use virtiofsd, it should support SELinux labeling, and then we can use it for better container separation on the Mac.-->
<volume.access.modifier></volume.access.modifier>
</properties>
</profile>

<profile>
<id>jakarta-rewrite</id>
<activation>
Expand Down
39 changes: 28 additions & 11 deletions extensions/reactive-mysql-client/deployment/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
~ under the License.
-->


<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
Expand Down Expand Up @@ -153,8 +154,24 @@
<configuration>
<images>
<image>
<name>${mariadb.image}</name>
<!-- Be aware when testing healthcheck scripts, caching of named images can cause apparently non-deterministic behaviour.
Change the name if making changes. -->
<name>healthcheck-${mariadb.image}</name>
<alias>quarkus-test-mariadb</alias>
<build>
<from>${mariadb.image}</from>
<healthCheck>
<!-- The exact values for these aren't very important, but it is important they are there -->
<interval>5s</interval>
<timeout>3s</timeout>
<startPeriod>5s</startPeriod>
<retries>5</retries>
<!-- Note that mysqladmin ping returns 0 even if the password is wrong-->
<cmd>
<shell>mysqladmin ping -h localhost || exit 1</shell>
</cmd>
</healthCheck>
</build>
<run>
<network>
<mode>bridge</mode>
Expand All @@ -176,26 +193,25 @@
<!-- Speed things up a bit by not actually flushing writes to disk -->
<tmpfs>/var/lib/mysql</tmpfs>
<wait>
<!-- good docs found at: http://dmp.fabric8.io/#build-healthcheck -->
<tcp>
<mode>direct</mode>
<ports>
<port>3306</port>
</ports>
</tcp>
<!-- good docs found at: http://dmp.fabric8.io/#start-wait -->
<!-- the sqladmin check seems more reliable than a tcp check, especially with
diverse container runtimes -->
<healthy>true</healthy>
<!-- Unfortunately booting MariaDB is slow, needs to set a generous timeout: -->
<time>40000</time>
</wait>
<volumes>
<bind>
<volume>${project.basedir}/custom-mariadbconfig:/etc/mysql/conf.d:Z</volume>
<volume>
${project.basedir}/custom-mariadbconfig:/etc/mysql/conf.d${volume.access.modifier}
</volume>
</bind>
</volumes>
</run>
</image>
</images>
<!--Stops all mariadb images currently running, not just those we just started.
Useful to stop processes still running from a previously failed integration test run -->
<!-- Stops all mariadb images currently running, not just those we just started.
Useful to stop processes still running from a previously failed integration test run -->
<allContainers>true</allContainers>
</configuration>
<executions>
Expand All @@ -204,6 +220,7 @@
<phase>compile</phase>
<goals>
<goal>stop</goal>
<goal>build</goal>
<goal>start</goal>
</goals>
</execution>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">

<parent>
<artifactId>quarkus-integration-test-hibernate-orm-tenancy</artifactId>
Expand All @@ -12,7 +12,10 @@

<artifactId>quarkus-integration-test-hibernate-orm-tenancy-connection-resolver-legacy-qualifiers</artifactId>
<name>Quarkus - Integration Tests - Hibernate - Tenancy - Connection</name>
<description>Tests for Hibernate ORM Multitenancy using a custom connection resolver and tenant resolver with legacy CDI qualifiers (@Default or @PersistenceUnit), running with the MariaDB database</description>
<description>Tests for Hibernate ORM Multitenancy using a custom connection resolver and tenant resolver with legacy CDI
qualifiers (@Default or @PersistenceUnit), running with the MariaDB
database
</description>

<properties>
<mariadb.base_url>jdbc:mariadb://localhost:3306</mariadb.base_url>
Expand Down Expand Up @@ -198,8 +201,24 @@
<configuration>
<images>
<image>
<name>${mariadb.image}</name>
<name>healthcheck-${mariadb.image}</name>
<alias>quarkus-test-mariadb</alias>
<build>
<from>${mariadb.image}</from>
<healthCheck>
<!-- The exact values for these aren't very important, but it is important they are there -->
<!-- The exact values for these aren't very important, but it is important they are there -->
<interval>5s</interval>
<timeout>3s</timeout>
<startPeriod>5s</startPeriod>
<retries>5</retries>
<!-- We could also use /usr/local/bin/healthcheck.sh but it seemed complicated to get the right level.
Note that mysqladmin ping returns 0 even if the password is wrong so we don't need to pass in a password, but it makes the logs cleaner-->
<cmd>
<shell>mysqladmin ping -h localhost -u root -psecret|| exit 1</shell>
</cmd>
</healthCheck>
</build>
<run>
<ports>
<port>3308:3306</port>
Expand All @@ -217,21 +236,24 @@
<tmpfs>/var/lib/mysql</tmpfs>
<wait>
<time>20000</time>
<healthy>true</healthy>
<exec>
<breakOnError>true</breakOnError>
<postStart>bash -c eval\ ${@} -- mysql -h localhost -uroot -psecret &lt;/etc/mysql/conf.d/init.sql</postStart>
</exec>
</wait>
<volumes>
<bind>
<volume>${project.basedir}/custom-mariadbconfig:/etc/mysql/conf.d:Z</volume>
<volume>
${project.basedir}/custom-mariadbconfig:/etc/mysql/conf.d${volume.access.modifier}
</volume>
</bind>
</volumes>
</run>
</image>
</images>
<!--Stops all mariadb images currently running, not just those
we just started. Useful to stop processes still running from a previously
we just started. Useful to stop processes still running from a previously
failed integration test run -->
<allContainers>true</allContainers>
</configuration>
Expand All @@ -241,6 +263,7 @@
<phase>compile</phase>
<goals>
<goal>stop</goal>
<goal>build</goal>
<goal>start</goal>
</goals>
</execution>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">

<parent>
<artifactId>quarkus-integration-test-hibernate-orm-tenancy</artifactId>
Expand All @@ -12,7 +12,8 @@

<artifactId>quarkus-integration-test-hibernate-orm-tenancy-connection-resolver</artifactId>
<name>Quarkus - Integration Tests - Hibernate - Tenancy - Connection</name>
<description>Tests for Hibernate ORM Multitenancy usingn a custom connection resolver, running with the MariaDB database</description>
<description>Tests for Hibernate ORM Multitenancy usingn a custom connection resolver, running with the MariaDB database
</description>

<properties>
<mariadb.base_url>jdbc:mariadb://localhost:3306</mariadb.base_url>
Expand Down Expand Up @@ -198,8 +199,24 @@
<configuration>
<images>
<image>
<name>${mariadb.image}</name>
<name>healthcheck-${mariadb.image}</name>
<alias>quarkus-test-mariadb</alias>
<build>
<from>${mariadb.image}</from>
<healthCheck>
<!-- The exact values for these aren't very important, but it is important they are there -->
<!-- The exact values for these aren't very important, but it is important they are there -->
<interval>5s</interval>
<timeout>3s</timeout>
<startPeriod>5s</startPeriod>
<retries>5</retries>
<!-- We could also use /usr/local/bin/healthcheck.sh but it seemed complicated to get the right level.
Note that mysqladmin ping returns 0 even if the password is wrong so we don't need to pass in a password, but it makes the logs cleaner-->
<cmd>
<shell>mysqladmin ping -h localhost -u root -psecret|| exit 1</shell>
</cmd>
</healthCheck>
</build>
<run>
<ports>
<port>3308:3306</port>
Expand All @@ -217,21 +234,24 @@
<tmpfs>/var/lib/mysql</tmpfs>
<wait>
<time>20000</time>
<healthy>true</healthy>
<exec>
<breakOnError>true</breakOnError>
<postStart>bash -c eval\ ${@} -- mysql -h localhost -uroot -psecret &lt;/etc/mysql/conf.d/init.sql</postStart>
</exec>
</wait>
<volumes>
<bind>
<volume>${project.basedir}/custom-mariadbconfig:/etc/mysql/conf.d:Z</volume>
<volume>
${project.basedir}/custom-mariadbconfig:/etc/mysql/conf.d${volume.access.modifier}
</volume>
</bind>
</volumes>
</run>
</image>
</images>
<!--Stops all mariadb images currently running, not just those
we just started. Useful to stop processes still running from a previously
we just started. Useful to stop processes still running from a previously
failed integration test run -->
<allContainers>true</allContainers>
</configuration>
Expand All @@ -241,6 +261,7 @@
<phase>compile</phase>
<goals>
<goal>stop</goal>
<goal>build</goal>
<goal>start</goal>
</goals>
</execution>
Expand Down
Loading