# gitlab ee

https://docs.gitlab.com/ee/install/docker.html

# 破解

破解文档: https://www.52dzd.com/2021/10/16/gitlab-ee-cracked/

* 进入docker容器

```bash
sudo docker exec -it gitlab /bin/bash
```

* 生成证书

```bash
ruby license.rb
```

* 替换默认公钥

```bash
cp -f license_key.pub /opt/gitlab/embedded/service/gitlab-rails/.license_encryption_key.pub
```

* 升级到ULTIMATE版本

```bash
修改文件 /opt/gitlab/embedded/service/gitlab-rails/ee/app/models/license.rb
替换对应restricted_attr(:plan).presence || STARTER_PLAN为 restricted_attr(:plan).presence || ULTIMATE_PLAN
```

* 重新配置gitlab

```bash
gitlab-ctl reconfigure
gitlab-ctl restart
```

* 导入许可证

> 进入 /admin/application_settings/general，底下有add license按钮
> 可以选择cat GitLabBV.gitlab-license打印出文件内容后，把密钥复制后使用密钥文本,而不是上传文件
> 

# 历史docker版本

```bash
docker pull registry.cn-zhangjiakou.aliyuncs.com/guanweiming/gitlab-ee:15.1.5-ee.0
docker pull registry.cn-zhangjiakou.aliyuncs.com/guanweiming/gitlab-ee:15.3.1-ee.0
```

# gitlab备份
```bash
touch /root/gitlab_backup.sh && chmod +x /root/gitlab_backup.sh
#！ /bin/bash 
case "$1" in
        start)
            docker exec gitlabee_demo gitlab-rake gitlab:backup:create
        ;;
esac
```
## 添加定时任务
> 参考 https://tool.lu/crontab/
```
crontab -e
*/15 * * * * /root/gitlab_backup.sh start
```
