OpenGrok

OpenGrok is an unmaintained package and at least for me did not seem to work out of the box.

After a bit of struggle, I got it working in a Jail. Would this be a useful guide to the community?

I should add, it was saving some files to /var/ rather than somewhere in /usr/local. This might be due to its illumos and Linux background.
 
If you really want to maximum your experience, consider adopting the opengrok port. Get it to work out of the box for everyone. You can even add a guide as additional documentation that the opengrok port provides.
 
I use OpenGrok quite a bit at work, albeit with CentOS. I think its userbase is expanding. I think people would appreciate any help you could provide to OpenGrok on FreeBSD.
 
If you really want to maximum your experience, consider adopting the opengrok port. Get it to work out of the box for everyone. You can even add a guide as additional documentation that the opengrok port provides.
Let me make a guide, see if it passes the scrutiny of the community, and then try to take up that package. How about that?

Like I said, I am particularly concerned about writing to directories that may be appropriate on illumos or Linux, but not on FreeBSD, and would hate to corrupt many-a-system :)
 
Figured it out! Here is a preliminary HOWTO. Please review and let me know how it works for you. If there are any errors, let me know exactly what you did up to that point, so I can reproduce your environment.

Install requirements:

Code:
pkg install tomcat8
pkg install zip
pkg install ctags
Download the latest version of OpenGrok. Currently, the latest release is 0.13, but your fetch command may differ.

fetch https://github.com/OpenGrok/OpenGrok/files/631110/opengrok-0.13-rc5.zip

Then unzip the file.

unzip opengrok-0.13-rc5.zip
tar -xzvf opengrok-0.13-rc5.tar.gz


Enter the newly created directory, make the required base directory and copy over the opengrok files. I selected /usr/local/var/opengrok/ as my base, but if there is a more FreeBSD-appropriate location, please let me know.

cd opengrok-0.13-rc5
mkdir -p /usr/local/var/opengrok
cp -r * /usr/local/var/opengrok/


Enter the opengrok directory.

cd /usr/local/var/opengrok

Unpackage and update the CONFIGURATION variable in the source.war file. More on this in a bit.

cd lib
unzip source.war -d source
cd source


Now edit the WEB-INF/web.xml file to change CONFIGURATION variable to set the configuration.xml path. It should look like this.
Code:
<context-param>
  <description>Full path to the configuration file where OpenGrok can read its configuration</description>
  <param-name>CONFIGURATION</param-name>
  <param-value>/usr/local/opengrok/etc/configuration.xml</param-value>
</context-param>
Recompress the source.war with the updated web.xml file as follows:

zip -u ../source.war WEB-INF/web.xml

Create the necessary environmental variables as follows:

export OPENGROK_TOMCAT_BASE="/usr/local/apache-tomcat-8.0"
export OPENGROK_SRC_PATH="/usr/local/var/opengrok/src/"
export JAVA_HOME="/usr/local/"


Start the tomcat service

service tomcat8 onestart

Deploy OpenGrok.

cd ../../bin
./OpenGrok deploy


Finally, index all directories that contain your source code.

./OpenGrok index /usr/local/var/opengrok/src

Now you should be able to visit the OpenGrok instance by going to http://address:8080/source. If for any reason you are told the CONFIGURATION parameter in web.xml is not configured, this is because somewhere there is a hard-coded path to /var/opengrok/etc/configuration.xml. You can fix this problem by creating a quick symlink:

ln -s configuration.xml /var/opengrok/etc/configuration.xml

And then reload the page, and it should work :)

Your mileage may vary, let me show how it works for you!
 
i would say this guide is completely out of scope of something reasonable.
If a new version of grok needs to be downloaded, then the port needs to be updated.
it also sounds like configuration.xml needs to be fixed by the port as well.

anyway, if you leave it here, your work is going to get lost. There's a howto section here that's slightly better but it's going to be really hard for something that doesn't know it exists to find it. Updating the port is the best way to preserve the knowledge.
 
Back
Top