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

CUSTCOM-130 Better compatibility of docker images #4594

Merged
merged 22 commits into from
Apr 29, 2020
Merged

CUSTCOM-130 Better compatibility of docker images #4594

merged 22 commits into from
Apr 29, 2020

Conversation

dmatej
Copy link
Contributor

@dmatej dmatej commented Mar 27, 2020

Description

  • Fixes incompatibility with debian/ubuntu based JDK11 images
  • Fixes warning about unsupported JVM option
  • Adds features - JVM memory settings for Micro and Server-Full and JVM_ARGS for Micro
  • All Dockerfiles use same commands for same things
  • URL for gpg can be changed with -D parameter

Important Info

Testing

JDK8

mvn clean install -PBuildExtras,BuildDockerImages -pl :docker-images -amd

JDK11

mvn clean install -PBuildExtras,BuildDockerImages -pl :docker-images -amd -Ddocker.payara.tag=5.202-SNAPSHOT-JDK11 -Ddocker.java.repository=adoptopenjdk/openjdk11 -Ddocker.java.tag=jdk-11.0.6_10-debian-slim

Payara4

  1. Build some Payara4 versions including all required distribution packages
  2. This will generate docker images
  3. PayaraServerNodeTest will fail, because there is a difference in syntax, but other images should pass their respective tests

mvn clean install -PBuildExtras,BuildDockerImages -pl :docker-images -amd -Dpayara.version=4.1.2.191.14-SNAPSHOT -Ddocker.payara.tag=4.1.2.191.14-SNAPSHOT -Ddocker.payara.rootDirectoryName=payara41 -Ddocker.payara.domainName=payaradomain

Changing env variables, extending

docker create --name payaramicroxxx --env "MEM_XSS=2m" --env MEM_MAX_RAM_PERCENTAGE=25.0 payara/micro:latest
# replace dcb7e7328f90 with a result of docker create
docker start dcb7e7328f90
docker logs dcb7e7328f90

Notes

  • I need a tester with Mac and Windows, all tests were done on Linux, but I know that other systems have limitations on Docker and TestContainers.
  • EDIT: passed on Kubuntu, Windows 10 and Mac

@dmatej dmatej requested a review from pdudits March 27, 2020 09:01
@dmatej dmatej self-assigned this Mar 27, 2020
DEPLOY_DIR=/opt/payara/deployments

# Create and set the Payara user and working directory owned by the new user
RUN true \
&& addgroup payara \
&& adduser -D -h ${PAYARA_HOME} -H -s /bin/bash payara -G payara \
&& addgroup --gid 1000 payara \
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Evil block - this works in alpine, debian and ubuntu

Copy link

@rdebusscher rdebusscher left a comment

Choose a reason for hiding this comment

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

The memory changes is part of QACI-40

@dmatej
Copy link
Contributor Author

dmatej commented Mar 27, 2020

The memory changes is part of QACI-40

There is no PR, memory changes are not even mentioned in description and finally - Patrik already did it in micro here. So I only updated the full server dockerfile with same settings.
Also I think original fraction value 1 was a bad idea, because there is also off-heap memory ... I doubt even about the 90% value ... but we need performance tests for this.

@dmatej dmatej added the PR: DO NOT MERGE Don't merge PR until further notice label Mar 27, 2020
@rdebusscher rdebusscher self-requested a review March 27, 2020 12:54
@rdebusscher
Copy link

Use an environment variable to define the MaxRamPercentage as suggested here https://github.com/payara/docker-payaraserver-full/pull/118/files

@dmatej
Copy link
Contributor Author

dmatej commented Apr 6, 2020

Use an environment variable to define the MaxRamPercentage as suggested here https://github.com/payara/docker-payaraserver-full/pull/118/files

This should go to standalone issue and PR, here I only "synchronized" it between containers. At this moment this PR is useful for both Patrik's and my work, other changes should have own issue and also testing. Also I don't think this option is sufficient, there are at least other three extremely important (ie -XX:MaxDirectMemorySize - probably 90% fraction for heap is too much).
Again, this is for another discussion and testing.

@poikilotherm
Copy link
Contributor

As the author of the mentioned PR: good to know development moved here. What do you want me to do? This stuff is crucial IMHO

@dmatej
Copy link
Contributor Author

dmatej commented Apr 6, 2020

As the author of the mentioned PR: good to know development moved here. What do you want me to do? This stuff is crucial IMHO

Probably only wait, we did more changes and at this moment we have some internal discussion about it ;)

I expect we will push and merge the final version soon, very soon ;)

@poikilotherm
Copy link
Contributor

Great. I'm really eager to release Dataverse images based on Payara 5 :-)

@dmatej dmatej removed the PR: DO NOT MERGE Don't merge PR until further notice label Apr 6, 2020
@dmatej
Copy link
Contributor Author

dmatej commented Apr 7, 2020

Jenkins test please

Copy link

@rdebusscher rdebusscher left a comment

Choose a reason for hiding this comment

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

Probably due to he change from java to sh in the entrypoint, this doesn't work anymore.

FROM payara/micro:5.202-SNAPSHOT
ADD testapp.war /opt/payara/deployments

No app is deployed anymore

@dmatej dmatej added the PR: DO NOT MERGE Don't merge PR until further notice label Apr 8, 2020
poikilotherm added a commit to gdcc/dataverse-kubernetes that referenced this pull request Apr 15, 2020
…ing the MaxRAMPercentage currently. Can be removed later, when upstream merged payara/Payara#4594
@rdebusscher
Copy link

