Introduce FastAPI
Merge after #2749 (needed for tests to pass)
Fixes #2715
To discuss:
- which ASGI server to use: currently I played with this with uvicorn, which is simple and lightweight, it doesn’t have http2 support though (for that we could use e.g. hypercorn), you can see some info on the alternatives here
- after reading few articles, I went with uvicorn for local development and gunicorn + uvicorn workers for prod/stg, as it is supposed to be more suitable for prod envs (scalable, robust)
- Flask runs under /api and is hardcoded as WSGI, so I couldn’t make it work so that new endpoints are under /api/v1, for now I put them to /v1, wdyt? (redoc and swagger are also on /v1/redoc and /v1/docs)
TODO:
- [x] tests
- [x] rename of run_httpd.sh and occurrences
- [ ] polish the code, FastAPI settings, look into
security_and_https_middlewaremore
RELEASE NOTES BEGIN
N/A
RELEASE NOTES END
Build failed. https://softwarefactory-project.io/zuul/t/packit-service/buildset/85b9bfd4e2714f949fd56b064571c77f
:x: pre-commit FAILURE in 1m 49s :x: packit-service-tests FAILURE in 1m 22s
Build failed. https://softwarefactory-project.io/zuul/t/packit-service/buildset/98ad1502fb0f43e283eaab0107059b83
:heavy_check_mark: pre-commit SUCCESS in 1m 51s :x: packit-service-tests FAILURE in 1m 14s
Build failed. https://softwarefactory-project.io/zuul/t/packit-service/buildset/054bcebc86ed4dd99528f8f7156b7438
:heavy_check_mark: pre-commit SUCCESS in 1m 50s :x: packit-service-tests FAILURE in 1m 17s
Would API documentation go to /v1/docs or /docs?
Currently it goes under /docs, but this can be easily changed.
Would API documentation go to /v1/docs or /docs?
Currently it goes under
/docs, but this can be easily changed.
Ah okay. Yeah I'd say put it under the specific api version due to using versioning
Build failed. https://softwarefactory-project.io/zuul/t/packit-service/buildset/84a877feca1f491da40b948b454e0422
:heavy_check_mark: pre-commit SUCCESS in 1m 53s :x: packit-service-tests FAILURE in 1m 19s
recheck
Build succeeded. https://softwarefactory-project.io/zuul/t/packit-service/buildset/4bac654cc0444a3693ce38303101f7db
:heavy_check_mark: pre-commit SUCCESS in 1m 56s :heavy_check_mark: packit-service-tests SUCCESS in 2m 48s
I fixed the staging in #2750 so I would wait with merging this until Monday afternoon (prod deployment), so that this can be observed a bit more in staging.
Unfortunately, with the recent capacity reduction of our team, we needed to deprioritise few of the epics so that we are able to deliver the high-prio ones (see board). I won't merge this until we have the necessary capacity to continue with the epic, as changing the framework may introduce additional work.