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

Fish 10015 design graceful shutdown of docker images #7158

Conversation

luiseufrasio
Copy link
Contributor

@luiseufrasio luiseufrasio commented Jan 15, 2025

Description

Implement Docker Images Graceful Shutdown Support

Important Info

Blockers

None

Testing

New tests

None

Testing Performed

Run in WSL:

  1. export JAVA_HOME=/usr/lib/jvm/zulu11-ca-amd64 && export PATH=${JAVA_HOME}/bin:${PATH}
  2. cd Payara
  3. mvn clean install -DskipTests
  4. cd appserver/extras/docker-images/server-full
  5. mvn clean package
  6. cd target/docker
  7. docker build -t payara/server-full:local -f ./payara/server-full/build/Dockerfile.jdk11 ./payara/server-full/tmp/docker-build/
  8. docker run -it -p 8080:8080 -p 4848:4848 --name payara_docker payara/server-full:local
  9. open another WSL Tab
  10. docker ps -a
  11. docker stop <container_id>, it works with only the id's 3 first chars
  12. It should show us the logs of stop-domain with a gracefull shutdown at the ORIGINAL WSL tab

Testing Environment

Zulu JDK 11.0.11 on Ubuntu 22 with Maven 3.9.0

Copy link
Contributor

@fturizo fturizo left a comment

Choose a reason for hiding this comment

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

LGTM, but there are some verbal corrections needed for the messaged printed out

Copy link
Member

@Pandrex247 Pandrex247 left a comment

Choose a reason for hiding this comment

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

Tested using the shutdown grace property on Server and Micro:

For Micro:

  • docker container run --publish 6900:6900 --publish 8080:8080 payara/micro:6.2025.2-SNAPSHOT-jdk21 --shutdowngrace 20000
  • Stop with docker container stop -t 60 ${name}
  • Container exits after 20 seconds

For Server:

  • Create and start a container
  • Log in to admin console and add fish.payara.shutdowngrace system property with value of 20000
  • Stop with docker container stop -t 60 ${name}
  • Container exits after 20 seconds

@luiseufrasio luiseufrasio requested a review from pdudits January 24, 2025 13:05
@luiseufrasio luiseufrasio merged commit 7804c66 into payara:main Jan 24, 2025
1 check passed
Copy link
Member

@Pandrex247 Pandrex247 left a comment

Choose a reason for hiding this comment

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

The latest change to the micro image prevents it from building.

[INFO] DOCKER>  > [4/5] COPY --chown=payara:payara maven/bin/* /opt/payara/:
[INFO] DOCKER> ------
[INFO] DOCKER>
[INFO] DOCKER>  1 warning found (use docker --debug to expand):
[INFO] DOCKER>  - JSONArgsRecommended: JSON arguments recommended for ENTRYPOINT to prevent unintended behavior related to OS signals (line 72)
[INFO] DOCKER> Dockerfile.jdk11:69
[INFO] DOCKER> --------------------
[INFO] DOCKER>   67 |     WORKDIR ${HOME_DIR}
[INFO] DOCKER>   68 |
[INFO] DOCKER>   69 | >>> COPY --chown=payara:payara maven/bin/* ${SCRIPT_DIR}/
[INFO] DOCKER>   70 |     COPY --chown=payara:payara maven/artifacts/payara-micro.jar .
[INFO] DOCKER>   71 |
[INFO] DOCKER> --------------------
[INFO] DOCKER> ERROR: failed to solve: lstat /maven/bin: no such file or directory
[INFO] DOCKER>
[INFO] DOCKER> View build details: docker-desktop://dashboard/build/maven/maven0/fb9cseegqd6gv3swe4z9efg98
[ERROR] DOCKER> Error status (1) when building

@luiseufrasio
Copy link
Contributor Author

The latest change to the micro image prevents it from building.

[INFO] DOCKER>  > [4/5] COPY --chown=payara:payara maven/bin/* /opt/payara/:
[INFO] DOCKER> ------
[INFO] DOCKER>
[INFO] DOCKER>  1 warning found (use docker --debug to expand):
[INFO] DOCKER>  - JSONArgsRecommended: JSON arguments recommended for ENTRYPOINT to prevent unintended behavior related to OS signals (line 72)
[INFO] DOCKER> Dockerfile.jdk11:69
[INFO] DOCKER> --------------------
[INFO] DOCKER>   67 |     WORKDIR ${HOME_DIR}
[INFO] DOCKER>   68 |
[INFO] DOCKER>   69 | >>> COPY --chown=payara:payara maven/bin/* ${SCRIPT_DIR}/
[INFO] DOCKER>   70 |     COPY --chown=payara:payara maven/artifacts/payara-micro.jar .
[INFO] DOCKER>   71 |
[INFO] DOCKER> --------------------
[INFO] DOCKER> ERROR: failed to solve: lstat /maven/bin: no such file or directory
[INFO] DOCKER>
[INFO] DOCKER> View build details: docker-desktop://dashboard/build/maven/maven0/fb9cseegqd6gv3swe4z9efg98
[ERROR] DOCKER> Error status (1) when building

Fixed in a new PR: #7173

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants