ÔõÑùʹÓöþ½øÖÆÎļþ×°ÖÃgitlab²¢±¸·Ý
ÔÚÒ»Ñùƽ³£µÄÈí¼þ¿ª·¢ÖУ¬gitlabÊÇÒ»¿î·Ç¾³£ÓõĴúÂëÍйÜƽ̨¡£ÈôÊÇÄãÐèÒª½«gitlab×°ÖÃÔÚ×Ô¼ºµÄЧÀÍÆ÷ÉÏ£¬±¾ÎĽ«ÎªÄãÌṩһ·ÝºÜÊÇÏêϸµÄ½Ì³Ì£¬½ÌÄãÔõÑùʹÓöþ½øÖÆÎļþÀ´×°ÖÃgitlab£¬²¢Ñ§Ï°ÔõÑù±¸·Ýgitlab¡£
1¡¢ÏÂÔØGitlabµÄ¶þ½øÖÆÎļþ
ÔÚGitlabµÄ¹ÙÍø£¨https://about.gitlab.com/installation/£©ÉÏ£¬Ñ¡Ôñ¡°Install Gitlab using binary packages¡±£¨Ê¹Óöþ½øÖÆÎļþ×°ÖÃGitlab£©Ñ¡ÏȻºóÑ¡ÔñÄúÐèҪʹÓõÄLinux¿¯ÐаæºÍ°æ±¾¡£ÕâÀïÎÒÃÇÑ¡ÔñµÄÊÇUbuntu 18.04¡£
½Ó×Å£¬ÔÚÒªÌí¼ÓµÄGitlab´æ´¢¿âµÄÖն˴°¿ÚÏÂÖ´ÐÐÒÔÏÂÏÂÁ
curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash
È»ºó£¬Ö´ÐÐÒÔÏÂÏÂÁîÀ´×°ÖÃGitlab-ce°ü£º
sudo apt-get install gitlab-ce
2¡¢ÉèÖÃGitLab
×°ÖÃGitLab-ce°üºó£¬¿ÉÒÔͨ¹ýÐÞ¸ÄÉèÖÃÎļþÀ´ÉèÖÃGitLab¡£GitLabµÄÉèÖÃÎļþλÓÚ/etc/gitlabĿ¼Ï¡£ÆäÖУ¬gitlab.rbÊÇÖ÷ÒªÉèÖÃÎļþ¡£
ʹÓÃÒÔÏÂÖÕ¶ËÏÂÁîÀ´±à¼GitLabµÄÉèÖÃÎļþ£º
sudo nano /etc/gitlab/gitlab.rb
ÉèÖÃÎļþÖÐÓÐһЩ³£¼ûÑ¡ÏÄú¿ÉÒÔ°´Ðè¾ÙÐÐÉèÖá£ÉúÑIJ¢¹Ø±ÕÉèÖÃÎļþºó£¬ÔËÐÐÒÔÏÂÏÂÁîÒÔÖØÐÂÆô¶¯GitLab£º
sudo gitlab-ctl reconfigure
3¡¢±¸·ÝGitLab
¹ØÓÚÈκÎÉú²ú¼¶±ðµÄÓ¦ÓóÌÐò¶øÑÔ£¬Êý¾Ý±¸·Ý¶¼ÊǺÜÊÇÖ÷ÒªµÄ¡£GitLabÊÇÒ»ÏîÓªÒµÖ÷ÒªµÄÈí¼þ£¬Òò´ËÓ¦¸ÃΪÆäÉèÖñ¸·Ý¡£
GitLabÓÐÁ½ÖÖÀàÐ͵ı¸·Ý¡£ËüÃÇÊÇ£º
Ò»Ñùƽ³£±¸·Ý¡£ÕâÖÖ±¸·Ý½«ËùÓÐGitLabÊý¾ÝÉúÑĵ½µ¥¸öÎļþÖУ¬²¢½«¸ÃÎļþ±¸·Ýµ½²î±ðµÄ´æ´¢ÇøÓò¡£
µ¼³öËùÓС£ÕâÖÖ±¸·Ý½«GitLabÖеÄËùÓÐÊý¾Ý£¬°üÀ¨¾ÙÐÐÖеÄת´¢Îļþ¡¢LFSÎļþµÈ£¬ËùÓе¼³öÔÚÒ»¸ötarÎļþÖС£
ΪÁËÈÃGitLabÌìÉú×Ô¶¯±¸·Ý£¬Äú¿ÉÒÔÔÚÉèÖÃÎļþÖÐÉèÖÃÒÔÏÂÑ¡Ï
gitlab_rails[‘backup_keep_time’]£¬ÉèÖÃGitLab±£´æ±¸·ÝÎļþµÄʱ¼ä¡£
gitlab_rails[‘backup_upload_connection’]£¬ÉèÖñ¸·ÝÎļþÉÏ´«µ½µÄЧÀÍÆ÷¡£
ÒÔÏÂÊDZ¸·ÝGitLabÊý¾ÝµÄÀú³Ì£º
½øÈëGitLabЧÀÍÆ÷£¬²¢Çл»µ½GitLab±¸·ÝĿ¼¡£
cd /var/opt/gitlab/backups
½¨Éè´Ë±¸·Ý°æ±¾µÄGitLab±¸·Ý¡£
sudo gitlab-rake gitlab:backup:create
½«±¸·ÝÎļþ¸´ÖƵ½ÆäËûЧÀÍÆ÷»ò´ÅÅÌÇý¶¯Æ÷ÖУ¨ÒÔ±ÜÃâɥʧ»òË𻵵ȣ©¡£
cp 1452432564_gitlab_backup.tar /root
¶ÔGitLab¾ÙÐÐÍêÈ«±¸·Ý£¨°üÀ¨¾ÙÐÐÖеÄת´¢Îļþ¡¢LFSÎļþµÈ£©¡£
sudo gitlab-rake gitlab:backup:create SKIP=registry,pages,artifacts
½«GitLab±¸·ÝÎļþÉÏ´«µ½ÆäËûЧÀÍÆ÷»ò´ÅÅÌÇý¶¯Æ÷ÖС£
scp 1452432564_gitlab_backup.tar root@server:/home
¾ÙÐб¸·Ý»Ö¸´¡£ÔÚGitLab±¸·Ý»Ö¸´Àú³ÌÖУ¬ÒªÈ·±£½«Òª»¹Ôµ½µÄGitLab°æ±¾Ó뱸·ÝÎļþÖеİ汾ÍêÈ«Ïàͬ¡£
sudo gitlab-rake gitlab:backup:restore BACKUP=1452432564
×ܽá
ͨ¹ý±¾ÎÄ£¬ÄúѧϰÁËÔõÑùʹÓöþ½øÖÆÎļþÀ´×°ÖÃGitLab£¬ÒÔ¼°ÔõÑù±¸·ÝGitLab¡£±¸·ÝÊÇGitLabÖв»¿É»òȱµÄ¹¦Ð§£¬Ëü¿ÉÒÔ±£»¤ÄúµÄÊý¾ÝÃâÊÜÒâÍâɥʧ»òË𻵵ÄÓ°Ïì¡£ÈôÊÇÄú»¹Î´×îÏȱ¸·Ý£¬ÏÖÔÚÊÇÖØÐÂ×îÏȵĺÃʱ»ú¡£
ÒÔÉϾÍÊÇÔõÑùʹÓöþ½øÖÆÎļþ×°ÖÃgitlab²¢±¸·ÝµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