This is a simple flask app with 3 endpoints:
- /ping -> returns "Alive" and current time
- /v1/now -> returns json, e.g. {'now": }
- /v1/VIP/ -> returns either
- after more than 5 sec: TIMEOUT
- if there is a db error: ERROR
- in normal operation a json, e.g. {"gpsCoords":{"lat":77.77449,"long":106.75767},"source":"vip-db"}
A log file is generated in the current directory. The log will contain a periodic heartbeat for each worker and timeout/error messages.
$ python3 -m venv <your_virtual_environment>
$ source <your_virual_environment>/bin/activate
$ git clone [email protected]:tibor-reiss/avagps.git <new_folder>
$ cd <new_folder>
$ python3 -m pip install -e .
Logging location: avagps.log
Development
flask run
Production
gunicorn -b localhost:<port> -w <workers> src.wsgi:app
From browser:
- http://localhost:5000/ping
- http://localhost:5000/v1/now
- http://localhost:5000/v1/VIP/<integer>
From command line:
curl -X GET http://localhost:5000/ping
curl -X GET http://localhost:5000/v1/now
curl -X GET http://localhost:5000/v1/VIP/<integer>
pytest
pytest --cov=src