`
liunancun
  • 浏览: 33970 次
社区版块
存档分类
最新评论

Docker安装Gitlab

 
阅读更多
通过docker-compose.yml文件安装
gitlab:
  image: 'gitlab/gitlab-ce:latest'
  container_name: gitlab
  restart: always
  hostname: '192.168.99.182'
  environment:
    GITLAB_OMNIBUS_CONFIG: |
      external_url 'http://192.168.99.182'
      gitlab_rails['smtp_enable'] = true
      gitlab_rails['smtp_address'] = "smtp.163.com"
      gitlab_rails['smtp_port'] = 25
      gitlab_rails['smtp_user_name'] = "xxx@163.com"
      gitlab_rails['smtp_password'] = "xxx"
      gitlab_rails['smtp_domain'] = "163.com"
      gitlab_rails['smtp_authentication'] = "login"
      gitlab_rails['smtp_enable_starttls_auto'] = true
      gitlab_rails['gitlab_email_from'] = 'xxx@163.com'
      gitlab_rails['time_zone'] = 'PRC'
      gitlab_rails['gitlab_default_can_create_group'] = false
      gitlab_rails['gitlab_username_changing_enabled'] = false
  ports:
    - '80:80'
  volumes:
    - '/home/gitlab/config:/etc/gitlab'
    - '/home/gitlab/logs:/var/log/gitlab'
    - '/home/gitlab/data:/var/opt/gitlab'


User Settings-Preferences-Localization
"Language"选择"简体中文"

用户设置-编辑个人资料-主要设置
"全名"从"Administrator"改为"管理员"
"电子邮件"改为"xxx@163.com"
"Commit email"改为"xxx@163.com"

管理中心-设置-可见性与访问控制
"启用 Git 访问协议"选择"Only HTTP(S)"


管理中心-设置-注册限制
去掉"Sign-up enabled"选项


管理中心-CI/CD-持续集成和部署
去掉"所有项目默认使用Auto DevOps流水线"选项
去掉"为新项目启用共享Runner"选项

简单启动
docker run -d --hostname 192.168.99.230 -p 80:80 --name gitlab gitlab/gitlab-ce:latest

备份
docker exec -it gitlab bash
gitlab-rake gitlab:backup:create

恢复
docker exec -it gitlab bash
gitlab-ctl stop unicorn
gitlab-ctl stop sidekiq
gitlab-rake gitlab:backup:restore BACKUP=1593142626_2020_06_26_12.3.3
gitlab-ctl start

定时备份
1 2 * * * docker exec gitlab gitlab-rake gitlab:backup:create;

备份传输
1 3 * * * sshpass -p "******" scp -P 22 `ls /home/gitlab/data/backups -t|head -n 1` root@192.168.99.xx:/home/gitlab_backup;

升级
主要版本.次要版本.补丁版本
先升级到当前主要版本下的最大版本
再升级到下个主要版本下的最小版本
再升级到下个主要版本下的目标版本

安装 GitLab Runner
docker run -d --name gitlab-runner -v /var/run/docker.sock:/var/run/docker.sock gitlab/gitlab-runner:latest
docker exec -it gitlab-runner bash
gitlab-runner register
gitlab-runner register --docker-volumes /var/run/docker.sock:/var/run/docker.sock
docker
alpine:latest
参考:https://docs.gitlab.com/runner/install

runner:
  image: gitlab/gitlab-runner
  container_name: runner
  volumes:
    - /home/data/runner:/etc/gitlab-runner
    - /var/run/docker.sock:/var/run/docker.sock


docker exec -it runner gitlab-runner register \
--name docker \
--url http://192.168.99.182 \
--registration-token jwsf8zhHBfQGkuCuZ4ew \
--executor docker \
--docker-image alpine:latest \
--docker-volumes /var/run/docker.sock:/var/run/docker.sock \
--docker-volumes /home/data/.m2:/root/.m2 \
--docker-volumes /builds:/builds \
--tag-list docker \
--non-interactive


docker exec -it runner gitlab-runner register \
--name ssh_dev \
--url http://192.168.99.182 \
--registration-token jwsf8zhHBfQGkuCuZ4ew \
--executor ssh \
--ssh-user root \
--ssh-password Li721Zhong! \
--ssh-host 192.168.99.230 \
--ssh-disable-strict-host-key-checking true \
--tag-list ssh_dev \
--non-interactive


安装新版Git
yum localinstall -y http://opensource.wandisco.com/centos/7/git/x86_64/git-2.22.0-1.WANdisco.437.x86_64.rpm http://opensource.wandisco.com/centos/7/git/x86_64/perl-Git-2.22.0-1.WANdisco.437.noarch.rpm
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics