springtainer-awss3mock
Dependency
<dependency>
<groupId>com.avides.springboot.springtainer</groupId>
<artifactId>springtainer-awss3mock</artifactId>
<version>1.2.0</version>
<scope>test</scope>
</dependency>
Configuration
Properties consumed (in bootstrap-it.properties
):
embedded.container.awss3mock.enabled
(default istrue
)embedded.container.awss3mock.startup-timeout
(default is30
)embedded.container.awss3mock.docker-image
(default isadobe/s3mock:2.1.21
)embedded.container.awss3mock.endpoint-http-port
(default is9090
)embedded.container.awss3mock.endpoint-https-port
(default is9191
)
Properties provided (in application-it.properties
):
embedded.container.awss3mock.endpoint.http.url
embedded.container.awss3mock.endpoint.https.url
Example for minimal configuration in application-it.properties
:
any-s3-endpoint.url=${embedded.container.awss3mock.endpoint.http.url}
A properly configured AmazonS3 Object can be provided by the AmazonS3Helper.
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=awss3mock
SPRINGTAINER_IMAGE=${embedded.container.awss3mock.docker-image}
SPRINGTAINER_STARTED=$currentTimestamp
Special Note
It's highly recommended to use BasicAWSCredentials with sample dates to avoid bad performance of the AWS-SDK.
Example: AmazonS3 amazonS3 = AmazonS3ClientBuilder.standard() .withCredentials(new AWSStaticCredentialsProvider(new BasicAWSCredentials("acesskey", "secretkey"))) .withEndpointConfiguration(new AwsClientBuilder.EndpointConfiguration(s3HttpEndpoint, Regions.EU_CENTRAL_1.getName())) .build();
The AmazonS3Helper
class can be used to build AmazonS3
objects with sample credentials.