Skip to content

Alok255/todo-memory-app-spring-boot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TODO Memory App Spring Boot

This TODO Memory is Java Application built using Spring Boot, Spring Data JPA, H2 in memory database and MySQL Connector Java.

The TODO Memory RESTful API is implemented as a Spring Boot app running an embedded version of Tomcat. For demonstration purposes, the data store is a H2 in-memory and MySQL database accessed via Spring JPA.

Table of Contents

  1. Build and Run
  2. Contributors

Build and Run

1. mvn clean install
2. mvn spring-boot:run

From Intellij

  1. Create Application Configuration under springtodolist module
  2. Set Main Class com.spring.todolist.SpringtodolistApplication

Dockerising Spring Boot application with Mysql Database

Download and install Docker for windows/Linux/mac from the official website https://hub.docker.com/

Then open the “Dockerfile” from the project folder. This contains the commands for generating Docker image.

Note:- Always run these commands from the project folder, where Dockerfile and docker-compose.yml file located, and add your database credentials in the .env file.

    $ docker build --tag springtodolist .
     
    $ docker images
    
    $ docker run --detach --publish 8080:8080 springtodolist -e DB_USER_NAME=db_username -e DB_PASSWORD=db_password -e DB_ROOT_PASSWORD=db_root_password -e DB_NAME=db_name -e SPRING_DB_URL=spring_datasource_url
    
    $ docker ps -a
    
    $ docker kill <CONTAINER ID>
    
    $ docker rmi <IMAGE ID>
      $ docker-compose build ##Create the build with docker compose to build docker image using built jar file.
       
      $ docker-compose up -d ##Start up the application stack using the docker-compose up command. add the -d flag to run everything in the background.
      
      $ docker-compose down ##To tear it all down, hit this command, the containers will stop and the network will be removed.
      
      $ docker-compose up 

Contributors

This project welcomes contributions and suggestions.