dzÎöLinuxÉÏÔõôʹÓÃDcoker°²ÅÅGitLab
¸ÅÊö
gitlab ÊÇÒ»¿î»ùÓÚgit°æ±¾¿ØÖÆϵͳµÄ¿ÍÕ»ÖÎÀíÈí¼þ£¬¹¦Ð§¸»ºñ£¬¹¦Ð§°üÀ¨ÏîÄ¿ÖÎÀí¡¢´úÂëÉó²é¡¢ci/cdºÍÍŶÓÖÎÀíµÈ¡£±¾ÎĽ«ÏÈÈÝÔõÑùÔÚlinux ϵͳÉÏʹÓà dcoker °²ÅÅ gitlab£¬²¢¶ÔÆä¾ÙÐмòÆÓµÄÉèÖúͲâÊÔ¡£
×°ÖÃ Docker
ÔÚ°²ÅÅGitlab֮ǰ£¬ÎÒÃÇÐèҪװÖÃDocker£¬ÕâÀïÎÒÃÇʹÓÃUbuntu 18.04ϵͳ£¬Ö´ÐÐÒÔÏÂÏÂÁî×°ÖÃdocker£º
sudo apt-get update sudo apt-get install docker.io
µÇ¼ºó¸´ÖÆ
×°ÖÃÍêDockerÖ®ºó£¬¼ì²éDockerÊÇ·ñ×°ÖÃÀֳɣº
docker --version
µÇ¼ºó¸´ÖÆ
ÈôÊÇ¿´µ½Docker°æ±¾ÐÅÏ¢£¬Ôò˵Ã÷Docker×°ÖÃÀֳɡ£
ÉèÖÃÖÎÀíÔ±ÃÜÂë
Ö´ÐÐÒÔÏÂÏÂÁîÆô¶¯GitlabÈÝÆ÷£º
sudo docker run --detach --hostname gitlab.example.com \ --publish 443:443 --publish 80:80 --publish 22:22 \ --name gitlab \ --restart always \ --volume /srv/gitlab/config:/etc/gitlab \ --volume /srv/gitlab/logs:/var/log/gitlab \ --volume /srv/gitlab/data:/var/opt/gitlab \ gitlab/gitlab-ce:latest
µÇ¼ºó¸´ÖÆ
ÆäÖУ¬gitlab.example.comΪGitlabµÄÓòÃû£¬/srv/gitlab/config£¬/srv/gitlab/logs£¬/srv/gitlab/data»®·ÖΪGitlabµÄÉèÖÃÎļþ¼Ð¡¢ÈÕÖ¾Îļþ¼Ð¡¢Êý¾ÝÎļþ¼Ð¡£
ÔÚÈÝÆ÷ÔËÐÐÖ®ºó£¬ÎÒÃÇÐèÒª»ñȡĬÈÏÖÎÀíÔ±µÄÃÜÂ룬ִÐÐÒÔÏÂÏÂÁ
sudo docker exec -it gitlab /bin/bash
µÇ¼ºó¸´ÖÆ
½øÈëÈÝÆ÷ÖÐÖ®ºó£¬Ö´ÐÐÏÂÁÐÏÂÁ
gitlab-rails console production u=User.where(id:1).first u.password='your_new_password_here' u.password_confirmation='your_new_password_here' u.save
µÇ¼ºó¸´ÖÆ
ÕâÑù¾ÍÍê³ÉÁËÖÎÀíÔ±ÃÜÂëµÄÖØÖã¬Í˳öÈÝÆ÷¡£
ÉèÖÃSMTP
Gitlab ĬÈÏÓʼþ·¢ËÍʹÓà Sendmail£¬ÈôÊÇÏëҪʹÓÃSMTP·¢ËÍÓʼþ£¬ÐèÒª¸ü¸ÄÉèÖÃÎļþ¡£ÔÚÕâÀïÎÒÃÇʹÓà QQÓÊÏä×÷ΪÓʼþ·¢ËÍ£¬ÈôʹÓÃÆäËûÓÊÏäÇëƾ֤ÏÖÕæÏàÐθü¸ÄSMTPµØµã¡¢¶Ë¿Ú¡¢Óû§ÃûºÍÃÜÂë¡£
Ê×ÏÈ£¬ÔÚGitlabµÄÉèÖÃÎļþ¼ÐÖÐ ½¨Éè»ò±à¼ gitlab.rb ¿ÉÒÔʹÓÃÒÔÏÂÏÂÁÉèÎļþ²¢Ð´ÈëÉèÖãº
sudo touch /srv/gitlab/config/gitlab.rb sudo echo "gitlab_rails['smtp_enable'] = true" >> /srv/gitlab/config/gitlab.rb sudo echo "gitlab_rails['smtp_address'] = \"smtp.qq.com\"" >> /srv/gitlab/config/gitlab.rb sudo echo "gitlab_rails['smtp_port'] = 465" >> /srv/gitlab/config/gitlab.rb sudo echo "gitlab_rails['smtp_user_name'] = 'your_qq_email_address'" >> /srv/gitlab/config/gitlab.rb sudo echo "gitlab_rails['smtp_password'] = 'your_qq_email_password'" >> /srv/gitlab/config/gitlab.rb sudo echo "gitlab_rails['smtp_domain'] = \"smtp.qq.com\"" >> /srv/gitlab/config/gitlab.rb sudo echo "gitlab_rails['smtp_authentication'] = \"login\"" >> /srv/gitlab/config/gitlab.rb sudo echo "gitlab_rails['smtp_enable_starttls_auto'] = true" >> /srv/gitlab/config/gitlab.rb sudo echo "gitlab_rails['smtp_tls'] = true" >> /srv/gitlab/config/gitlab.rb
µÇ¼ºó¸´ÖÆ
×¢Öظü¸ÄÉèÖÃÖеÄQQÓÊÏäºÍÃÜÂë¡£
ÖØÆôGitLab
¸ü¸ÄÍêÉèÖÃÖ®ºó£¬ÐèÒªÖØÐÂÆô¶¯Gitlab²Å»ªÊ¹ÉèÖÃÉúЧ£¬Ö´ÐÐÒÔÏÂÏÂÁ
sudo docker restart gitlab
µÇ¼ºó¸´ÖÆ
Ö®ºó¾Í¿ÉÒÔ»á¼ûGitlabµÄÖÎÀíÒ³Ã棬ÊäÈëÖÎÀíÔ±ÕʺźÍеÄÃÜÂë½øÈëϵͳ¡£
¿¢ÊÂÓï
±¾ÎĽö½öÏÈÈÝÁËGitLabµÄ¼òÆÓ°²ÅźÍÉèÖ㬸ü¶à¸üÏêϸµÄÉèÖòÎÊýºÍÐÅÏ¢£¬Çë²ÎÔÄGitLab¹Ù·½Îĵµ¡£
ÒÔÉϾÍÊÇdzÎöLinuxÉÏÔõôʹÓÃDcoker°²ÅÅGitLabµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