Skip to content

Commit

Permalink
Merge pull request #517 from OpenLiberty/vNext
Browse files Browse the repository at this point in the history
Merge vNext commits into main
  • Loading branch information
leochr authored Feb 28, 2024
2 parents db945ea + 8812cdd commit 740273e
Show file tree
Hide file tree
Showing 117 changed files with 462 additions and 160 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ before_install:
env:
- RELEASE=../releases/23.0.0.9
- RELEASE=../releases/23.0.0.12
- RELEASE=../releases/24.0.0.1
- RELEASE=../releases/24.0.0.2
- RELEASE=../releases/latest

script:
Expand Down
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,14 +119,20 @@ Note that currently some content in the SCC is sensitive to heap geometry. If th
This feature can be controlled via the following variables:

* `OPENJ9_SCC` (environment variable)
* Decription: If `"true"`, cache application-specific in an SCC and include it in the image. A new SCC will be created if needed, otherwise data will be added to the existing SCC.
* Description: If `"true"`, cache application-specific in an SCC and include it in the image. A new SCC will be created if needed, otherwise data will be added to the existing SCC.
* Default: `"true"`.
* `TRIM_SCC` (environment variable)
* Description: If `"true"`, the application-specific SCC layer will be sized-down to accomodate only the data populated during image build process. To allow the application to add more data to the SCC at runtime, set this variable to `"false"`, but also ensure the SCC is not marked read-only. This can be done by setting the OPENJ9_JAVA_OPTIONS environment variable in your application Dockerfile like so: `ENV OPENJ9_JAVA_OPTIONS="-XX:+IgnoreUnrecognizedVMOptions -XX:+IdleTuningGcOnIdle -Xshareclasses:name=openj9_system_scc,cacheDir=/opt/java/.scc,nonFatal -Dosgi.checkConfiguration=false"`. Note that OPENJ9_JAVA_OPTIONS is already defined in the base Liberty image dockerfile, but includes the `readonly` sub-option.
* Default: `"true"`.
* `SCC_SIZE` (environment variable)
* Description: The size of the application-specific SCC layer in the image. This value is only used if `TRIM_SCC` is set to `"false"`.
* Default: `"80m"`.
* `WARM_ENDPOINT` (environment variable)
* Description: If `"true"`, curl will be used to access the WARM_ENDPOINT_URL (see below) during the population of the SCC. This will increase the amount of information in the SCC and improve first request time in subsequent starts of the image.
* Default: `"true"`
* `WARM_ENDPOINT_URL` (enviornment variable)
* Description: The URL to access during SCC population if WARM_ENDPOINT is true.
* Default: `"localhost:9080/"`

To customize one of the built-in XML snippets, make a copy of the snippet from Github and edit it locally. Once you have completed your changes, use the `COPY` command inside your Dockerfile to copy the snippet into `/config/configDropins/overrides`. It is important to note that you do not need to set build-arguments (`ARG`) for any customized XML snippets. The following Dockerfile snippet is an example of how you should include the customized snippet.

Expand Down
8 changes: 8 additions & 0 deletions create-new-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,14 @@ for file in $(find ./releases/latest ./releases/$NEW_VERSION -name Dockerfile.*)
sed -i'.bak' -e "s/ARG LIBERTY_BUILD_LABEL=.*/ARG LIBERTY_BUILD_LABEL=$BUILD_LABEL/g" $file;

sed -i'.bak' -e "s/LIBERTY_SHA=.*/LIBERTY_SHA={replace_with_correct_sha}/" $file;

sed -i'.bak' -e "s/FEATURES_SHA=.*/FEATURES_SHA={replace_with_correct_sha}/" $file;

# Do these substitutions only in $NEW_VERSION, not latest.
if [[ "$file" == "./releases/$NEW_VERSION/"* ]];
then
sed -i'.bak' -e "s/ARG PARENT_IMAGE=icr.io\/appcafe\/open-liberty:kernel-slim/ARG PARENT_IMAGE=icr.io\/appcafe\/open-liberty:$NEW_VERSION-kernel-slim/g" $file;
fi

