Files
homelab/active/container_gitlab/gitlab.md
2026-02-06 20:08:50 -05:00

1.8 KiB

Gitlab

Docker Install

# Change the server's SSH port in /etc/ssh/sshd_config
Port = 2424

# Then tell selinux about it
semanage port -a -t ssh_port_t -p tcp 2424
# And add the firewall rule
firewall-cmd --add-port=2424/tcp --permanent
firewall-cmd --reload
# Reload SSH
systemctl restart sshd

# Make a Gitlab directory
mkdir -p /srv/gitlab

# Add the following to .bashrc (used in the compose file)
export GITLAB_HOME=/srv/gitlab

Create your gitlab-compose.yaml. See the file in this repo for an example.

Also create the file secrets/gitlab.rb with your configuration. Should look something like this:

# Add any other gitlab.rb configuration here, each on its own line
external_url 'https://gitlab.reeseapps.com'
nginx['listen_port'] = 80
nginx['listen_https'] = false
nginx['proxy_set_headers'] = {
    "X-Forwarded-Proto" => "https",
    "X-Forwarded-Ssl" => "on",
    "Host" => "gitlab.mydomain.de",
    "X-Real-IP" => "$$remote_addr",
    "X-Forwarded-For" => "$$proxy_add_x_forwarded_for",
    "Upgrade" => "$$http_upgrade",
    "Connection" => "$$connection_upgrade"
}
gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = "email-smtp.us-east-1.amazonaws.com"
gitlab_rails['smtp_port'] = 465
gitlab_rails['smtp_user_name'] = ""
gitlab_rails['smtp_password'] = ""
gitlab_rails['smtp_domain'] = ""
gitlab_rails['smtp_authentication'] = "login"
gitlab_rails['smtp_ssl'] = true
gitlab_rails['smtp_force_ssl'] = true

Copy gitlab.rb and gitlab-compose.yaml to your server:

scp active/container_gitlab/gitlab-compose.yaml gitlab:
scp active/container_gitlab/secrets/gitlab.rb gitlab:/srv/gitlab

Then docker compose up:

docker compose -f gitlab-compose.yaml up -d

The initial username is root and the password will be at /srv/gitlab/config/initial_root_password.