• git 备份和恢复


    实际应用
    设置之前要在个人用户设置中增加key(为了备份ssh的项目)
    备份
    进入ditlab容器
    cd /home/git/gitlab
    bundle exec rake gitlab:backup:create RAILS_ENV=production
     
    cd /home/git/gitlab
    bundle exec bin/rake gitlab:backup:restore RAILS_ENV=production 
    chown git:git -R /opt/gitlab-7.11.4-0/apps/gitlab/repositories
     
     以上为自我时间内容,以下为转载其他人内容

    分类: 项目管理

       
       下载安装包wget https://downloads.bitnami.com/files/stacks/gitlab/7.11.4-0/bitnami-gitlab-7.11.4-0-linux-x64-installer.run
       然后更改成执行权限:chmod a+x bitnami-gitlab-7.11.4-0-linux-x64-installer.run
       再执行安装:./bitnami-gitlab-7.11.4-0-linux-x64-installer.run
       按照提示安装输入Y/N安装:

    点击(此处)折叠或打开

    1. [root@wb-2 ~]# ./bitnami-gitlab-7.11.4-0-linux-x64-installer.run
    2. The installer detects that exists a 'git' user in the system. This installer will change the configuration for this user. Do you want to continue the installation? [y/N]: y
    3. The installer detects that exists a 'gitlab_ci' user in the system. This installer will change the configuration for this user. Do you want to continue the installation? [y/N]: y
    4. ----------------------------------------------------------------------------
    5. Welcome to the Bitnami Gitlab Stack Setup Wizard.
    6. ----------------------------------------------------------------------------
    7. Select the components you want to install; clear the components you do not want
    8. to install. Click Next when you are ready to continue.
    9. PhpPgAdmin [Y/n] :Y
    10. GitLab : Y (Cannot be edited)
    11. GitLab CI [Y/n] :Y
    12. Is the selection above correct? [Y/n]: Y
    13. ----------------------------------------------------------------------------
    14. Installation folder
    15. Please, choose a folder to install Bitnami Gitlab Stack
    16. Select a folder [/opt/gitlab-7.11.4-0]: /opt/bitnami
    17. ----------------------------------------------------------------------------
    18. Create Admin account
    19. Bitnami Gitlab Stack admin user creation
    20. Email Address [user@example.com]: test@gmail.com
    21. Login [user]: test
    22. Password :
    23. Please confirm your password :
    24. ----------------------------------------------------------------------------
    25. Hostname that will be used to create internal URLs. If this value is incorrect,
    26. you may be unable to access your Gitlab installation from other computers. It is
    27. advisable to use a Domain instead of an IP address for compatibility with
    28. different browsers.
    29. Domain [127.0.0.1]: test.gitlab.com
    30. Do you want to configure mail support? [y/N]: N
    31. ----------------------------------------------------------------------------
    32. Setup is now ready to begin installing Bitnami Gitlab Stack on your computer.
    33. Do you want to continue? [Y/n]: Y
    34. ----------------------------------------------------------------------------
    35. Please wait while Setup installs Bitnami Gitlab Stack on your computer.
    36. Installing
    37. 0% ______________ 50% ______________ 100%
    38. #########################################
    39. ----------------------------------------------------------------------------
    40. Setup has finished installing Bitnami Gitlab Stack on your computer.
    41. Info: To access the Bitnami Gitlab Stack, go to
    42. http://dev.domain.org:80 from your browser.
    43. Press [Enter] to continue:
           上面红色标志的按照自己喜好设置了,如安装路径、admin用户等。
          到此,整个安装结束,设置好HOST后访问test.gitlab.com就可以正常使用了。



           备份以及恢复的操作,以下操作使用root用户执行:
          1、指定备份路径vi /opt/gitlab-6.4.3-1/apps/gitlab/htdocs/config/gitlab.yml,找到如下所示修改
               

    点击(此处)折叠或打开

    1. ## Backup settings
    2. backup:
    3. path: "/tmp/backups" # Relative paths are relative to Rails.root (default: tmp/backups/)
           
           2、执行备份

    点击(此处)折叠或打开

    1. cd /opt/gitlab-7.11.4-0/
    2. ./use_gitlab
    3. cd /opt/gitlab-7.11.4-0/apps/gitlab/htdocs
    4. bundle exec bin/rake gitlab:backup:create RAILS_ENV=production
           操作执行完毕,会在/tmp/backups/目录下生产一个备份文件,类似1438917368_gitlab_backup.tar

          3、恢复备份的数据

    点击(此处)折叠或打开

    1. cd /opt/gitlab-7.11.4-0/
    2. ./use_gitlab
    3. cd /opt/gitlab-7.11.4-0/apps/gitlab/htdocs
    4. bundle exec bin/rake gitlab:backup:restore RAILS_ENV=production 
    5. chown git:git -R /opt/gitlab-7.11.4-0/apps/gitlab/repositories
            如果备份的目录下不止一个备份文件,则RAILS_ENV=production后面需要指定备份文件 BACKUP=xxx。
           至此备份恢复完毕。
  • 相关阅读:
    需要学习的技术
    面试资料
    数据库设计三大范式
    java List 排序 Collections.sort() 对 List 排序
    hibernate的延迟加载
    索引失效原因总结
    mybatis调用oracle存储过程
    Android开发中需要注意哪些坑
    Intent在Activity之间传值的几种方式
    Android动画(Animations)
  • 原文地址:https://www.cnblogs.com/cuizhipeng/p/5042994.html
Copyright © 2020-2023  润新知