OpenGrok review - why and how to use it in a large team

When working in large software companies, it is common that you end up working at some point for a large project with a business logic history that is never well documented. You find it hard to know what features are available in the existing project, which component triggers a specific behavior or if  the system processes some specific information you need to learn more about.
This is particularly frustrating in migration projects from an old platform to a new one, especial when the initial engineers are no longer with the company or have reduced their number.
While this is not a very big issue for developers given the codebase is usually their documentation, it might be an issue for business analysts or other functions who do not have the habit to browse through the codebase using professional tools.
Luckily nowadays there are a lot of  source code web browsers, that offer the search capability in a web interface for references in the codebase. 
The source code browser I worked with in several projects is Opengrok A wicked fast source browser as its logo says. You can find it's features available at its official webpage.
The tool was developed by Oracle(Sun) with help from it's community. It is actually a *.war file available for deployment in a web container such as tomcat or Glassfish. It's name comes from the word GROK - which means "deeply understand", and it was initially created by a group of people in Sun Microsystems company in order to facilitate the possibility to search a large codebase for possible security breaches, by searching in both codebase and the generated binaries. Today there are many alternatives to OpenGrok, such as Text-Sherlock which says it is easier to setup than OpenGrok or Woboq for C/C++ codebases, or famous Atlassian Fisheye and many others.

In order to install opengrok you need to install as a prerequisite 
  • Java 8 JRE
  • a web container such as tomcat
  • exuberant tags or ctags
  • additionally you need to have a source control client installed to make available the latest code changes
Installation steps as per the official page

  • Download latest JRE 8
  • Download Tomcat 8 
  • Download Universal Tags 
  • Download opengrok 
  • Install Tomcat and setup CATALINA_HOME to your tomcat instllation
  • Make sure JAVA_HOME points to your Java 8 installation
  • Install Universal tags
  • Extract opengrok and deploy it

  • Create your SRC_ROOT with the sourcecode in /var/opengrok/src
  • Start Tomcat - $CATALINA_HOME/bin/startup.sh
  • Now your projects are available for browsing at http://localhost:8080/source/ 
  • Tips 

    • Depending on your machine setup you migth need all sorts of configurations for the installation to go smoothly, which was my case also, but all secret is to read the opengrok.conf file and change where needed
    • Installation usually takes about 2h
    • Write some scripts to clone all needed repositories and pull changes as needed (nightly maybe)
    • If your team is using Git and not following trunk-based development, then you might need multiple repositories for each release branch.
    • If your teams are concerned about security and open read access to source code, then add ldap-based group access or create a local user in Tomcat and only share with your team members.  
    In order to play with the tool before installing it you can check out it's exiting public installation available at this page  such as for example Illumos

    Enjoy!

    Comments

    Popular posts from this blog

    I Take Unconference 2018 Highlights

    Happy Programmer's day - 13 September 2018

    Spark learning journey - Part 1