forked from IQSS/dataverse
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature(container): Refactor Dockerfile basing on openjdk:11-jre
Instead of using the upstream Payara image we build on the OpenJDK image which is also used by Solr. That way we reduce image pulls. We also optimize the domain1 configuration to be more production ready. Relates to IQSS#5292
- Loading branch information
1 parent
32d89a6
commit 5059c09
Showing
10 changed files
with
272 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/bash | ||
|
||
for f in ${SCRIPT_DIR}/init_* ${SCRIPT_DIR}/init.d/*; do | ||
case "$f" in | ||
*.sh) echo "[Entrypoint] running $f"; . "$f" ;; | ||
*) echo "[Entrypoint] ignoring $f" ;; | ||
esac | ||
echo | ||
done | ||
|
||
exec ${SCRIPT_DIR}/startInForeground.sh $PAYARA_ARGS |
62 changes: 62 additions & 0 deletions
62
conf/container/scripts/system/init_1_generate_deploy_commands.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
#!/bin/bash | ||
################################################################################ | ||
# | ||
# A script to append deploy commands to the post boot command file at | ||
# $PAYARA_HOME/scripts/post-boot-commands.asadmin file. All applications in the | ||
# $DEPLOY_DIR (either files or folders) will be deployed. | ||
# The $POSTBOOT_COMMANDS file can then be used with the start-domain using the | ||
# --postbootcommandfile parameter to deploy applications on startup. | ||
# | ||
# Usage: | ||
# ./generate_deploy_commands.sh | ||
# | ||
# Optionally, any number of parameters of the asadmin deploy command can be | ||
# specified as parameters to this script. | ||
# E.g., to deploy applications with implicit CDI scanning disabled: | ||
# | ||
# ./generate_deploy_commands.sh --properties=implicitCdiEnabled=false | ||
# | ||
# Environment variables used: | ||
# - $PREBOOT_COMMANDS - the pre boot command file. | ||
# - $POSTBOOT_COMMANDS - the post boot command file. | ||
# | ||
# Note that many parameters to the deploy command can be safely used only when | ||
# a single application exists in the $DEPLOY_DIR directory. | ||
################################################################################ | ||
|
||
# Check required variables are set | ||
if [ -z $DEPLOY_DIR ]; then echo "Variable DEPLOY_DIR is not set."; exit 1; fi | ||
if [ -z $PREBOOT_COMMANDS ]; then echo "Variable PREBOOT_COMMANDS is not set."; exit 1; fi | ||
if [ -z $POSTBOOT_COMMANDS ]; then echo "Variable POSTBOOT_COMMANDS is not set."; exit 1; fi | ||
|
||
# Create pre and post boot command files if they don't exist | ||
touch $POSTBOOT_COMMANDS | ||
touch $PREBOOT_COMMANDS | ||
|
||
deploy() { | ||
|
||
if [ -z $1 ]; then | ||
echo "No deployment specified"; | ||
exit 1; | ||
fi | ||
|
||
DEPLOY_STATEMENT="deploy $DEPLOY_PROPS $1" | ||
if grep -q $1 $POSTBOOT_COMMANDS; then | ||
echo "post boot commands already deploys $1"; | ||
else | ||
echo "Adding deployment target $1 to post boot commands"; | ||
echo $DEPLOY_STATEMENT >> $POSTBOOT_COMMANDS; | ||
fi | ||
} | ||
|
||
# RAR files first | ||
for deployment in $(find $DEPLOY_DIR -mindepth 1 -maxdepth 1 -name "*.rar"); | ||
do | ||
deploy $deployment; | ||
done | ||
|
||
# Then every other WAR, EAR, JAR or directory | ||
for deployment in $(find $DEPLOY_DIR -mindepth 1 -maxdepth 1 ! -name "*.rar" -a -name "*.war" -o -name "*.ear" -o -name "*.jar" -o -type d); | ||
do | ||
deploy $deployment; | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
#!/bin/bash | ||
########################################################################################################## | ||
# | ||
# This script is to execute Payara Server in foreground, mainly in a docker environment. | ||
# It allows to avoid running 2 instances of JVM, which happens with the start-domain --verbose command. | ||
# | ||
# Usage: | ||
# Running | ||
# startInForeground.sh <arguments> | ||
# is equivalent to running | ||
# asadmin start-domain <arguments> | ||
# | ||
# It's possible to use any arguments of the start-domain command as arguments to startInForeground.sh | ||
# | ||
# Environment variables used: | ||
# - $ADMIN_USER - the username to use for the asadmin utility. | ||
# - $PASSWORD_FILE - the password file to use for the asadmin utility. | ||
# - $PREBOOT_COMMANDS - the pre boot command file. | ||
# - $POSTBOOT_COMMANDS - the post boot command file. | ||
# - $DOMAIN_NAME - the name of the domain to start. | ||
# - $JVM_ARGS - extra JVM options to pass to the Payara Server instance. | ||
# - $AS_ADMIN_MASTERPASSWORD - the master password for the Payara Server instance. | ||
# | ||
# This script executes the asadmin tool which is expected at ~/appserver/bin/asadmin. | ||
# | ||
########################################################################################################## | ||
|
||
# Check required variables are set | ||
if [ -z $ADMIN_USER ]; then echo "Variable ADMIN_USER is not set."; exit 1; fi | ||
if [ -z $PASSWORD_FILE ]; then echo "Variable PASSWORD_FILE is not set."; exit 1; fi | ||
if [ -z $PREBOOT_COMMANDS ]; then echo "Variable PREBOOT_COMMANDS is not set."; exit 1; fi | ||
if [ -z $POSTBOOT_COMMANDS ]; then echo "Variable POSTBOOT_COMMANDS is not set."; exit 1; fi | ||
if [ -z $DOMAIN_NAME ]; then echo "Variable DOMAIN_NAME is not set."; exit 1; fi | ||
|
||
# The following command gets the command line to be executed by start-domain | ||
# - print the command line to the server with --dry-run, each argument on a separate line | ||
# - remove -read-string argument | ||
# - surround each line except with parenthesis to allow spaces in paths | ||
# - remove lines before and after the command line and squash commands on a single line | ||
|
||
# Create pre and post boot command files if they don't exist | ||
touch $POSTBOOT_COMMANDS | ||
touch $PREBOOT_COMMANDS | ||
|
||
OUTPUT=`${PAYARA_DIR}/bin/asadmin --user=${ADMIN_USER} --passwordfile=${PASSWORD_FILE} start-domain --dry-run --prebootcommandfile=${PREBOOT_COMMANDS} --postbootcommandfile=${POSTBOOT_COMMANDS} $@ $DOMAIN_NAME` | ||
STATUS=$? | ||
if [ "$STATUS" -ne 0 ] | ||
then | ||
echo ERROR: $OUTPUT >&2 | ||
exit 1 | ||
fi | ||
|
||
COMMAND=`echo "$OUTPUT"\ | ||
| sed -n -e '2,/^$/p'\ | ||
| sed "s|glassfish.jar|glassfish.jar $JVM_ARGS |g"` | ||
|
||
echo Executing Payara Server with the following command line: | ||
echo $COMMAND | tr ' ' '\n' | ||
echo | ||
|
||
# Run the server in foreground - read master password from variable or file or use the default "changeit" password | ||
|
||
set +x | ||
if test "$AS_ADMIN_MASTERPASSWORD"x = x -a -f "$PASSWORD_FILE" | ||
then | ||
source "$PASSWORD_FILE" | ||
fi | ||
if test "$AS_ADMIN_MASTERPASSWORD"x = x | ||
then | ||
AS_ADMIN_MASTERPASSWORD=changeit | ||
fi | ||
echo "AS_ADMIN_MASTERPASSWORD=$AS_ADMIN_MASTERPASSWORD" > /tmp/masterpwdfile | ||
exec ${COMMAND} < /tmp/masterpwdfile |