LinuxCommandLibrary

gitlab-ctl

Manage and control GitLab services

TLDR

Display the status of every service

$ sudo gitlab-ctl status
copy

Display the status of a specific service
$ sudo gitlab-ctl status [nginx]
copy

Restart every service
$ sudo gitlab-ctl restart
copy

Restart a specific service
$ sudo gitlab-ctl restart [nginx]
copy

Display the logs of every service and keep reading until is pressed
$ sudo gitlab-ctl tail
copy

Display the logs of a specific service
$ sudo gitlab-ctl tail [nginx]
copy

Send the SIGKILL signal to specific service
$ sudo gitlab-ctl kill [nginx]
copy

Reconfigure the application
$ sudo gitlab-ctl reconfigure
copy

SYNOPSIS

gitlab-ctl [options]

PARAMETERS

start
    Starts all GitLab services.

stop
    Stops all GitLab services.

restart
    Restarts all GitLab services.

reconfigure
    Applies the GitLab configuration based on /etc/gitlab/gitlab.rb.

status
    Shows the status of all GitLab services.

tail
    Tails the logs of all GitLab services.

test
    Runs various tests to ensure GitLab is functioning correctly.

backup-create
    Creates a backup of the GitLab data.

restore
    Restores a GitLab backup.

upgrade
    Upgrades GitLab to the latest version.

uninstall
    Uninstalls GitLab completely.

show-config
    Displays the current GitLab configuration.

gitlab-shell-check
    Checks the GitLab Shell configuration.

pg-upgrade
    Manages and performs PostgreSQL upgrades within the GitLab Omnibus installation.

promote-db
    Promotes a standby database to be the primary database. Primarily used in HA configurations.

DESCRIPTION

gitlab-ctl is a command-line tool used to manage and control GitLab services. It provides a unified interface for starting, stopping, restarting, configuring, and checking the status of GitLab and its dependencies.

It abstracts away the complexity of managing individual services like PostgreSQL, Redis, Unicorn (or Puma), Sidekiq, and others, making it easier to administer a GitLab instance. It is the primary tool for interacting with a GitLab installation after the initial setup. It's frequently used for tasks like applying configuration changes, upgrading GitLab, troubleshooting issues, and backing up and restoring data. The tool uses a series of subcommands and configuration files to manage various aspects of the GitLab installation, often interacting with the Omnibus package's internal tooling.

CAVEATS

The behavior of gitlab-ctl can vary depending on the GitLab version and the underlying Omnibus package. Always refer to the official GitLab documentation for the most accurate and up-to-date information. Some commands require root privileges.

CONFIGURATION FILE

The primary configuration file for GitLab managed by gitlab-ctl is `/etc/gitlab/gitlab.rb`. This file contains settings for all GitLab components, including database connections, email settings, and web server configurations.

Use `gitlab-ctl reconfigure` to apply changes made to this file.

LOG FILES

GitLab logs are typically located in `/var/log/gitlab`. Each service has its own log file, such as `unicorn/current`, `sidekiq/current`, and `postgresql/current`. The `gitlab-ctl tail` command can be used to view these logs in real-time.

HISTORY

gitlab-ctl was introduced as part of the Omnibus GitLab package to simplify the management of GitLab and its dependencies. Before Omnibus, managing GitLab required manual configuration of each service, making deployments and upgrades complex and error-prone. gitlab-ctl abstracts these complexities, providing a consistent interface across different GitLab versions and environments. It has evolved over time to include more features and support for various deployment scenarios.

SEE ALSO

gitlab.rb(5), psql(1), redis-cli(1)

Copied to clipboard