Simple fastapi skeleton for a stateless microservice (application for ml models, optimization, ...)
To run the service manually in debug mode install the required python dependencies:
uv install
You can run the service in debug mode:
export FASTAPI_ENV="dev"
./run_app.sh
To build the Docker image:
docker build -t "fastapi-api:latest" . --build-arg FASTAPI_ENV=dev
To run the Docker image:
docker run -p 5051:5051 -ti sim_ir:latest
To check that the service is alive, run:
curl -X GET "http://localhost:5000/health" -H "accept: application/json"
curl -X GET "http://localhost:5000/v1/health" -H "accept: application/json"
For the websockets endpoint, run:
websocat ws://127.0.0.1:5000/ws/health
websocat ws://127.0.0.1:5000/v1/ws/health
The user interface for the API is defined in http://localhost:5000/docs endpoint.
Be aware, that OpenAPI schema doesn't support websockets.
To run the tests:
uv run python -m pytest --verbose --cov=./