gitlab备份与恢复操作方法
github私有仓库是收费的,有些代码不方便托管到外面的git仓库,因此就产生了自己搭建git服务器的需求。
好在有广大的开源人士的贡献,有了gitlab这一神器。
手动配置较多,直接用集成包: bitnami-gitlab-6.4.3-1-linux-x64-installer.run
=============================
假定gitlab安装路径为: /opt/gitlab-6.4.3-1/
全程以root用户操作。
1.设定备份目录:
/opt/gitlab-6.4.3-1/apps/gitlab/htdocs/config/gitlab.yml

2.备份:
有些时候会报错: You have already activated rake 0.9.2.2,but our Gemfile requires rake 10.1.0,Using bundle exec may solve this.
原因是默认的path路径不对,需要执行下bitnami自带的环境变量设置脚本: use_gitlab 即可解决。

cd /opt/gitlab-6.4.3-1/
./use_gitlab
cd /opt/gitlab-6.4.3-1/apps/gitlab/htdocs
bundle exec bin/rake gitlab:backup:create RAILS_ENV=production
3.恢复:
BACKUP=timestamp_of_backup #(required if more than one backup exists):
cd /opt/gitlab-6.4.3-1/
./use_gitlab
cd /opt/gitlab-6.4.3-1/apps/gitlab/htdocs
bundle exec bin/rake gitlab:backup:restore RAILS_ENV=production BACKUP=1405247282
chown git:git -R /opt/gitlab-6.4.3-1/apps/gitlab/repositories
4.crontab定时备份脚本参考:
use_gitlab使用了exec,脚本会重新打开一个进程,没有上下文,所以需要单独提出path.
脚本需要使用root账户运行。脚本包含了rsync远程同步到nas相应目录中,按照自己实际修改即可(预先生成ssh证书,免密码登录)。
#!/bin/bash if [ `id -u` -ne 0 ];then
echo "this backup script must be exec as root."
exit
fi
date
PATH="/opt/gitlab-6.4.3-1/apps/gitlabci/gitlabci-runner/bin:/opt/gitlab-6.4.3-1/apps/gitlab/gitlab-shell/bin:/opt/gitlab-6.4.3-1/redis/bin:/opt/gitlab-6.4.3-1/sqlite/bin:/opt/gitlab-6.4.3-1/python/bin:/opt/gitlab-6.4.3-1/perl/bin:/opt/gitlab-6.4.3-1/git/bin:/opt/gitlab-6.4.3-1/ruby/bin:/opt/gitlab-6.4.3-1/mysql/bin:/opt/gitlab-6.4.3-1/apache2/bin:/opt/gitlab-6.4.3-1/common/bin:$PATH" echo "backup gitlab to local storage begin.. " cd /opt/gitlab-6.4.3-1/apps/gitlab/htdocs bundle exec bin/rake gitlab:backup:create RAILS_ENV=production echo "rsync -avzP --delete /data/backups_gitlab xxx@xxx.com:/mnt/disk1/docs/rsync_gitlab_backup"
rsync -avzP --delete /data/backups_gitlab xxx@xxx.com:/mnt/disk1/docs/rsync_gitlab_backup/ date
echo "this job is end."
gitlab备份与恢复操作方法的更多相关文章
- Git--07 Gitlab备份与恢复
目录 Gitlab备份与恢复 01). 备份 02). 恢复 Gitlab备份与恢复 对gitlab进行备份将会创建一个包含所有库和附件的归档文件.对备份的恢复只能恢复到与备份时的gitlab相同 ...
- gitlab 备份与恢复
1. gitlab 备份命令:# gitlab-rake gitlab:backup:create 1.1 查看备份文件(默认备份路径:/var/opt/gitlab/backups)# ls /va ...
- Gitlab备份与恢复、迁移与升级
0.Gitlab安装 1.安装和配置必要的依赖关系 在CentOS7,下面的命令将在系统防火墙打开HTTP和SSH访问. yum install curl openssh-server postf ...
- Gitlab备份与恢复[七]
标签(linux): git 笔者Q:972581034 交流群:605799367.有任何疑问可与笔者或加群交流 备份 配置文件中加入 gitlab_rails['bakup_path']='/da ...
- gitlab备份与恢复
(1)备份 1.创建备份目录,并授权 mkdir /data/backups/gitlab -pv chown -R git.git /data 2.修改gitlab配置 vim /etc/gitla ...
- 3、gitlab备份与恢复
1.备份 #修改配置文件,启用备份 [root@localhost ~]# vim /etc/gitlab/gitlab.rb 377 gitlab_rails['backup_path'] = &q ...
- gitlab 从古老的 bitnami 版本 迁移到官方最新版本
这是我之前发布在 yuque 的文章.是我刚来新公司的时候帮公司搬迁 git 记录下来的,现在看来去掉敏感部分直接发布也没啥问题啦,就搬家过来,我自己也方便查 XD . 8.1.6 -> 10. ...
- git学习------> Gitlab如何进行备份恢复与迁移?
前段时间,在某台CenterOS服务器上搭建了Gitlab环境,并且大家陆陆续续的都把代码从svn迁移到了gitlab,但是之前的CenterOS服务器并不是搭建在公司的机房环境,而是搭建在办公室的某 ...
- GitLab 迁移与升级
参考: [ 博客园 BigBao ] 环境说明: OS: CentOS 7.x gitlab-ce 初始版本: 8.8.5 gitlab-ce 升级到版本: 11.2.3 升级方式: rpm 安装升级 ...
随机推荐
- 排序算法之直接插入排序(java实现)
package com.javaTest300; import java.util.Arrays; public class Test041 { public static void main(Str ...
- iOS图形处理和性能
转自陶丰平的博客 原文的题目是Designing for iOS: Graphics & Performance,晚上花了两个不到小时大致翻译了下. ---Begin--- 在之前的文章里 ...
- Spring MVC MultiActionController example
In Spring MVC application, MultiActionController is used to group related actions into a single cont ...
- Linux上svn服务器的搭建
安装svn服务器 直接用yum安装,命令如下: #yum install -y subversion 验证是否安装成功. #svnserve --version 创建SVN版本库 在home目录下创建 ...
- Spring Data JPA教程, 第七部分: Pagination(未翻译)
The previous part of my Spring Data JPA tutorialdescribed how you can sort query results with Spring ...
- Intel HAXM
Hardware Accelerated Execution Manager的缩写. intel的硬件加速执行管理器,是一款可以使用英特尔虚拟化技术(VT)加快 Android* 开发速度的硬件辅助虚 ...
- 计算两个日期相隔的天数(jodd)
public static void main(String[] args) throws ParseException { System.out.println(TimeUtil.dayOfYear ...
- struts2文件下载 出现Can not find a java.io.InputStream with the name的错误
成功代码: 前台界面jsp: <a style="text-decoration:none;" href="<%=path %>/main/frontN ...
- linux之unlink函数解析
[lingyun@localhost unlink]$ cat unlink.c /********************************************************* ...
- PPTP + FreeRADIUS + MySQL 安装与配置
原文地址:http://www.zhukun.net/archives/5375 PPTP + FreeRADIUS + MySQL 安装与配置 2012/03/29Linux运维centos.Fre ...