GitLab Architecture

This section provides an overview of the GitLab architecture, focusing on the web application, API, and database interactions.

High-Level Architecture

GitLab is a complex application built on a variety of technologies. The core components include:

Web Application

The GitLab web application is built using Ruby on Rails, a popular web framework. It handles user interactions, rendering views, and processing requests. The web application is responsible for:

  • User authentication and authorization: Managing user accounts, permissions, and access control.
  • Project management: Creating, managing, and collaborating on projects.
  • Code repository management: Hosting Git repositories, managing branches, and enabling version control.
  • Continuous integration and delivery (CI/CD): Automating the build, test, and deployment process.
  • Issue tracking and project planning: Tracking bugs, feature requests, and other project tasks.

API

The GitLab API provides a RESTful interface for interacting with GitLab programmatically. It allows developers to automate tasks, integrate with other applications, and build custom workflows. The API supports a wide range of operations, including:

  • Creating and managing projects: Creating new projects, managing project settings, and adding collaborators.
  • Working with Git repositories: Cloning repositories, creating branches, and pushing changes.
  • Managing issues and merge requests: Creating, updating, and closing issues and merge requests.
  • Running CI/CD pipelines: Triggering pipelines, viewing build results, and accessing job artifacts.
  • Managing users and groups: Creating and managing user accounts, adding users to groups, and setting group permissions.

Database

The GitLab database stores all the data for the application, including:

  • Project information: Names, descriptions, settings, and other project details.
  • Repository data: Code, commit history, and other repository information.
  • User data: User accounts, profiles, and permissions.
  • Issue and merge request data: Issue descriptions, comments, and other information related to issues and merge requests.
  • CI/CD pipeline data: Pipeline configurations, build results, and job artifacts.

GitLab primarily uses PostgreSQL as its database, which offers robust features and scalability.

Sidekiq

Sidekiq is a background job processing system used by GitLab to handle asynchronous tasks. This allows the web application to respond quickly to user requests while offloading long-running operations to Sidekiq workers. Examples of tasks handled by Sidekiq include:

  • Email notifications: Sending emails to users about new issues, comments, or other activity.
  • Repository updates: Updating repository data after pushes or changes.
  • CI/CD pipeline execution: Running CI/CD pipelines for projects.
  • Import/export operations: Importing and exporting project data.

Sidekiq helps improve GitLab’s performance by ensuring that time-consuming tasks don’t block the main application thread.