markcdev101 / spring-flavour-vault-backend

Repository for backend code for Flavour Vault
0 stars 0 forks source link

Ticket 04: Set Up MySQL Database with Docker #6

Closed markcdev101 closed 1 month ago

markcdev101 commented 1 month ago

Description: Set up a MySQL database in Docker for local development. Configure Spring Boot to connect to MySQL.

Spring Boot Concepts:

Guide:

Acceptance Criteria:

markcdev101 commented 1 month ago

Set up a MySQL Docker container using docker-compose.yml. Here’s an example Docker Compose configuration: Step by Step Completed:

  1. Added docker-compose.yml to the root directory
  2. then run this command - docker-compose up -d
  3. then run this command to check if the container is running - docker ps

Image

markcdev101 commented 1 month ago

Configure Spring Boot in the application.yml to connect to the MySQL instance: Step by Step Completed:

  1. Add application.yaml to include information about the MySQL DB
  2. Add MySQL Driver dependency
  3. Verify connection by running the following commands mvn spring-boot:run
  4. Checks the logs for the following: HikariPool-1 - Starting... HikariPool-1 - Start completed.

Image

markcdev101 commented 1 month ago

Run the MySQL container and verify the connection from the Spring Boot app by checking the logs or querying the database.

Initial test shows that endpoints are working as expected.

Image