EXAMPLE.txt revision 299
115N/AOpenGrok deployment, step by step
115N/A---------------------------------
115N/A
115N/AOne of the design goals of OpenGrok is that it should be easy to use, so a
115N/Auser should be able to use OpenGrok with a minimum of configuration. While the
115N/Amimimum configuration is suitable for some users, it will not fit all users.
115N/AThe intent of this document is to offer a "step by step" guide for two
115N/Adifferent deployments of OpenGrok. A simple configuration suitable for small
115N/Adeployments, and a more "advanced" one for sites that want to host multiple
115N/Asource projects with a single OpenGrok server.
115N/A
115N/ASimple configuration.
115N/A---------------------
115N/A
115N/AThe first thing you need to do is to create a directory structure to hold the
115N/Asources and the database used by OpenGrok. I would suggest something like:
115N/A
115N/A/opengrok
115N/A|-- bin
115N/A|-- data
115N/A`-- source
115N/A
115N/AYou should copy the OpenGrok binaries into the bin-directory. The following
115N/Acommand should do the trick:
115N/A
299N/A$ cp -r OpenGrok opengrok.jar lib /opengrok/bin
115N/A
299N/AEdit OpenGrok, review the configuration section and set at least the
299N/Afollowing parameters to reflect your system and requirements:
115N/ASRC_ROOT=/opengrok/source
115N/ADATA_ROOT=/opengrok/data
115N/AEXUB_CTAGS=/absolute/path/to/Exubrant/Ctags
115N/A
115N/AThe last thing we need to do is to configure the web application. To do so,
115N/Aplease execute the following commands:
115N/A$ mkdir /opengrok/web/source
115N/A$ cd /opengrok/web/source
115N/A$ unzip /path/to/opengrok-release/source.war
115N/A
115N/Aedit WEB-INF/web.xml and specify SRC_ROOT and DATA_ROOT.
115N/A
115N/AYou may also want to modify the file index_body.html before you re-create
115N/Athe war-file with the following commands:
115N/A
115N/A$ cd /opengrok/web/source
115N/A$ zip -r /opengrok/web/source.war
115N/A
115N/ADeploy OpenGrok to a Tomcat server by copying source.war to the "webapps"
115N/Adirectory in the Tomcat installation.
115N/AIn case you have Glassfish, you can use web admin UI to deploy the war, or
115N/Ayou can simply put it in your domains directory in the "autodeploy" folder.
115N/AIf you are using any other web application container servers, please refer to
115N/Atheir documentation on war deployments.
115N/A
115N/A
115N/AAdvanced configuration.
115N/A-----------------------
115N/A
115N/AThis configuration is suitable for deployments where you would like to host
115N/Amultiple source projects in the same OpenGrok installation. This configuration
115N/Ais also suitable if you want to run the index generation on one server, and
115N/Athe web interface on another server.
115N/A
115N/AI would recommend that you create a unique user and group named opengrok to
115N/Aown the files and run the indexing software.
115N/A
115N/AAs with the simple configuration you need to set up a directory structure.
115N/AI would suggest something like:
115N/A
115N/A/opengrok
115N/A|-- bin
115N/A|-- smf
115N/A|-- stage1
115N/A| |-- data
115N/A| `-- source
115N/A`-- stage2
115N/A |-- data
115N/A `-- source
115N/A
115N/AThe reason we need two stage directories is that the web service will use one
115N/Awhile we're updating the other.
115N/A
115N/AYou should then populate the directory with files from the OpenGrok
115N/Adistribution:
115N/A$ cp -r opengrok.jar lib /opengrok/bin
115N/A$ cp -r tools/smf /opengrok
115N/A
115N/A(Please note that you should use the same value for SRC_ROOT and DATA_ROOT for
115N/Aon all servers if you generate indexes on one server and run the web interface
115N/Aon another server. On Solaris you could use the automounter to mount /opengrok
115N/Aon all servers, or you could specify the path by using /net/servername/opengrok)
115N/A
115N/AThe /opengrok/smf subdirectory contains scripts and manifest files that may be
115N/Aused to run the index generation as a Solaris service. You will find a script
115N/Athat may be used as a skeleton to create you own startup / shutdown script in
115N/Atools/init.d. This should be placed in /etc/init.d and appropriate links
115N/Amust be creted from the desired rcX.d directory.
115N/A
115N/ASolaris users should edit /opengrok/smf/opengrok.xml and verify that the
115N/Avariables specified there are correct. The service is imported by executing
115N/Athe following command:
115N/A# svccfg import /opengrok/smf/opengrok.xml
115N/A
115N/AFor other platforms these variables are specified in /etc/init.d/opengrok.sh
115N/A
115N/AThe next thing to do is to populate the source trees with the sources you want
115N/AOpenGrok to serve. E.g. to create your own "mirror" of the OpenGrok sources you
115N/Awould execute:
115N/A
115N/A$ cd /opengrok/stage1/source
115N/A$ hg clone ssh://anon@opensolaris.org/hg/opengrok/trunk opengrok
115N/A$ cp -pr opengrok /opengrok/stage2/source
115N/A
115N/AIf you are going to host source from multiple projects in your OpenGrok server,
115N/Ayou should edit /opengrok/smf/indexer.sh and look for the line:
115N/A # ADD_PROJECTS="-P -p /onnv-gate -W ${DATA_ROOT}/../configuration.xml"
115N/A
115N/ARemove the '#' to activate the line, and replace "/onnv-gate" with the
115N/Adirectory name of the project you would like to be selected as default (to
115N/Aselect the opengrok source we added above, insert "/opengrok").
115N/A
115N/AThe last step we need to do before we can start generating the indices is to
115N/Acreate the configuration file used by the web interface. You create the
115N/Aconfiguration file by executing the following command:
115N/A
115N/A$ java -jar /opengrok/bin/opengrok.jar -W /opengrok/stage1/configuration.xml \
115N/A -c /path/to/ctags -P -S -v -s /opengrok/stage1/source \
206N/A -d /opengrok/stage1/data
115N/A
115N/AYou can now start generating indices by executing:
115N/ASolaris with SMF:
115N/A# svcadm enable opengrok
115N/AOr if you use scripts in /etc/init.d:
115N/A# /etc/init.d/opengrok start
115N/A
115N/AThe last thing we need to do is to configure the web application. To do so,
115N/Aplease execute the following commands:
115N/A$ mkdir /opengrok/web/source
115N/A$ cd /opengrok/web/source
115N/A$ unzip /path/to/opengrok-release/source.war
115N/A
115N/Aedit WEB-INF/web.xml and add the following section (next to all the other
115N/A<context-param> entries):
115N/A
115N/A <context-param>
115N/A <param-name>CONFIGURATION</param-name>
115N/A <param-value>/opengrok/configuration.xml</param-value>
115N/A </context-param>
115N/A
115N/A <context-param>
115N/A <param-name>ConfigAddress</param-name>
115N/A <param-value>localhost:2424</param-value>
115N/A </context-param>
115N/A
115N/AThe last entry will let the web application listen on port 2424 for
115N/Aconfiguration updates. There is currently _no_ authentication implemented here,
115N/Aso you should not add an ip address reachable from an untrusted source.
115N/AIf you run the index generation on another server than the web server, you must
115N/Aadd one of the external interfaces of the web server (but it should _NOT_ be
115N/Areachable from external hosts).
115N/A
115N/AYou may also want to modify the file index_body.html before you re-create
115N/Athe jar-file with the following commands:
115N/A
115N/A$ cd /opengrok/web/source
115N/A$ zip -r /opengrok/web/source.war
115N/A
115N/ADeploy OpenGrok to a Tomcat server by copying source.war to the webapps
115N/Adirectory in the Tomcat installation.
115N/AIn case you have Glassfish, you can use web admin UI to deploy the war, or
115N/Ayou can simply put it in your domains directory in the "autodeploy" folder.
115N/AIf you are using any other web application container servers, please refer to
115N/Atheir documentation on war deployments.
115N/A
115N/A