{"id":13512397,"url":"https://github.com/GerritCodeReview/docker-gerrit","last_synced_at":"2025-03-30T22:32:41.862Z","repository":{"id":24163104,"uuid":"100779603","full_name":"GerritCodeReview/docker-gerrit","owner":"GerritCodeReview","description":"Official Docker image of Gerrit Code Review - (mirror of http://gerrit.googlesource.com/docker-gerrit)","archived":false,"fork":false,"pushed_at":"2025-01-13T17:46:10.000Z","size":1008,"stargazers_count":200,"open_issues_count":3,"forks_count":60,"subscribers_count":14,"default_branch":"master","last_synced_at":"2025-01-13T17:52:51.740Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/GerritCodeReview.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-08-19T07:58:50.000Z","updated_at":"2024-12-02T20:47:36.000Z","dependencies_parsed_at":"2024-03-09T02:23:21.999Z","dependency_job_id":"31b86551-d5c2-42c0-a0d5-0b62dc06542e","html_url":"https://github.com/GerritCodeReview/docker-gerrit","commit_stats":null,"previous_names":[],"tags_count":245,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GerritCodeReview%2Fdocker-gerrit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GerritCodeReview%2Fdocker-gerrit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GerritCodeReview%2Fdocker-gerrit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GerritCodeReview%2Fdocker-gerrit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GerritCodeReview","download_url":"https://codeload.github.com/GerritCodeReview/docker-gerrit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246390878,"owners_count":20769476,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T03:01:48.830Z","updated_at":"2025-03-30T22:32:36.852Z","avatar_url":"https://github.com/GerritCodeReview.png","language":"Shell","readme":"# Gerrit Code Review docker images\n\nThese images provide official Gerrit Code Review releases using the\nDEB/RPM packages available from the\n[GerritForge repositories](https://gitenterprise.me/2015/02/27/gerrit-2-10-rpm-and-debian-packages-available/).\nThe DEB/RPM packages contain the release `gerrit.war` file along with additional configuration files that\nprovide an [out-of-the-box](https://gerrit.googlesource.com/plugins/out-of-the-box/) setup.\n\nEach image is intended to be used AS-IS for training or staging environments.\n\nFor production environments, the images provide a base on which required customizations\nto `gerrit.config` and persistent external modules can be made.\n\n## Quickstart\n\nStart Gerrit Code Review in its demo/staging \"out-of-the-box\" setup like so:\n\n```\ndocker run -ti -p 8080:8080 -p 29418:29418 docker.io/gerritcodereview/gerrit\n```\n\nWait a few minutes until the `Gerrit Code Review NNN ready` message appears,\nwhere NNN is your current Gerrit version, then open your browser to http://localhost:8080\nand you will be in Gerrit Code Review.\n\n*NOTE*: If your docker server is running on a remote host, change 'localhost' to\nthe hostname or IP address of your remote docker server.\n\nThe [plugin-manager](https://gerrit.googlesource.com/plugins/plugin-manager/) introduction screen\nguides you through the basics of Gerrit and allows installation of additional plugins downloaded from\n[Gerrit CI](https://gerrit-ci.gerritforge.com).\n\nImages for previous Gerrit Code Review releases are available; e.g. to run version 3.8.0,\nuse the following command:\n\n```\ndocker run -ti -p 8080:8080 -p 29418:29418 docker.io/gerritcodereview/gerrit:3.8.0\n```\n\n## Build docker images\n\nTo build docker images, clone the git repository https://gerrit.googlesource.com/docker-gerrit.\n\nRelease tags are available and can be used to build particular releases.  E.g. to build an\nimage using Gerrit 3.8.0, checkout the respective tag:\n\n```\ngit checkout v3.8.0\n```\n\nNavigate to either `./almalinux/9` or `./ubuntu/22` to build the almalinux- or ubuntu-based\ndocker image. Then run:\n\n```\ndocker build -t gerritcodereview/gerrit:$(git describe) .\n```\n\nTo build an image containing a development build of Gerrit (e.g. to test a change), run the\nfollowing command instead:\n\n```\ndocker build --build-arg GERRIT_WAR_URL=\"\u003curl\u003e\" -t gerritcodereview/gerrit -f Dockerfile-dev .\n```\n\nThe `\u003curl\u003e` passed to the `GERRIT_WAR_URL`-build argument has to point to a Gerrit-`.war`-file.\nThe build argument defaults to the URL pointing to the last successful build of the Gerrit master\nbranch on the [Gerrit CI](https://gerrit-ci.gerritforge.com).\n\n## Build multi-platform images\n\nFor the official releases one can build both `amd64` and `arm64` images at once and either\nload them to the local docker registry or push them to the `gerritcodereview` dockerhub account.\nIn order to do that, one simply calls:\n\n```\n./build_multiplatform.sh --load\n```\n\nAnd multiplatform images will be created and loaded locally. Calling:\n\n```\n./build_multiplatform.sh --push\n```\n\npushes images to docker-hub instead.\n\nNotes:\n* in the `--load` target only the current system architecture image is pushed to the local\n  registry\n* the almalinux image is additionally tagged as the default release image.\n\n## Using persistent volumes\n\nUse docker persistent volumes to keep Gerrit data across restarts.\nBelow is a sample `docker-compose.yaml` with externally-mounted Lucene indexes,\nCaches and Git repositories.\n\n```yaml\nversion: '3'\n\nservices:\n  gerrit:\n    image: docker.io/gerritcodereview/gerrit\n    volumes:\n       - git-volume:/var/gerrit/git\n       - index-volume:/var/gerrit/index\n       - cache-volume:/var/gerrit/cache\n    ports:\n       - \"29418:29418\"\n       - \"8080:8080\"\n\nvolumes:\n  git-volume:\n  index-volume:\n  cache-volume:\n```\n\nRun `docker compose up` (or `docker-compose up` with older versions of\nDocker) to trigger the build and execution of your container.\n\nNote that the path `/var/gerrit/etc` may also be externally-mounted. If this is done, then\nthe config file `/var/gerrit/etc/gerrit.config` initialized by the Gerrit DEB/RPM\npackage inside the container will no longer be available.  If gerrit does not find an existing\n`gerrit.config` file under the externally-mounted path, then it generates a new one.  However, the\nnewly generated config file does not provide the same first-run behaviour as the one from the\nDEB/RPM package (the out-of-the-box plugin is not configured, and the introductory screen of\nthe plugin-manager will not appear).\n\n## Environment variables\n\nThis is a list of available environment variables to change the Gerrit configuration:\n\n* `CANONICAL_WEB_URL`: Optional. Set the `gerrit.canonicalWebUrl` parameter in `gerrit.config`.\nDefaults to `http://\u003cimage_hostname\u003e`\n* `HTTPD_LISTEN_URL`: Optional. Override the `httpd.listenUrl` parameter in `gerrit.config`.\n\n## Using Gerrit in production\n\nWhen running Gerrit on Docker in production, it is a good idea to rely on a physical external\nstorage with much better performance and reliability than the Docker's internal AUFS, and an external\nconfiguration directory (`etc`) for better change management traceability. Additionally,\nyou may want to use a proper external authentication (e.g. ldap).\n\nA more advanced `docker-compose.yaml` example is given below, which uses OpenLDAP\n(published by Osixia on Docker Hub).  The example assumes you have an external directory\navailable as `/external/gerrit`\n\n```yaml\nversion: '3'\n\nservices:\n  gerrit:\n    image: docker.io/gerritcodereview/gerrit\n    ports:\n      - \"29418:29418\"\n      - \"80:8080\"\n    depends_on:\n      - ldap\n    volumes:\n      - /external/gerrit/etc:/var/gerrit/etc\n      - /external/gerrit/git:/var/gerrit/git\n      - /external/gerrit/db:/var/gerrit/db\n      - /external/gerrit/index:/var/gerrit/index\n      - /external/gerrit/cache:/var/gerrit/cache\n    environment:\n      - CANONICAL_WEB_URL=http://localhost\n    # command: init\n\n  ldap:\n    image: docker.io/osixia/openldap\n    ports:\n      - \"389:389\"\n      - \"636:636\"\n    environment:\n      - LDAP_ADMIN_PASSWORD=secret\n    volumes:\n      - /external/gerrit/ldap/var:/var/lib/ldap\n      - /external/gerrit/ldap/etc:/etc/ldap/slapd.d\n\n  ldap-admin:\n    image: docker.io/osixia/phpldapadmin\n    ports:\n      - \"6443:443\"\n    environment:\n      - PHPLDAPADMIN_LDAP_HOSTS=ldap\n```\n\nExample of `/external/gerrit/etc/gerrit.config`\n\n```\n[gerrit]\n  basePath = git\n\n[index]\n  type = LUCENE\n\n[auth]\n  type = ldap\n  gitBasicAuth = true\n\n[ldap]\n  server = ldap://ldap\n  username=cn=admin,dc=example,dc=org\n  accountBase = dc=example,dc=org\n  accountPattern = (\u0026(objectClass=person)(uid=${username}))\n  accountFullName = displayName\n  accountEmailAddress = mail\n\n[sendemail]\n  smtpServer = localhost\n\n[sshd]\n  listenAddress = *:29418\n\n[httpd]\n  listenUrl = http://*:8080/\n\n[cache]\n  directory = cache\n\n[container]\n  user = root\n```\n\nExample of `/external/gerrit/etc/secure.config`\n```\n[ldap]\n  password = secret\n```\n\n### Initialize Gerrit DB and Git repositories with Docker\n\nThe external filesystem needs to be initialized with gerrit.war beforehand:\n- All-Projects and All-Users Git repositories created in Gerrit\n- System Group UUIDs created in Git repositories\n\nThe initialization can be done as a one-off operation before starting all containers.\n\n#### Step-1: Run Gerrit docker init setup from docker\n\nUncomment the `command: init` option in `docker-compose.yaml` and run Gerrit with `docker compose`\nin foreground.\n\n```\ndocker compose up gerrit\n```\n\nWait until you see in the output the message `Initialized /var/gerrit` and then the container\nwill exit.\n\n#### Step-2: Start Gerrit in daemon mode\n\nComment out the `command: init` option in `docker-compose.yaml` and start all the nodes:\n\n```\ndocker compose up -d\n```\n\n### Registering users in OpenLDAP with PhpLdapAdmin\n\nThe sample docker compose project includes a node with PhpLdapAdmin connected to OpenLDAP\nand exposed via Web UX at https://localhost:6443.\n\nThe first user that logs in Gerrit is considered the initial administrator, it is important\nthat you configure it on LDAP to login and having the ability to administer your Gerrit setup.\n\n#### Define the Gerrit administrator in OpenLDAP\n\nLogin to PhpLdapAdmin using `cn=admin,dc=example,dc=org` as username and `secret` as password\nand then create a new child node of type \"Courier Mail Account\" for the Gerrit Administrator\n\nExample:\n\n- Given Name: Gerrit\n- Last Name: Admin\n- Common Name: Gerrit Admin\n- User ID: gerritadmin\n- Email: gerritadmin@localdomain\n- Password: secret\n\nVerify that your data is correct and then commit the changes to LDAP.\n\n#### Login to Gerrit as Administrator\n\nLogin to Gerrit on http://localhost using the new Gerrit Admin credentials created on LDAP.\n\nExample:\n\n- Login: gerritadmin\n- Password: secret\n\n## More information about Gerrit Code Review\n\nRefer to Gerrit Documentation at http://localhost/Documentation/index.html for more information on\nhow to configure, administer and use Gerrit Code Review.\n\nFor a full list of Gerrit Code Review resources, refer to the [Gerrit Code Review home page](https://www.gerritcodereview.com)\n","funding_links":[],"categories":["Shell"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FGerritCodeReview%2Fdocker-gerrit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FGerritCodeReview%2Fdocker-gerrit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FGerritCodeReview%2Fdocker-gerrit/lists"}