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
 
 以上為自我時間內容,以下為轉載其他人內容
gitlab的安裝以及備份恢復 2015-08-07 15:22:03

分類: 項目管理

 

   
   下載安裝包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。
       至此備份恢復完畢。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM