Sidekiq: Gracefully exit sidekiq when using Docker

Created on 5 Oct 2017  路  5Comments  路  Source: mperham/sidekiq

Hey guys,

I'm moving my application to Elastic Beanstalk Docker Multicontainer platform, and I'd like to know if anyone have a script for gracefully exit Sidekiq. I couldn't find out yet if Elastic Beanstalk sends a SIGKILL or a SIGINT to the process on docker container. The documentation really sucks. Anyone have any experience with it?

Most helpful comment

I don't have any experience with EB but I'm hoping someone else can chime in with more data.

All 5 comments

I don't have any experience with EB but I'm hoping someone else can chime in with more data.

Afaik, AWS Elastic Beanstalk Docker uses the EC2 Container Service (ECS) under the hood. The ECS service documentation states that they only use a docker stop command, which is the equivalent of a SIGTERM then wait 30 seconds before issuing a SIGKILL. There's no mention of a TSTP signal used

http://docs.aws.amazon.com/AmazonECS/latest/developerguide/update-service.html

the equivalent of docker stop is issued to the containers running in the task. This results in a SIGTERM signal and a 30-second timeout, after which SIGKILL is sent and the containers are forcibly stopped. If the container handles the SIGTERM signal gracefully and exits within 30 seconds from receiving it, no SIGKILL signal is sent. The service scheduler starts and stops tasks as defined by your minimum healthy percent and maximum percent settings.

Heroku has the same time limit now. If that's the case, you want to use -t 25 on the command line to give your jobs the maximum amount of time to finish.

@btsuhako thnks for the insights. I just read somewhere that Beanstalk uses a docker kill instead of docker stop. I gotta check this further though, I read on an old Stack Overflow post. Will deal with that later this week and will update here.

@Ricardonacif sorry but why not just use ECS ? EB looks simple but not flexible....

Was this page helpful?
0 / 5 - 0 ratings