Simple API that is using the following tech:
- Flask
- Docker
- Kubernetes
- MongoDB
- Elasticsearch
Two paths are available for project setup
In a terminal enter the following
- Will start up and create the services
docker compose up
- Will seed the database with test values
docker compose exec api python seed.py
In a terminal enter the following
- Create secrets for MongoDB
kubectl create secret generic mongodb-secret --from-literal=username=root --from-literal=password=root
- Starts creating the K8s cluster.
helm install project-api ./helm/
- Shows all pods, copy the name for the project-api pod (i.e.
products-api-59b95b696b-vtshd
)kubectl get pods
- Seeds the database with test values.
kubectl exec -it <pod name> -- python seed.py
For convenience I have included a Postman Collection of all the API endpoints. Please see the Projects API.postman_collection.json
file for examples of the api.
Test can be ran by executing the run_test.py
file.
docker compose exec api python run_test.py
kubectl exec -it <pod name> -- python run_test.py
Documentation for the project's API.