GitLab – Complete DevOps Platform for Software Development

4.8 Stars
Version 16.7
2.5 GB
GitLab – Complete DevOps Platform for Software Development

What is GitLab?

GitLab is a comprehensive DevOps platform that provides a complete solution for the entire software development lifecycle in a single application. From project planning and source code management to CI/CD, monitoring, and security, GitLab unifies all DevOps stages under one roof, eliminating the need for multiple disconnected tools.

Originally launched in 2011 as a Git repository manager, GitLab has evolved into a complete DevOps platform used by millions of developers and thousands of organizations worldwide, including major enterprises like Goldman Sachs, Siemens, and NVIDIA. The platform is available as a self-hosted solution (GitLab CE/EE) or as a SaaS offering (GitLab.com).

GitLab’s single-application approach simplifies DevOps workflows, reduces context switching, and provides complete visibility across the development pipeline. With built-in CI/CD, container registry, security scanning, and project management features, teams can manage their entire workflow without integrating multiple tools.

Key Features and Capabilities

Source Code Management

GitLab provides enterprise-grade Git repository management with branch protection, merge request workflows, code review features, and integrated wiki documentation. Repository mirroring, file locking for binary assets, and advanced search capabilities support diverse development workflows.

CI/CD Pipelines

GitLab CI/CD enables automated building, testing, and deployment through YAML-defined pipelines. Auto DevOps provides pre-configured pipelines for common workflows, while custom pipelines support any complexity. Parallel jobs, directed acyclic graphs (DAG), and multi-project pipelines optimize build efficiency.

Container Registry

The integrated container registry stores Docker images alongside source code, simplifying image management and deployment workflows. Built-in vulnerability scanning identifies security issues in container images before deployment.

Security and Compliance

GitLab’s security features include Static Application Security Testing (SAST), Dynamic Application Security Testing (DAST), dependency scanning, container scanning, and secret detection. Security dashboards aggregate findings across projects for comprehensive vulnerability management.

Project Management

Issue tracking, milestones, boards, and roadmaps provide complete project visibility. Epics organize related issues across projects, while time tracking and burndown charts support sprint management and capacity planning.

GitLab Pages

Host static websites directly from repositories with automatic deployment from CI/CD pipelines. Custom domains, SSL certificates, and CDN support enable production-ready web hosting.

System Requirements

Self-Hosted Requirements

GitLab self-hosted requires minimum 4 CPU cores, 4 GB RAM, and 10 GB storage for small teams. Recommended specifications are 8 CPU cores, 16 GB RAM, and SSD storage. GitLab runs on Linux (Ubuntu, Debian, CentOS, RHEL) with PostgreSQL as the database.

Installation Guide

Installing on Ubuntu/Debian

# Install dependencies
sudo apt-get update
sudo apt-get install -y curl openssh-server ca-certificates perl postfix

# Add GitLab repository
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.deb.sh | sudo bash

# Install GitLab (set your domain)
sudo EXTERNAL_URL="https://gitlab.example.com" apt-get install gitlab-ee

# For Community Edition
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash
sudo EXTERNAL_URL="https://gitlab.example.com" apt-get install gitlab-ce

# Initial root password
sudo cat /etc/gitlab/initial_root_password

# Reconfigure GitLab
sudo gitlab-ctl reconfigure

Installing on RHEL/CentOS

# Install dependencies
sudo dnf install -y curl policycoreutils openssh-server perl postfix

# Enable services
sudo systemctl enable sshd
sudo systemctl start sshd
sudo systemctl enable postfix
sudo systemctl start postfix

# Add GitLab repository
curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.rpm.sh | sudo bash

# Install GitLab
sudo EXTERNAL_URL="https://gitlab.example.com" dnf install -y gitlab-ee

# Configure firewall
sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --permanent --add-service=https
sudo firewall-cmd --reload

Installing with Docker

# Run GitLab container
sudo docker run --detach \
  --hostname gitlab.example.com \
  --publish 443:443 --publish 80:80 --publish 22:22 \
  --name gitlab \
  --restart always \
  --volume gitlab-config:/etc/gitlab \
  --volume gitlab-logs:/var/log/gitlab \
  --volume gitlab-data:/var/opt/gitlab \
  --shm-size 256m \
  gitlab/gitlab-ee:latest

