Skip to content
GitLab
    • GitLab: the DevOps platform
    • Explore GitLab
    • Install GitLab
    • How GitLab compares
    • Get started
    • GitLab docs
    • GitLab Learn
  • Pricing
  • Talk to an expert
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
    • Switch to GitLab Next
    Projects Groups Topics Snippets
  • Register
  • Sign in
  • cic-stack cic-stack
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 110
    • Issues 110
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 8
    • Merge requests 8
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Container Registry
    • Infrastructure Registry
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Grassroots EconomicsGrassroots Economics
  • cic-stackcic-stack
  • Merge requests
  • !335

Research fix docker entrypoint

  • Review changes

  • Download
  • Email patches
  • Plain diff
Open Blair Vanderlugt requested to merge bvanderlugt/cic-internal-integration:research-fix-docker-entrypoint into master Jan 22, 2022
  • Overview 7
  • Commits 27
  • Pipelines 25
  • Changes 24

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

Run

  1. docker-compose up cic-ussd-tasker
  2. docker-compose stop [cic-ussd-tasker container id]
  3. docker inspect [cic-ussd-tasker container id]
  4. 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

TODO

[ ] 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?

#198

Don't have an issue? Go here and submit or pick one --> Monorepo Kanban board: Good First Issue

Grassroots Economics Development Board

Edited Apr 14, 2022 by Blair Vanderlugt
Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: research-fix-docker-entrypoint