What features/fixes does this MR address?
Addresses issues with docker shutdown not being gracefully handled and locking. Also makes image size smaller. Also changes prestart to contain db migrations that can be optionally mounted which can help us with migrations in the cluster.
How to validate:
Here is the case for celery tasks but it should be a similar effect to other services. The main problem being sending SIGTERM to the process inside the container having it respond with a graceful shutdown. SIGTERM is the default shutdown signal docker will send to stop a container.
Run the following in master and this branch
- docker-compose up cic-ussd-tasker
- docker-compose stop [cic-ussd-tasker container id]
- docker inspect [cic-ussd-tasker container id]
- See Status.ExitCode to see the exit code for the docker container.
Send a specific signal with docker kill
docker kill --signal=SIGTERM cic-eth-dispatcher
0 = graceful shutdown 137 = is the equivalent of -9 ie, the process did not shut down gracefully and the docker engine forcefully terminated it
requires changes to deployment as the images have new names and entrypoints
Implementation reference is from tiangolo's containers https://github.com/tiangolo/uvicorn-gunicorn-docker/tree/master/docker-images
[ ] cic-eth-dispatcher does handle SIGTERM signal and exit gracefully
[ ] cic-ussd-server does handle SIGTERM signal and exit gracefully
[ ] cic-ussd-server does not wait for postgres to come up
[x] fix tests - added docker build step for unit test report in junit format that can be handled by gitlab MR - added docker build step for coverage report in xml format
[ ] get coverage report results to coverage-server (@GochoMugo help?)
[ ] Capture the pytest exit code in the test container and copy to a test-result container using the scratch output. Use this to fail the build and block a merge request.
[ ] research using https://cobertura.github.io/cobertura/ for coverage reports and coverage.py to generate reports https://coverage.readthedocs.io/
[ ] Add the cic-eth-server dockerfile spec to this MR
What is the Grassroots Economics Kanban board task url?
Don't have an issue? Go here and submit or pick one --> Monorepo Kanban board: Good First Issue