springtainer-mysql
Dependency
<dependency>
<groupId>com.avides.springboot.springtainer</groupId>
<artifactId>springtainer-mysql</artifactId>
<version>1.2.0</version>
<scope>test</scope>
</dependency>
Configuration
Properties consumed (in bootstrap.properties
):
embedded.container.mysql.enabled
(default istrue
)embedded.container.mysql.startup-timeout
(default is30
)embedded.container.mysql.docker-image
(default ismysql:8.0.20
)embedded.container.mysql.port
(default is3306
)embedded.container.mysql.root-password
(default isroot
)embedded.container.mysql.database-name
(default isembeddedMySqlDb
)embedded.container.mysql.database-charset
(default isutf8mb4
)
Properties provided (in application-it.properties
):
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