• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

README.mdH A D08-Jun-20205.1 KiB14898

index.shH A D08-Jun-2020703 3425

logging.propertiesH A D08-Jun-20202 KiB4334

start.shH A D08-Jun-20201.3 KiB5036

README.md

1[![](https://images.microbadger.com/badges/image/opengrok/docker.svg)](https://microbadger.com/images/opengrok/docker "Get your own image badge on microbadger.com")
2[![](https://images.microbadger.com/badges/version/opengrok/docker.svg)](https://microbadger.com/images/opengrok/docker "Get your own version badge on microbadger.com")
3
4# A Docker container for OpenGrok
5
6## OpenGrok from official source
7
8Built from official source: https://github.com/oracle/opengrok/releases/
9
10You can learn more about OpenGrok at http://oracle.github.io/opengrok/
11
12The container is available from DockerHub at https://hub.docker.com/r/opengrok/docker/
13
14## When not to use it
15
16This image is simple wrapper around OpenGrok environment. It is basically a small appliance. The indexer and the web container are **not** tuned for large workloads.
17
18If you happen to have one of the following:
19
20  - large source data (e.g. [AOSP](https://en.wikipedia.org/wiki/Android_Open_Source_Project) or the like)
21  - stable service
22  - Source Code Management systems not supported in the image (e.g. Perforce,
23    Clearcase, etc.)
24  - need for authentication/authorization
25
26then it is advisable to run OpenGrok standalone or construct your own Docker
27image based on the official one.
28
29## Additional info about the image
30
31* Tomcat 9
32* JRE 11
33* Configurable mirroring/reindexing (default every 10 min)
34
35The mirroring step works by going through all projects and attempting to
36synchronize all its repositories (e.g. it will do `git pull` for Git
37repositories).
38
39### Indexer logs
40
41The indexer/mirroring is set so that it does not log into files.
42Rather, everything goes to standard (error) output. To see how the indexer
43is doing, use the `docker logs` command.
44
45### Source Code Management systems supported
46
47- Mercurial
48- Git
49- Subversion
50
51### Tags and versioning
52
53Each OpenGrok release triggers creation of new Docker image.
54
55| Tag      | Note                                                    |
56| -------- |:--------------------------------------------------------|
57| `latest` | tracks the latest version                               |
58| `x.y.z`  | if you want to pin against a specific version           |
59| `x.y`    | stay on micro versions to avoid reindexing from scratch |
60
61## How to run
62
63### From DockerHub
64
65    docker run -d -v <path/to/your/src>:/opengrok/src -p 8080:8080 opengrok/docker:latest
66
67The container exports ports 8080 for OpenGrok.
68
69The 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.
70
71## Environment Variables
72
73| Docker Environment Var. | Description |
74| ----------------------- | ----------- |
75`REINDEX: <time_in_minutes>`<br/> *Optional* *Default: 10* | Period of automatic mirroring/reindexing. Setting to `0` will disable automatic indexing. You can manually trigger an reindex using docker exec: `docker exec <container> /scripts/index.sh`
76`INDEXER_OPT` | pass extra options to opengrok-indexer. For example, "-i d:vendor" will remove all the `*/vendor/*` files from the index. You can check the indexer options on https://github.com/oracle/opengrok/wiki/Python-scripts-transition-guide
77`NOMIRROR` | To avoid the mirroring step, set the variable to non-empty value.
78
79To specify environment variable for `docker run`, use the `-e` option, e.g. `-e REINDEX=30`
80
81## OpenGrok Web-Interface
82
83The container has OpenGrok as default web app installed (accessible directly from `/`). With the above container setup, you can find it running on
84
85http://localhost:8080/
86
87The first reindex will take some time to finish. Subsequent reindex will be incremental so will take signigicantly less time.
88
89## Using Docker compose
90
91[Docker-compose](https://docs.docker.com/compose/install/) example:
92
93```yaml
94version: "3"
95
96# More info at https://github.com/oracle/opengrok/docker/
97services:
98  opengrok:
99    container_name: opengrok
100    image: opengrok/docker:latest
101    ports:
102      - "8080:8080/tcp"
103    environment:
104      REINDEX: '60'
105    # Volumes store your data between container upgrades
106    volumes:
107       - '~/opengrok-src/:/opengrok/src/'  # source code
108       - '~/opengrok-etc/:/opengrok/etc/'  # folder contains configuration.xml
109       - '~/opengrok-data/:/opengrok/data/'  # index and other things for source code
110```
111
112Save the file into `docker-compose.yml` and then simply run
113
114    docker-compose up -d
115
116Equivalent `docker run` command would look like this:
117
118```bash
119docker run -d \
120    --name opengrok \
121    -p 8080:8080/tcp \
122    -e REINDEX="60" \
123    -v ~/opengrok-src/:/opengrok/src/ \
124    -v ~/opengrok-etc/:/opengrok/etc/ \
125    -v ~/opengrok-data/:/opengrok/data/ \
126    opengrok/docker:latest
127```
128
129## Build image locally
130
131If you want to do your own development, you can build the image yourself:
132
133    docker build -t opengrok-dev .
134
135Then run the container:
136
137    docker run -d -v <path/to/your/src>:/opengrok/src -p 8080:8080 opengrok-dev
138
139## Inspecting the container
140
141You can get inside a container using the [command below](https://docs.docker.com/engine/reference/commandline/exec/):
142
143```bash
144docker exec -it <container> bash
145```
146
147Enjoy.
148