Develop a service designed to work in a cloud environment (Kubernetes). The service is a storage of JSON-objects with HTTP-interface. Stored objects are placed in RAM, it is possible to set object lifetime.
- Writing objects to the storage
- Reading objects from storage
- Support for standard HTTP liveness and readiness validation methods for integration with k8s
- Obtaining metrics in prometheus format
- Storing data on disc and restoring the storage state from a file when the application is started
There are a total of three quick ways to get your project up and running:
- Using the Poetry package manager
- Using docker-compose
- Using k8s
-
Use the commands:
> cp example.env .env> poetry install> poetry shell> poetry run start -
Go to
http://localhost:8000/docsto view and use the endpoints
-
Use the command
> cp example.env .env -
Use docker compose to build an image
> docker-compose build -
Run docker compose up to start the application
> docker-compose up -
Go to
http://localhost:8000/docsto view and use the endpoints
-
Use the commands:
> cd k8s/> kubectl apply -f namespace> kubectl apply -f fastapi -
Make sure that pod has been started with the command
> kubectl get pods -n fastapi-storage-service -
Go to
http://localhost:31001/docsto view and use the endpoints
To run the tests, load the dependencies using the poetry package manager and run the command > pytest