The database service (MariaDB) for the Adaptable TeaStore
595
The Adaptable TeaStore Database component utilizes MariaDB as its database service. This image is essential for storing all persistent data related to the Adaptable TeaStore application, including user information, product details, and transaction records.
The database component operates as a standalone service within the adaptable TeaStore architecture. It communicates with other microservices, such as the Persistence service, which relies on it to read and write data.
To start the Adaptable TeaStore Database component using the command line interface (CLI), you can use the following command:
docker run -p 3306:3306 -d cerberus237/adaptable-teastore-db
docker run: Command to create and run a new container.-p 3306:3306: Maps port 3306 of the host to port 3306 of the container, allowing external access to the database.-d: Runs the container in detached mode (in the background).cerberus237/adaptable-teastore-db: The name of the Docker image.Here’s a sample docker-compose.yml file to run the Adaptable TeaStore Database component using Docker Compose:
version: '3'
services:
db:
image: cerberus237/adaptable-teastore-db
expose:
- "3306"
ports:
- "3306:3306"
version: '3': Specifies the Docker Compose file format version.services: Defines the services to be run.
db: The name of the service representing the database.
image: Specifies the Docker image to use for the service.expose: Makes the specified port accessible to linked services (not to the host).ports: Maps the host port to the container port.The Dockerfile for the Adaptable TeaStore Database image is designed to set up the MariaDB environment. Below is an overview of its structure and components:
# Use the official MariaDB base image
FROM mariadb:10.4.12
LABEL org.opencontainers.image.authors="Inria R&D engineer <[email protected]>"
# The setup.sql must be run before the data sql file. The container will execute the files in alphabetical order
COPY setup.sql /docker-entrypoint-initdb.d/setup_0.sql
# Uncomment the following line if the teadb schema should come with a standard initialized data set
# COPY setupData.sql /docker-entrypoint-initdb.d/setup_1.sql
RUN sed -i "s/max_connections.*/max_connections = 2048/g" /etc/mysql/my.cnf
ENV MYSQL_ROOT_PASSWORD=rootpassword
EXPOSE 3306
FROM mariadb:latest: Specifies the base image to use, which is the latest version of MariaDB.ENV: Sets environment variables for the database, including the root password.EXPOSE 3306: Informs Docker that the container listens on port 3306 at runtime.The Adaptable TeaStore Database component is a crucial part of the overall architecture, providing persistent storage using MariaDB. It can be easily started using Docker commands or Docker Compose. The provided Dockerfile ensures a robust setup for the database service, enabling seamless integration with other microservices. For further information and detailed instructions, please refer to the Getting Started documentation.
This documentation should help users understand the database component, how to deploy it, and the underlying configurations in a clear and straightforward manner.
Content type
Image
Digest
sha256:57ff14331…
Size
108.5 MB
Last updated
about 1 year ago
docker pull cerberus237/adaptable-teastore-db