• Stars
    star
    197
  • Rank 197,722 (Top 4 %)
  • Language
    Shell
  • License
    Apache License 2.0
  • Created about 7 years ago
  • Updated 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Official Docker image of Gerrit Code Review - (mirror of http://gerrit.googlesource.com/docker-gerrit)

Gerrit Code Review docker image

The official Gerrit Code Review image with an out-of-the-box setup with H2 and DEVELOPMENT account setup.

This image is intended to be used AS-IS for training or staging environments. It can be used for production as base image and requires customizations to its gerrit.config and definition of persistent external modules.

Quickstart

Start Gerrit Code Review in its demo/staging out-of-the-box setup:

docker run -ti -p 8080:8080 -p 29418:29418 gerritcodereview/gerrit

Wait a few minutes until the Gerrit Code Review NNN ready message appears, where NNN is your current Gerrit version, then open your browser to http://localhost:8080 and you will be in Gerrit Code Review.

NOTE: If your docker server is running on a remote host, change 'localhost' to the hostname or IP address of your remote docker server.

Starting from Ver. 2.14, a new introduction screen guides you through the basics of Gerrit and allows installing additional plugins downloaded from Gerrit CI.

Official releases are also available as Docker images, e.g. use the following to run the 3.3.0 version.

docker run -ti -p 8080:8080 -p 29418:29418 gerritcodereview/gerrit:3.3.0

Build docker image

For docker images that contain released Gerrit versions, tags exist in this git repository pointing to a state of the repository, where this version of Gerrit (e.g. 3.3.0) is referenced in the Dockerfiles. To build such a docker image for development purposes, checkout the respective version tag, e.g.:

git checkout v3.3.0

Navigate to either ./almalinux/9 or ./ubuntu/22 to build the almalinux- or ubuntu-based docker image, respectively. Then run:

docker build -t gerritcodereview/gerrit:$(git describe) .

To build an image containing a development build of Gerrit, e.g. to test a change, run the following command instead:

docker build --build-arg GERRIT_WAR_URL="<url>" -t gerritcodereview/gerrit -f Dockerfile-dev .

The <url> passed to the GERRIT_WAR_URL-build argument has to point to a Gerrit-.war-file. The build argument defaults to the URL pointing to the last successful build of the Gerrit master branch on the Gerrit CI.

Build multi-platform images

For the official releases one can build both amd64 and arm64 images at once and either load them to the local docker registry or push them to the gerritcodereview dockerhub account. In order to do that one simply calls:

./build_multiplatform.sh --load

And multiplatform images will be created and loaded locally. Calling:

./build_multiplatform.sh --push

pushes images to the dockerhub instead.

Notes:

  • in the --load target only the current system architecture image is pushed to the local registry
  • the almalinux image is additionally tagged as the default release image.

Using persistent volumes

Use docker persistent volumes to keep Gerrit data across restarts. See below a sample docker-compose.yaml per externally-mounted Lucene indexes, Caches and Git repositories.

Example of /docker-compose.yaml

version: '3'

services:
  gerrit:
    image: gerritcodereview/gerrit
    volumes:
       - git-volume:/var/gerrit/git
       - index-volume:/var/gerrit/index
       - cache-volume:/var/gerrit/cache
    ports:
       - "29418:29418"
       - "8080:8080"

volumes:
  git-volume:
  index-volume:
  cache-volume:

Run docker-compose up to trigger the build and execution of your custom Gerrit docker setup.

Environment variables

This is a list of available environment variables to change the Gerrit configuration:

  • CANONICAL_WEB_URL: Optional. Set the gerrit.canonicalWebUrl parameter in gerrit.config. Defaults to http://<image_hostname>
  • HTTPD_LISTEN_URL: Optional. Override the httpd.listenUrl parameter in gerrit.config.

Using Gerrit in production

When running Gerrit on Docker in production, it is a good idea to rely on a physical external storage with much better performance and reliability than the Docker's internal AUFS, and an external configuration directory for better change management traceability. Additionally, you may want to use a proper external authentication.

See below a more advanced example of docker-compose.yaml with OpenLDAP (from Osixia's DockerHub).

Example of /docker-compose.yaml assuming you have an external directory available as /external/gerrit

version: '3'

services:
  gerrit:
    image: gerritcodereview/gerrit
    ports:
      - "29418:29418"
      - "80:8080"
    depends_on:
      - ldap
    volumes:
      - /external/gerrit/etc:/var/gerrit/etc
      - /external/gerrit/git:/var/gerrit/git
      - /external/gerrit/db:/var/gerrit/db
      - /external/gerrit/index:/var/gerrit/index
      - /external/gerrit/cache:/var/gerrit/cache
    environment:
      - CANONICAL_WEB_URL=http://localhost
    # command: init

  ldap:
    image: osixia/openldap
    ports:
      - "389:389"
      - "636:636"
    environment:
      - LDAP_ADMIN_PASSWORD=secret
    volumes:
      - /external/gerrit/ldap/var:/var/lib/ldap
      - /external/gerrit/ldap/etc:/etc/ldap/slapd.d

  ldap-admin:
    image: osixia/phpldapadmin
    ports:
      - "6443:443"
    environment:
      - PHPLDAPADMIN_LDAP_HOSTS=ldap

Example of /external/gerrit/etc/gerrit.config

[gerrit]
  basePath = git

[index]
  type = LUCENE

[auth]
  type = ldap
  gitBasicAuth = true

[ldap]
  server = ldap://ldap
  username=cn=admin,dc=example,dc=org
  accountBase = dc=example,dc=org
  accountPattern = (&(objectClass=person)(uid=${username}))
  accountFullName = displayName
  accountEmailAddress = mail

[sendemail]
  smtpServer = localhost

[sshd]
  listenAddress = *:29418

[httpd]
  listenUrl = http://*:8080/

[cache]
  directory = cache

[container]
  user = root

Example of /external/gerrit/etc/secure.config

[ldap]
  password = secret

Initialize Gerrit DB and Git repositories with Docker

The external filesystem needs to be initialized with gerrit.war beforehand:

  • All-Projects and All-Users Git repositories created in Gerrit
  • System Group UUIDs created in Git repositories

The initialization can be done as a one-off operation before starting all containers.

Step-1: Run Gerrit docker init setup from docker

Uncomment the command: init option in docker-compose.yaml and run Gerrit with docker-compose in foreground.

docker-compose up gerrit

Wait until you see in the output the message Initialized /var/gerrit and then the container will exit.

Step-2: Start Gerrit in daemon mode

Comment out the command: init option in docker-compose.yaml and start all the docker-compose nodes:

docker-compose up -d

Registering users in OpenLDAP with PhpLdapAdmin

The sample docker compose project includes a node with PhpLdapAdmin connected to OpenLDAP and exposed via Web UX at https://localhost:6443.

The first user that logs in Gerrit is considered the initial administrator, it is important that you configure it on LDAP to login and having the ability to administer your Gerrit setup.

Define the Gerrit administrator in OpenLDAP

Login to PhpLdapAdmin using cn=admin,dc=example,dc=org as username and secret as password and then create a new child node of type "Courier Mail Account" for the Gerrit Administrator

Example:

  • Given Name: Gerrit
  • Last Name: Admin
  • Common Name: Gerrit Admin
  • User ID: gerritadmin
  • Email: gerritadmin@localdomain
  • Password: secret

Verify that your data is correct and then commit the changes to LDAP.

Login to Gerrit as Administrator

Login to Gerrit on http://localhost using the new Gerrit Admin credentials created on LDAP.

Example:

  • Login: gerritadmin
  • Password: secret

More information about Gerrit Code Review

Refer to Gerrit Documentation at http://localhost/Documentation/index.html for more information on how to configure, administer and use Gerrit Code Review.

For a full list of Gerrit Code Review resources, refer to the Gerrit Code Review home page

More Repositories

1

gerrit

Gerrit Code Review - (mirror of https://gerrit.googlesource.com/gerrit)
Java
839
star
2

git-repo

repo - The Multiple Git Repository Tool - (mirror of https://gerrit.googlesource.com/git-repo)
Python
266
star
3

k8s-gerrit

Kubernetes support for Gerrit Code Review
Java
27
star
4

plugins_github

Plugin to integrate with GitHub: replication, pull-request to Change-Sets - (mirror of https://gerrit.googlesource.com/plugins%2Fgithub)
Java
24
star
5

gitiles

A simple browser for Git repositories - (mirror of https://gerrit.googlesource.com/gitiles)
Java
19
star
6

bazlets

Re-usable building blocks for Bazel build tool - (mirror of https://gerrit.googlesource.com/./bazlets)
Starlark
13
star
7

gerrit-installer

Gerrit native installation packages for Windows, Linux and Mac OSX - (mirror of https://gerrit.googlesource.com/gerrit-installer)
Makefile
10
star
8

plugins_replication

Copies to other servers using the Git protocol - (mirror of https://gerrit.googlesource.com/plugins%2Freplication)
Java
9
star
9

gerrit-ci-scripts

Scripts used for continuous integration builds of Gerrit - (mirror of http://gerrit.googlesource.com/gerrit-ci-scripts)
Groovy
8
star
10

aws-gerrit

Collection of AWS setup scripts for setting up Gerrit Code Review - (mirror of https://gerrit.googlesource.com/aws-gerrit)
Makefile
7
star
11

prolog-cafe

Prolog Cafe: A Prolog-to-Java source-to-source translator system - (mirror of http://gerrit.googlesource.com/prolog-cafe)
Java
7
star
12

plugins_oauth

OAuth provider for GitHub and Google - (mirror of http://gerrit.googlesource.com/plugins%2Foauth)
Java
6
star
13

plugins_code-owners

The code-owners provides support for defining code owners for files in a repository. If the code-owners plugin is enabled, changes can only be submitted if all touched files are covered by approvals from code owners. - (mirror of https://gerrit.googlesource.com/plugins/code-owners)
Java
6
star
14

plugins_hooks

Old-style fork+exec hooks. - (mirror of http://gerrit.googlesource.com/plugins%2Fhooks)
Java
5
star
15

plugins_lfs

LFS plugin storing large objects - (mirror of https://gerrit.googlesource.com/plugins/lfs)
Java
4
star
16

plugins_webhooks

- (mirror of https://gerrit.googlesource.com/plugins/webhooks)
Java
4
star
17

apps_analytics-etl

Spark ETL to extra analytics data from Gerrit Projects using the Analytics plugin - (mirror of https://gerrit.googlesource.com/apps_analytics-etl)
Scala
4
star
18

zoekt

Fast trigram based code search - (mirror of https://gerrit.googlesource.com/./zoekt)
3
star
19

plugins_gitblit

GitBlit code-viewer plug-in with SSO and Security Access Control - (mirror of https://gerrit.googlesource.com/plugins%2Fgitblit)
Java
3
star
20

gitfs

FUSE file system for lightweight android checkouts. - (mirror of https://gerrit.googlesource.com/./gitfs)
Go
3
star
21

apps_reviewit

The 'Review It!?' app is an Android application for Gerrit that allows sorting of incoming changes and review of small/trivial changes. This is not an official Google product. - (mirror of https://gerrit.googlesource.com/apps/reviewit)
Java
3
star
22

polymer-bridges

null - (mirror of https://gerrit.googlesource.com/./polymer-bridges)
JavaScript
2
star
23

plugins_multi-site

Multi-site support for Gerrit Code Review - (mirror of http://gerrit.googlesource.com/plugins%2Fmulti-site)
Java
2
star
24

plugins_examples

Collection of example plugins for Gerrit Code Review. - (mirror of https://gerrit.googlesource.com/plugins/examples)
Java
2
star
25

gwtjsonrpc

JSON-RPC for Google Web Toolkit (GWT) - (mirror of http://gerrit.googlesource.com/gwtjsonrpc)
Java
2
star
26

plugins_download-commands

Adds the standard download schemes and commands. - (mirror of http://gerrit.googlesource.com/plugins%2Fdownload-commands)
Java
2
star
27

gerrit-monitoring

null - (mirror of https://gerrit.googlesource.com/./gerrit-monitoring)
Jsonnet
2
star
28

homepage

Source for Gerrit Code Review homepage at https://www.gerritcodereview.com/ - (mirror of https://gerrit.googlesource.com/homepage)
HTML
2
star
29

plugins_avatars-gravatar

Plugin to display user icons from Gravatar. - (mirror of http://gerrit.googlesource.com/plugins%2Favatars-gravatar)
Java
2
star
30

plugins_analytics

Plugin to aggregate information from Gerrit projects and reviews and expose them through REST and SSH API. - (mirror of https://gerrit.googlesource.com/plugins/analytics)
Scala
2
star
31

plugins_pull-replication

Mirror repos from other servers using the Git protocol - (mirror of https://gerrit.googlesource.com/plugins/pull-replication)
Java
2
star
32

plugins_delete-project

A plugin which allows projects to be deleted from Gerrit via an SSH command - (mirror of http://gerrit.googlesource.com/plugins%2Fdelete-project)
Java
1
star
33

gwtorm

Tiny ORM - (mirror of http://gerrit.googlesource.com/gwtorm)
Java
1
star
34

plugins_high-availability

- (mirror of https://gerrit.googlesource.com/plugins/high-availability)
Java
1
star
35

plugins_labelui

The labelui plugin allows users to configure a different control for displaying the labels/approvals on the change screen. - (mirror of http://gerrit.googlesource.com/plugins%2Flabelui)
Java
1
star
36

gitblit

Fork of https://github.com/gitblit/gitblit project - (mirror of https://gerrit.googlesource.com/./gitblit)
Java
1
star
37

plugins_menuextender

Plugin that allows Gerrit administrators to configure additional menu entries from the WebUI. - (mirror of http://gerrit.googlesource.com/plugins%2Fmenuextender)
Java
1
star
38

plugins_owners

Provides a Prolog predicate add_owner_approval/3 that appends label('Owner-Approval', need(_)) to a provided list. - (mirror of http://gerrit.googlesource.com/plugins%2Fowners)
Java
1
star
39

plugins_github-pullrequest

Import existing GitHub Pull Requests as Gerrit Changes and Patch-Sets with one click. - (mirror of https://gerrit.googlesource.com/plugins/github-pullrequest)
Python
1
star
40

plugins_imagare

Plugin allows Gerrit users to upload and share images. - (mirror of http://gerrit.googlesource.com/plugins%2Fimagare)
Java
1
star
41

plugins_audit-sl4j

null - (mirror of https://gerrit.googlesource.com/plugins/audit-sl4j)
Java
1
star
42

plugins_server-config

This plugin enables access (download and upload) to the server config files. It may be used to change Gerrit config files (like etc/gerrit.config) in cases where direct access to the file system where Gerrit's config files are stored is difficult or impossible to get. - (mirror of https://gerrit.googlesource.com/plugins/server-config)
Java
1
star
43

plugins_gitiles

Plugin running Gitiles alongside a Gerrit server - (mirror of http://gerrit.googlesource.com/plugins%2Fgitiles)
Java
1
star
44

plugins_reviewers-by-blame

A plugin that allows to automatically add reviewers to a change from the git blame computation on the changed files. It will add the users as reviewer that authored most of the lines touched by the change, since these users should be familiar with the code and can most likely review the change. - (mirror of http://gerrit.googlesource.com/plugins%2Freviewers-by-blame)
Java
1
star
45

gerrit-load-tests

null - (mirror of https://gerrit.googlesource.com/./gerrit-load-tests)
Python
1
star
46

plugins_its-base

Plugin base for issue tracking systems. New project for 'plugins/hooks-its'. - (mirror of https://gerrit.googlesource.com/plugins/its-base)
Java
1
star
47

plugins_lfs-storage-s3

DEPRECATED: Use the plugins/lfs LFS plugin storing large objects in an Amazon S3 bucket - (mirror of https://gerrit.googlesource.com/plugins/lfs-storage-s3)
Java
1
star
48

plugins_account

Plugin to expose a self-service API and UX to manage accounts and associated personal information. - (mirror of https://gerrit.googlesource.com/plugins/account)
Java
1
star
49

plugins_its-jira

Plugin to integrate with Atlassian JIRA. New project for 'plugins/hooks-jira'. - (mirror of https://gerrit.googlesource.com/plugins/its-jira)
Java
1
star
50

plugins_helloworld

Template plugin that adds new SSH commands to a server. Deprecated. The cookbook-plugin is now used to demo plugin features. - (mirror of https://gerrit.googlesource.com/plugins/helloworld)
Java
1
star
51

plugins_reviewassistant

Gives advice to reviewers on how the review should be performed to be as effective as possible. - (mirror of https://gerrit.googlesource.com/plugins/reviewassistant)
Java
1
star
52

training_gerrit

Gerrit related training and info material - (mirror of http://gerrit.googlesource.com/training%2Fgerrit)
Shell
1
star
53

modules_virtualhost

Module to split the projects' space into virtual hosts similarly to an HTTP server and different domain names. - (mirror of https://gerrit.googlesource.com/modules/virtualhost)
Java
1
star
54

plugins_commit-validator-sample

Sample validator to accept, refuse or provide warnings on Git commit changes during push. - (mirror of http://gerrit.googlesource.com/plugins%2Fcommit-validator-sample)
Java
1
star
55

plugins_its-rtc

Plugin to integrate with IBM Rational Team Concert. New project for 'plugins/hooks-rtc'. - (mirror of https://gerrit.googlesource.com/plugins/its-rtc)
Java
1
star
56

plugins_simple-submit-rules

null - (mirror of https://gerrit.googlesource.com/plugins/simple-submit-rules)
Java
1
star
57

plugins_healthcheck

Gerrit plugin for triggering a general configuration and runtime health check - (mirror of http://gerrit.googlesource.com/plugins%2Fhealthcheck)
Java
1
star