# Clean up temp files
rm $file.bak
Expand Down
6 changes: 6 additions & 0 deletions releases/23.0.0.12/full/helpers/build/configure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,12 @@ function main() {
if [ ! "$SCC_SIZE" = "" ]; then
cmd+=" -s $SCC_SIZE"
fi
if [ "$WARM_ENDPOINT" = "false" ]; then
cmd+=" -c"
fi
if [ ! "$WARM_ENDPOINT_URL" = "" ]; then
cmd+=" -u $WARM_ENDPOINT_URL"
fi
eval $cmd
fi
}
Expand Down
30 changes: 28 additions & 2 deletions releases/23.0.0.12/full/helpers/build/populate_scc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ set -Eeox pipefail
SCC_SIZE="80m" # Default size of the SCC layer.
ITERATIONS=2 # Number of iterations to run to populate it.
TRIM_SCC=yes # Trim the SCC to eliminate any wasted space.
WARM_ENDPOINT=true
WARM_ENDPOINT_URL=localhost:9080/

# If this directory exists and has at least ug=rwx permissions, assume the base image includes an SCC called 'openj9_system_scc' and build on it.
# If not, build on our own SCC.
Expand All @@ -32,7 +34,7 @@ CREATE_LAYER="$OPENJ9_JAVA_OPTIONS,createLayer,groupAccess"
DESTROY_LAYER="$OPENJ9_JAVA_OPTIONS,destroy"
PRINT_LAYER_STATS="$OPENJ9_JAVA_OPTIONS,printTopLayerStats"

while getopts ":i:s:tdh" OPT
while getopts ":i:s:u:tdhwc" OPT
do
case "$OPT" in
i)
Expand All @@ -48,13 +50,24 @@ do
d)
TRIM_SCC=no
;;
w)
WARM_ENDPOINT=true
;;
c)
WARM_ENDPOINT=false
;;
u)
WARM_ENDPOINT_URL="${OPTARG}"
;;
h)
echo \
"Usage: $0 [-i iterations] [-s size] [-t] [-d]
"Usage: $0 [-i iterations] [-s size] [-t] [-d] [-w] [-u url]
-i <iterations> Number of iterations to run to populate the SCC. (Default: $ITERATIONS)
-s <size> Size of the SCC in megabytes (m suffix required). (Default: $SCC_SIZE)
-t Trim the SCC to eliminate most of the free space, if any.
-d Don't trim the SCC.
-w Use curl to warm an endpoint during SCC creation. (Default: $WARM_ENDPOINT)
-u The URL endpoint to warm during SCC creation. (Default: $WARM_ENDPOINT_URL)
Trimming enabled=$TRIM_SCC"
exit 1
Expand Down Expand Up @@ -82,7 +95,14 @@ then
echo "Calculating SCC layer upper bound, starting with initial size $SCC_SIZE."
# Populate the newly created class cache layer.
/opt/ol/wlp/bin/server start

if [ ${WARM_ENDPOINT} == true ]
then
curl --silent --output /dev/null --show-error --fail --max-time 5 ${WARM_ENDPOINT_URL} 2>&1 || echo "WARM_ENDPOINT call failed, continuing"
fi

/opt/ol/wlp/bin/server stop

# Find out how full it is.
FULL=`( java $PRINT_LAYER_STATS || true ) 2>&1 | awk '/^Cache is [0-9.]*% .*full/ {print substr($3, 1, length($3)-1)}'`
echo "SCC layer is $FULL% full. Destroying layer."
Expand All @@ -106,6 +126,12 @@ fi
for ((i=0; i<$ITERATIONS; i++))
do
/opt/ol/wlp/bin/server start

if [ ${WARM_ENDPOINT} == true ]
then
curl --silent --output /dev/null --show-error --fail --max-time 5 ${WARM_ENDPOINT_URL} 2>&1 || echo "WARM_ENDPOINT call failed, continuing"
fi

