This is the voting application, a simple distributed application running across multiple Docker containers, which can be deployed using Docker Compose or Kubernetes.
To get started with deploying the example voting application, follow the instructions below:
To deploy the application using Docker Compose, make sure you have Docker installed on your system.
-
For Mac or Windows: Download Docker Desktop for Mac or Windows. Docker Compose will be automatically installed.
-
For Linux: Make sure you have the latest version of Docker Compose installed.
-
Clone this repository:
git clone https://github.com/guddev99/voting-app.git
-
Navigate to the cloned directory:
cd voting-app
-
Run the following command to start the services:
docker-compose up
-
Access the voting interface at
http://localhost:5000
and the result interface athttp://localhost:5001
.
To deploy the application using Kubernetes, make sure you have kubectl
installed and configured to connect to your Kubernetes cluster.
The folder k8s-specifications contains the yaml specifications of the Voting App's services.
-
Run the following command to create the deployments and services:
kubectl create -f k8s-specifications/
-
Monitor the deployment until all services are up and running:
kubectl get pods
-
Once all pods are in a
Running
state, you can access the Vote and Result interfaces using the respective services. This assumes that your Kubernetes environment supports LoadBalancer type services, such as GKE (Google Kubernetes Engine), EKS (Amazon Elastic Kubernetes Service), etc. Follow these steps:-
Find the external IP address of the voting-service by running:
kubectl get svc voting-service
Then, navigate to the external IP address of the voting-service in your web browser to access the Vote interface.
-
Similarly, find the external IP address of the result-service by running:
kubectl get svc result-service
Then, navigate to the external IP address of the result-service in your web browser to access the Result interface.
Note: If your Kubernetes environment does not support LoadBalancer type services, such as in on-premises or self-hosted environments, you may need to use alternative methods to access the services externally. This could include using NodePort type services, Ingress controllers, or other networking configurations depending on your specific environment setup.
-
- A front-end web app in Python which lets you vote between two options
- A Redis which collects new votes
- A .NET worker which consumes votes and stores them in…
- A Postgres database backed by a Docker volume
- A Node.js webapp which shows the results of the voting in real time
The voting application only accepts one vote per client. It does not register votes if a vote has already been submitted from a client.
This application is based on the example-voting-app repository from the dockersamples GitHub page.