# Visitor Counter Application ## Description of the Application This application is designed to count the number of visits to a webpage. It utilizes Flask for the backend, Apache for serving static web content, and Redis for storing visitor counts. ## List of Containers Used - **Backend Container**: Built using Flask, this container handles API requests and updates visitor counts in Redis. - **Web Container**: Built using Apache, this container serves static HTML content. - **Redis Container**: Uses the official Redis image to store visitor counts persistently. ## List of Kubernetes Objects - **Deployments**: - **Backend Deployment**: Manages the backend Flask application. - **Web Deployment**: Manages the web Apache server. - **Services**: - **Backend Service**: Exposes the backend application on a specific port. - **Web Service**: Exposes the web server on a specific port. - **Redis Service**: Provides access to the Redis database. - **StatefulSet**: - **Redis StatefulSet**: Ensures persistent storage for Redis data. - **PersistentVolumeClaim (PVC)** and **PersistentVolume (PV)**: - Used for providing persistent storage to Redis. ## Virtual Networks and Named Volumes - **Virtual Networks**: Kubernetes automatically manages pod-to-pod communication within a cluster. - **Named Volumes**: Used for persistent storage in Redis, ensuring data is retained across pod restarts. ## Container Configuration - **Backend Container**: Configured to listen on port 5000 and connect to Redis for storing visitor counts. - **Web Container**: Configured to serve static HTML content on port 80. - **Redis Container**: Configured to store data persistently using a PersistentVolumeClaim. ## Instructions to Prepare, Run, Pause, and Delete the Application 1. **Prepare the Application**: Run the `prepare-app.sh` script to build Docker images and load them into Minikube. ./prepare-app.sh 2. **Run the Application**: Run the `start-app.sh` script to create all necessary Kubernetes objects and start the application. ./start-app.sh 3. **Pause the Application**: You can pause the application by scaling down deployments to zero replicas: kubectl scale deployment backend-deployment --replicas=0 kubectl scale deployment web-deployment --replicas=0 4. **Delete the Application**: Run the `stop-app.sh` script to delete all Kubernetes objects and stop the application. ./stop-app.sh ## Instructions to View the Application on the Web 1. **Access the Web Service**: Use Minikube to access the web service: minikube service web-service --url This will output a URL that you can use to view the application in your web browser by ctrl+clicking on the link.