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"
Maintainer CC'd
*** Bug 195827 has been marked as a duplicate of this bug. ***
paul, The maintainer has not responded in his allotted time (two weeks). However, you also didn't provide the patch as an attachment which is a requirement. (most people aren't going to cut and paste a patch from a browser). Please update the PR by attaching a patch and we can promote it without maintainer approval.
fyi - this port no longer has a maintainer as of 30 seconds ago.
I'm sorry for the late reply. I've created another pr #197377 which contain this one.
Created attachment 152626 [details] Patch against /usr/ports/textproc/apache-solr/files/solr.in
Sorry for not including a separate patch last time: I'm not familiar with PR submission etiquette. I've attached a new patch that is against the /usr/ports/textproc/apache-solr/files/solr.in file, to make it easier to update the port with my suggested change.
Superseded by bug 197377 *** This bug has been marked as a duplicate of bug 197377 ***