Giter VIP home page Giter VIP logo

spring-docker-kubernetes's Introduction

Jukebox

Application setup

We have provided 3 ways to run this application

  • Using Docker
  • Using Kubernetes
  • Local Deployment

1. Using Docker

This application has been tested on Docker version 20.10.5, build 55c4c88
Please install the appropriate version of Docker from Docker Documentation
Make sure the Dockerfile is available in the root path of the project. The contents of the Dockerfile is as follows

FROM arm64v8/openjdk:8
RUN mkdir /app
RUN cd /app
COPY target/jukebox-0.0.1-SNAPSHOT.jar /app/jukebox.jar
COPY config/production.properties /app/application.properties
WORKDIR /app
EXPOSE 8080
ENTRYPOINT ["java", "-jar", "jukebox.jar", "--spring.config.location=application.properties"]

Here we are using a Base image of arm64v8/openjdk:8 which is suitable for a M1 Macbook Pro. It is recommended to use the base image which correctly suits your machine platform. You can check if the openJdk base image is supported for your machine architecture by following this link .
If you are using a non compatible version of the image, then its likely to show an error message

The requested platform doesn't support the host platform

Once this is done, you can follow the steps mentioned in the file docker-readme.txt which is attached with this project. The documentation provides a clear cut of how to deploy and start the container using docker.

2. Using Kubernetes

For deploying this application using Kubernetes, we are using a localised setup called Minikube. This is not recommended for a production deployment and is only used for local testing and development.

  1. Install kubectl which is a kubernetes resource client from their downloads page
  2. Install Minikube from their official page
  3. Make sure you have already followed the instruction in docker-readme.txt and created docker image of the application locally
  4. Follow the instructions in the file kubernetes-readme.txt included in this project.
  5. The instructions provided in the txt file will guide you in deploying the application into a minikube kubernetes cluster
  6. In a production environment, you can try using kubectl directly in deploying applications

References

I've followed the below tutorials and documentations in deploying this application using kubernetes

3. Local Deployment

  • Install mysql in local machine
  • Login to mysql server
  • create a database named "jukebox" - CREATE DATABASE jukebox
  • Create a jar build of the application using the maven command - mvn clean install
  • Run the application using the command : java -jar path/to/jar/build
  • By default the application runs on the port 8089

API documentation

You can access the API documentation by using Swagger doc

  • Docker deployment - swagger-doc
  • kubernetes deployment - generate minikube url by using "minikube service jukebox --url", then use /swagger-ui.html
  • Local deployment - swagger-doc

spring-docker-kubernetes's People

Contributors

emil-ep avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

tanbinh123

spring-docker-kubernetes's Issues

Musician types is required

There should be specific musician type that can be entered by user. If user provides a un supported type, then a response should be provided back "Unsupported musician type. Available types are 1, 2,3 etc"

API to upload profile pic

  • Create a new API to upload profile pic
  • The uploaded profile pic should be stored in resources folder
  • Modify the existing update profile api to include the "profile_pic" parameter which points to the location of the profile picture
  • Update the swagger documentation to include these api changes
  • Need to modify the docker and Kubernetes configuration to include the profile pic storage changes

Test profile pic api

Test the profile picture API on docker and kubernetes to make sure there are no storage issues

Database not created during initial run

Database is not created after running it on the first time.

Getting the below error

Caused by: org.flywaydb.core.internal.exception.FlywaySqlException: Unable to obtain connection from database: Unknown database

Allow CORS for the application

The web server rejects http request from react frontend throwing an error
Access to XMLHttpRequest at 'http://localhost:8080/api/v1/auth/signIn' from origin 'http://localhost:3000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.

Create API for updating, retrieving profile details

  1. Need to create an API for updating profile details (Should be based on the user id)
    1. FirstName (Should have validation)
    2. LastName
    3. Email (Should have validation in backend) - should not be updated initially
    4. Current password (need to verify this with the already existing passowrd in db)
    5. Password (Should have validation in backend)
  2. Need to create an API for fetching the profile details
    1. should be based on user id
  3. Need to update the sign in api to return user id in the response

Jenkins

This should be the lowest priority. Create a jenkins application using any free service and take the build using jenkins. Try to optimise the time taken to run the unit test cases (This needs to be researched and implemented)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.