For the complete documentation index, see llms.txt. This page is also available as Markdown.

38.9 GitLab Enterprise Edition Deployment

GitLab EE provides additional enterprise features on top of the CE version.

Installing GitLab EE

# pkg install gitlab-ee

Or install using Ports:

# cd /usr/ports/www/gitlab/
# make FLAVOR=ee install clean

This Port also includes GitLab CE (Community Edition); to install EE (Enterprise Edition), you must specify the parameter FLAVOR=ee.

After installation, view the package documentation to understand the subsequent configuration steps.

# pkg info -D gitlab-ee

The FreeBSD version of GitLab comes with complete installation instructions provided by the maintainer; please refer to: https://gitlab.com/mfechner/freebsd-gitlab-docu/blob/master/install/17.8-freebsd.md.

To sponsor this developer, visit: https://www.patreon.com/mfechner_gitlab_freebsd.

Starting Services

After installation, you need to start the relevant services.

First, set the GitLab service to start at boot:

# service gitlab enable

PostgreSQL Database Configuration

GitLab requires a PostgreSQL database. For PostgreSQL database version requirements, see GitLab installation requirements — PostgreSQL.

Please refer to other relevant chapters in this book to complete the PostgreSQL database deployment.

Database and User Initialization

Create the database and user for GitLab:

Database Extension Configuration

Create the necessary extensions for the GitLab database:

Redis Cache Service Configuration

Redis is an open-source in-memory data structure store; GitLab uses it as a cache and session store. Redis is automatically installed as a dependency.

View post-installation information:

Redis-related file structure:

Configuring Socket

Configure Redis to use UNIX socket communication:

Configuring the Service

Set the Redis service to start at boot:

Restart the Redis service:

Configuring User Permissions

Add user git to the redis user group to allow GitLab to access Redis:

Git Environment Configuration

GitLab's core components include:

Component
Description

Puma

Web application server used by GitLab

Gitaly

Service responsible for Git repository storage and access

Sidekiq

Background job processing queue

GitLab Workhorse

Smart reverse proxy that handles HTTP requests

Configure the Git environment:

File structure:

Configuring GitLab

The configuration file path is at /usr/local/www/gitlab.

Adjusting GitLab Load

Check the number of CPU cores on the system:

Edit the /usr/local/www/gitlab/config/puma.rb file and change workers 3 to the value output above, i.e., change to workers 16.

Database Connection Configuration

Edit the /usr/local/www/gitlab/config/database.yml file and change password: "secure password" to password: "password" (password is the database password set above).

GitLab requires write permissions to create symbolic links:

Initialize the GitLab database and related configuration:

Revoke the previously granted permissions:

Check whether GitLab and its environment are configured correctly:

If using corepack (Node.js), change the owner of the package.json file to the git user:

Set the Python version; before setting, use ls to check:

After confirming the version, set Yarn to use the specified Python interpreter as the git user:

Compile assets; install production dependencies as the git user in the GitLab directory using the lockfile:

Compile GitLab assets in the production environment as the git user, while skipping database and storage validation:

Set the PostgreSQL user git as a non-superuser:

Start the GitLab service:

Nginx

Nginx is a high-performance web server and reverse proxy; GitLab uses it as the frontend web server.

Please refer to other chapters to install Nginx.

Configuring the /usr/local/etc/nginx/nginx.conf File

Edit the /usr/local/etc/nginx/nginx.conf file and find:

Modify as follows to include the Nginx configuration file provided by GitLab:

Directory structure:

Configuring Services

Set Nginx to start automatically at system boot:

Start the Nginx service:

Configuring GitLab Pages

GitLab Pages is a static website hosting service provided by GitLab. Configure GitLab Pages:

Directory structure:

Starting the Service

Start the GitLab Pages service:

Checking Configuration

Check the GitLab production environment configuration as the git user:

Platform Access and Initialization

Restart the GitLab service:

Enter the server IP in the browser and press Enter, for example 192.168.197.128 in this example. Please fill in the email and set a password (at least 8 characters, must include complex characters).

Tip

The 192.168.197.128 in the above example is a placeholder and needs to be replaced with the actual value.

GitLab Login Page

Log in:

Logging into GitLab
GitLab Homepage

Language Environment Configuration

Click the avatar, go to "Preferences", find "Localization", select "Simplified Chinese", then click "Save changes" to save the setting:

Changing GitLab Interface Language

License Activation (For Learning Reference Only)

Warning

The following operations involve generating an unauthorized license, which may violate the GitLab End User License Agreement (EULA). This content is provided for personal study and research reference only, and is strictly prohibited for use in any production environment or commercial purpose. The author and publisher of this book are not responsible for any legal liability arising from the misuse of this section. Please support the official version: Purchase GitLab License.

Install gitlab-license (gem is the Ruby package manager, already installed automatically as a dependency):

Create the license directory:

Write the following content to the gitlab-license/license.rb file:

Execute the license.rb script using Ruby:

Back up the old public key:

View the files in the directory. Three files were generated in this directory:

Replace the original public key with the newly generated public key:

View the public key:

Visit http://192.168.197.128/admin/application_settings/general (replace with the actual IP address), click "Add license", then paste the content of the GitLabBV.gitlab-license file into the "Enter license key" box:

Activating GitLab
Activating GitLab

References

External Project Import Configuration

Open http://192.168.197.128/admin, click "General", select "Import and export settings" on the right, select the desired projects, and save.

GitLab General Settings
GitLab Import and Export Settings
GitLab External Project Import Configuration

References

  • Li Juncai. CI/CD Notes.GitLab Series: 2024 Update - Setting GitLab Import Sources[EB/OL]. (2024-03-11)[2026-03-26]. https://bbs.huaweicloud.com/blogs/423539. Explains the steps for configuring external project import sources in the 2024 version of GitLab.

Troubleshooting and Unfinished Items

Logs

  • /var/log/nginx/gitlab_error.log

  • /var/log/nginx/error.log

  • /var/log/gitlab_pages.log

  • /var/log/gitlab-shell/gitlab-shell.log

500: We're sorry, something went wrong on our end

Check the current status of the GitLab service:

If the service is running normally and there are no anomalies in the error logs, it may be due to insufficient memory. Display kernel ring buffer messages:

If the 500 error persists, it is recommended to check the system resource (memory and swap space) configuration.

References

Last updated