This is an example project using "Thymeleaf + Spring".
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
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
Pull Docker Image
docker pull farhanejaz/mtechphoneshop
kubectl create ns 230928005
Fig: describe namespace
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
- cd Kustomize/mongo
- Kubectl apply -k . -n 230928005
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
- cd Kustomize/apps
- Kubectl apply -k . -n 230928005
Fig: Mongo and Applications deployed to 230928005 namespace
Fig: Screenshot Service A
Fig: Screenshot Service B
Fig: Screenshot Service B