Skip to content

Conversation

@mathieucarbou
Copy link
Member

@mathieucarbou mathieucarbou commented Jan 3, 2023

This PR adds a docker folder in the Ehcache kit with instructions on how to build the 3 images, plus the README to place on Docker Hub.

  • ehcache-server ehcache-terracotta-server
  • terracotta-voter-oss ehcache-terracotta-voter
  • terracotta-config-tool-oss ehcache-terracotta-config-tool

Notes:

  • I have manually tested them, since it is not yet possible to add docker tests in Ehcache
  • Naming still to be discussed
  • Gradle / Docker build scripts and deployment to hub.docker.com still to be done in a subsequent PR
  • A cherry-pick to the release/3.9 branch can be made once merged

Some ref regarding these required perm / uid:0 with OpenShift (also others): https://docs.openshift.com/container-platform/3.11/creating_images/guidelines.html#openshift-specific-guidelines

TO TEST:

gw assemble
gw distDir
cd clustered/ehcache-clustered/build/kit/
./docker/buildAndTest.groovy

@@ -0,0 +1,31 @@
FROM azul/zulu-openjdk-alpine:17-jre-latest
Copy link
Member

Choose a reason for hiding this comment

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

Should this be a reference to an immutable tag?

Copy link
Member Author

Choose a reason for hiding this comment

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

I've asked myself the question and I think that's better to use lastest. Otherwise we are forced to put a process in place to handle the update. Latest also does not harm for a sample file or something deployed OSS I think. Anybody not happy with that could grab the code and rebuild.

Copy link
Member Author

@mathieucarbou mathieucarbou Jan 3, 2023

Choose a reason for hiding this comment

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

Note: my answer would be different when we can add later a process to generate and deploy docker image to Docker hub from gradle ;-) But for now for a sample in the kit i don't see any issue.

@@ -0,0 +1,31 @@
FROM azul/zulu-openjdk-alpine:17-jre-latest

RUN apk update && apk upgrade && apk add bash
Copy link
Member

Choose a reason for hiding this comment

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

Do we need bash because of the start server script, or the entrypoint.sh?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes to keep the content in sync as much as possible as what's done in enterprise... If a fix has to be made, easier like that.

FROM azul/zulu-openjdk-alpine:17-jre-latest

RUN apk update && apk upgrade && apk add bash
RUN mkdir /terracotta && chgrp -R 0 /terracotta && chmod -R g+rX /terracotta
Copy link
Member

Choose a reason for hiding this comment

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

Would it be simpler to mirror the structure of the existing internal Docker images here?

Copy link
Member Author

@mathieucarbou mathieucarbou Jan 3, 2023

Choose a reason for hiding this comment

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

Not at all ;-)

That sag base image is breaking the basic rules about container immutability with their home dir and sagadmin perm requirements.

We have the opportunity to do things clean here and only open to group 0 and only specific RW folder for OpenShift random uid:0 support. Everything is installed as root and accessed in read-only mode by default, as it should be.


EXPOSE 9410

ENV DEFAULT_OFFHEAP "offheap-1:512MB,offheap-2:512MB"
Copy link
Member

Choose a reason for hiding this comment

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

Any reason we need two offheap resources by default in an Ehcache setup?

Copy link
Member Author

Choose a reason for hiding this comment

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

I replicated the enterprise defaults. I prefer to keep them as-is because config tool and sever defaults also have 2 offheaps I think... Better to be consistent across all our maintained images.

EXPOSE 9410

ENV DEFAULT_OFFHEAP "offheap-1:512MB,offheap-2:512MB"
ENV DEFAULT_ACTIVATE "false"
Copy link
Member

Choose a reason for hiding this comment

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

Would it make sense for this to be true for OSS images?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good question... It would help users I think but... The problem is that this won't be consistent with the use of the docker image with a custom CLI (not through using env vars by tweaking the default CLI). When using CLI, the auto activate flag has to be added to auto activate.

@mathieucarbou mathieucarbou changed the title Docker files for Ehcache [master] Docker files for Ehcache Jan 4, 2023
@mathieucarbou
Copy link
Member Author

Updated READMEs to add the necessary header and footer (licensing, etc) required to be deployed on hub.docker.com

@mathieucarbou
Copy link
Member Author

mathieucarbou commented Jan 9, 2023

  • Added 3.10-SNAPSHOT tag to built images
  • Added ./docker/buildAndTest.groovy to automate building and testing of images
gw assemble
gw distDir
cd clustered/ehcache-clustered/build/kit/
./docker/buildAndTest.groovy

@mathieucarbou mathieucarbou marked this pull request as draft January 11, 2023 13:49
@mathieucarbou
Copy link
Member Author

  • Changed image names to:

    terracotta/ehcache-terracotta-server
    terracotta/ehcache-terracotta-config-tool
    terracotta/ehcache-terracotta-voter

  • Updated ./docker/buildAndTest.groovy to include an Ehcache put/get test

  • Fixed base images to azul/zulu-openjdk-alpine:17.0.5-17.38.21

  • Added resource filtering in Groovy build script to generate docker files with the correct project version

@mathieucarbou mathieucarbou marked this pull request as ready for review January 11, 2023 17:06
@jhouserizer jhouserizer merged commit 52060d4 into ehcache:master Jan 17, 2023
@mathieucarbou mathieucarbou deleted the docker/master branch April 25, 2023 16:14
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.

3 participants