This project is the quick setup of the legacy webshop of the masters course 'Distributed Information Systems' at the University of Applied Sciences (Karlsruhe).
docker-compose
You can run the images from docker hub
which is preferred or built it on your own.
First: Start Docker daemon and check with docker ps
docker-compose.yml
locally in a desired folder and run
$ docker-compose up -d
# to follow the logs
$ docker-compose logs -tf
# to shutdown
$ docker-compose down
docker-compose -f docker-compose-local.yml up -d
which will
war
in a staged build, packs it into a docker tomcat8 container,
and sets the user tomcat
with password admin
for the Management Console at http://localhost:8888/hibernate.cfg.xml
docker-compose -f docker-compose-local.yml logs -tf
docker-compose -f docker-compose-local.yml down
If you change the user and password of the MySQL database, you should run
$ docker-compose rm -v
$ rm -rf .data
Details can be found here
Make sure to have minikube
, kubectl
and istioctl
installed.
These commands will be used throughout the setup process.
Start minikube cluster with at least 3 cpu cores allocated. Fewer cores can lead to deployments not starting because of to little computing ressources.
minikube start --cpus 3
Start the kubernetes dashboard:
minikube dashboard
To access the deployed services, an ingress needs to be setup. The nginx-minikube addon will be used in this case.
minikube addons enable ingress
You may have to start the minikube cluster directly with the ingress addon enabled. In this case recreate the minikube cluster:
minikube delete
minikube start --cpus 3 --addons ingress
minikube dashboard
Deploy all containers and services as well as the database using kubectl
.
All used images are public, so no authentication is required.
kubectl apply -f kubernetes/kubernetes.yaml
In the dashboard you can see the deployments created, which will start the necessary pods and configure the services and ingress.
Using the ingress, the services can be reached on their respective paths /user
, /category
and /product
.
The base ip can be retrieved with minikube.
minikube ip
The load balancing can be demonstrated using a special endpoint built into the user service.
The endpoint /user/v1/pod/
returns the hostname -- and thus the pod name.
To install Istio, issue the following command:
istioctl install
Confirm the question with y
and wait for the processing to complete.
kubectl label namespace default istio-injection=enabled
This commands instructs Istio to install the sidecar next to the deployments of the EShop. However, this only takes affect on new deployments. So redeploy using the following commands:
kubectl delete -f kubernetes/kubernetes.yaml
kubectl apply -f kubernetes/kubernetes.yaml
After deployment is finished, you should see two containers per pod in the Kubernetes Dashboard.
Kiali, Prometheus and Grafana are already provided as addons by Istio. These addons are preconfigured, so only the deployment using the provided files is necessary.
kubectl apply -f samples/addons/kiali.yaml
To access Kiali, set up a port forwarding:
kubectl port-forward svc/kiali -n istio-system 20001:20001
kubectl apply -f samples/addons/prometheus.yaml
Grafana uses the prometheus metrics to display statistics. The endpoints as well as the Grafana Dashboard are already configured by default.
kubectl apply -f samples/addons/grafana.yaml
kubectl port-forward svc/grafana -n istio-system 3000:3000
To issue multiple requests to the services, a bash script may be used.
./call_every_service.sh
Copyright (c) 2017-2018 Manuel Vogel Source code is open source and released under the MIT license.