ÁÄÁÄÔõô¸ü¸ÄGitLabЧÀÍÆ÷µÄIPµØµã
gitlabÊÇÒ»¸ö¿ªÔ´µÄ¿ÍÕ»ÖÎÀíϵͳ£¬ÌṩԴ´úÂë°æ±¾¿ØÖÆ¡¢´úÂëƬ¶ÏÖÎÀí¡¢ÎÊÌâ¸ú×Ù¡¢ci/cd¹¹½¨µÈ¹¦Ð§¡£Ëü¿ÉÒÔͨ¹ýweb½çÃæ»òÏÂÁîÐй¤¾ß¾ÙÐÐÖÎÀíºÍʹÓá£ÔÚʹÓÃgitlabʱ£¬ÎÒÃÇÓÐʱÐèÒª¸ü¸ÄgitlabЧÀÍÆ÷µÄipµØµã¡£ÔÚÕâƪÎÄÕÂÖУ¬ÎÒÃǽ«ÌÖÂÛÔõÑù¸ü¸ÄgitlabЧÀÍÆ÷µÄipµØµã¡£
È·¶¨Ð§ÀÍÆ÷IPµØµã
ÔÚ¸ü¸ÄGitLabЧÀÍÆ÷µÄIPµØµã֮ǰ£¬Ê×ÏÈҪȷ¶¨ÐµÄIPµØµã¡£ÎÒÃÇ¿ÉÒÔʹÓÃifconfig»òip addrµÈÏÂÁîÀ´¼ì²éÄ¿½ñЧÀÍÆ÷µÄIPµØµã¡£ÀýÈ磬ÎÒÃÇ¿ÉÒÔʹÓÃÒÔÏÂÏÂÁîÀ´¼ì²éÄ¿½ñЧÀÍÆ÷µÄIPµØµã£º
ifconfig
µÇ¼ºó¸´ÖÆ
Êä³öЧ¹ûÈçÏ£º
eth0: flags=4163<up> mtu 1500 inet 192.168.1.101 netmask 255.255.255.0 broadcast 192.168.1.255 inet6 fe80::a00:27ff:fede:c03 prefixlen 64 scopeid 0x20<link> ether 08:00:27:de:0c:03 txqueuelen 1000 (Ethernet) RX packets 338 bytes 35743 (34.9 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 224 bytes 21212 (20.7 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0</up>
µÇ¼ºó¸´ÖÆ
´ÓÊä³öЧ¹ûÖпÉÒÔ¿´µ½£¬Ä¿½ñЧÀÍÆ÷µÄIPµØµãÊÇ192.168.1.101¡£ÔÚÕâƪÎÄÕÂÖУ¬ÎÒÃǽ«°ÑЧÀÍÆ÷µÄIPµØµã¸ü¸ÄΪ192.168.1.102¡£
ÐÞ¸ÄGitLabÉèÖÃÎļþ
½ÓÏÂÀ´£¬ÎÒÃÇÐèÒªÐÞ¸ÄGitLabµÄÉèÖÃÎļþ£¬ÒÔ±ãÈÃGitLabʹÓÃеÄIPµØµã¡£GitLabµÄÉèÖÃÎļþͨ³£Î»ÓÚ/etc/gitlab/gitlab.rbÖС£ÎÒÃÇ¿ÉÒÔʹÓÃÒÔÏÂÏÂÁîÀ´·¿ªÉèÖÃÎļþ£º
sudo nano /etc/gitlab/gitlab.rb
µÇ¼ºó¸´ÖÆ
ÔÚÉèÖÃÎļþÖУ¬ÎÒÃÇÐèÒªÕÒµ½external_url²ÎÊý£¬²¢½«ÆäÖµ¸ü¸ÄΪеÄIPµØµã¡£ÀýÈ磬ÎÒÃÇ¿ÉÒÔ½«Æä¸ü¸ÄΪ£º
external_url 'http://192.168.1.102'
µÇ¼ºó¸´ÖÆ
ÉúÑIJ¢¹Ø±ÕÎļþ¡£½ÓÏÂÀ´£¬ÎÒÃÇÐèÒªÖØÐÂÉèÖÃGitLabÒÔʹ¸ü¸ÄÉúЧ¡£ÎÒÃÇ¿ÉÒÔʹÓÃÒÔÏÂÏÂÁîÀ´ÖØÐÂÉèÖÃGitLab£º
sudo gitlab-ctl reconfigure
µÇ¼ºó¸´ÖÆ
Õ⽫ÖØÐÂÆô¶¯GitLab²¢Ó¦ÓÃеÄÉèÖá£Í¨¹ýÖØÐÂÉèÖã¬GitLab½«Ê¹ÓÃеÄIPµØµã¡£
ÐÞ¸ÄDNS¼Í¼
ÈôÊÇÄúʹÓõÄÊÇÓòÃû»á¼ûGitLab£¬Ôò»¹ÐèÒªÐÞ¸ÄDNS¼Í¼ÒÔÖ¸ÏòеÄIPµØµã¡£Äú¿ÉÒÔÔÚÓòÃû¿ØÖÆÃæ°å»òDNSÖÎÀíÃæ°åÖоÙÐд˲Ù×÷¡£ÒÔGodaddyΪÀý£¬ÄúÐèÒª½øÈë¿ØÖÆÃæ°å£¬ÕÒµ½DNSÖÎÀí£¬È»ºóÕÒµ½GitLabÓòÃûµÄ¼Í¼£¬²¢½«Æä¸ü¸ÄΪеÄIPµØµã¡£Ð޸ĺó£¬DNS¼Í¼ÐèҪһЩʱ¼ä²Å»ªÉúЧ¡£Äú¿ÉÒÔʹÓÃpingÏÂÁî²âÊÔеÄIPµØµãÊÇ·ñÉúЧ¡£
ping gitlab.example.com
µÇ¼ºó¸´ÖÆ
ÈôÊÇpingÏÂÁî·µ»ØеÄIPµØµã£¬Ôò˵Ã÷еÄIPµØµãÒÑÉúЧ¡£
×ܽá
¸ü¸ÄGitLabЧÀÍÆ÷µÄIPµØµã¿ÉÒÔʹÓÃifconfig»òip addrµÈÏÂÁîÀ´Éó²éÄ¿½ñЧÀÍÆ÷µÄIPµØµã£¬²¢Ê¹ÓÃnano /etc/gitlab/gitlab.rbÏÂÁîÐÞ¸ÄÉèÖÃÎļþÖеÄexternal_url²ÎÊý¡£È»ºó£¬Í¨¹ýÔËÐÐsudo gitlab-ctl reconfigureÏÂÁîÖØÐÂÉèÖÃGitLab¡£ÈôÊÇʹÓÃÓòÃû»á¼ûGitLab£¬Ôò»¹ÐèÒªÐÞ¸ÄDNS¼Í¼ÒÔÖ¸ÏòеÄIPµØµã¡£
ÒÔÉϾÍÊÇÁÄÁÄÔõô¸ü¸ÄGitLabЧÀÍÆ÷µÄIPµØµãµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