Skip to content
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

Closed
wants to merge 13 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 14 additions & 3 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@ WORKDIR /root/

# Install dependencies
RUN apk update
RUN apk --no-cache add apache-ant bash git openjdk11
RUN apk --no-cache add apache-ant bash git openjdk11 supervisor

# Establish environment variables
RUN echo 'export JAVA_HOME=/usr/lib/jvm/java-11-openjdk' >> $HOME/.bashrc
env NUTCH_HOME='/root/nutch_source/runtime/local'
ENV JAVA_HOME '/usr/lib/jvm/java-11-openjdk'
lewismc marked this conversation as resolved.
Show resolved Hide resolved
ENV NUTCH_HOME '/root/nutch_source/runtime/local'

# Checkout and build the Nutch master branch (1.x)
RUN git clone https://github.com/apache/nutch.git nutch_source && \
Expand All @@ -32,6 +34,15 @@ RUN git clone https://github.com/apache/nutch.git nutch_source && \
rm -rf build/ && \
rm -rf /root/.ivy2/

# Arrange necessary setup for supervisord
RUN mkdir -p /var/log/supervisord
COPY ./config/supervisord_startserver_webapp.conf /etc/supervisord.conf

# Create symlinks for runtime/local/bin/nutch and runtime/local/bin/crawl
RUN ln -sf $NUTCH_HOME/bin/nutch /usr/local/bin/
RUN ln -sf $NUTCH_HOME/bin/crawl /usr/local/bin/
RUN ln -sf $NUTCH_HOME/bin/crawl /usr/local/bin/

EXPOSE 8080
EXPOSE 8081

ENTRYPOINT [ "supervisord", "--nodaemon", "--configuration", "/etc/supervisord.conf" ]
2 changes: 1 addition & 1 deletion docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Start docker

Start up an image and attach to it

docker run -t -i -d --name nutchcontainer apache/nutch /bin/bash
docker run -t -i -d -p 8080:8080 -p 8081:8081 --name nutchcontainer apache/nutch /bin/bash
docker attach --sig-proxy=false nutchcontainer

Nutch is located in ~/nutch and is almost ready to run.
Expand Down
63 changes: 63 additions & 0 deletions docker/config/supervisord_startserver_webapp.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

[supervisord]
childlogdir=/var/log/supervisord/
logfile=/tmp/supervisord.log ; (main log file;default $CWD/supervisord.log)
logfile_maxbytes=50MB ; (max main logfile bytes b4 rotation;default 50MB)
logfile_backups=10 ; (num of main logfile rotation backups;default 10)
loglevel=info ; (log level;default info; others: debug,warn,trace)
minfds=1024 ; (min. avail startup file descriptors;default 1024)
minprocs=200 ; (min. avail process descriptors;default 200)
nodaemon=false ; (start in foreground if true;default false)
pidfile=/tmp/supervisord.pid ; (supervisord pidfile;default supervisord.pid)

[program:nutchserver]
autorestart=true
autostart=true
command=nutch startserver
process_name=%(program_name)s
numprocs=1
redirect_stderr=true
startsecs=2
stderr_capture_maxbytes=10MB
stderr_logfile=/var/log/supervisord/%(program_name)s_stderr.log
stderr_logfile_backups=5
stderr_logfile_maxbytes=10MB
#stderr_syslog=
stdout_capture_maxbytes=10MB
stdout_logfile=/var/log/supervisord/%(program_name)s_stdout.log
stdout_logfile_backups=5
stdout_logfile_maxbytes=10MB
#stdout_syslog=

[program:nutchwebapp]
autorestart=true
autostart=true
command=nutch webapp
process_name=%(program_name)s
numprocs=1
redirect_stderr=true
startsecs=2
stderr_capture_maxbytes=10MB
stderr_logfile=/var/log/supervisord/%(program_name)s_stderr.log
stderr_logfile_backups=5
stderr_logfile_maxbytes=10MB
#stderr_syslog=
stdout_capture_maxbytes=10MB
stdout_logfile=/var/log/supervisord/%(program_name)s_stdout.log
stdout_logfile_backups=5
stdout_logfile_maxbytes=10MB
#stdout_syslog=