Setting up a build environment
Omnibus GitLab provides Docker images for all the OS versions that it supports and these are available in the Container Registry. Users can use these images to setup the build environment. The steps are as follows
- Install Docker. Visit official docs for more details.
Containers need access to 4GB of memory to complete builds. Consult the documentation for your container runtime. Docker for Mac and Docker for Windows are known to set this value to 2GB for default installations.
-
Pull the Docker image for the OS you need to build a package for.
gitlab-omnibus-builder
registry contains images for all the supported OSs and versions. You can use one of them to build a package for it. For example, to prepare a build environment for Debian Stretch, you have to pull its image. The revision of the image to be used is specified inBUILDER_IMAGE_REVISION
variable in.gitlab-ci.yml
file. Make sure you substitute that value to${BUILDER_IMAGE_REVISION}
in the following commands.docker pull registry.gitlab.com/gitlab-org/gitlab-omnibus-builder/debian_9:${BUILDER_IMAGE_REVISION}
-
Start the container and enter its shell:
docker run -it registry.gitlab.com/gitlab-org/gitlab-omnibus-builder/debian_9:${BUILDER_IMAGE_REVISION} bash
-
Clone the Omnibus GitLab source and change to the cloned directory:
git clone https://gitlab.com/gitlab-org/omnibus-gitlab.git ~/omnibus-gitlab cd ~/omnibus-gitlab
-
Omnibus GitLab is optimized to use the internal repositories from https://dev.gitlab.org. These repositories are specified in the
.custom_sources.yml
file (specified byremote
key) in the root of the source tree and will be used by default. Since these repositories are not publicly usable, for personal builds you have to use public alternatives of these repositories. The alternatives are also provided in the same file, specified byalternative
key. The selection between these two is controlled byALTERNATIVE_SOURCES
environment variable, which can be set eithertrue
orfalse
. If that variable is settrue
, the repositories marked byalternative
key will be used. Similarly, if you want to use your custom forks as sources, modify the.custom_sources.yml
file and specify them asalternate
and set theALTERNATIVE_SOURCES
variable totrue
. - By default, Omnibus GitLab uses a Docker image containing pre-compiled assets for the
config/software/gitlab-rails.rb
- If you are building from a mirror of the GitLab application on the same instance, you should not need to do anything.
- To use the upstream assets, set the
ASSET_REGISTRY
environment variable toregistry.gitlab.com
- To compile your own, set the
COMPILE_ASSETS
environment variable totrue
-
Install the dependencies and generate binaries:
bundle install --path .bundle --binstubs
-
Run the build command to initiate a build process:
bin/omnibus build gitlab
You can see the results of the build in the
pkg
folder at the root of the source tree.