Single Page book Catalogue
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.mvn/wrapper
src
README.md
mvnw
mvnw.cmd
pom.xml

README.md

Book Catalogue

Single page App keeping track of books.

Stack

  • UI: AngularJS + Bookstrap + Thymeleaf
  • Backend: Spring Boot + JPA
  • Database: H2 (Development), MySQL (Integration)

Build Commands

mvn clean package

Java Doc URL

http://<>/jsondoc-ui.html#

Search for

http://<>/jsondoc

Build Docker Image From Dockerfile And Run it

docker build -t boot-catalogue . docker run -d -p 8080:8080 boot-catalogue

Fabric Plugin Commands

mvn clean package -DskipTests docker:build docker:push mvn docker:run
mvn docker:start
mvn docker:stop

Using MySQL DB Container

Method 1 (Running Service as Jar)

docker run --name mysql -e MYSQL_ROOT_PASSWORD=password -e MYSQL_DATABASE=catalogueDB -e MYSQL_USER=springuser -e MYSQL_PASSWORD=springpassword -p 3306:3306 -d mysql:latest

java -jar -Dspring.profiles.active=int target/bookcatalogue-1.0.1.RELEASE.jar

Method 2 (Running Service as Image)

docker run --name mysqlserver -e MYSQL_ROOT_PASSWORD=password -e MYSQL_DATABASE=catalogueDB -e MYSQL_USER=springuser -e MYSQL_PASSWORD=springpassword -p 3306:3306 -d mysql:latest

docker run --name bookcatalogue --link mysqlserver:mysql -e SPRING_DATASOURCE_URL=jdbc:mysql://mysql:3306/catalogueDB -e SPRING_PROFILES_ACTIVE=int -p 8080:8080 -d kamranalinitb/bookcatalogue:latest

Method 3 (Running inside cluster)

docker network create --driver overlay catalogue-service-network

docker service create --name mysql --network catalogue-service-network -e MYSQL_ROOT_PASSWORD=password -e MYSQL_DATABASE=catalogueDB -e MYSQL_USER=springuser -e MYSQL_PASSWORD=springpassword -p 3306:3306 -d mysql:latest

docker service create --name bookcatalogue --network catalogue-service-network -e SPRING_DATASOURCE_URL=jdbc:mysql://mysql:3306/catalogueDB -e SPRING_PROFILES_ACTIVE=int -p 8080:8080 -d kamranalinitb/bookcatalogue:latest

Docker Compose Commands

Without Swarm

docker-compose -f src/main/scripts/docker-compose.yml up
docker-compose -f src/main/scripts/docker-compose.yml down

Swarm

docker stack deploy -c src/main/scripts/stackcompose/docker-compose.yml catalogue_stack
docker stack rm catalogue_stack

License

Version 2.0 of the Apache License

References

This project started from youtube video Tutorial and has evolved since then