EvaluationTask
Repository Contains
- Spring boot application + mysql database.
- Dockerfile each for module + docker-compose.
- K8s config files.
- Sample postman collection.
How to run application
To install application, run the following commands:
Download the repository and uzip it or clone it.
git clone https://github.com/dkorb/EvaluationTask
First method (running in minikube)
If you want to run application in minikube, go to folder with k8s configuration then execute commands:
# launch minikube environment
minikube start
# create/update clusters in minikube from config
kubectl apply -f .
# create a route to services deployed
minikube tunnel
Now you can test application using endpoints in postman everything should work fine.
Second method (using uploaded docker images)
If you want to run application as docker container, go to path where docker-compose.yaml file is located then execute the command:
docker compose up
You dont have to build the project, because docker images have been uploaded to my dockerhub repository.
# FamilyApp docker image
https://hub.docker.com/r/dkorb/familyapp
# FamilyMemberApp docker image
https://hub.docker.com/r/dkorb/familymemberapp
Third method (using your own build docker images)
If you want to build project without using the images I uploaded to dockerhub change docker-compose.yaml file to this:
version: "3.8"
services:
database:
container_name: Familydatabase
image: mysql:8.0
environment:
MYSQL_USER: ${MYSQLDB_DOCKER_USER}
MYSQL_PASSWORD: ${MYSQLDB_DOCKER_PASSWORD}
MYSQL_ROOT_PASSWORD: ${MYSQLDB_DOCKER_PASSWORD}
volumes:
- "db_data:/var/lib/mysql"
- "./mysql-init:/docker-entrypoint-initdb.d"
ports:
- "${MYSQLDB_LOCAL_PORT}:${MYSQLDB_DOCKER_PORT}"
familymemberapp:
build: ./FamilyMemberApp
container_name: FamilyMemberApp
# image: dkorb/familymemberapp:latest
env_file: .env
ports:
- "${SPRING_FAMILY_MEMBER_APP_PORT}:${SPRING_FAMILY_MEMBER_APP_PORT}"
depends_on:
- database
familyapp:
build: ./FamilyApp
container_name: FamilyApp
# image: dkorb/familyapp:latest
env_file: .env
ports:
- "${SPRING_FAMILY_APP_PORT}:${SPRING_FAMILY_APP_PORT}"
depends_on:
- familymemberapp
volumes:
db_data:
now execute the command in path where docker-compose.yaml file is located.
docker compose up --build
Fourth method (running application locally)
If you want to run application locally, change spring.profile.active in application.properties to dev in both modules.
spring.profiles.active = dev
Postman
postman directory contain collection with sample endpoints for both modules.
Swagger
# in your browser for FamilyApp.
http://localhost:8020/swagger-ui/#
# in your browser for FamilyMemberApp.
http://localhost:8010/swagger-ui/#