æåã®èšäºã§ã¯ã Gitlabããããã€ããŸã ãããã«ã¯ä»¥äžãå«ãŸããŸãã
- gitãœãŒã¹ã³ãŒã管çã·ã¹ãã ã®ãŠã§ãã€ã³ã¿ãŒãã§ãŒã¹ ãããã¯githubã«æããã䌌ãŠããŸã
- ãŠãŒã¶ãŒã¢ã¯ãã£ããã£ã®äŸ¿å©ãªè¡šç€º
- ãã¡ã€ã«ãã©ãŠã¶
- Wiki
- ã³ãŒãã¬ãã¥ãŒæ©èœ
- ãã°ãã©ãã«ãŒ
- ã³ãŒãã¹ãããããäœæããæ©èœ
- Webããã¯ãæ¿å ¥ããæ©èœ
- ãã«ããµãŒããŒ
ãªã©ãªã©ã
ç¡æã®ãªããžããªãç¡å¶éã«äœæããã¢ã¯ã»ã¹ããã³ã»ãã¥ãªãã£ããªã·ãŒãæ§æã§ããŸãã Gitlabã®åã«VPNãå±éããå Žåããããªãã¯IPãµãŒããŒã«GitlabãæäŸããäŒæ¥ãããã¯ãŒã¯ããVPNãä»ããŠã¯ã©ãŠãã®å éšãããã¯ãŒã¯ã«æ¥ç¶ããããšã§ãããæäœããããšã¯ã§ããŸããã
ç°å¢ã®æºå
1. CentOS 7ã§ãµãŒããŒãäœæããŠã DocboxãInfoboxCloudã«ã€ã³ã¹ããŒã«ããŸã ã Dockerãæ©èœããããã«ã¯ããŸãã«ä»å¿ èŠãªä»®æ³ãã·ã³ã§ãããã®ããããµãŒããŒãäœæãããšãã¯ã ãOSã«ãŒãã«å¶åŸ¡ãèš±å¯ãããããã¯ã¹ãå¿ ããã§ãã¯ããŠãã ããã
InfoboxCloud for Dockerã§ãµãŒããŒãäœæããæ¹æ³
InfoboxCloudã«ãŸã ã¢ã¯ã»ã¹ã§ããªãå Žåã¯ã 泚æããŠãã ãã ã
ç»é²åŸãé»åã¡ãŒã«ã§ã³ã³ãããŒã«ããã«ã«ã¢ã¯ã»ã¹ããããã®ããŒã¿ãåãåããŸãã https://panel.infobox.ruã§ã³ã³ãããŒã«ããã«ã«ãã°ã€ã³ããŸãã
ãµãã¹ã¯ãªãã·ã§ã³ã®[ã¯ã©ãŠãã€ã³ãã©ã¹ãã©ã¯ãã£]ã»ã¯ã·ã§ã³ã§ã[æ°ãããµãŒããŒ]ãã¯ãªãã¯ããŸãïŒå¿ èŠã«å¿ããŠãããããããŠã³ã¡ãã¥ãŒã®å³äžé ã«ãããµãã¹ã¯ãªãã·ã§ã³ãå€æŽãããŸãïŒã
å¿ èŠãªãµãŒããŒãã©ã¡ãŒã¿ãèšå®ããŸãã äžã®ã¹ã¯ãªãŒã³ã·ã§ããã«ç€ºãããã«ããµãŒããŒã«1ã€ã®ãããªãã¯IPã¢ãã¬ã¹ãäžãã ãOSã«ãŒãã«å¶åŸ¡ãèš±å¯ãããããã¯ã¹ããã§ãã¯ããŠãã ããã
䜿çšå¯èœãªãªãã¬ãŒãã£ã³ã°ã·ã¹ãã ã®ãªã¹ãã§ãCentOS 7ãéžæãããµãŒããŒã®äœæãå®äºããŸãã
ãã®åŸããµãŒããŒã«ã¢ã¯ã»ã¹ããããã®ããŒã¿ãé»åã¡ãŒã«ã§éä¿¡ãããŸãã
ç»é²åŸãé»åã¡ãŒã«ã§ã³ã³ãããŒã«ããã«ã«ã¢ã¯ã»ã¹ããããã®ããŒã¿ãåãåããŸãã https://panel.infobox.ruã§ã³ã³ãããŒã«ããã«ã«ãã°ã€ã³ããŸãã
ãµãã¹ã¯ãªãã·ã§ã³ã®[ã¯ã©ãŠãã€ã³ãã©ã¹ãã©ã¯ãã£]ã»ã¯ã·ã§ã³ã§ã[æ°ãããµãŒããŒ]ãã¯ãªãã¯ããŸãïŒå¿ èŠã«å¿ããŠãããããããŠã³ã¡ãã¥ãŒã®å³äžé ã«ãããµãã¹ã¯ãªãã·ã§ã³ãå€æŽãããŸãïŒã
å¿ èŠãªãµãŒããŒãã©ã¡ãŒã¿ãèšå®ããŸãã äžã®ã¹ã¯ãªãŒã³ã·ã§ããã«ç€ºãããã«ããµãŒããŒã«1ã€ã®ãããªãã¯IPã¢ãã¬ã¹ãäžãã ãOSã«ãŒãã«å¶åŸ¡ãèš±å¯ãããããã¯ã¹ããã§ãã¯ããŠãã ããã
䜿çšå¯èœãªãªãã¬ãŒãã£ã³ã°ã·ã¹ãã ã®ãªã¹ãã§ãCentOS 7ãéžæãããµãŒããŒã®äœæãå®äºããŸãã
ãã®åŸããµãŒããŒã«ã¢ã¯ã»ã¹ããããã®ããŒã¿ãé»åã¡ãŒã«ã§éä¿¡ãããŸãã
CentOS 7ã§ãµãŒããŒãäœæããåŸã SSHãä»ããŠãµãŒããŒã«æ¥ç¶ããŸãã
ãã®ãããªãµãŒããŒã§DockerãšDockerãæäœããããã®äŸ¿å©ãªãŠãŒãã£ãªãã£ãã€ã³ã¹ããŒã«ã§ããã¹ã¯ãªãããæºåããŸããã å¿ èŠãªèšå®ã¯èªåçã«è¡ãããŸãã
ã³ãã³ããå®è¡ããŠDockerããã³Composeãã€ã³ã¹ããŒã«ããŸãã
bash <(curl -s http://repository.sandbox.infoboxcloud.ru/scripts/docker/centos7/install.sh)
Dockerãšcomposeãã€ã³ã¹ããŒã«ãããŸãã
ãµãŒããŒãã¯ãªãã¯ããŠãã€ã¡ãŒãžãäœæããã¯ãªãã¯ãããšãã³ã³ãããŒã«ããã«ã« dockerãã€ã³ã¹ããŒã«ãããã€ã¡ãŒãžãäœæã§ããŸãã ãã®åŸãDockerã䜿çšããŠã€ã¡ãŒãžããæ°ãããµãŒããŒãäœæãããã®ã¹ããããå床å®è¡ããªãã§ãã ããã
ã¯ã©ãŠããµãŒããŒã®ã·ã¹ãã èŠä»¶
Gitlabã®å¿«é©ãªæäœã®ããã«ã100ã500ãŠãŒã¶ãŒã®2ã€ã®CPUã³ã¢ãš2Gb Ramãæšå¥šãããŸãã
ãã¹ãäžã«å¯èœãªéãä¿åããå¿ èŠãããå Žåã¯ãGitlabãµãŒããŒã«1 CPUã³ã¢1 GHzãæå®ã§ããŸãããå°ãªããšã2 GBã®ã¡ã¢ãªãå¿ èŠã§ãã
å€æ°ã®ãŠãŒã¶ãŒãšé£æºããå¿ èŠãããå ŽåïŒ
CPU
- 4 CPUã³ã¢-æ倧2,000ãŠãŒã¶ãŒ
- 8 CPUã³ã¢-æ倧5,000ãŠãŒã¶ãŒ
- 16 CPUã³ã¢-æ倧10,000ãŠãŒã¶ãŒ
- 24 CPUã³ã¢-æ倧15,000ãŠãŒã¶ãŒ
RAM
- 4GB RAM-æ倧1,000ãŠãŒã¶ãŒ
- 8GB RAM-æ倧2,000ãŠãŒã¶ãŒ
- 16GB RAM-æ倧4,000ãŠãŒã¶ãŒ
- 32GB RAM-æ倧8,000ãŠãŒã¶ãŒ
- 64GB RAM-16,000ãŠãŒã¶ãŒ
ããã«ãŠãŒã¶ãŒãå¿ èŠãªå Žåã¯ãè€æ°ã®ãµãŒããŒã§ Gitlab ãå®è¡ã§ããŸã ã
Gitlabãã€ã³ã¹ããŒã«ãã
Gitlabã®ææ°ããŒãžã§ã³ãè¿ éã«å±éããããã®ãã¡ã€ã«ã¯ãã§ã«æºåãããŠããŸãã Gitlabã¯Dockerã³ã³ãããŒã«ãããã€ãããŸãã ãã®åã«ãGitlabã§å ¬åŒã€ã¡ãŒãžãæŽæ°ããŸããGitlabã®ææ°ããŒãžã§ã³ãå«ãOSäžã®ãã¹ãŠã®æŽæ°ããã°ã©ã ãåãåããŸãïŒå ¬åŒã€ã¡ãŒãžã¯é ããŠæŽæ°ãããŸããææ°ã®å®å®çã以åã«ãããŸãïŒã
次ã®ã³ãã³ãã§gitãã€ã³ã¹ããŒã«ããŸãã
yum install -y git
ãŠãŒã¶ãŒãã£ã¬ã¯ããªã«ç§»åããŸãã
cd ~
gitlabãå±éããããã«å¿ èŠãªãã¡ã€ã«ãããŠã³ããŒãããŸãã
git clone https://github.com/trukhinyuri/gitlab-docker.git
次ã«ãå±éçšã®ãã¡ã€ã«ããããã£ã¬ã¯ããªã«ç§»åããŸãã
cd ~/gitlab-docker
次ã®ãã¡ã€ã«ãšãã£ã¬ã¯ããªããã£ã¬ã¯ããªã«ååšããŸãã
- Dockerfile ïŒå ¬åŒã®gitlabã€ã¡ãŒãžã§å®è¡ãããã¢ã¯ã·ã§ã³ã«ã€ããŠèª¬æããŠããŸãã
- docker-compose.ymlã¯ãçµæã®ã€ã¡ãŒãžããããã€ããæ¹æ³ã転éããããŒãããã¹ãã«ããŠã³ãããã³ã³ãããŒã®ãã©ã«ããŒãèšè¿°ããŸãã
- configãã©ã«ããŒïŒgitlabã¯ãã®ãã©ã«ããŒã«æ§æãã¡ã€ã«ãä¿åããŸã
- ããŒã¿ãã©ã«ããŒïŒgitlabã¯ãã®ãã©ã«ããŒã«ããŒã¿ãã¡ã€ã«ãä¿åããŸã
- logsãã©ã«ããŒïŒgitlabã¯ãã®ãã©ã«ããŒã«ãã°ãä¿åããŸã
Dockerfileã®å 容ïŒ
FROM gitlab/gitlab-ce:latest MAINTAINER Yuri Trukhin <yuri@trukhin.com> ENV REFRESHED_AT 2015.09.27.004 ENV GITLAB_SHELL_SSH_PORT 8005 RUN apt-get update RUN apt-get -y upgrade EXPOSE 80 EXPOSE 443 EXPOSE 22
ã³ãã³ãã®ç®çãããã«è©³ããèŠãŠã¿ãŸãããã
- FROMã¯ãã©ã®ã€ã¡ãŒãžããã©ã®ããŒãžã§ã³ã®ã³ã³ããããã«ããããã瀺ããŸãã ãã®å Žåãææ°ããŒãžã§ã³ã®Gitlab Community Editionã®å ¬åŒã€ã¡ãŒãžã䜿çšããŸãã
- ENVã¯ç°å¢å€æ°ãèšå®ããŸãã ENV REFRESHED_AT 2015.09.27.004-ã€ã¡ãŒãžãäœæãããæ¥ä»ã ã³ã³ãããæŽæ°ããå¿ èŠãããå Žåã¯ãæ¥ä»ãå€æŽããã€ã¡ãŒãžãåæ§ç¯ããŠïŒä»¥äžã§è¡ããŸãïŒãå±éããŸãã ENV GITLAB_SHELL_SSH_PORT 8005ã¯ããã¹ãã®SSHãããŒã8005ã«ããããã®ããŒãã§äœæ¥ããå¿ èŠãããããšãGitlabã«äŒããŸãïŒãããŠããããWebã€ã³ã¿ãŒãã§ãŒã¹ã§èæ ®ããŸãïŒã
- RUNã¯ãã³ã³ããå ã§ã³ãã³ããå®è¡ããŸãã OSãæŽæ°ããŸãã
- EXPOSEã¯ããã¹ããžã®è»¢éã«äœ¿çšå¯èœã«ããå¿ èŠãããããŒãã瀺ããŸãã
Docker-compose.ymlã«ã¯ä»¥äžãå«ãŸããŸãã
gitlab: build: . ports: - "8004:443" - "8003:80" - "8005:22" volumes: - ./config:/etc/gitlab - ./logs:/var/log/gitlab - ./data:/var/opt/gitlab restart: always
æåã®è¡ã¯ãçµæã®ã³ã³ããã®ååã瀺ããŸãã buildã¯ãã€ã¡ãŒãžããã«ãããããã®Dockerfileã®ãããã¹ã瀺ããŸãã ããŒãã»ã¯ã·ã§ã³ã§ãã©ã®ãã¹ãããŒããã©ã®ã³ã³ããããŒãã«è»¢éããããæå®ããŸãã ããªã¥ãŒã ã»ã¯ã·ã§ã³ã§ãé©åãªãã©ã«ããŒå ã®ã³ã³ãããŒã«è»¢éãããã¹ããã©ã«ããŒãæå®ããŸãã restartïŒalwaysããªã·ãŒã¯ãã·ã¹ãã ã®èµ·åæããã³ããã»ã¹ããã®äžã«å ¥ã£ããšãã«ã³ã³ãããèªåçã«èµ·åããããšãæå³ããŸãã
ããã¯ãã¹ãŠæºåæžã¿ã§ããæåã«ã³ãã³ãã§ç»åãåéããå¿ èŠããããŸãã
docker-compose build
次ã«ãã³ãã³ãã䜿çšããŠã³ã³ããããããã€ããŸãã
docker-compose up -d
Gitlabã®åã«ãã©ã³ãµãŒãé 眮ããå¿ èŠãããå Žåã¯ããã®èšäºã®ãã©ã³ãµãŒã§é¢é£ããã³ã³ãããŒãäœæããäŸãåç §ã§ããŸãã Gitlabã«å®å šã«ãã°ã€ã³ããã«ã¯ãNGINXãã©ã³ãµãŒåŽã§ãã©ãã£ãã¯ã®æå·åãæå¹ã«ããããšããå§ãããŸãã
ãã¡ã€ã«ã®ç·šéæ¹æ³ãããããªãå Žåã¯ããã®èšäºã®è©³çŽ°ã«ã€ã㊠ãããã¹ããã¡ã€ã«ãç·šéããæ¹æ³ãã»ã¯ã·ã§ã³ãåç §ããŠãã ãã ã Docker Composeã®åŠçã«èå³ãããå Žåã¯ãããã«è©³çŽ°ããããŸã ã
ããã§ãgitlabã«ãã°ã€ã³ã§ããŸãïŒ
http://ipâ
Gitlabãæ£åžžã«ã€ã³ã¹ããŒã«ãããŸããã
ããã©ã«ãã®ãã°ã€ã³ããŒã¿ïŒ
- ãã°ã€ã³ ïŒã«ãŒã
- ãã¹ã¯ãŒã ïŒ5iveLïŒfe
æåã®ãã°ã€ã³æã«ããã°ã€ã³çšã®æ°ãããã¹ã¯ãŒããèšå®ããããã«æ±ããããŸãã
ãã¹ã¯ãŒããå€æŽããŠGitlabã«ãã°ã€ã³ãããšãã¹ã¿ãŒãããŒãžã衚瀺ãããŸãã
åæèšå®
gitlabã䜿çšããããã¡ã€ã³ã®Aã¬ã³ãŒãããã¯ã©ãŠãå ã®ãã¹ãã®å°çšIPã¢ãã¬ã¹ã«åããŸãã 匷調衚瀺ãããã¢ãã¬ã¹ã¯ããã¯ã©ãŠãã€ã³ãã©ã¹ãã©ã¯ãã£ãã»ã¯ã·ã§ã³ã®ã³ã³ãããŒã«ããã«ã§è¡šç€ºã§ããŸãã
ã¡ã€ã³ã®gitlabãã©ã¡ãŒã¿ãŒã¯ããã¹ãã®ã/ gitlab / config / gitlab.rbãã¡ã€ã«ã§æå®ããå¿ èŠããããŸã ã
æ瀺ãããã©ã¡ãŒã¿ãŒãæã€è¡ãã³ã¡ã³ãåãããŠããå ŽåïŒïŒã¯ãã©ã¡ãŒã¿ãŒã®åã«èšå®ãããŸãïŒ-ïŒãåé€ããå¿ èŠããããŸãã ããã¯ãèšå®ãããŠãããã©ã¡ãŒã¿ãŒã«å¯ŸããŠã®ã¿è¡ãå¿ èŠããããŸãã
ãŸããæ§æãã¡ã€ã«ãããã¯ã¢ããããŸãã ãã©ã¡ãŒã¿ãŒãå€æŽããããã³ã«ãããè¡ãããšããå§ãããŸãã
cp gitlab.rb gitlab.rb.old
gitlab.rbã®ãã©ã¡ãŒã¿ãŒèšå®
external_url
ãã©ã¡ãŒã¿ãŒã§ãGitlabã䜿çšã§ãããµãŒããŒã«åãããããã¡ã€ã³ãæå®ããŸãã
time_zone
ãã®ãã©ã¡ãŒã¿ãŒã¯æé垯ãæå®ããŸãã
gitlab_rails['time_zone'] = 'Europe/Moscow'
gitlab.rbã®ã¡ãŒã«èšå®
ãã®ã»ã¯ã·ã§ã³ã§ã¯ã Yandex Mailã« é¢é£ä»ãããããã¡ã€ã³ã®gitlab.rbã®äœæ¥ãã©ã¡ãŒã¿ãŒã瀺ããŸãã GmailãšMailgunã®èšå®ã¯ããã«ãªã¹ããããŠããŸã ã
ãããã®ãã©ã¡ãŒã¿ãŒãgitlab.rbãã¡ã€ã«ã«è²Œãä»ãã git.alm @ plugndo.comããã¡ã€ã³ã®Yandexã¢ãã¬ã¹ã«çœ®ãæããŸãã ããã§ã¡ãŒã«ãã¹ã¯ãŒããã¡ãŒã«ãã¹ã¯ãŒãã«çœ®ãæããŸã ã plugndo.comã®ä»£ããã«ãã¡ãŒã«ãã¡ã€ã³ã®ååãæ¿å ¥ããŸãã æ®ãã®èšå®ã¯å€æŽããªãã§ãã ããã
gitlab_rails['smtp_enable'] = true gitlab_rails['smtp_address'] = "smtp.yandex.ru" gitlab_rails['smtp_port'] = 587 gitlab_rails['smtp_user_name'] = "git.alm@plugndo.com" gitlab_rails['smtp_password'] = " " gitlab_rails['smtp_domain'] = "plugndo.com" gitlab_rails['smtp_authentication'] = "login" gitlab_rails['smtp_enable_starttls_auto'] = true #gitlab_rails['smtp_openssl_verify_mode'] = 'peer' gitlab_rails['gitlab_email_from'] = 'git.alm@plugndo.com' gitlab_rails['gitlab_email_reply_to'] = 'git.alm@plugndo.com'
å€æŽãä¿åããåŸãgitlabã³ãã³ãã§ã³ã³ãããŒããªããŒãããŸãã
docker restart CONTAINER_ID
ãããã§ã CONTAINER_IDã®ä»£ããã«ãgitlabã§ã³ã³ãããŒã®äžæã®çªå·ãæå®ããŸãã 次ã®ã³ãã³ãã䜿çšããŠè¡šç€ºã§ããŸãã
docker ps
ã¡ãŒã«èšå®ã®æ£ç¢ºæ§ã確èªããã«ã¯ãGitlabã§ãŠãŒã¶ãŒãäœæããŸãããã¹ãŠãæ£ããè¡ãããå ŽåããŠãŒã¶ãŒã¯ãã¹ã¯ãŒããèšå®ããããã®ã¡ãŒã«ãªã³ã¯ãåãåããŸãã
ãããã«
ãã®èšäºã®æé ãé©çšãããšãç¬èªã®ã¯ã©ãŠããµãŒããŒã«ææ°ããŒãžã§ã³ã®Gitlabãå±ããŸããã ãããžã§ã¯ãçšã«ã·ã¹ãã ã®æ§æãéå§ã§ããŸãã InfoboxCloudã®åæ£åãã©ãŒã«ããã¬ã©ã³ãã¹ãã¬ãŒãžã·ã¹ãã ã®ããªãã«ã¬ããªã±ãŒã·ã§ã³ã®ãããã§ãããŒã¿ã®å®å šæ§ã«ã€ããŠå¿é ããããšã¯ã§ããŸããã
InfoboxCloudã®è©Šçšçãç¡æã§å ¥æããæ¹æ³ã¯ïŒ
trukhinyuri@infoboxcloud.comã«ã¡ãŒã«ã¢ãã¬ã¹ãšæ°åããéããã ãããã³ã³ãããŒã«ããã«ã«ã¢ã¯ã»ã¹ããããã®ããŒã¿ãåãåããŸãã æ°ããã¯ã©ãŠããªãŒãžã§ã³ã14æ¥éãã¹ãããåŸãã¯ã©ãŠãã®ãã«ããŒãžã§ã³ã«ç§»åã§ããŸãã
èšäºã«ééããèŠã€ããå ŽåããŸãã¯è³ªå/ã³ã¡ã³ããããå Žåã¯ãPMãŸãã¯ã¡ãŒã«ã§ãé£çµ¡ãã ããã Habréã«ã³ã¡ã³ããæ®ããªãå Žåã¯ã InfoboxCloudã³ãã¥ããã£ã«æžã蟌ã¿ãŸãã
çç£çãªéçºïŒ