极狐GitLab Docker 镜像 | 极狐GitLab
cat docker-compose.yml 最后访问 gitlab.xxx.bj.cn
version: '3.6'
services:
web:
image: 'registry.gitlab.cn/omnibus/gitlab-jh:latest'
restart: always
hostname: 'gitlab.xxx.bj.cn'
environment:
GITLAB_OMNIBUS_CONFIG: |
external_url 'https://gitlab.xxx.bj.cn'
# Add any other gitlab.rb configuration here, each on its own line
ports:
- '10080:80'
- '443:443'
- '10022:22'
volumes:
- '$GITLAB_HOME/config:/etc/gitlab'
- '$GITLAB_HOME/logs:/var/log/gitlab'
- '$GITLAB_HOME/data:/var/opt/gitlab'
shm_size: '256m'
#安装
下载链接:Index of /gitlab-ce/yum/el7/ | 清华大学开源软件镜像站 | Tsinghua Open Source Mirror
# 安装
sudo yum install curl openssh-server openssh-clients postfix cronie
sudo service postfix start
sudo chkconfig postfix on
# 安装依赖 重要
yum install policycoreutils-python -y
yum -y localinstall gitlab-ce-13.2.10-ce.0.el7.x86_64.rpm
cat /etc/gitlab/gitlab.rb
cp /etc/gitlab/gitlab.rb{,.bak}
ls /etc/gitlab/gitlab.rb
ls /etc/gitlab
cat > /etc/gitlab/gitlab.rb << EOF
external_url 'http://10.72.5.18'
gitlab_rails['time_zone'] = 'Asia/Shanghai'
# git_data_dir "/mnt/application/gitlab/git-data" # 数据存放路径
EOF
cat /etc/gitlab/gitlab.rb | grep -v ^$ | grep -v ^#
gitlab-ctl reconfigure
gitlab-ctl restart
# 备份和还原,参考:gitlab 备份与恢复 - 简书
#备份
crontab -l
0 3 * * * gitlab-rake gitlab:backup:create >/dev/null2>&1
# 还原
gitlab-ctl stop unicorn
gitlab-ctl stop sidekiq
ls
cp 1619550096_2021_04_28_13.2.10_gitlab_backup.tar /var/opt/gitlab/backups/
cd /var/opt/gitlab/backups
chmod 777 1619550096_2021_04_28_13.2.10_gitlab_backup.tar
gitlab-rake gitlab:backup:restore BACKUP=1619550096_2021_04_28_13.2.10
gitlab-ctl reconfigure
gitlab-ctl restart
# 如果忘记密码看下面
原文:
Gitlab忘记root用户密码的解决办法_Locutus的博客-CSDN博客_gitlab root密码忘记
步骤 :
1 查看iid
curl http://xxx.xxx.xxx/api/v4/users?username=root # xxxgitlab里面配置的url
2 例如,重置root用户密码为root123*,root用户id为1。
# gitlab-rails console -e production
irb(main):001:0> user = User.where(id: 1).first
=> #
irb(main):002:0> user.password = 'root123*'
=> "root123*"
irb(main):003:0> user.password_confirmation = 'root123*'
=> "root123*"
irb(main):004:0> user.save!
Enqueued ActionMailer::DeliveryJob (Job ID: e562694d-2a1b-4bad-843b-d8567ac51077) to Sidekiq(mailers) with arguments: "DeviseMailer", "password_change", "deliver_now", #>
=> true
irb(main):005:0> quit
# 如果是容器化安装的参考:
服务器Gitlab忘记root密码_豆豆orz的博客-CSDN博客_gitlab root密码忘记
直接通过邮箱找回
1、登录容器
docker exec -it gitlab-ce /bin/bash
2、登录GitLab后台服务器,并且切换至git用户
su - git
gitlab-rails console
user = User.where(id: 1).first
user.password='xxxxxx'
user.save!