/opt/ol/wlp/bin/server stop
done

Expand Down
6 changes: 6 additions & 0 deletions releases/23.0.0.12/kernel-slim/helpers/build/configure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,12 @@ function main() {
if [ ! "$SCC_SIZE" = "" ]; then
cmd+=" -s $SCC_SIZE"
fi
if [ "$WARM_ENDPOINT" = "false" ]; then
cmd+=" -c"
fi
if [ ! "$WARM_ENDPOINT_URL" = "" ]; then
cmd+=" -u $WARM_ENDPOINT_URL"
fi
eval $cmd
fi
}
Expand Down
30 changes: 28 additions & 2 deletions releases/23.0.0.12/kernel-slim/helpers/build/populate_scc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ set -Eeox pipefail
SCC_SIZE="80m" # Default size of the SCC layer.
ITERATIONS=2 # Number of iterations to run to populate it.
TRIM_SCC=yes # Trim the SCC to eliminate any wasted space.
WARM_ENDPOINT=true
WARM_ENDPOINT_URL=localhost:9080/

# If this directory exists and has at least ug=rwx permissions, assume the base image includes an SCC called 'openj9_system_scc' and build on it.
# If not, build on our own SCC.
Expand All @@ -32,7 +34,7 @@ CREATE_LAYER="$OPENJ9_JAVA_OPTIONS,createLayer,groupAccess"
DESTROY_LAYER="$OPENJ9_JAVA_OPTIONS,destroy"
PRINT_LAYER_STATS="$OPENJ9_JAVA_OPTIONS,printTopLayerStats"

while getopts ":i:s:tdh" OPT
while getopts ":i:s:u:tdhwc" OPT
do
case "$OPT" in
i)
Expand All @@ -48,13 +50,24 @@ do
d)
TRIM_SCC=no
;;
w)
WARM_ENDPOINT=true
;;
c)
WARM_ENDPOINT=false
;;
u)
WARM_ENDPOINT_URL="${OPTARG}"
;;
h)
echo \
"Usage: $0 [-i iterations] [-s size] [-t] [-d]
"Usage: $0 [-i iterations] [-s size] [-t] [-d] [-w] [-u url]
-i <iterations> Number of iterations to run to populate the SCC. (Default: $ITERATIONS)
-s <size> Size of the SCC in megabytes (m suffix required). (Default: $SCC_SIZE)
-t Trim the SCC to eliminate most of the free space, if any.
-d Don't trim the SCC.
-w Use curl to warm an endpoint during SCC creation. (Default: $WARM_ENDPOINT)
-u The URL endpoint to warm during SCC creation. (Default: $WARM_ENDPOINT_URL)
Trimming enabled=$TRIM_SCC"
exit 1
Expand Down Expand Up @@ -82,7 +95,14 @@ then
echo "Calculating SCC layer upper bound, starting with initial size $SCC_SIZE."
# Populate the newly created class cache layer.
/opt/ol/wlp/bin/server start

if [ ${WARM_ENDPOINT} == true ]
then
curl --silent --output /dev/null --show-error --fail --max-time 5 ${WARM_ENDPOINT_URL} 2>&1 || echo "WARM_ENDPOINT call failed, continuing"
fi

/opt/ol/wlp/bin/server stop

# Find out how full it is.
FULL=`( java $PRINT_LAYER_STATS || true ) 2>&1 | awk '/^Cache is [0-9.]*% .*full/ {print substr($3, 1, length($3)-1)}'`
echo "SCC layer is $FULL% full. Destroying layer."
Expand All @@ -106,6 +126,12 @@ fi
for ((i=0; i<$ITERATIONS; i++))
do
/opt/ol/wlp/bin/server start

if [ ${WARM_ENDPOINT} == true ]
then
curl --silent --output /dev/null --show-error --fail --max-time 5 ${WARM_ENDPOINT_URL} 2>&1 || echo "WARM_ENDPOINT call failed, continuing"
fi

/opt/ol/wlp/bin/server stop
done

