1 115 trond OpenGrok deployment, step by step 2 115 trond --------------------------------- 3 115 trond 4 115 trond One of the design goals of OpenGrok is that it should be easy to use, so a 5 115 trond user should be able to use OpenGrok with a minimum of configuration. While the 6 115 trond mimimum configuration is suitable for some users, it will not fit all users. 7 115 trond The intent of this document is to offer a "step by step" guide for two 8 115 trond different deployments of OpenGrok. A simple configuration suitable for small 9 115 trond deployments, and a more "advanced" one for sites that want to host multiple 10 115 trond source projects with a single OpenGrok server. 11 867 Lubos 12 867 Lubos Note that projects cannot have a "," in their name because of web application 13 867 Lubos project field separator. 14 115 trond 15 115 trond Simple configuration. 16 115 trond --------------------- 17 115 trond 18 115 trond The first thing you need to do is to create a directory structure to hold the 19 115 trond sources and the database used by OpenGrok. I would suggest something like: 20 115 trond 21 115 trond /opengrok 22 115 trond |-- bin 23 115 trond |-- data 24 115 trond `-- source 25 115 trond 26 115 trond You should copy the OpenGrok binaries into the bin-directory. The following 27 115 trond command should do the trick: 28 115 trond 29 299 Peter $ cp -r OpenGrok opengrok.jar lib /opengrok/bin 30 115 trond 31 299 Peter Edit OpenGrok, review the configuration section and set at least the 32 299 Peter following parameters to reflect your system and requirements: 33 115 trond SRC_ROOT=/opengrok/source 34 115 trond DATA_ROOT=/opengrok/data 35 115 trond EXUB_CTAGS=/absolute/path/to/Exubrant/Ctags 36 115 trond 37 115 trond The last thing we need to do is to configure the web application. To do so, 38 115 trond please execute the following commands: 39 115 trond $ mkdir /opengrok/web/source 40 115 trond $ cd /opengrok/web/source 41 115 trond $ unzip /path/to/opengrok-release/source.war 42 115 trond 43 115 trond edit WEB-INF/web.xml and specify SRC_ROOT and DATA_ROOT. 44 115 trond 45 115 trond You may also want to modify the file index_body.html before you re-create 46 115 trond the war-file with the following commands: 47 115 trond 48 115 trond $ cd /opengrok/web/source 49 115 trond $ zip -r /opengrok/web/source.war 50 115 trond 51 115 trond Deploy OpenGrok to a Tomcat server by copying source.war to the "webapps" 52 115 trond directory in the Tomcat installation. 53 115 trond In case you have Glassfish, you can use web admin UI to deploy the war, or 54 115 trond you can simply put it in your domains directory in the "autodeploy" folder. 55 115 trond If you are using any other web application container servers, please refer to 56 115 trond their documentation on war deployments. 57 115 trond 58 115 trond 59 115 trond Advanced configuration. 60 115 trond ----------------------- 61 115 trond 62 115 trond This configuration is suitable for deployments where you would like to host 63 115 trond multiple source projects in the same OpenGrok installation. This configuration 64 115 trond is also suitable if you want to run the index generation on one server, and 65 115 trond the web interface on another server. 66 115 trond 67 115 trond I would recommend that you create a unique user and group named opengrok to 68 115 trond own the files and run the indexing software. 69 115 trond 70 115 trond As with the simple configuration you need to set up a directory structure. 71 115 trond I would suggest something like: 72 115 trond 73 115 trond /opengrok 74 115 trond |-- bin 75 115 trond |-- smf 76 115 trond |-- stage1 77 115 trond | |-- data 78 115 trond | `-- source 79 115 trond `-- stage2 80 115 trond |-- data 81 115 trond `-- source 82 115 trond 83 115 trond The reason we need two stage directories is that the web service will use one 84 115 trond while we're updating the other. 85 115 trond 86 115 trond You should then populate the directory with files from the OpenGrok 87 115 trond distribution: 88 115 trond $ cp -r opengrok.jar lib /opengrok/bin 89 115 trond $ cp -r tools/smf /opengrok 90 115 trond 91 115 trond (Please note that you should use the same value for SRC_ROOT and DATA_ROOT for 92 115 trond on all servers if you generate indexes on one server and run the web interface 93 115 trond on another server. On Solaris you could use the automounter to mount /opengrok 94 115 trond on all servers, or you could specify the path by using /net/servername/opengrok) 95 115 trond 96 115 trond The /opengrok/smf subdirectory contains scripts and manifest files that may be 97 115 trond used to run the index generation as a Solaris service. You will find a script 98 115 trond that may be used as a skeleton to create you own startup / shutdown script in 99 115 trond tools/init.d. This should be placed in /etc/init.d and appropriate links 100 115 trond must be creted from the desired rcX.d directory. 101 115 trond 102 115 trond Solaris users should edit /opengrok/smf/opengrok.xml and verify that the 103 115 trond variables specified there are correct. The service is imported by executing 104 115 trond the following command: 105 115 trond # svccfg import /opengrok/smf/opengrok.xml 106 115 trond 107 115 trond For other platforms these variables are specified in /etc/init.d/opengrok.sh 108 115 trond 109 115 trond The next thing to do is to populate the source trees with the sources you want 110 115 trond OpenGrok to serve. E.g. to create your own "mirror" of the OpenGrok sources you 111 115 trond would execute: 112 115 trond 113 115 trond $ cd /opengrok/stage1/source 114 115 trond $ hg clone ssh://anon (a] opensolaris.org/hg/opengrok/trunk opengrok 115 115 trond $ cp -pr opengrok /opengrok/stage2/source 116 115 trond 117 115 trond If you are going to host source from multiple projects in your OpenGrok server, 118 115 trond you should edit /opengrok/smf/indexer.sh and look for the line: 119 115 trond # ADD_PROJECTS="-P -p /onnv-gate -W ${DATA_ROOT}/../configuration.xml" 120 115 trond 121 115 trond Remove the '#' to activate the line, and replace "/onnv-gate" with the 122 115 trond directory name of the project you would like to be selected as default (to 123 115 trond select the opengrok source we added above, insert "/opengrok"). 124 115 trond 125 115 trond The last step we need to do before we can start generating the indices is to 126 115 trond create the configuration file used by the web interface. You create the 127 115 trond configuration file by executing the following command: 128 115 trond 129 115 trond $ java -jar /opengrok/bin/opengrok.jar -W /opengrok/stage1/configuration.xml \ 130 115 trond -c /path/to/ctags -P -S -v -s /opengrok/stage1/source \ 131 206 trond -d /opengrok/stage1/data 132 115 trond 133 115 trond You can now start generating indices by executing: 134 115 trond Solaris with SMF: 135 115 trond # svcadm enable opengrok 136 115 trond Or if you use scripts in /etc/init.d: 137 115 trond # /etc/init.d/opengrok start 138 115 trond 139 115 trond The last thing we need to do is to configure the web application. To do so, 140 115 trond please execute the following commands: 141 115 trond $ mkdir /opengrok/web/source 142 115 trond $ cd /opengrok/web/source 143 115 trond $ unzip /path/to/opengrok-release/source.war 144 115 trond 145 115 trond edit WEB-INF/web.xml and add the following section (next to all the other 146 115 trond <context-param> entries): 147 115 trond 148 115 trond <context-param> 149 115 trond <param-name>CONFIGURATION</param-name> 150 115 trond <param-value>/opengrok/configuration.xml</param-value> 151 115 trond </context-param> 152 115 trond 153 115 trond <context-param> 154 115 trond <param-name>ConfigAddress</param-name> 155 115 trond <param-value>localhost:2424</param-value> 156 115 trond </context-param> 157 115 trond 158 115 trond The last entry will let the web application listen on port 2424 for 159 115 trond configuration updates. There is currently _no_ authentication implemented here, 160 115 trond so you should not add an ip address reachable from an untrusted source. 161 115 trond If you run the index generation on another server than the web server, you must 162 115 trond add one of the external interfaces of the web server (but it should _NOT_ be 163 115 trond reachable from external hosts). 164 115 trond 165 115 trond You may also want to modify the file index_body.html before you re-create 166 115 trond the jar-file with the following commands: 167 115 trond 168 115 trond $ cd /opengrok/web/source 169 115 trond $ zip -r /opengrok/web/source.war 170 115 trond 171 115 trond Deploy OpenGrok to a Tomcat server by copying source.war to the webapps 172 115 trond directory in the Tomcat installation. 173 115 trond In case you have Glassfish, you can use web admin UI to deploy the war, or 174 115 trond you can simply put it in your domains directory in the "autodeploy" folder. 175 115 trond If you are using any other web application container servers, please refer to 176 115 trond their documentation on war deployments. 177 115 trond 178 115 trond 179