@@ -7,17 +7,12 @@ Copyright (c) 2006, 2018 Oracle and/or its affiliates. All rights reserved.
7
7
[ ![ wercker status] ( https://app.wercker.com/status/e2a879f4677e679c0bbf8fa82bcc0dba/s/master " wercker status ")] ( https://app.wercker.com/project/byKey/e2a879f4677e679c0bbf8fa82bcc0dba )
8
8
[ ![ Coverage Status] ( https://coveralls.io/repos/oracle/opengrok/badge.svg?branch=master )] ( https://coveralls.io/r/oracle/opengrok?branch=master )
9
9
10
- 1 . [ Introduction] ( #1-introduction )
11
- 2 . [ Requirements] ( #2-requirements )
12
- 3 . [ Usage] ( #3-usage )
13
- 4 . [ OpenGrok install] ( #4-opengrok-install )
14
- 5 . [ OpenGrok setup] ( #5-opengrok-setup )
15
- 6 . [ Change web application properties or name] ( #7-change-web-application-properties-or-name )
16
- 7 . [ Information for developers] ( #8-information-for-developers )
17
- 8 . [ Tuning OpenGrok for large code bases] ( #9-tuning-opengrok-for-large-code-bases )
18
- 9 . [ Authors] ( #10-authors )
19
- 10 . [ Contact us] ( #11-contact-us )
20
- 11 . [ Demo] ( #12-demo )
10
+ 1 . [ Introduction] ( #1-introduction )
11
+ 2 . [ OpenGrok setup] ( #2-opengrok-install-and-setup )
12
+ 3 . [ Information for developers] ( #3-information-for-developers )
13
+ 4 . [ Authors] ( #4-authors )
14
+ 5 . [ Contact us] ( #5-contact-us )
15
+ 7 . [ Demo] ( #6-demo )
21
16
22
17
## 1. Introduction
23
18
@@ -29,356 +24,21 @@ version control histories of many source code management systems.
29
24
Official page of the project is on:
30
25
< http://opengrok.github.com/OpenGrok/ >
31
26
32
- ## 2. Requirements
33
- * Latest Java (at least 1.8)
34
- < http://www.oracle.com/technetwork/java/ >
35
- * A servlet container like Tomcat (8.x or later) supporting Servlet 3.1 and JSP 2.1
36
- < http://tomcat.apache.org/ >
37
- * Exuberant Ctags or Universal Ctags
38
- < http://ctags.sourceforge.net/ >
39
- < https://ctags.io/ >
40
- * Source Code Management installation depending on type of repositories indexed
41
- * If you want to build OpenGrok:
42
- * Ant (1.9.4 and later)
43
- < http://ant.apache.org/ > or Maven < https://maven.apache.org/ >
44
- * JFlex
45
- < http://www.jflex.de/ >
46
- * Netbeans (optional, at least 8.2, will need Ant 1.9.4)
47
- < http://netbeans.org/ >
27
+ ## 2. OpenGrok install and setup
48
28
49
- ## 3. Usage
29
+ See https://github.com/oracle/opengrok/wiki/How-to-setup-OpenGrok
50
30
51
- OpenGrok usually runs in servlet container (e.g. Tomcat).
52
-
53
- ` SRC_ROOT ` environment variable refers to the directory containing your source
54
- tree. OpenGrok analyzes the source tree and builds a search index along with
55
- cross-referenced hypertext versions of the source files. These generated
56
- data files will be stored in directory referred to with environment variable
57
- called ` DATA_ROOT ` .
58
-
59
- ### 3.1 Projects
60
-
61
- OpenGrok has a concept of ** Projects** - one project is one directory underneath
62
- ` SRC_ROOT ` directory which usually contains a checkout of a project sources.
63
- (this can be branch, version, ...)
64
-
65
- Projects effectively replace the need to have more web applications, each with
66
- opengrok ` .war ` file. Instead it leaves you with one indexer and one web
67
- application serving multiple source code repositories - projects.
68
- Then you have a simple update script and simple index refresher script in
69
- place, which simplifies management of more repositories.
70
-
71
- A nice concept is to have a naming convention for directories underneath
72
- ` SRC_ROOT ` , thereby creating a good overview of projects (e.g.
73
- name-version-branch).
74
-
75
- For example, the ` SRC_ROOT ` directory can contain the following directories:
76
-
77
- * openssl-head
78
- * openssl-0.9.8-stable
79
- * openssl-1.0.0-stable
80
-
81
- Each of these directories was created with ` cvs checkout ` command (with
82
- appropriate arguments to get given branch) and will be treated by OpenGrok
83
- as a project.
84
-
85
- ### 3.2 Web services
86
-
87
- See https://github.com/oracle/opengrok/wiki/Web-services
88
-
89
- ## 4. OpenGrok install
90
-
91
- Grab a tar ball from https://github.com/oracle/opengrok/releases and
92
- extract it.
93
-
94
- See https://github.com/OpenGrok/platform for OS specific integration.
95
-
96
- ## 5. OpenGrok setup
97
-
98
- To setup OpenGrok it is needed to prepare the source code, let OpenGrok index
99
- it and start the web application.
100
-
101
- ### 5.1 Setting up the sources
102
-
103
- Source base should be available locally for OpenGrok to work efficiently.
104
- No changes are required to your source tree. If the code is under source
105
- control management (SCM) OpenGrok requires the checked out source tree under
106
- ` SRC_ROOT ` .
107
-
108
- By itself OpenGrok does not perform the setup of the source code repositories
109
- or synchronization of the source code with its origin. This needs to be done by
110
- the user or by using automatic scripts.
111
-
112
- It is possible for SCM systems which are not distributed (Subversion, CVS)
113
- to use a remote repository but this is not recommended due to the performance
114
- penalty. Special option when running the OpenGrok indexer is needed to enable
115
- remote repository support (` -r on ` ).
116
-
117
- In order for history indexing to work for any SCM system it is necessary
118
- to have environment for given SCM systems installed and in a path accessible
119
- by OpenGrok.
120
-
121
- Note that OpenGrok ignores symbolic links.
122
-
123
- If you want to skip indexing the history of a particular directory,
124
- use per project settings as per
125
- https://github.com/oracle/opengrok/wiki/Per-project-configuration
126
- If you want to disable history generation for all repositories globally, then
127
- set ` OPENGROK_GENERATE_HISTORY ` environment variable to ` off ` during indexing.
128
-
129
- ### 5.2 Using Opengrok shell wrapper script to create indexes
130
-
131
- For \* nix systems there is a shell script called ` OpenGrok ` which simplifies
132
- most of the tasks. It has been tested on Solaris and Linux distributions.
133
-
134
- #### 5.2.1 Deploy the web application
135
-
136
- First please change to opengrok directory where the OpenGrok shell script is
137
- stored (can vary on your system).
138
-
139
- Note that now you might need to change to user which owns the target
140
- directories for data, e.g. on Solaris you'd do:
141
-
142
- ``` bash
143
- pfexec su - webservd
144
- cd /usr/opengrok/bin
145
- ```
146
-
147
- and run
148
-
149
- ``` bash
150
- ./OpenGrok deploy
151
- ```
152
-
153
- This command will do some sanity checks and will deploy the ` source.war ` in
154
- its directory to one of detected web application containers.
155
- Please follow the error message it provides.
156
-
157
- If it fails to discover your container, please refer to optional steps on
158
- changing web application properties below, which explains how to do this.
159
-
160
- Note that OpenGrok script expects the directory ` /var/opengrok ` to be
161
- available to user running opengrok with all permissions. In root user case
162
- it will create all the directories needed, otherwise you have to manually
163
- create the directory and grant all permissions to the user used.
164
-
165
- #### 5.2.2 Populate DATA\_ ROOT Directory
166
-
167
- During this process the indexer will generate OpenGrok XML configuration file
168
- ` configuration.xml ` and sends the updated configuration to your web app.
169
-
170
- The indexing can take a lot of time. After this is done, indexer automatically
171
- attempts to upload newly generated configuration to the web application.
172
- Most probably you will not be able to use Opengrok before this is done for the
173
- first time.
174
-
175
- Please change to opengrok directory (can vary on your system)
176
-
177
- ``` bash
178
- cd /usr/opengrok/bin
179
- ```
180
-
181
- and run, if your ` SRC_ROOT ` is prepared under ` /var/opengrok/src `
182
-
183
- ``` bash
184
- ./OpenGrok index
185
- ```
186
-
187
- otherwise (if ` SRC_ROOT ` is in different directory) run:
188
-
189
- ``` bash
190
- ./OpenGrok index < absolute_path_to_your_SRC_ROOT>
191
- ```
192
-
193
- The above command attempts to upload the latest index status reflected into
194
- ` configuration.xml ` to a running source web application.
195
- Once above command finishes without errors you should be able to enjoy your
196
- OpenGrok and search your sources using latest indexes and setup.
197
-
198
- It is assumed that any SCM commands are reachable in one of the components
199
- of the PATH environment variable (e.g. ` git ` command for Git repositories).
200
- Likewise, this should be maintained in the environment of the user which runs
201
- the web server instance.
202
-
203
- Congratulations, you should now be able to point your browser to
204
- ` http://<YOUR_WEBAPP_SERVER>:<WEBAPPSRV_PORT>/source ` to work with your fresh
205
- OpenGrok installation! :-)
206
-
207
- At this time we'd like to point out some customization to OpenGrok script
208
- for advanced users.
209
- A common case would be, that you want the data in some other directory than
210
- ` /var/opengrok ` . This can be easily achieved by using environment variable
211
- ` OPENGROK_INSTANCE_BASE ` .
212
-
213
- E.g. if OpenGrok data directory is ` /tank/opengrok ` and source root is
214
- in ` /tank/source ` then to get more verbosity run the indexer as:
215
-
216
- ``` bash
217
- OPENGROK_VERBOSE=true OPENGROK_INSTANCE_BASE=/tank/opengrok
218
- ./OpenGrok index /tank/source
219
- ```
220
-
221
- Since above will also change default location of config file, beforehand(or
222
- restart your web container after creating this symlink) I suggest doing
223
- below for our case of having OpenGrok instance in ` /tank/opengrok ` :
224
-
225
- ``` bash
226
- ln -s /tank/opengrok/etc/configuration.xml /var/opengrok/etc/configuration.xml
227
- ```
228
-
229
- More customizations can be found inside the script, you just need to
230
- have a look at it, eventually create a configuration out of it and use
231
- ` OPENGROK_CONFIGURATION ` environment variable to point to it. Obviously such
232
- setups can be used for nightly cron job updates of index or other automated
233
- purposes.
234
-
235
- #### 5.2.3 Partial reindex
236
-
237
- There is inherent time window between after the source code is updated
238
- (highlighted in step ** 5.1** above) and before indexer completes. During this
239
- time window the index does not match the source code. To alleviate this
240
- limitation, one can kick off update of all source repositories in
241
- parallel and once all the mirroring completes perform complete reindex.
242
- This does not really help in case when some of the source code
243
- repositories are slow to sync, e.g. because the latency to their origin is
244
- significant, because the overall mirroring process has to wait for all the
245
- projects to finish syncing before running the indexer. To overcome this
246
- limitation, the index of each project can be created just after the
247
- mirroring of this project finishes.
248
-
249
- Indexing of all projects (i.e. ` OpenGrok index /var/opengrok/src ` ) in
250
- order to discover new and remove deleted projects from the configuration can be
251
- avoided. One can start with no index and no projects and then incrementally add
252
- them and index them.
253
-
254
- It basically works like this:
255
-
256
- 1 . create initial configuration:
257
-
258
- ` OpenGrok bootstrap `
259
-
260
- * this will create ` /var/opengrok/etc/configuration.xml ` with basic set of
261
- properties. If more is needed use:
262
-
263
- ``` bash
264
- curl -d " ${value} " -H " Content-Type: text/plain" -X PUT " ${webapp_uri} /api/v1/configuration/${property} "
265
- ```
266
-
267
- 2. add a new project ** foo** :
268
-
269
- ```
270
- curl -d "foo" -H "Content-Type: text/plain" -X POST "${webapp_uri}/api/v1/projects"
271
- ```
272
-
273
- * the project **foo** is now visible in the configuration however is not yet
274
- searchable. Store the config in a file so that indexer can see the project
275
- and its repositories:
276
-
277
- ```bash
278
- curl "${webapp_uri}/api/v1/configuration" > /var/opengrok/etc/configuration.xml
279
- ```
280
-
281
- 3. index the project. It will become searchable after that.
282
-
283
- ```
284
- OPENGROK_READ_XML_CONFIGURATION=/var/opengrok/etc/configuration.xml \
285
- OpenGrok indexpart /foo
286
- ```
287
-
288
- 4. make the project `indexed` status of the project persistent so that if
289
- webapp is redeployed the project will be still visible:
290
-
291
- ```bash
292
- curl "${webapp_uri}/api/v1/configuration" > /var/opengrok/etc/configuration.xml
293
- ```
294
-
295
- If an * add project* REST API call is invoked that matches existing project, the list of
296
- repositories for that project will be refreshed. This is handy when repositories
297
- are added/deleted.
298
-
299
- ##### 5.2.3.1 Logging when running partial reindex
300
-
301
- When running the indexer the logs are being written to single file. Since
302
- multiple indexers are being run in parallel in step 2, their logs have to
303
- be separated. To do this, create ` logging.properties ` file for each project
304
- using the ` /var/opengrok/logging.properties ` file as template. The only line
305
- which can differ would be this:
306
-
307
- ```
308
- java.util.logging.FileHandler.pattern = /var/opengrok/log/myproj/opengrok%g.%u.log
309
- ```
310
-
311
- Note the path component ` myproj ` which separates the logs for given
312
- project to this directory. The creation of the per-project directory and the
313
- ` logging.properties ` file can be easily done in a script.
314
-
315
- The command used in step 2 can thus look like this:
316
-
317
- ``` bash
318
- OPENGROK_LOGGER_CONFIG_PATH=/var/opengrok/myproj.logging \
319
- OPENGROK_READ_XML_CONFIGURATION=/var/opengrok/etc/configuration.xml \
320
- OpenGrok indexpart /myproj
321
- ```
322
-
323
- The last argument is path relative to ` SRC_ROOT ` .
324
-
325
- ### 5.4 Using command line interface to create indexes
326
-
327
- There are 2 (or 3) steps needed for this task.
328
-
329
- #### 5.4.1 Populate DATA\_ ROOT Directory
330
-
331
- * ** Option 1. OpenGrok** :
332
- There is a sample shell script ` OpenGrok ` that is suitable
333
- for using in a cron job to run regularly. Modify the variables in the script
334
- to point appropriate directories, or as the code suggests factor your local
335
- configuration into a separate file and simplify future upgrades.
336
-
337
- * ** Option 2. opengrok.jar** :
338
- You can also directly use the Java application. If
339
- the sources are all located in a directory ` SRC_ROOT ` and the data and
340
- hypertext files generated by OpenGrok are to be stored in ` DATA_ROOT ` , run
341
-
342
- ``` bash
343
- java -jar opengrok.jar -s $SRC_ROOT -d $DATA_ROOT
344
- ```
345
-
346
- See ` opengrok.jar ` manual below for more details.
347
-
348
- ### 5.7 Logging
349
-
350
- Both indexer and web app emit extensive log messages.
351
-
352
- OpenGrok is shipped with the ` logging.properties ` file that contains logging
353
- configuration.
354
-
355
- The ` OpenGrok ` shell script will automatically use this file
356
- if found under the base directory. It can also be set using the
357
- ` OPENGROK_LOGGER_CONFIG_PATH ` environment variable.
358
-
359
- If not using the shell script, the path to the configuration file can be
360
- set using the ` -Djava.util.logging.config.file=/PATH/TO/MY/logging.properties `
361
- java parameter.
362
-
363
- ## 6. Change web application properties or name
364
-
365
- See https://github.com/oracle/opengrok/wiki/Webapp-configuration
366
-
367
- ## 7. Information for developers
31
+ ## 3. Information for developers
368
32
369
33
See https://github.com/oracle/opengrok/wiki/Developer-intro and https://github.com/oracle/opengrok/wiki/Developers
370
34
371
- ## 8. Tuning OpenGrok for large code bases
372
-
373
- See https://github.com/oracle/opengrok/wiki/Tuning-for-large-code-bases
374
-
375
- ## 9. Authors
35
+ ## 4. Authors
376
36
377
37
The project has been originally conceived in Sun Microsystems by Chandan B.N.
378
38
379
39
For full list of contributors see https://github.com/oracle/opengrok/graphs/contributors
380
40
381
- ## 10 . Contact us
41
+ ## 5 . Contact us
382
42
383
43
Feel free to participate in discussion on the mailing lists:
384
44
@@ -388,6 +48,6 @@ Feel free to participate in discussion on the mailing lists:
388
48
389
49
To subscribe, send email to
` <mailing_list_name>[email protected] `
390
50
391
- ## 11 . Demo
51
+ ## 6 . Demo
392
52
393
53
Visit < http://demo.opengrok.org >
0 commit comments