Skip to content

springtainer/springtainer-mysql

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

springtainer-mysql

Maven Central Build Nightly build Coverage report Quality Gate Technical dept

Dependency

<dependency>
  <groupId>com.avides.springboot.springtainer</groupId>
  <artifactId>springtainer-mysql</artifactId>
  <version>1.4.0</version>
  <scope>test</scope>
</dependency>

Configuration

Properties consumed (in bootstrap.properties):

  • embedded.container.mysql.enabled (default is true)
  • embedded.container.mysql.startup-timeout (default is 30)
  • embedded.container.mysql.docker-image (default is mysql:8.0.32)
  • embedded.container.mysql.port (default is 3306)
  • embedded.container.mysql.root-password (default is root)
  • embedded.container.mysql.database-name (default is embeddedMySqlDb)
  • embedded.container.mysql.database-charset (default is utf8mb4)

Properties provided (in application-it.properties):

  • embedded.container.mysql.url (an alias for embedded.container.mysql.jdbc-url)
  • embedded.container.mysql.jdbc-url
  • embedded.container.mysql.r2dbc-url
  • embedded.container.mysql.host
  • embedded.container.mysql.port

Example for minimal configuration in application-it.properties:

spring.datasource.url=${embedded.container.mysql.url}
spring.datasource.username=root
spring.datasource.password=${embedded.container.mysql.root-password}

Logging

To reduce logging insert this into the logback-configuration:

<!-- Springtainer -->
<logger name="com.github.dockerjava.jaxrs" level="WARN" />
<logger name="com.github.dockerjava.core.command" level="WARN" />
<logger name="org.apache.http" level="WARN" />

Labels

The container exports multiple labels to analyze running springtainers:

  • SPRINGTAINER_SERVICE=mysql
  • SPRINGTAINER_IMAGE=${embedded.container.mysql.docker-image}
  • SPRINGTAINER_STARTED=$currentTimestamp