# Docker Compose
version: '3.8'
services:
  gitlab:
    image: gitlab/gitlab-ee:latest
    container_name: gitlab
    restart: always
    hostname: 'gitlab.example.com'
    environment:
      GITLAB_OMNIBUS_CONFIG: |
        external_url 'https://gitlab.example.com'
        gitlab_rails['gitlab_shell_ssh_port'] = 2224
    ports:
      - '80:80'
      - '443:443'
      - '2224:22'
    volumes:
      - gitlab-config:/etc/gitlab
      - gitlab-logs:/var/log/gitlab
      - gitlab-data:/var/opt/gitlab
    shm_size: '256m'

volumes:
  gitlab-config:
  gitlab-logs:
  gitlab-data:

Installing on Kubernetes

# Using Helm
helm repo add gitlab https://charts.gitlab.io/
helm repo update

# Install GitLab
helm install gitlab gitlab/gitlab \
  --set global.hosts.domain=example.com \
  --set certmanager-issuer.email=admin@example.com

# Get root password
kubectl get secret gitlab-gitlab-initial-root-password -ojsonpath='{.data.password}' | base64 --decode

GitLab CI/CD Configuration

Basic .gitlab-ci.yml

# .gitlab-ci.yml
stages:
  - build
  - test
  - deploy

variables:
  APP_NAME: my-application
  DOCKER_REGISTRY: registry.gitlab.com

# Cache dependencies
cache:
  key: ${CI_COMMIT_REF_SLUG}
  paths:
    - node_modules/
    - .npm/

# Build stage
build:
  stage: build
  image: node:18
  script:
    - npm ci
    - npm run build
  artifacts:
    paths:
      - dist/
    expire_in: 1 hour

# Test stage with parallel jobs
test:unit:
  stage: test
  image: node:18
  script:
    - npm ci
    - npm run test:unit
  coverage: '/Lines\s*:\s*(\d+\.?\d*)%/'
  artifacts:
    reports:
      junit: junit.xml
      coverage_report:
        coverage_format: cobertura
        path: coverage/cobertura-coverage.xml

test:integration:
  stage: test
  image: node:18
  services:
    - postgres:14
  variables:
    POSTGRES_DB: test_db
    POSTGRES_USER: test_user
    POSTGRES_PASSWORD: test_password
  script:
    - npm ci
    - npm run test:integration

# Deploy to staging
deploy:staging:
  stage: deploy
  image: alpine:latest
  environment:
    name: staging
    url: https://staging.example.com
  script:
    - apk add --no-cache curl
    - curl -X POST $DEPLOY_WEBHOOK_STAGING
  only:
    - develop

# Deploy to production with manual trigger
deploy:production:
  stage: deploy
  image: alpine:latest
  environment:
    name: production
    url: https://example.com
  script:
    - ./deploy-production.sh
  when: manual
  only:
    - main

Advanced Pipeline Features

# Multi-stage Docker build
build:docker:
  stage: build
  image: docker:latest
  services:
    - docker:dind
  variables:
    DOCKER_TLS_CERTDIR: "/certs"
  before_script:
    - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
  script:
    - docker build -t $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA .
    - docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA
    - docker tag $CI_REGISTRY_IMAGE:$CI_COMMIT_SHA $CI_REGISTRY_IMAGE:latest
    - docker push $CI_REGISTRY_IMAGE:latest

# Using rules instead of only/except
deploy:review:
  stage: deploy
  script:
    - deploy-review-app.sh
  environment:
    name: review/$CI_COMMIT_REF_SLUG
    url: https://$CI_COMMIT_REF_SLUG.review.example.com
    on_stop: stop:review
  rules:
    - if: $CI_MERGE_REQUEST_IID
      when: always
    - when: never

stop:review:
  stage: deploy
  script:
    - stop-review-app.sh
  environment:
    name: review/$CI_COMMIT_REF_SLUG
    action: stop
  when: manual
  rules:
    - if: $CI_MERGE_REQUEST_IID
      when: manual

# DAG (needs keyword)
test:frontend:
  stage: test
  needs: ["build:frontend"]
  script:
    - npm run test:frontend

test:backend:
  stage: test
  needs: ["build:backend"]
  script:
    - npm run test:backend

# Matrix builds
test:
  stage: test
  parallel:
    matrix:
      - NODE_VERSION: ['16', '18', '20']
        DATABASE: ['postgres', 'mysql']
  image: node:${NODE_VERSION}
  services:
    - ${DATABASE}:latest
  script:
    - npm test

GitLab CLI (glab)

