Example of a Python microservice that exposes an API to allow storing session data.
Key concepts:
- Automate documentation of environment variables
- Automate api documentation
- Provide minimalistic scripts to run basic container tasks
- Provide console for quick diagonostics
- Provice script to inspect container configuration
- Consume sub-service apis using an adapter
- Fully tested API
To run the server
. start_server.sh
This will start a server that listens to port 7030 (both internally and in the host machine)
API Docs
Api docs are available on localhost:7030/docs
The settings supported by the app are documented in then CONFIGURATION.md file.
This file is automatically generated from app/settings.py. It can be updated by running:
. update_docs.sh
If you want to print the settings to stdout, you can run:
python scripts/show_env_vars.py [--no-color]
To run regular tests:
. run_tests.sh [OPTIONS]
To run a specific test
. run_tests.sh tests/path/to/file_test.py
To run doctests:
. run_doctests.sh [OPTIONS]
Both scripts accept options, see their files for more info.
Launches python's REPL and loads the app and some other variables to quickly test functions, settings, routes, etc.
. console.shThis service always uses host 0.0.0.0 and port 80, assumes that it will be run inside a container and that the ports will be forwared to other values.