Skip to content

farhan-ejaz/thymeleafexamples-stsm

 
 

Repository files navigation

Phone Service: Demo Project


This is an example project using "Thymeleaf + Spring".

Build


To build this project you will need Maven 3. You can get it at:

 http://maven.apache.org

Clean compilation products:

  mvn clean

Compile:

 mvn compile

Package


Build Docker image

 docker build -t mtech/phoneshop .

Push Docker image

 - docker tag mtech/phoneshop farhanejaz/mtechphoneshop
 - docker login -u <your-user-name>
 - docker push farhanejaz/mtechphoneshop

Fig: Docker image pushed

Alt text

Pull Docker Image

  docker pull farhanejaz/mtechphoneshop

Install


Create Namespace (Prerequisite)

  kubectl create ns 230928005

Fig: describe namespace

Alt text

Ingress Controller (Prerequisite)

Installed in default namespace 'ingress-nginx'

   - kubectl apply -f https://github.com/raw/kubernetes/ingress-nginx/controller-v1.10.0/deploy/static/provider/cloud/deploy.yaml
   - kubectl apply -f https://github.com/raw/kubernetes/ingress-nginx/controller-v1.10.0/deploy/static/provider/baremetal/deploy.yaml

Fig: Ingress controller

Alt text

Mongo (Kustomize)

 - cd Kustomize/mongo
 - Kubectl apply -k . -n 230928005

App Services

Using Docker

Three environment variables are required

  • SERVICE_KEY can have values ('serviceA','serviceB','serviceC')
  • SERVICE_NAME can have values ('iPhone','Samsung','OPPO')
  • MONGO_CONNSTR As per your instance. If you have installed using the steps defined below in this document, the value mentioned here should work.

Example to deploy as ServiceA

  docker run -itd -p 8080:8080 \
  -e SERVICE_KEY=serviceA \
  -e SERVICE_NAME=iPhone \
  -e MONGO_CONNSTR=mongodb://adminuser:password123@172.17.0.1:32000/serviceA?authSource=admin \
  --name serviceA mtech/phoneshop

Using Kubernetes (Kustomize)

  - cd Kustomize/apps
  - Kubectl apply -k . -n 230928005

Fig: Mongo and Applications deployed to 230928005 namespace

Alt text

Fig: Screenshot Service A

Alt text

Fig: Screenshot Service B

Alt text

Fig: Screenshot Service B

Alt text

Releases

No releases published

Packages

No packages published

Languages

  • Java 77.8%
  • CSS 12.1%
  • HTML 5.9%
  • Dockerfile 4.2%