JiaHe

相遇即是缘

Gitlab

yum安装

https://about.gitlab.com/install/

curl -s https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh | sudo bash

yum install gitlab-ce
/etc/gitlab/gitlab.rb
external_url "http://ip:port"

Docker安装Gitlab

准备好挂载的目录

# 创建挂载目录
mkdir -p /home/docker/gitlab/{config,log,data}

docker-compose.yml

/home/docker/gitlab/docker-compose.yml
version: "3"
services:
gitlab:
image: gitlab/gitlab-ce:latest
container_name: gitlab
restart: "always"
privileged: true
hostname: "192.168.56.29" # ip或域名
environment:
TZ: "Asia/Shanghai"
GITLAB_OMNIBUS_CONFIG: |
# 域名的话就不能带端口号
external_url 'http://192.168.56.29:8180'
gitlab_rails['time_zone'] = 'Asia/Shanghai'
gitlab_rails['gitlab_shell_ssh_port'] = 8222 # clone地址中ssh对应的端口号
ports:
- "8180:8180"
- "8222:22"
- "8443:443"
volumes:
- /home/docker/gitlab/config:/etc/gitlab
- /home/docker/gitlab/log:/var/log/gitlab
- /home/docker/gitlab/data:/var/opt/gitlab

执行 docker exec -it gitlab grep 'Password:' /etc/gitlab/initial_root_password 获取初始密码

轻量化运行

原文:https://zhuanlan.zhihu.com/p/389717047

# 关闭电子邮件相关功能
gitlab_rails['smtp_enable'] = false
gitlab_rails['gitlab_email_enabled'] = false
gitlab_rails['incoming_email_enabled'] = false

# Terraform
gitlab_rails['terraform_state_enabled'] = false

# Usage Statistics
gitlab_rails['usage_ping_enabled'] = false
gitlab_rails['sentry_enabled'] = false
grafana['reporting_enabled'] = false

# 关闭容器仓库功能
gitlab_rails['gitlab_default_projects_features_container_registry'] = false
gitlab_rails['registry_enabled'] = false
registry['enable'] = false
registry_nginx['enable'] = false

# 包仓库
gitlab_rails['packages_enabled'] = false
gitlab_rails['dependency_proxy_enabled'] = false

# GitLab KAS
gitlab_kas['enable'] = false
gitlab_rails['gitlab_kas_enabled'] = false

# Mattermost
mattermost['enable'] = false
mattermost_nginx['enable'] = false

# Kerberos
gitlab_rails['kerberos_enabled'] = false
sentinel['enable'] = false

# GitLab Pages
gitlab_pages['enable'] = false
pages_nginx['enable'] = false

# 禁用 PUMA 集群模式
puma['worker_processes'] = 0
puma['min_threads'] = 1
puma['max_threads'] = 2

# 降低后台守护进程并发数
sidekiq['max_concurrency'] = 5

gitlab_ci['gitlab_ci_all_broken_builds'] = false
gitlab_ci['gitlab_ci_add_pusher'] = false

# 关闭监控
prometheus_monitoring['enable'] = false
alertmanager['enable'] = false
node_exporter['enable'] = false
redis_exporter['enable'] = false
postgres_exporter['enable'] = false
pgbouncer_exporter['enable'] = false
gitlab_exporter['enable'] = false
grafana['enable'] = false
sidekiq['metrics_enabled'] = false