Example of a python microservices using FastApi framework
- Python 3
- Virtual env
- VSCode or an other IDE
- Python 3
- Virtual env
- VSCode or an other IDE
- Service documentation (Open api)
- Multiple environments with dotenv
- Docker
- Mongo connector with Motor
- Authentication check (Test with keycloak)
- Authentication roles check (Test with keycloak)
- CI
- Unit test with pytest
- Cache
- Kafka producer
- Kafka consumer
- Jobs with Apache Airflow
- Run
./make.shto build the virtual env - Activate python virtual env :
- For linux :
source env/bin/activate - For windows :
source env/Scripts/activate
- For linux :
- Copy and set
.env-sampleto.env, edit variables - Run
python main.pyor use a launcher in VScode - Access to http://127.0.0.1:8080/
- Access to http://127.0.0.1:8080/docs for swagger
- Access to http://127.0.0.1:8080/redoc for Redoc
- Set WEB_CONCURRENCY environment variable for number of workers
- Write tests in
testsfolder - File pattern should be
*_test.py - Run with the command
pytest
- Use the script
./init_from_sample.sh