[Feature] Improve entrypoint script to gracefully shutdown application #65

Closed
opened 2022-06-14 14:57:39 +00:00 by abdulrabbani00 · 1 comment
abdulrabbani00 commented 2022-06-14 14:57:39 +00:00 (Migrated from github.com)

Table of contents generated with markdown-toc

Overview

  • Requester: @srwadleigh
  • Epic Link: None

Request

Currently, when we run docker stop, it stops the container without allowing the ipld-eth-beacon-indexer application a moment to gracefully stop. We want to have a process that stops the docker container, and also allows the application to gracefully stop. We can't include special instructions as members might not follow them.

Potential Solution

  • Keep track of the PID that is running the application.
  • When the entrypoint.sh script receives a SIGTERM/SIGKILL, it should kill $PID.
  • Wait for the PID to end properly.
  • End the entrypoint.
  • We might need to bump the amount of time we allot to SIGTERM when calling docker stop.

Alternative Solutions

Additional Context

- [Overview](#overview) - [Request](#request) - [Potential Solution](#potential-solution) - [Alternative Solutions](#alternative-solutions) - [Additional Context](#additional-context) <small><i><a href='http://ecotrust-canada.github.io/markdown-toc/'>Table of contents generated with markdown-toc</a></i></small> # Overview - **Requester**: @srwadleigh - **Epic Link**: None ## Request <!--- Explain what you want and why. If this feature is related to a problem please highlight it here.** ---> Currently, when we run `docker stop`, it stops the container without allowing the `ipld-eth-beacon-indexer` application a moment to gracefully stop. We want to have a process that stops the docker container, and also allows the application to gracefully stop. We can't include special instructions as members might not follow them. # Potential Solution <!---Provide any details for a potential solution. ---> * Keep track of the PID that is running the application. * When the `entrypoint.sh` script receives a SIGTERM/SIGKILL, it should `kill $PID`. * Wait for the PID to end properly. * End the entrypoint. * We might need to bump the amount of time we allot to SIGTERM when calling `docker stop`. ## Alternative Solutions <!---Provide any alternative solutions. ---> # Additional Context <!---Provide Additional Context. --->
abdulrabbani00 commented 2022-06-14 15:07:05 +00:00 (Migrated from github.com)

https://akomljen.com/stopping-docker-containers-gracefully/

Might be very simple by simply adding exec.

https://akomljen.com/stopping-docker-containers-gracefully/ Might be very simple by simply adding `exec`.
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: cerc-io/ipld-eth-beacon-indexer#65
No description provided.