gitlab 16.2.4 恢复

新创建新gitlab,版本需和备份的gitlab版本一致

docker run -d -p 322:22 -p 822:80 --name gitlab_1 gitlab/gitlab-ce:16.2.4-ce.0

进入容器内部 docker exec -it c51685817e27 /bin/bash

新的环境至少运行过一次,sudo gitlab-ctl reconfigure

确认GitLab是否 正常运行,sudo gitlab-ctl status

使用gitlab-ctl命令停止unicorn(或者puma)以及sidekiq服务

gitlab-ctl stop unicorn

gitlab-ctl stop puma

gitlab-ctl stop sidekiq

报错:

ERROR: must be owner of extension btree_gist

ERROR: must be owner of extension btree_gist

ERROR: must be owner of extension pg_trgm

  1. 修改postgresql配置

vi /var/opt/gitlab/postgresql/data/postgresql.conf

listen_addresses = '*'

vi /var/opt/gitlab/postgresql/data/pg_hba.conf

最下面新增两行

local all all trust

host all all 127.0.0.1/32 trust

2.重启gitlab服务

gitlab-ctl restart

3.修改gitlab账号为超级用户

root@c51685817e27:/# su - gitlab-psql

$ /opt/gitlab/embedded/bin/psql -h 127.0.0.1 gitlabhq_production

psql (13.11)

SSL connection (protocol: TLSv1.3, cipher: TLS_AES_256_GCM_SHA384, bits: 256, compression: off)

Type "help" for help.

gitlabhq_production=# ALTER USER gitlab WITH SUPERUSER;

ALTER ROLE

gitlabhq_production=# \q

停服务

gitlab-ctl reconfigure

gitlab-ctl stop unicorn

gitlab-ctl stop puma

gitlab-ctl stop sidekiq

拷贝备份文件

确定备份目录: /etc/gitlab.rb

gitlab_rails['backup_path'] = "/var/opt/gitlab/backups"

/var/opt/gitlab/backups

docker cp 1713382241_2024_04_18_16.2.4_gitlab_backup.tar c51685817e27:/var/opt/gitlab/backups/

赋权备份文件777权限

备份文件: 1713382241_2024_04_18_16.2.4_gitlab_backup.tar

恢复命令:

gitlab-rake gitlab:backup:restore BACKUP=1713382241_2024_04_18_16.2.4

注意:末尾不要加日期与压缩后缀。 坑。。。

恢复完成后,还需要恢复gitlab.rb gitlab-secrets.json 文件

然后重置,重启gitlab

gitlab-ctl reconfigure && gitlab-ctl restart && gitlab-rake gitlab:check SANITIZE=true

相关推荐
林晓lx12 小时前
使用Git钩子+ husky + lint语法检查提高前端项目代码质量
前端·git·gitlab·源代码管理
爱宇阳16 小时前
从容器化到自动化:Vue3 项目 Docker 部署与 GitLab CI/CD 集成 Harbor 全流程
docker·自动化·gitlab
爱宇阳18 小时前
Spring Boot 项目 GitLab CI/CD 自动构建并推送到 Harbor 教程
spring boot·ci/cd·gitlab
爱宇阳1 天前
Vue3 项目 GitLab CI/CD 自动构建并推送到 Harbor 教程
ci/cd·gitlab
西部森林牧歌2 天前
Arbess零基础学习 - 使用Arbess+GitLab实现Node.js项目自动化构建/主机部署
ci/cd·node.js·gitlab·arbess·tiklab devops
极小狐3 天前
极狐GitLab 18.5 正式发布,更新 Maven 虚拟仓库 UI(Beta)、全新个人主页、实例级合规与安全策略管理 以及 DAST 认证脚本 等
java·gitlab·maven
维尔切4 天前
GitLab 版本控制系统
gitlab
创实信息4 天前
创实信息正式成为极狐GitLab中国授权代理
ci/cd·gitlab·devops·代码管理·极狐
谢尔登4 天前
【GitLab/CD】前端 CD
前端·gitlab
一念一花一世界4 天前
Jenkins vs GitLab CI/CD vs Arbess,CI/CD工具一文纵评
ci/cd·gitlab·jenkins·arbess