bitnami gitlab 一键安装包迁移问题

场景:

centos 使用 bitnami 的安装包 (bitnami-gitlab-8.5.1-0-linux-x64-installer.run)一键安装gitlab,默认安装到了系统盘 /opt/gitlab-8.5.1-0
git 项目越来越大,系统盘被占满,需要将 gitlab 移动到数据盘 /data/software/gitlab-8.5.1-0 对应目录

成功方案:

采用移动 gitlab 目录,创建软链接(symlinks)的办法解决系统盘空间占用问题

注意:移动目录时一定要使用命令cp -rp
一定要使用参数p
一定要使用参数p
一定要使用参数p

使用p参数可以同时拷贝文件用户权限,否则你会发现,复制过去的项目,启动时,总是会出现 permission denied

发现的问题:

运行时,发现项目只能 pull (拉取)不能 push(提交)。
提交时报错如下:

remote: GitLab: The project you were looking for could not be found.
To git@xxx.xxx.xxx.xxx:root/test-project.git
 ! [remote rejected] develop -> develop (pre-receive hook declined)
error: failed to push some refs to 'git@xxx.xxx.xxx.xxx:root/test-project.git'

或者

remote: GitLab: The project you were looking for could not be found.
To git@xxx.xxx.xxx.xxx:root/test-project.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git@xxx.xxx.xxx.xxx:root/test-project.git'

解决办法:

根据大神的解决方案(点我),由于配置中的 repo地址(git 库)需要用绝对路径引用,不能使用软链接。所以需要修改配置文件,将软链接的路径改为绝对路径。
配置文件路径:

/data/software/gitlab-8.5.1-0/apps/gitlab/gitlab-shell/config.yml

等同于使用软链接指向的目录:

/opt/gitlab-8.5.1-0/apps/gitlab/gitlab-shell/config.yml

修改其中的内容:

# Repositories path
# Give the canonicalized absolute pathname,
# REPOS_PATH MUST NOT CONTAIN ANY SYMLINK!!!
# Check twice that none of the components is a symlink, including "/home".
repos_path: "/opt/gitlab-8.5.1-0/apps/gitlab/repositories"

修改为以下:

# Repositories path
# Give the canonicalized absolute pathname,
# REPOS_PATH MUST NOT CONTAIN ANY SYMLINK!!!
# Check twice that none of the components is a symlink, including "/home".
repos_path: "/data/software/gitlab-8.5.1-0/apps/gitlab/repositories"

可以看见,配置文件中有明确的说明# REPOS_PATH MUST NOT CONTAIN ANY SYMLINK!!! 仓库路径必须不含有字符链接

然后保存文件,重启项目即可。

其他想到的迁移方案(失败)

移动 gitlab 一键安装目录到 数据盘,修改配置文件引用路径
失败原因:配置文件过多,引用路径频繁,导致不能一一修改

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • Spring Cloud为开发人员提供了快速构建分布式系统中一些常见模式的工具(例如配置管理,服务发现,断路器,智...
    卡卡罗2017阅读 134,991评论 19 139
  • Ubuntu的发音 Ubuntu,源于非洲祖鲁人和科萨人的语言,发作 oo-boon-too 的音。了解发音是有意...
    萤火虫de梦阅读 99,593评论 9 467
  • linux资料总章2.1 1.0写的不好抱歉 但是2.0已经改了很多 但是错误还是无法避免 以后资料会慢慢更新 大...
    数据革命阅读 12,239评论 2 33
  • 谷雨是“雨生百谷”的意思,每年4月20日或21日太阳到达黄经30°时为谷雨。 谷雨一过,天气就要真的热起来了。 中...
    咪咪盟阅读 630评论 0 0
  • 夜已深,心却不能静。读完史铁生的《命若琴弦》,内心深处风起云涌,翻江倒海,感触颇深,我和铁生的生命遭遇有些相似,却...
    青樱低诉阅读 340评论 3 2