Expand Down
6 changes: 6 additions & 0 deletions releases/23.0.0.9/full/helpers/build/configure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,12 @@ function main() {
if [ ! "$SCC_SIZE" = "" ]; then
cmd+=" -s $SCC_SIZE"
fi
if [ "$WARM_ENDPOINT" = "false" ]; then
cmd+=" -c"
fi
if [ ! "$WARM_ENDPOINT_URL" = "" ]; then
cmd+=" -u $WARM_ENDPOINT_URL"
fi
eval $cmd
fi
}
Expand Down
30 changes: 28 additions & 2 deletions releases/23.0.0.9/full/helpers/build/populate_scc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ set -Eeox pipefail
SCC_SIZE="80m" # Default size of the SCC layer.
ITERATIONS=2 # Number of iterations to run to populate it.
TRIM_SCC=yes # Trim the SCC to eliminate any wasted space.
WARM_ENDPOINT=true
WARM_ENDPOINT_URL=localhost:9080/

# If this directory exists and has at least ug=rwx permissions, assume the base image includes an SCC called 'openj9_system_scc' and build on it.
# If not, build on our own SCC.
Expand All @@ -32,7 +34,7 @@ CREATE_LAYER="$OPENJ9_JAVA_OPTIONS,createLayer,groupAccess"
DESTROY_LAYER="$OPENJ9_JAVA_OPTIONS,destroy"
PRINT_LAYER_STATS="$OPENJ9_JAVA_OPTIONS,printTopLayerStats"

while getopts ":i:s:tdh" OPT
while getopts ":i:s:u:tdhwc" OPT
do
case "$OPT" in
i)
Expand All @@ -48,13 +50,24 @@ do
d)
TRIM_SCC=no
;;
w)
WARM_ENDPOINT=true
;;
c)
WARM_ENDPOINT=false
;;
u)
WARM_ENDPOINT_URL="${OPTARG}"
;;
h)
echo \
"Usage: $0 [-i iterations] [-s size] [-t] [-d]
"Usage: $0 [-i iterations] [-s size] [-t] [-d] [-w] [-u url]
-i <iterations> Number of iterations to run to populate the SCC. (Default: $ITERATIONS)
-s <size> Size of the SCC in megabytes (m suffix required). (Default: $SCC_SIZE)
-t Trim the SCC to eliminate most of the free space, if any.
-d Don't trim the SCC.
-w Use curl to warm an endpoint during SCC creation. (Default: $WARM_ENDPOINT)
-u The URL endpoint to warm during SCC creation. (Default: $WARM_ENDPOINT_URL)
Trimming enabled=$TRIM_SCC"
exit 1
Expand Down Expand Up @@ -82,7 +95,14 @@ then
echo "Calculating SCC layer upper bound, starting with initial size $SCC_SIZE."
# Populate the newly created class cache layer.
/opt/ol/wlp/bin/server start

if [ ${WARM_ENDPOINT} == true ]
then
curl --silent --output /dev/null --show-error --fail --max-time 5 ${WARM_ENDPOINT_URL} 2>&1 || echo "WARM_ENDPOINT call failed, continuing"
fi

/opt/ol/wlp/bin/server stop

# Find out how full it is.
FULL=`( java $PRINT_LAYER_STATS || true ) 2>&1 | awk '/^Cache is [0-9.]*% .*full/ {print substr($3, 1, length($3)-1)}'`
echo "SCC layer is $FULL% full. Destroying layer."
Expand All @@ -106,6 +126,12 @@ fi
for ((i=0; i<$ITERATIONS; i++))
do
/opt/ol/wlp/bin/server start

if [ ${WARM_ENDPOINT} == true ]
then
curl --silent --output /dev/null --show-error --fail --max-time 5 ${WARM_ENDPOINT_URL} 2>&1 || echo "WARM_ENDPOINT call failed, continuing"
fi

/opt/ol/wlp/bin/server stop
done