The Image for Payara Micro looks good and Application deployment is ok again.

But the PayaraMicroTestfails

ERROR [main] docker[payara/micro:5.202-SNAPSHOT]:472 - Could not start container
com.github.dockerjava.api.exception.InternalServerErrorException: Mounts denied:
path /var/folders/2p/g987c05s2f1d8tw5pzhr4tt00000gn/T/TestServlet7784738673461879995.war

@dmatej
Copy link
Contributor Author

dmatej commented Apr 17, 2020

Nevermind, I used temporary file, and it seems on your computer it cannot be mapped into the container. I will change it to use the target folder instead, I hope it will be enough.

David Matejcek added 5 commits April 18, 2020 12:09
- adduser has different syntax in each distribution
- it often fails, so you can use only -Ddocker.verbose to watch what it does
  and to see why it failed.
- the url is not filtered from pom.xml file, so you can use another url
  ie. -Ddocker.keyserver.url=hkp://ipv4.pool.sks-keyservers.net
  or  -Ddocker.keyserver.url=hkp://p80.pool.sks-keyservers.net:80
- all dockerfiles use same mechanisms and conventions
- useradd and groupadd are not in alpine by default
- adduser and addgroup abbreviated parameters are ambiguous on debian/ubuntu
- => removed coreutils dependency, using adduser and addgroup with long params
- it is also a bit faster
- tested with
  - mvn clean install -PBuildExtras,BuildDockerImages -pl :docker-images -amd
  - mvn clean install -PBuildExtras,BuildDockerImages -pl :docker-images -amd
    -Ddocker.java.repository=adoptopenjdk/openjdk11
    -Ddocker.java.tag=x86_64-debian-jdk-11.0.5_10
…entage

- it was already used in micro
- JDK8 supports it since u191 too
David Matejcek added 7 commits April 18, 2020 12:09
- server-node - no changes, configuration is obtained from DAS
- server-full and micro
  - basic configuration for DAS
  - MEM_MAX_RAM_PERCENTAGE aka -XX:MaxRAMPercentage
    - 70% of host memory by default - the rest for OS+NIO+stacks
  - MEM_XSS aka Xss
    - default 512k; enough for most applications
- micro
  - JVM_ARGS - possibility to add more JVM options
- hint for extending these docker images: read docker create --help
- deployment did not work
- extended test to deploy a trivial servlet application
- verification of tini and user management is done only once,
  then the image is shared
- this image has caching enabled by default
- only micro has it's own, because it uses leaner jdk image based on alpine
- renamed some properties to use common scheme
- PayaraServerNodeTest with lower timeouts as it waits for the DAS; if
  something went wrong, it hanged for too long
@dmatej
Copy link
Contributor Author

dmatej commented Apr 19, 2020

I need someone to verify that everything works as expected as I described in the description in other than Linux systems: Mac and Windows.
Currently I believe that @rdebusscher's problem is now fixed, but to believe is not enough.
In last PR I also made build much faster - now three of four images use the same precreated image, only micro is alpine-based to be lean as possible.

@dmatej
Copy link
Contributor Author

dmatej commented Apr 19, 2020

Jenkins test please

- sometimes it was not enough
Copy link

@rdebusscher rdebusscher left a comment

Choose a reason for hiding this comment

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

Change order of COPY statements to allow better re-usage of layers.

Copy link
Contributor

@pdudits pdudits left a comment

Choose a reason for hiding this comment

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

Tested on Windows, passes after small changes:

Had add .gitattributes for Windows, and brought back CMD support for Payara Micro.

@pdudits
Copy link
Contributor

pdudits commented Apr 20, 2020

The necessary changes are in https://github.com/dmatej/Payara/pull/3

pdudits and others added 4 commits April 20, 2020 13:57
New shell folder, new .gitattributes
- deploymentDir is now CMD concern, overrideable by user
- shell executes exec, so that java becomes the main process of container
- shell expansion is not available in CMD, therefore DEPLOY_DIR used expanded,
  but this is usual Docker behavior
@dmatej dmatej removed the PR: DO NOT MERGE Don't merge PR until further notice label Apr 20, 2020
@dmatej dmatej requested a review from rdebusscher April 20, 2020 13:08
@dmatej
Copy link
Contributor Author

dmatej commented Apr 20, 2020

Jenkins test please

- removed unuseful comments
- sync with other docker files
- tested
- note: even if environment variables are not used here, they may be used
  by users
@dmatej
Copy link
Contributor Author

dmatej commented Apr 20, 2020

Jenkins test please

MEM_XSS="512k"
ENV PATH="${PATH}:${PAYARA_DIR}/bin"

ARG TINI_VERSION=v0.18.0
Copy link
Contributor

@poikilotherm poikilotherm Apr 21, 2020

Choose a reason for hiding this comment

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

Heads up that tini v0.19 has been released two days ago.
Releases now offer SHA256 sums, thus easing installation A LOT!
https://github.com/krallin/tini/releases/tag/v0.19.0

See also krallin/tini#153

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think we will merge this first and then upgrade this in standalone PR, but thanks for the good news!

@dmatej dmatej merged commit f540098 into payara:master Apr 29, 2020
@dmatej dmatej deleted the CUSTCOM-130-docker-micro-jdk11 branch April 29, 2020 13:00
@poikilotherm
Copy link
Contributor

poikilotherm commented Apr 29, 2020

Congrats getting this huge PR done and merged 🎉 🥳
Looking forward to build awesome stuff with it!

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