Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 09 Dec 2014 15:56:49 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-ports-bugs@FreeBSD.org
Subject:   [Bug 195827] New: Patch to textproc/apache-solr rc.d startup script to allow Solr to run on a given host and port (and as a given user)
Message-ID:  <bug-195827-13@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=195827

            Bug ID: 195827
           Summary: Patch to textproc/apache-solr rc.d startup script to
                    allow Solr to run on a given host and port (and as a
                    given user)
           Product: Ports Tree
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: Individual Port(s)
          Assignee: freebsd-ports-bugs@FreeBSD.org
          Reporter: paul@gromit.dlib.vt.edu
                CC: gaod@hychen.org
                CC: gaod@hychen.org
             Flags: maintainer-feedback?(gaod@hychen.org)

The rc.d solr startup script for textproc/apache-solr currently only allows
Solr to run as root and Solr itself will bind to all available interfaces when
it runs.  It is desirable to run network daemons so they will bind to a
particular interface (e.g., to coexist better with Jails), and also to run as a
particular user.  To that end, I've modified the /usr/local/etc/rc.d/solr
startup script so that Solr can at least be bound to a particular host and
port.

I've also almost achieved the latter aim of allowing Solr to be run as a
non-root user.  The only thing preventing the startup script being able to do
this is that is needs to ensure the
/usr/local/share/examples/apache-solr/solr-webapp directory is writable by the
user under which Solr is to be run.  (The solr-webapp directory is the one into
which the bundled Jetty deploys Solr.)

There are two other changes to the solr rc.d script that support being able to
run Solr as an unprivileged user: specifying the location of the logs and pid
file.  (Both currently specify locations requiring root write access.)

The changes in the patch below support the following rc.conf settings for the
solr rc.d script:

solr_host: IP address to bind to (defaults to 0.0.0.0, i.e., all interfaces)
solr_port: port to bind to (defaults to 8983)
solr_log: directory to store log files (defaults to /var/log)
solr_pidfile: location of pidfile (defaults to /var/run/solr.pid)

All the defaults default to the current behaviour of the port.  If solr_user is
set in /etc/rc.conf, and the solr-webapp exists and is writable by that user,
then Solr will run successfully as $solr_user, assuming solr_log and
solr_pidfile point to places writable by that user.

Here is the patch to textproc/apache-solr:

--- /usr/local/etc/rc.d/solr    2014-12-08 17:47:24.509744000 -0500
+++ solr    2014-12-09 10:34:32.154587847 -0500
@@ -38,13 +38,17 @@

 : ${solr_enable:=NO}
 : ${solr_instance:=/var/db/solr}
+: ${solr_pidfile:=/var/run/solr.pid}
+: ${solr_log:=/var/log}
+: ${solr_host:=0.0.0.0}
+: ${solr_port:=8983}

 required_files=${solr_instance}/solr.xml
-pidfile=/var/run/solr.pid
+pidfile=${solr_pidfile}
 command=/usr/sbin/daemon
 procname=/usr/local/openjdk7/bin/java
 start_precmd="cd /usr/local/share/examples/apache-solr"

-command_args="-f -p ${pidfile} ${procname} ${solr_flags}
-Dsolr.solr.home=${solr_instance} -Dsolr.log=/var/log -jar
/usr/local/share/examples/apache-solr/start.jar"
+command_args="-f -p ${pidfile} ${procname} ${solr_flags}
-Djetty.host=${solr_host} -Djetty.port=${solr_port}
-Dsolr.solr.home=${solr_instance} -Dsolr.log=${solr_log} -jar
/usr/local/share/examples/apache-solr/start.jar"

 run_rc_command "$1"

--- Comment #1 from Bugzilla Automation <bugzilla@FreeBSD.org> ---
Maintainer CC'd

-- 
You are receiving this mail because:
You are the assignee for the bug.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-195827-13>