GitLab CE in Docker. Deploying
About GitLab CE
GitLab CE is an open source, cloud-based Git repository and version control system used by thousands of organizations worldwide. GitLab CE includes a host of features that enable software development teams to consolidate source code, track and manage releases, increase code quality, deploy code changes, and track the evolution of software over time.
Also included in the GitLab CE is a fully functional Continuous Integration and Delivery (CI/CD) system that can build, test, and deploy software updates as your team produces new code. Supporting the CI/CD functionality of GitLab is a private registry for Docker containers, enabling teams to streamline updates for production deployments that are running on a microservices architecture.
You can install and self-manage GitLab under and MIT license or use GitLab’s commercial software built on top of the open source edition with additional features.
Next will showed how to deploy GitLab CE quickly. The Docker will help us with it. With official Docker images based on the Omnibus GitLab package it will easy.
Omnibus GitLab is a way to package different services and tools required to run GitLab, so that most users can install it without laborious configuration.
Requirements
The GitLab has a minimum system requirements: 1 Cores, 4 GB RAM, 10 GB Storage. For a big workload read the docs.
The docker installation require installed Docker software.
Installation
Full docs are available here. I will show only main parts of it to run it quickly and easy.
- There is
docker-compose.yml
file has included the basic configuration to start deploy GitLab as Docker container:
web:
image: 'gitlab/gitlab-ce:latest'
name: gitlab
restart: always
hostname: 'gitlab.example.com'
environment:
GITLAB_OMNIBUS_CONFIG: |
external_url 'https://gitlab.example.com'
ports:
- '80:80'
- '443:443'
- '22:22'
volumes:
- '/srv/gitlab/config:/etc/gitlab'
- '/srv/gitlab/logs:/var/log/gitlab'
- '/srv/gitlab/data:/var/opt/gitlab'
Don’t forget to change the gitlab.example.com
to desired hostname.
GitLab has allow to set variables with GITLAB_OMNIBUS_CONFIG
for configuration
GitLab.
Note: The settings contained in
GITLAB_OMNIBUS_CONFIG
will not be written to thegitlab.rb
configuration file, they’re evaluated on load.
It’s reason then I preferable to write any customization in gitlab.rb
.
I show my config in next topic.
- To start the installation run the command:
docker-compose up -d
- To view logs after starting use next:
docker logs gitlab -f
- After success starting open browser (https://gitlab.example.com) and setup new admin password.
Some notes
I can’t start GitLab with mounted volumes in NFS Storage. The error will be:
Multiple failures occurred:
* RuntimeError occurred in chef run: ruby_block[verify_chown_persisted_on_redis] (/opt/gitlab/embedded/cookbooks/cache/cookbooks/runit/libraries/provider_runit_service.rb line 148) had an error: RuntimeError: Unable to persist filesystem ownership changes of /var/log/gitlab/redis/config. See https://docs.gitlab.com/ee/administration/high_availability/nfs.html#recommended-options for guidance.
* RuntimeError occurred in delayed notification: ruby_block[restart_log_service] (/opt/gitlab/embedded/cookbooks/cache/cookbooks/runit/libraries/provider_runit_service.rb line 69) had an error: RuntimeError: ruby_block[verify_chown_persisted_on_redis] (/opt/gitlab/embedded/cookbooks/cache/cookbooks/runit/libraries/provider_runit_service.rb line 148) had an error: RuntimeError: Unable to persist filesystem ownership changes of /var/log/gitlab/redis/config. See https://docs.gitlab.com/ee/administration/high_availability/nfs.html#recommended-options for guidance.
I found the simple solution and delete a row '/srv/gitlab/logs:/var/log/gitlab'
from yuml-file.
Without it gitlab logs will not save in host machine but you still view
logs with docker logs
command.
Also you can use the next advice from docs - GitLab - Disable storage directories management.
Additional information
- Dockerfile of official GitLab image - To view what actions was doing after you start an container.
- Omnibus GitLab Docs - GitLab Docker images - The full information about installation GitLab in Docker.
- Download and install GitLab - The start page of installation process for everywhere.
- GitLab Feature Comparison - Find the difference between version of self-hosted GitLab.