A simple web application for container orchestrator testing
This is a simple web application that can be used to test container orchestrators like Kubernetes, OpenShift, Docker Swarm, etc. It is a simple web application that displays the hostname of the pod/container that is serving the request.
The image serves a simple web application on port 8000 by default, which returns
the hostname of the pod/container in a h1
tag. Besides the root path, the
application also serves a /api
path that returns the hostname in a p
tag.
You can also set the API_URL
environment variable to append content from the
API to the html output, this can be used to simulate full stack applications
with load balancers, databases, etc.
A sample docker-compose
file is as follows:
services:
frontend:
image: jljl1337/testpod
ports:
- "8000:8000"
environment:
- API_URL=http://backend:8000/api
backend:
image: jljl1337/testpod
environment:
- API_URL=http://database:8000/api
database:
image: jljl1337/testpod
Examples of Docker Swarm, Kubernetes can be found in the examples
directory
here.
The environment variables can be set are:
API_URL
: The URL to fetch content from and append to the html outputHOST
: The host to serve the application onPORT
: The port to serve the application on
Files for dev container are included, but you can also run the application locally.
If you are developing locally, first install uv.
Run the following command to create the virtual environment:
uv sync
Run the following command to start the application:
uv run main
This project is licensed under the MIT License - see the LICENSE