-
Notifications
You must be signed in to change notification settings - Fork 26
Conversation
run-presto.sh
Outdated
|
||
graceful_shutdown() { | ||
echo "calling graceful shutdown" | ||
curl -v -X PUT -d '"SHUTTING_DOWN"' -H "Content-type: application/json" http://localhost:8081/v1/info/state -H X-Presto-User:name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the address be passed as some kind of argument (depending on how worker is set up downstream like here)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The address localhost
is correct.
It just need to find the correct port number configured in /etc/presto/config.properties
like:
grep "^http-server.http.port=" /etc/presto/config.properties | cut -d'=' -f2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wow didn't know you could do this, thanks for sharing!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please also use STOPSIGNAL
instruction as well
Dockerfile
Outdated
@@ -32,3 +32,6 @@ USER root | |||
USER presto:presto | |||
# Add Db2 connector | |||
COPY --from=builder --chown=presto:presto presto-db2-* /usr/lib/presto/plugin/db2 | |||
|
|||
RUN chmod +x ./run-presto.sh |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this line can be removed if the file run-presto.sh
has mod 755
Dockerfile
Outdated
@@ -32,3 +32,6 @@ USER root | |||
USER presto:presto | |||
# Add Db2 connector | |||
COPY --from=builder --chown=presto:presto presto-db2-* /usr/lib/presto/plugin/db2 | |||
|
|||
RUN chmod +x ./run-presto.sh | |||
ENTRYPOINT ["./run-presto.sh"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you mind using CMD
instead of ENTRYPOINT
? it will be consistent with upstream image:
run-presto.sh
Outdated
|
||
graceful_shutdown() { | ||
echo "calling graceful shutdown" | ||
curl -v -X PUT -d '"SHUTTING_DOWN"' -H "Content-type: application/json" http://localhost:8081/v1/info/state -H X-Presto-User:name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The address localhost
is correct.
It just need to find the correct port number configured in /etc/presto/config.properties
like:
grep "^http-server.http.port=" /etc/presto/config.properties | cut -d'=' -f2
run-presto.sh
Outdated
echo "calling graceful shutdown" | ||
curl -v -X PUT -d '"SHUTTING_DOWN"' -H "Content-type: application/json" http://localhost:8081/v1/info/state -H X-Presto-User:name | ||
} | ||
trap graceful_shutdown SIGTERM |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use TERM
instead of SIGTERM
. see https://www.linuxjournal.com/content/bash-trap-command
run-presto.sh
Outdated
@@ -0,0 +1,22 @@ | |||
#!/bin/bash | |||
|
|||
# set -xeuo pipefail |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
uncomment this please
run-presto.sh
Outdated
} | ||
trap graceful_shutdown SIGTERM | ||
|
||
# set +e |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
uncomment this please
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good.
Would you please add some document to highlight this feature?
bf76c4c
to
0a8be3b
Compare
Closes #41.
Customizes the container entrypoint to initiate graceful shutdown for the Presto worker on a
SIGTERM
signal.