or,
- Git Clone this repo.
- Execute below
docker-compose
command wait for images to be pulled, build and started. - Open http://localhost for app.
- Open http://localhost:8080/swagger-ui/index.html for swagger.
docker-compose -f docker-compose-dev.yml up
OR
- The project in directory
./weather-prediction-api
is the gradle project and implements API in springboot and Kotlin - While importing the project in Intellij, select
build.gradle
and open as project - Set Project JDK to Java 17 by opening Module Settings for the project
- Use
clean
,build
and thenbootRun
options build and application tasks in the Gradle tool window - Alternatively
./gradlew clean build bootRun
can be used
The images build in the project are build and published at https://hub.docker.com/repositories/ianunay. For example, api published with tag v0 and image name ianunay/weather-app-api
> docker build -t ianunay/weather-app-api:v0 -f Dockerfile-api .
> docker push ianunay/weather-app-api:v0
eksctl create cluster --name eks-weather-cluster-0 --region us-west-2 --nodegroup-name standard-workers --node-type t3.small --nodes 1 --nodes-min 0 --nodes-max 1 --managed
kubectl apply -f eks-weather-app.yaml
kubectl get service nginx -n eks-weather-app -o jsonpath='{.status.loadBalancer.ingress[0].hostname}'
http://a96a52c8094de46d78688c6d5008e893-149566309.us-west-2.elb.amazonaws.com
To access the service using a domain name, create a hosted zone in Route 53 and create an A record with the load balancer DNS name. http://myday.outorin.com or http://44.228.245.169
aws route53 change-resource-record-sets --hosted-zone-id <hosted-zone-id> --change-batch '{
"Changes": [
{
"Action": "CREATE",
"ResourceRecordSet": {
"Name": "myday.outorin.io",
"Type": "A",
"AliasTarget": {
"HostedZoneId": "Z35SXDOTRQ7X7K", // Hosted zone ID for ELB in us-west-2
"DNSName": "dualstack.a96a52c8094de46d78688c6d5008e893-149566309.us-west-2.elb.amazonaws.com.",
"EvaluateTargetHealth": false
}
}
}
]
}'
eksctl scale nodegroup --cluster=eks-weather-cluster-0 --name=standard-workers --nodes=0
kubectl get nodes
eksctl scale nodegroup --cluster=eks-weather-cluster-0 --name=standard-workers --nodes=1
kubectl get nodes
kind create cluster --name weather-cluster
kubectl cluster-info --context kind-weather-cluster
kubectl apply -f kubernetes-dashboard.yaml
kubectl port-forward service/nginx 30080:80 -n kind-weather-app
brew install kompose
# Convert your Docker Compose file to Kubernetes:
kompose convert -f docker-compose-k8s.yml
brew install ubuntu/microk8s/microk8s
microk8s install
microk8s status --wait-ready
microk8s enable dashboard dns istio storage
microk8s kubectl
alias k='microk8s.kubectl'
microk8s dashboard-proxy
microk8s kubectl apply -f .
microk8s kubectl delete -n default deployment ui consul redis-cache-weather-prediction nginx api
microk8s kubectl delete -n default persistentvolumeclaim consul-claim0 redis-cache-weather-prediction-claim0
microk8s kubectl delete -n default service api consul nginx redis-cache-weather-prediction ui kubernetes
minikube start
minikube kubectl -- get po -A
minikube dashboard
minikube kubectl -- delete -n default service api consul nginx ui redis-cache-weather-prediction
kubectl create deployment wapp-ui --image=ianunay/weather-app-ui:v0
kubectl expose deployment wapp-ui --type=LoadBalancer --port=5001
kubectl port-forward service/wapp-ui 5001:5001
kubectl create deployment wapp-redis --image=redis
kubectl expose deployment wapp-redis --type=LoadBalancer --port=6379
kubectl port-forward service/wapp-redis 6379:6379
kubectl create deployment wapp-ssm --image=ianunay/weather-app-ssm:v0
kubectl expose deployment wapp-ssm --type=LoadBalancer --port=8500
kubectl port-forward service/wapp-ssm 8500:8500
kubectl create deployment wapp-api --image=ianunay/weather-app-api:v0
kubectl expose deployment wapp-api --type=LoadBalancer --port=8080
kubectl port-forward service/wapp-api 8080:8080
- The api runs at port 8080
- The api doc can be seen at
http://localhost:8080/swagger-ui/index.html
- The UI that consumes this API is located in directory
./weather-prediction-ui
- The UI can be started following the commands
> cd ./weather-prediction-ui
> npm install
> npm start
- The UI in react runs at port 5001
Caching is done using redis server running in docker The cached keys can be checked by login to redis-cli
> redis-cli
127.0.0.1:6379> keys *
- security
- logging
- controller advice for error responses
cachingDoneunit test for tddDoneintegratuon test for bddDonedocker-compose and jenkins scriptDone