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
NUTCH-2883 Provide means to run server as a persistent service in Docker container #691
Conversation
…ces in Docker container
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.
Looks good (but haven't tried it).
Something I would like feedback on is whether we want to run I haven't found a way to make this conditional i.e. if we were to build the image as follows docker build -t apache/nutch . --build-arg startserver=true --build-arg webapp=true Then we would expose the ports (these could also be configurable) by implementing Also, it's important for me to mention that I am aware of the one-service-one-container rule. The reason I chose to try supervisord in this case was that these services are entirely complimentary... I didn't see the reason to complicate things further by using |
…ces in Docker container
…ces in Docker container
…ces in Docker container
…ces in Docker container
…ces in Docker container
OK this PR is ready for full review. I've added in the conditional logic as explained in the README.
I augmented a the documentation so the above is clear. I also showed how we can browse container logs for server and webapp if they are running. |
…ces in Docker container
…ces in Docker container
…ces in Docker container
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.
Hi Lewis,
see the comments regarding the supervisord log and pid files.
Good solution with the build modes.
For now the server/webapp does not start, looks like the environment variables setting the ports are not visible to the supervisor and then cannot be passed to its children resp. the build args are not visible when the environment variables are defined:
docker build -t apache/nutch . --build-arg BUILD_MODE=2 --build-arg SERVER_PORT=8081 --build-arg SERVER_HOST=0.0.0.0 --build-arg WEBAPP_PORT=8080
docker run -t -i -d -p 8080:8080 -p 8081:8081 --name nutchcontainer apache/nutch
docker exec nutchcontainer /bin/bash
bash-5.1# tail /var/log/supervisord/*
==> /var/log/supervisord/nutchserver_stderr.log <==
at java.base/java.lang.Integer.parseInt(Integer.java:614)
at java.base/java.lang.Integer.parseInt(Integer.java:770)
at org.apache.nutch.service.NutchServer.main(NutchServer.java:186)Exception in thread "main" java.lang.NumberFormatException: null
at java.base/java.lang.Integer.parseInt(Integer.java:614)
at java.base/java.lang.Integer.parseInt(Integer.java:770)
at org.apache.nutch.service.NutchServer.main(NutchServer.java:186)
Exception in thread "main" java.lang.NumberFormatException: null
at java.base/java.lang.Integer.parseInt(Integer.java:614)
at java.base/java.lang.Integer.parseInt(Integer.java:770)
at org.apache.nutch.service.NutchServer.main(NutchServer.java:186)
==> /var/log/supervisord/nutchserver_stdout.log <==
==> /var/log/supervisord/nutchwebapp_stderr.log <==
at java.base/java.lang.Integer.parseInt(Integer.java:770)
at org.apache.nutch.webui.NutchUiServer.main(NutchUiServer.java:63)
Exception in thread "main" java.lang.NumberFormatException: null
at java.base/java.lang.Integer.parseInt(Integer.java:614)
at java.base/java.lang.Integer.parseInt(Integer.java:770)
at org.apache.nutch.webui.NutchUiServer.main(NutchUiServer.java:63)
Exception in thread "main" java.lang.NumberFormatException: null
at java.base/java.lang.Integer.parseInt(Integer.java:614)
at java.base/java.lang.Integer.parseInt(Integer.java:770)
at org.apache.nutch.webui.NutchUiServer.main(NutchUiServer.java:63)
==> /var/log/supervisord/nutchwebapp_stdout.log <==
bash-5.1# cat /proc/1/environ | tr '\000' '\n'
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
HOSTNAME=47570450a581
TERM=xterm
JAVA_HOME=/usr/lib/jvm/java-11-openjdk
NUTCH_HOME=/root/nutch_source/runtime/local
SERVER_PORT=
SERVER_HOST=
WEBAPP_PORT=
HOME=/root
…ces in Docker container
@sebastian-nagel here's what I tried. First prune entire Docker development cache
The build
Note the above output where the correct
and curl the REST endpoint
I can also reach the WebApp on 8081.
All is good... |
Hi @lewismc! Sorry, it took longer to get back... Finally found, why server and webapp didn't work (
Another point: after the webapp was moved into separate repository (see NUTCH-2886), it needs to be installed separately in the Dockerfile. Right now it fails with:
|
I'll update this to remove the webapp. |
This is a WIP for https://issues.apache.org/jira/browse/NUTCH-2883 feedback would be appreciated.