xref: /OpenGrok/docker/README.md (revision 1106ade604e4e6cf829504ffdfecc61622a91db4)
1*1106ade6SVladimir Kotal[![Travis status](https://travis-ci.com/OpenGrok/docker.svg?branch=master)](https://travis-ci.com/OpenGrok/docker)
2*1106ade6SVladimir Kotal
3*1106ade6SVladimir Kotal# A Docker container for OpenGrok
4*1106ade6SVladimir Kotal
5*1106ade6SVladimir Kotal## OpenGrok from official source
6*1106ade6SVladimir Kotal
7*1106ade6SVladimir KotalBuilt from official source: https://github.com/oracle/opengrok/releases/
8*1106ade6SVladimir Kotal
9*1106ade6SVladimir KotalYou can learn more about OpenGrok at http://oracle.github.io/opengrok/
10*1106ade6SVladimir Kotal
11*1106ade6SVladimir KotalThe container is available from DockerHub at https://hub.docker.com/r/opengrok/docker/
12*1106ade6SVladimir Kotal
13*1106ade6SVladimir Kotal## When not to use it
14*1106ade6SVladimir Kotal
15*1106ade6SVladimir KotalThis image is simple wrapper around OpenGrok environment. The indexer and the web container are **not** tuned for large workloads.
16*1106ade6SVladimir KotalIf you happen to have one of the following:
17*1106ade6SVladimir Kotal  - large source data (e.g. [AOSP](https://en.wikipedia.org/wiki/Android_Open_Source_Project) or the like)
18*1106ade6SVladimir Kotal  - stable service
19*1106ade6SVladimir Kotal  - Source Code Management systems not supported in the image (e.g. Perforce,
20*1106ade6SVladimir Kotal    Clearcase, etc.)
21*1106ade6SVladimir Kotalthen it is advisable to run OpenGrok standalone or construct your own docker
22*1106ade6SVladimir Kotalimage based on the official one.
23*1106ade6SVladimir Kotal
24*1106ade6SVladimir Kotal## Additional info about the container
25*1106ade6SVladimir Kotal
26*1106ade6SVladimir Kotal* Tomcat 9
27*1106ade6SVladimir Kotal* JRE 8 (Required for Opengrok 1.0+)
28*1106ade6SVladimir Kotal* Configurable mirroring/reindexing (default every 10 min)
29*1106ade6SVladimir Kotal
30*1106ade6SVladimir KotalThe mirroring step works by going through all projects and attempting to
31*1106ade6SVladimir Kotalsynchronize all its repositories (e.g. it will do `git pull` for Git
32*1106ade6SVladimir Kotalrepositories).
33*1106ade6SVladimir Kotal
34*1106ade6SVladimir KotalThe indexer/mirroring is set so that it does not log into files.
35*1106ade6SVladimir KotalRather, everything goes to standard (error) output. To see how the indexer
36*1106ade6SVladimir Kotalis doing, use the `docker logs` command.
37*1106ade6SVladimir Kotal
38*1106ade6SVladimir Kotal## How to run
39*1106ade6SVladimir Kotal
40*1106ade6SVladimir Kotal### From DockerHub
41*1106ade6SVladimir Kotal
42*1106ade6SVladimir Kotal    docker run -d -v <path/to/your/src>:/opengrok/src -p 8080:8080 opengrok/docker:latest
43*1106ade6SVladimir Kotal
44*1106ade6SVladimir KotalThe container exports ports 8080 for OpenGrok.
45*1106ade6SVladimir Kotal
46*1106ade6SVladimir KotalThe volume mounted to `/opengrok/src` should contain the projects you want to make searchable (in sub directories). You can use common revision control checkouts (git, svn, etc...) and OpenGrok will make history and blame information available.
47*1106ade6SVladimir Kotal
48*1106ade6SVladimir KotalBy default, the index will be rebuild every ten minutes. You can adjust this
49*1106ade6SVladimir Kotaltime (in minutes) by passing the `REINDEX` environment variable:
50*1106ade6SVladimir Kotal
51*1106ade6SVladimir Kotal    docker run -d -e REINDEX=30 -v <path/to/your/src>:/opengrok/src -p 8080:8080 opengrok/docker:latest
52*1106ade6SVladimir Kotal
53*1106ade6SVladimir KotalSetting `REINDEX` to `0` will disable automatic indexing. You can manually trigger an reindex using docker exec:
54*1106ade6SVladimir Kotal
55*1106ade6SVladimir Kotal    docker exec <container> /scripts/index.sh
56*1106ade6SVladimir Kotal
57*1106ade6SVladimir KotalSetting `INDEXER_OPT` could pass extra options to opengrok-indexer. For example, you can run with:
58*1106ade6SVladimir Kotal
59*1106ade6SVladimir Kotal    docker run -d -e INDEXER_OPT="-i d:vendor" -v <path/to/your/src>:/opengrok/src -p 8080:8080 opengrok/docker:latest
60*1106ade6SVladimir Kotal
61*1106ade6SVladimir KotalTo remove all the `*/vendor/*` files from the index. You can check the indexer options on
62*1106ade6SVladimir Kotal
63*1106ade6SVladimir Kotalhttps://github.com/oracle/opengrok/wiki/Python-scripts-transition-guide
64*1106ade6SVladimir Kotal
65*1106ade6SVladimir KotalTo avoid the mirroring step, set the `NOMIRROR` variable to non-empty value.
66*1106ade6SVladimir Kotal
67*1106ade6SVladimir Kotal## OpenGrok Web-Interface
68*1106ade6SVladimir Kotal
69*1106ade6SVladimir KotalThe container has OpenGrok as default web app installed (accessible directly from `/`). With the above container setup, you can find it running on
70*1106ade6SVladimir Kotal
71*1106ade6SVladimir Kotalhttp://localhost:8080/
72*1106ade6SVladimir Kotal
73*1106ade6SVladimir KotalThe first reindex will take some time to finish. Subsequent reindex will be incremental so will take signigicantly less time.
74*1106ade6SVladimir Kotal
75*1106ade6SVladimir Kotal### Build image locally
76*1106ade6SVladimir Kotal
77*1106ade6SVladimir KotalIf you want to do your own development, you can build the image yourself:
78*1106ade6SVladimir Kotal
79*1106ade6SVladimir Kotal    docker build -t opengrok-dev .
80*1106ade6SVladimir Kotal
81*1106ade6SVladimir KotalThen run the container:
82*1106ade6SVladimir Kotal
83*1106ade6SVladimir Kotal    docker run -d -v <path/to/your/src>:/opengrok/src -p 8080:8080 opengrok-dev
84*1106ade6SVladimir Kotal
85*1106ade6SVladimir Kotal## Inspecting the container
86*1106ade6SVladimir Kotal
87*1106ade6SVladimir KotalYou can get inside a container using the [command below](https://docs.docker.com/engine/reference/commandline/exec/):
88*1106ade6SVladimir Kotal
89*1106ade6SVladimir Kotal```
90*1106ade6SVladimir Kotaldocker exec -it <container> bash
91*1106ade6SVladimir Kotal```
92*1106ade6SVladimir Kotal
93*1106ade6SVladimir KotalEnjoy.
94