-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Issue #10696 - Addressing start-stop-daemon behaviors in jetty.sh #10700
Conversation
Signed-off-by: Joakim Erdfelt <[email protected]>
Signed-off-by: Joakim Erdfelt <[email protected]>
Signed-off-by: Joakim Erdfelt <[email protected]>
…t, or process will switch to JETTY_USER Signed-off-by: Joakim Erdfelt <[email protected]>
Signed-off-by: Joakim Erdfelt <[email protected]>
@olamy i'd like to use testcontainers and add a set of docker testing for jetty.sh I've been doing it manually with the docker images i have at https://github.com/joakime/jettysh-tests Ideally we would build a Docker image from our own committed Dockerfiles, and we can test via shell script or direct bash commands? |
Signed-off-by: Joakim Erdfelt <[email protected]>
Signed-off-by: Joakim Erdfelt <[email protected]>
I don't think we can use the testcontainers / docker to test the linux service startup techniques (init.d or systemd). |
Note: this change is for The only difference in the |
Signed-off-by: Joakim Erdfelt <[email protected]>
@gregw i'm happy with this version, it's been testing well in various virtual machines (so I can test service start/stop behaviors), and also basic docker setups (not our image), and even command line. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This still fails the test I described in #10696 :
[1011] ../jetty-home/bin/jetty.sh start
ERROR : Unrecognized argument: "dir" in <command-line>
Usage: java -jar $JETTY_HOME/start.jar [options] [properties] [configs]
java -jar $JETTY_HOME/start.jar --help # for more information
Starting Jetty: .Unrecognized option: --start-log-file=/home/gregw/src/jetty-10.0.x/jetty-home/target/base/jetty/jetty-start.log
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
...
This diff fix I posted there still applies, but no longer fixes that test.
@joakime I'm reposting this comment I made in the issue here. This is still failing with your latest version. I've found and "fixed" another pathological test case (that we should include). I created a base dir like:
modules/test.mod is
etc/jetty.conf is
The xml files are both just: <?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "https://www.eclipse.org/jetty/configure_10_0.dtd">
<Configure id="Server" class="org.eclipse.jetty.server.Server">
</Configure> This died in numerous ways. The "fix" I have is diff --git a/jetty-home/src/main/resources/bin/jetty.sh b/jetty-home/src/main/resources/bin/jetty.sh
index 9fd13d0281..c6882a543d 100755
--- a/jetty-home/src/main/resources/bin/jetty.sh
+++ b/jetty-home/src/main/resources/bin/jetty.sh
@@ -471,14 +471,14 @@ then
do
if [ -r "$XMLFILE" ] && [ -f "$XMLFILE" ]
then
- JETTY_ARGS=(${JETTY_ARGS[*]} "$XMLFILE")
+ JETTY_ARGS=(${JETTY_ARGS[*]} "'$XMLFILE'")
else
echo "** WARNING: Cannot read '$XMLFILE' specified in '$JETTY_CONF'"
fi
done
else
# assume it's a command line parameter (let start.jar deal with its validity)
- JETTY_ARGS=(${JETTY_ARGS[*]} "$CONF")
+ JETTY_ARGS=(${JETTY_ARGS[*]} "'$CONF'")
fi
done < "$JETTY_CONF"
fi
@@ -566,7 +566,7 @@ then
fi
# Collect the dry-run (of opts,path,main,args) from the jetty.base configuration
-JETTY_DRY_RUN=$("$JAVA" -jar "$JETTY_START" --dry-run=opts,path,main,args ${JETTY_ARGS[*]} ${JAVA_OPTIONS[*]})
+JETTY_DRY_RUN=$({ echo -jar "$JETTY_START" --dry-run=opts,path,main,args ; echo ${JETTY_ARGS[*]} ${JAVA_OPTIONS[*]} ; } | xargs "$JAVA" )
RUN_ARGS=($JETTY_SYS_PROPS ${JETTY_DRY_RUN[@]})
if (( DEBUG )) Specifically I am adding single quotes around what I know are single arguments. Edit: I applied this fix to the latest version and it no longer fixes it. So more work is needed. |
That's a great testcase / scenario / usecase @gregw I really need to get these into a set of docker tests (with the important configurations), i'll prioritize this over the next 2 days. |
Closing in favor of PR #10753 |
touch <file>
tests to only execute if theJETTY_USER
is unspecified. (ie: no user id change)start-stop-daemon
, allowing Jetty'sPidFile
andjetty.sh
manage it.USE_START_STOP_DAEMON=1
to thejetty.sh
to allow disabling use ofstart-stop-daemon
based on configuration.