Expand Down
8 changes: 7 additions & 1 deletion releases/23.0.0.9/kernel-slim/helpers/build/configure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ function main() {
if [ ! "$SCC_SIZE" = "" ]; then
cmd+=" -s $SCC_SIZE"
fi
if [ "$WARM_ENDPOINT" = "false" ]; then
cmd+=" -c"
fi
if [ ! "$WARM_ENDPOINT_URL" = "" ]; then
cmd+=" -u $WARM_ENDPOINT_URL"
fi
eval $cmd
fi
}
Expand Down Expand Up @@ -103,4 +109,4 @@ function parseCommaList() {
done
}

main "$@"
main "$@"
30 changes: 28 additions & 2 deletions releases/23.0.0.9/kernel-slim/helpers/build/populate_scc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ set -Eeox pipefail
SCC_SIZE="80m" # Default size of the SCC layer.
ITERATIONS=2 # Number of iterations to run to populate it.
TRIM_SCC=yes # Trim the SCC to eliminate any wasted space.
WARM_ENDPOINT=true
WARM_ENDPOINT_URL=localhost:9080/

# If this directory exists and has at least ug=rwx permissions, assume the base image includes an SCC called 'openj9_system_scc' and build on it.
# If not, build on our own SCC.
Expand All @@ -32,7 +34,7 @@ CREATE_LAYER="$OPENJ9_JAVA_OPTIONS,createLayer,groupAccess"
DESTROY_LAYER="$OPENJ9_JAVA_OPTIONS,destroy"
PRINT_LAYER_STATS="$OPENJ9_JAVA_OPTIONS,printTopLayerStats"

while getopts ":i:s:tdh" OPT
while getopts ":i:s:u:tdhwc" OPT
do
case "$OPT" in
i)
Expand All @@ -48,13 +50,24 @@ do
d)
TRIM_SCC=no
;;
w)
WARM_ENDPOINT=true
;;
c)
WARM_ENDPOINT=false
;;
u)
WARM_ENDPOINT_URL="${OPTARG}"
;;
h)
echo \
"Usage: $0 [-i iterations] [-s size] [-t] [-d]
"Usage: $0 [-i iterations] [-s size] [-t] [-d] [-w] [-u url]
-i <iterations> Number of iterations to run to populate the SCC. (Default: $ITERATIONS)
-s <size> Size of the SCC in megabytes (m suffix required). (Default: $SCC_SIZE)
-t Trim the SCC to eliminate most of the free space, if any.
-d Don't trim the SCC.
-w Use curl to warm an endpoint during SCC creation. (Default: $WARM_ENDPOINT)
-u The URL endpoint to warm during SCC creation. (Default: $WARM_ENDPOINT_URL)
Trimming enabled=$TRIM_SCC"
exit 1
Expand Down Expand Up @@ -82,7 +95,14 @@ then
echo "Calculating SCC layer upper bound, starting with initial size $SCC_SIZE."
# Populate the newly created class cache layer.
/opt/ol/wlp/bin/server start

if [ ${WARM_ENDPOINT} == true ]
then
curl --silent --output /dev/null --show-error --fail --max-time 5 ${WARM_ENDPOINT_URL} 2>&1 || echo "WARM_ENDPOINT call failed, continuing"
fi

/opt/ol/wlp/bin/server stop

# Find out how full it is.
FULL=`( java $PRINT_LAYER_STATS || true ) 2>&1 | awk '/^Cache is [0-9.]*% .*full/ {print substr($3, 1, length($3)-1)}'`
echo "SCC layer is $FULL% full. Destroying layer."
Expand All @@ -106,6 +126,12 @@ fi
for ((i=0; i<$ITERATIONS; i++))
do
/opt/ol/wlp/bin/server start

if [ ${WARM_ENDPOINT} == true ]
then
curl --silent --output /dev/null --show-error --fail --max-time 5 ${WARM_ENDPOINT_URL} 2>&1 || echo "WARM_ENDPOINT call failed, continuing"
fi

/opt/ol/wlp/bin/server stop
done

Expand Down
Loading

0 comments on commit 740273e

Please sign in to comment.