ÁÄÁÄgitlab´î½¨ÓëʹÓÃ
Ëæ×ÅÈí¼þ¿ª·¢µÄ¿ìËÙÉú³¤£¬ÎÒÃÇÔÚ¿ª·¢Àú³ÌÖеĴúÂëÐͬºÍ°æ±¾ÖÎÀíÔ½À´Ô½Ö÷Òª¡£gitÊÇÏÖÔÚ×îÖ÷Á÷ºÍ×îÊ¢Ðеİ汾¿ØÖÆϵͳ֮һ¡£gitlab¾ÍÊÇ»ùÓÚgitµÄÒ»¸öºÜÊÇÇ¿Ê¢µÄÔ´´úÂëÖÎÀí¹¤¾ß£¬Ëü¾ßÓÐÐí¶àÆæÒìµÄÌØÕ÷£¬È縻ºñµÄ¹¦Ð§£¬Ò×ÓÚʹÓõȡ£±¾ÎĽ«ÏòÄúÏÈÈÝgitlabµÄ´î½¨ÓëʹÓá£
Ò»¡¢GitLab¸ÅÊö
GitLabÊÇÒ»¸ö¿ªÔ´´úÂëÍйܺÍÐ×÷ƽ̨£¬Ëü¿ÉÒÔ×ÊÖúÎÒÃǸüºÃµØÖÎÀí´úÂ룬ʵÏÖÒ»¸öÕæÕýµÄDevOpsƽ̨¡£Ëü¿ÉÒÔÔÚÍâµØ»òÔƶËÔËÐУ¬ÌṩǿʢµÄÔ´´úÂëÖÎÀí¡¢CI / CD×Ô¶¯»¯¡¢´úÂëÉó²éºÍÎó²î¼ì²âµÈ¹¦Ð§¡£Í¨¹ýʹÓÃGitLab£¬ÍŶӿÉÒÔÇáËɵؾÙÐдúÂë¹²ÏíºÍÐ×÷£¬´Ó¶øÌá¸ßÕû¸öÍŶӵÄÊÂÇéЧÂʺʹúÂëÖÊÁ¿¡£
¶þ¡¢GitLabÔõÑù´î½¨
×¼±¸ÊÂÇé
ÔÚ×îÏÈ×°ÖÃGitLab֮ǰ£¬ÄúÐèҪȷ±£²Ù×÷ϵͳÉÏÒÑ×°ÖÃDockerºÍDocker Compose¡£DockerÊÇÒ»¸ö¿ªÔ´µÄƽ̨£¬¿ÉÒÔ×ÊÖúÎÒÃǹ¹½¨¡¢Ðû²¼ºÍÔËÐÐÓ¦ÓóÌÐò¡£¶øDocker ComposeÊÇDockerµÄÉèÖù¤¾ß£¬¿ÉÒÔ×ÊÖúÎÒÃÇÀû±ãµØ½ç˵ºÍÔËÐжà¸öDockerÈÝÆ÷¡£
»ñÈ¡GitLab×°Öðü
Äú¿ÉÒÔ´ÓDocker Store»ñÈ¡×îа汾µÄGitLab×°Öðü¡£ÇëÈ·±£Ñ¡ÔñÊÊÓÃÓÚÄú²Ù×÷ϵͳµÄ°æ±¾¡£
ÏÂÔØ×°Öðü
ʹÓÃDocker Compose½¨ÉèÒ»¸ö°üÀ¨GitLabµÄDockerÈÝÆ÷¡£ÔËÐÐÒÔÏÂÏÂÁ
mkdir -p /srv/gitlab/config /srv/gitlab/data /srv/gitlab/logs cd /srv/gitlab/ touch docker-compose.yml
µÇ¼ºó¸´ÖÆ
ÔÚdocker-compose.ymlµÄÎļþÖÐÌí¼ÓÒÔÏÂÄÚÈÝ£º
version: '3' services: web: image: 'gitlab/gitlab-ce:latest' restart: always hostname: 'gitlab.example.com' environment: GITLAB_OMNIBUS_CONFIG: | external_url 'http://gitlab.example.com' nginx['listen_port'] = 80 nginx['listen_https'] = false gitlab_rails['gitlab_shell_ssh_port'] = 2224 ports: - '80:80' - '443:443' - '2224:22' volumes: - '/srv/gitlab/config:/etc/gitlab' - '/srv/gitlab/logs:/var/log/gitlab' - '/srv/gitlab/data:/var/opt/gitlab'
µÇ¼ºó¸´ÖÆ
´Ë´¦£¬ÄúÐèÒª½«hostnameÃüÃûΪÄúÏëҪʹÓõÄGitLabÖ÷»úÃû¡£±ðµÄ£¬½«external_url×÷ΪGitLabµÄURL£¨ÔÚ´ËʾÀýÖУ¬¡°http£º// gitlab.example.com¡±£©¡£
Æô¶¯ÈÝÆ÷
ʹÓÃÒÔÏÂÏÂÁîÀ´Æô¶¯ÈÝÆ÷£º
docker-compose up -d
µÇ¼ºó¸´ÖÆ
»á¼ûGitLab
GitLabÒѾÀֳɵذ²ÅÅÔÚÄúµÄЧÀÍÆ÷ÉÏÁË¡£Äú¿ÉÒÔͨ¹ýä¯ÀÀÆ÷»á¼ûhttp£º//gitlab.example.com£¬Ê¹ÓÃĬÈÏÖÎÀíÔ±Óû§Ãû¡°root¡±ºÍÃÜÂë¡°5iveL!fe¡±µÇ¼¡£
Èý¡¢GitLabÔõÑùʹÓÃ
ÔÚGitLabÖУ¬Äú¿ÉÒÔ½¨ÉèÒ»¸öÏîÄ¿£¬Ìí¼Ó³ÉÔ±£¬ÖÎÀí´æ´¢¿âµÈµÈ¡£ÏÂÃ潫¼òÆÓÏÈÈÝGitLabµÄһЩÖ÷Òª¹¦Ð§¡£
½¨ÉèÏîÄ¿
µ¥»÷¡°ÐÂÏîÄ¿¡±°´Å¥£¬Äú½«±»´øµ½ÏîÄ¿½¨ÉèÒ³Ãæ¡£ÔÚÏîÄ¿½¨ÉèÒ³ÃæÖУ¬Äú¿ÉÒÔÊäÈëÏîÄ¿µÄÃû³Æ¡¢ÐÎòºÍ»á¼û¼¶±ðµÈÐÅÏ¢¡£Ñ¡Ôñ¡°½¨ÉèÏîÄ¿¡±°´Å¥£¬GitLab½«ÎªÄú½¨ÉèÒ»¸öÏîÄ¿¡£
Ìí¼Ó³ÉÔ±
ÔÚÏîÄ¿Ò³ÃæµÄ×ó²à²Ëµ¥ÖÐÑ¡Ôñ¡°³ÉÔ±¡±£¬Äú¿ÉÒÔÌí¼Ó¡¢±à¼¡¢ÒƳýÏîÄ¿³ÉÔ±¡£¹ØÓÚÿ¸ö³ÉÔ±£¬Äú¿ÉÒÔÉèÖÃÆä½ÇÉ«ºÍȨÏÞ¡£
ÖÎÀí´æ´¢¿â
ÔÚÏîÄ¿Ò³Ã涥²¿£¬Äú½«¿´µ½Ò»¸ö´æ´¢¿âURL¡£Äú¿ÉÒÔʹÓôËURLÀ´½«ÏîÄ¿¿Ë¡µ½ÄúµÄÍâµØÅÌËã»úÖС£Äú¿ÉÒÔʹÓÃGitLabÌṩµÄWeb½çÃæÀ´ÖÎÀí´æ´¢¿âµÄÄÚÈÝ£¬Ò²¿ÉÒÔʹÓÃGit CLI£¨ÏÂÁîÐнçÃ棩¾ÙÐÐÍâµØµ÷½â¡£GitLabÖ§³ÖÖÖÖÖ°æ±¾¿ØÖƲÙ×÷£¬ÈçÌá½»½ÓÂë¡¢ºÏ²¢ÇëÇóµÈµÈ¡£
CI / CD×Ô¶¯»¯
GitLab»¹ÌṩÁËÇ¿Ê¢µÄCI / CD×Ô¶¯»¯¹¦Ð§¡£Ñ¡ÔñÏîÄ¿Ò³ÃæÉÏ·½µÄCI / CD²Ëµ¥£¬Äú¿ÉÒÔÉèÖÃÒ»¸ö¹ÜµÀÒÔÉèÖÃ×Ô¶¯»¯ÊÂÇéÁ÷¡£Í¨¹ýÉèÖÃÕâЩÊÂÇéÁ÷£¬Äú¿ÉÒÔ×Ô¶¯»¯¹¹½¨¡¢²âÊԺͰ²ÅÅÓ¦ÓóÌÐò¡£
´úÂëÉó²éºÍÎó²î¼ì²â
½èÖúÄÚÖõĴúÂëÉó²é¹¤¾ß£¬Äú¿ÉÒÔÇáËɵØÉó²éÍŶӳÉÔ±Ìá½»µÄ´úÂë¡£±ðµÄ£¬GitLab»¹ÌṩÎó²î¼ì²âºÍÇå¾²ÆÊÎö¹¤¾ß£¬¿ÉÒÔ×ÊÖúÄúÇáËɼì²âÏ¢Õù¾öDZÔÚµÄÇå¾²ÎÊÌâ¡£
ËÄ¡¢×ܽá
ͨ¹ý±¾ÎÄ£¬ÄúÓ¦¸Ã¶ÔGitLabµÄ´î½¨ºÍʹÓÃÓÐÁ˸üÉîÈëµÄÏàʶ¡£Äú¿ÉÒÔʹÓÃDocker¿ìËÙ°²ÅÅGitLab£¬²¢×îÏÈÔÚÍŶÓÖÐʹÓÃËü¾ÙÐдúÂëÐ×÷ºÍÖÎÀí¡£²»µ«ÔÆÔÆ£¬Äú»¹¿ÉÒÔÔÚGitLabÖÐÉèÖÃ×Ô¶¯CI / CD¹ÜµÀ£¬Ê¹ÓÃÆäÄÚÖõÄÉó²é¹¤¾ßºÍÎó²î¼ì²â¹¤¾ßÀ´Ìá¸ß´úÂëµÄÖÊÁ¿ºÍÇå¾²ÐÔ¡£
ÒÔÉϾÍÊÇÁÄÁÄgitlab´î½¨ÓëʹÓõÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