Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docker: start opensearch with exec for graceful termination #4694

Merged

Conversation

Jakob3xD
Copy link
Contributor

@Jakob3xD Jakob3xD commented May 8, 2024

Description

Testing with Podman on Ubuntu 24.04:

root@test ~ # podman run --name=test --ulimit memlock=-1:-1 --env discovery.type=single-node --env OPENSEARCH_INITIAL_ADMIN_PASSWORD='myStrongPassword123!' --pull never --security-opt=apparmor=unconfined --stop-signal=SIGINT opensearchproject/opensearch:2.13.0

Stopping it via an additional terminal:

root@test ~ # podman stop test
WARN[0010] StopSignal SIGINT failed to stop container test in 10 seconds, resorting to SIGKILL 
test

Opensearch gets terminated without any graceful shutdown.

Self build image with exec in opensearch-docker-entrypoint.sh to start container:

FROM opensearchproject/opensearch:2.13.0
RUN sed -i 's/    "$@"/    exec "$@"/g' opensearch-docker-entrypoint.sh
root@test ~ # podman run --name=test --ulimit memlock=-1:-1 --env discovery.type=single-node --env OPENSEARCH_INITIAL_ADMIN_PASSWORD='myStrongPassword123!' --pull never --security-opt=apparmor=unconfined --stop-signal=SIGINT localhost/opensearch-test
root@test ~ # podman stop test
test

Opensearch stops graceful with following log lines:

[2024-05-08T10:08:48,758][INFO ][o.o.s.a.r.AuditMessageRouter] [9cb111d7ce0d] Closing AuditMessageRouter
[2024-05-08T10:08:48,758][INFO ][o.o.n.Node               ] [9cb111d7ce0d] stopping ...
[2024-05-08T10:08:48,759][INFO ][o.o.s.a.s.SinkProvider   ] [9cb111d7ce0d] Closing InternalOpenSearchSink
[2024-05-08T10:08:48,759][INFO ][o.o.s.a.s.SinkProvider   ] [9cb111d7ce0d] Closing DebugSink
[2024-05-08T10:08:48,796][INFO ][o.o.n.Node               ] [9cb111d7ce0d] stopped
[2024-05-08T10:08:48,796][INFO ][o.o.n.Node               ] [9cb111d7ce0d] closing ...
[2024-05-08T10:08:48,798][INFO ][o.o.s.a.i.AuditLogImpl   ] [9cb111d7ce0d] Closing AuditLogImpl
[2024-05-08T10:08:48,798][INFO ][o.o.n.Node               ] [9cb111d7ce0d] closed

Issues Resolved

Closes #3229

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@peterzhuamazon
Copy link
Member

peterzhuamazon commented May 8, 2024

Thanks @Jakob3xD , can we add this for opensearch-dashboards as well?

We might not be able to make it for 2.14.0 tho as we already have 3 RCs out.

cc: @bbarani @rishabh6788

Thanks.

@prudhvigodithi prudhvigodithi self-requested a review May 14, 2024 16:12
Copy link
Member

@peterzhuamazon peterzhuamazon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Jakob3xD for your contribution here.

@peterzhuamazon peterzhuamazon merged commit a17589a into opensearch-project:main May 15, 2024
11 checks passed
@Jakob3xD Jakob3xD deleted the jh-graceful-termination branch May 21, 2024 11:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] OpenSearch container does not allow for graceful termination
3 participants