CLI Commands

# Install glab
# macOS
brew install glab

# Linux (Debian/Ubuntu)
curl -s https://raw.githubusercontent.com/profclems/glab/trunk/scripts/install.sh | sudo bash

# Authenticate
glab auth login

# Repository operations
glab repo clone owner/repo
glab repo fork owner/repo
glab repo view

# Issue management
glab issue list
glab issue create --title "Bug report" --description "Description"
glab issue view 123
glab issue close 123

# Merge request operations
glab mr list
glab mr create --title "Feature" --description "Description" --target-branch main
glab mr view 45
glab mr merge 45
glab mr approve 45

# CI/CD operations
glab ci status
glab ci view
glab ci run
glab ci trace

# Pipeline commands
glab pipeline list
glab pipeline view 12345
glab pipeline delete 12345

GitLab API

API Examples

# Get projects
curl --header "PRIVATE-TOKEN: your_token" \
  "https://gitlab.example.com/api/v4/projects"

# Create project
curl --request POST --header "PRIVATE-TOKEN: your_token" \
  --data "name=new-project&namespace_id=1" \
  "https://gitlab.example.com/api/v4/projects"

# Get merge requests
curl --header "PRIVATE-TOKEN: your_token" \
  "https://gitlab.example.com/api/v4/projects/1/merge_requests"

# Create issue
curl --request POST --header "PRIVATE-TOKEN: your_token" \
  --data "title=New Issue&description=Issue description" \
  "https://gitlab.example.com/api/v4/projects/1/issues"

# Trigger pipeline
curl --request POST --header "PRIVATE-TOKEN: your_token" \
  --form "ref=main" \
  --form "variables[DEPLOY_ENV]=production" \
  "https://gitlab.example.com/api/v4/projects/1/trigger/pipeline"

GitLab Runner Configuration

Installing GitLab Runner

# Linux (Debian/Ubuntu)
curl -L "https://packages.gitlab.com/install/repositories/runner/gitlab-runner/script.deb.sh" | sudo bash
sudo apt-get install gitlab-runner

# Register runner
sudo gitlab-runner register

# Docker executor registration
sudo gitlab-runner register \
  --non-interactive \
  --url "https://gitlab.example.com/" \
  --registration-token "PROJECT_REGISTRATION_TOKEN" \
  --executor "docker" \
  --docker-image alpine:latest \
  --description "docker-runner" \
  --tag-list "docker,linux"

# config.toml
concurrent = 4
check_interval = 0

[[runners]]
  name = "docker-runner"
  url = "https://gitlab.example.com/"
  token = "TOKEN"
  executor = "docker"
  [runners.docker]
    tls_verify = false
    image = "alpine:latest"
    privileged = true
    disable_entrypoint_overwrite = false
    oom_kill_disable = false
    disable_cache = false
    volumes = ["/cache", "/var/run/docker.sock:/var/run/docker.sock"]
    shm_size = 0

GitLab Administration

gitlab-ctl Commands

# Service management
sudo gitlab-ctl status
sudo gitlab-ctl start
sudo gitlab-ctl stop
sudo gitlab-ctl restart

# Reconfigure after changes
sudo gitlab-ctl reconfigure

# Check configuration
sudo gitlab-rake gitlab:check

# Backup
sudo gitlab-backup create

# Restore backup
sudo gitlab-backup restore BACKUP=timestamp_of_backup

# Rails console
sudo gitlab-rails console

# Database console
sudo gitlab-psql

Best Practices

Repository Best Practices

1. Use protected branches for main/production
2. Require merge request approvals
3. Enable code owners for automatic assignment
4. Use commit signing for security
5. Configure branch naming conventions
6. Enable merge request templates
7. Use labels for issue organization
8. Configure project access tokens for CI/CD

Conclusion

GitLab provides a comprehensive DevOps platform that streamlines the entire software development lifecycle. Its integrated approach reduces toolchain complexity while providing powerful features for source control, CI/CD, security, and project management.

Whether using GitLab.com or self-hosting, the platform scales from individual projects to enterprise deployments, making it an excellent choice for organizations seeking a unified DevOps solution.

Developer: GitLab Inc

Download Options

Download GitLab – Complete DevOps Platform for Software Development

Version 16.7

File Size: 2.5 GB

Download Now
Safe & Secure

Verified and scanned for viruses

Regular Updates

Always get the latest version

24/7 Support

Help available when you need it