Contains 2 main services: One spams the other with messages while the other logs the messages it received.
🌐 First service: Logger
- Every time the route
/ping
is being called with an http post request, it adds a log of the message in the request body. - Displays all the logs from its database.
💻 Second service: Pinger
- Pings the logger service and sends http post requests with a random message every 5 seconds to that
/ping
route.
- Clone the repository:
git clone https://github.com/Robert076/logger.git
- Start your local minikube server:
minikube start
- Run the Kubernetes deployment:
kubectl apply -f kubernetes/
- Port forward the logger port from inside the minikube
kubectl port-forward service/logger-service 8080:8080
- Visit localhost:8080/pings on your browser.
📁 .
├── 📜 LICENSE
├── 📘 README.md
├── 📁 kubernetes
│ ├── 📦 db-deployment.yml # deployment for the postgres container
│ ├── 💾 db-pvc.yml # persistent volume claim so we don't lose the data from the database
│ ├── 🌐 db-service.yml # k8s service for the database
│ │── ⚙️ init-ping-table.yml # k8s job to automatically create the table in he database so the program works as expected with no manual intervention
│ ├── ⚙️ logger-config.yml # config map for the project's env vars
│ ├── 📦 logger-deployment.yml # deployment for the logger service
│ ├── 🌐 logger-service.yml # k8s service for the logger
│ ├── 📦 pg-deployment.yml # deployment for the pg container (optional, we don't use pg anyways)
│ └── 🌐 pg-service.yml # k8s service for the pg service (optional, we don't use pg anyways)
├── 📁 logger-service
│ ├── 🐳 Dockerfile # Dockerfile for building the logger image
│ ├── 📁 db
│ │ └── 🛢️ db.go # database module for the logger app
│ ├── 🐙 docker-compose.yml # docker-compose for local development, run with this if you don't want to use k8s
│ ├── 📦 go.mod # go module
│ ├── 📦 go.sum # imports for the logger app
│ ├── 🚀 main.go # main for the logger service
│ └── 📁 ping
│ └── 📄 ping.go # data structure for the ping
└── 📁 pinger-service
├── 📦 go.mod # go module
├── 🚀 main.go # main for the pinger service
└── 📁 messages
└── 💬 messages.go # 20 random hardcoded messages