GitLab Cookbook with SSL
Cookbook SSL이 설정된 GitLab을 쉽게 설치할 수 있습니다.
Prepare
먼저 マシン
및 ドメイン
및 証明書
를 준비합니다.
기계
AWS 또는 사쿠라 VPS 등으로 공용으로 기계를 만듭니다.
(이번 OS
는 Ubuntu 12.04
를 사용합니다.)
SSH
로컬 및 원격 SSH를 설정합니다. 원격 암호 인증을 금지하려면sshd_config
에서 PasswordAuthentication
를 no
로 편집합니다.
$ ssh [email protected] mkdir .ssh
$ scp ~/.ssh/id_rsa.pub [email protected]:.ssh/authorized_keys
$ cat << __EOS__ >> ~/.ssh/config
Host example.com
User ubuntu
IdentityFile ~/.ssh/id_rsa
__EOS__
$ ssh example.com
ubuntu@example:~$ sudo editor /etc/ssh/sshd_config
ubuntu@example:~$ sudo service ssh restart
도메인
이름.com, 도레지 등으로 도메인을 가져옵니다.
(DNS
설정에서 SPF 레코드을 등록합시다.)
Sender Policy Framework
nslookup
명령으로 TXT 레코드를 확인합니다.
$ nslookup -q=txt example.com
Server: 192.168.0.1
Address: 192.168.0.1#53
Non-authoritative answer:
example.com text = "v=spf1 ip4:93.184.216.119 -all"
Certificate
사이버 트러스트 나 BIZCERT 등으로 서버 증명서를 취득합니다.
(이번에는 자기 서명 증명서를 이용합니다.)
Self-signed certificate
openssl
명령으로 자체 서명 인증서(올레올레 인증서)를 만듭니다.
$ openssl genrsa -out server.key 2048
$ openssl req -new -key server.key -out server.csr
$ openssl rsa -in server.key -out server.key
$ openssl x509 -req -days 3650 -in server.csr -signkey server.key -out server.crt
秘密鍵
및 証明書
파일은 나중에 사용할 수 있습니다.
Files
내용
보충
server.key
RSA PRIVATE KEY
비밀키
server.csr
CERTIFICATE REQUEST
인증서 서명 요청
server.crt
CERTIFICATE
증명서
Delivered
Chef Solo
다음은 Chef 도구로 GitLab을 설치합니다.
Download
설치에는 knife-solo 및 Berkshelf을 사용합니다.
$ gem install berkshelf
$ gem install knife-solo
$ knife configure
$ knife solo init ./gitlab_chef
$ cd ./gitlab_chef/
$ curl -o Berksfile https://gitlab.com/gitlab-org/cookbook-gitlab/raw/master/Berksfile
$ sed -i.bak '/^metadata$/d' Berksfile
$ echo "cookbook 'gitlab', git: 'https://gitlab.com/gitlab-org/cookbook-gitlab.git'" >> Berksfile
$ berks vendor
Provision
ssl_certificate
및 ssl_certificate_key
에서 証明書
및 秘密鍵
의 내용을 편집합니다. (개행은 \n
입니다.)knife solo
명령이 GitLab을 설치합니다.
$ cat << __EOS__ > ./nodes/example.com.json
{
"gitlab": {
"host": "example.com",
"port": "443",
"email_from": "[email protected]",
"url": "https://git.example.com/",
"ssl_certificate": "-----BEGIN CERTIFICATE-----\nfoo\nbar\nbaz\n-----END CERTIFICATE-----",
"ssl_certificate_key": "-----BEGIN RSA PRIVATE KEY-----\nqux\nquux\ncorge\n-----END RSA PRIVATE KEY-----"
}
"run_list": [
"gitlab::default"
]
}
__EOS__
$ knife solo prepare example.com --bootstrap-version 11.4.4
$ knife solo cook example.com
Self-signed certificate
자체 서명 인증서는 config.yml
의 self_signed_cert
를 true
로 편집합니다.
$ ssh example.com
ubuntu@example:~$ sudo editor /home/git/gitlab-shell/config.yml
메일(SMTP)
Postfix
메일을 보낼 때 Postfix
를 사용합니다. main.cf
를 편집하고 다시 시작합니다.
$ ssh example.com
ubuntu@example:~$ sudo apt-get install postfix
ubuntu@example:~$ sudo editor /etc/postfix/main.cf
ubuntu@example:~$ sudo service postfix restart
Gitlab
production.rb
의 config.action_mailer.delivery_method = :sendmail
다음 줄에 다음 config.action_mailer.sendmail_settings
를 추가합니다.
config.action_mailer.sendmail_settings = {
location: '/usr/sbin/sendmail',
arguments: '-i -t'
}
production.rb
를 편집하고 다시 시작합니다.
$ ssh example.com
ubuntu@example:~$ sudo editor /home/git/gitlab/config/environments/production.rb
ubuntu@example:~$ sudo service gitlab restart
Inspect
새 사용자를 만들고 프로젝트를 만듭니다.
추가 공개 키를 추가하면 세 개의 이메일이 수신됩니다.
Actions
메일 Subject
New User
Account was created for you
새로운 프로젝트
Access to project was granted
Add SSH Key
SSH key was added to your account
이것으로 올레올레 GitLab이 완성됩니다.
Tips
Vagrant
Vagrant 및 Amazon EC2은 GitLab을 더 쉽게 설치할 수 있습니다.
Download
Vagrantfile
, access_key_id
, secret_access_key
, private_key_path
및 keypair_name
를 편집합니다.
$ gem install berkshelf
$ vagrant plugin install vagrant-berkshelf
$ vagrant plugin install vagrant-omnibus
$ vagrant plugin install vagrant-aws
$ vagrant box add dummy https://github.com/mitchellh/vagrant-aws/raw/master/dummy.box
$ git clone https://gitlab.com/gitlab-org/cookbook-gitlab.git ./gitlab
$ cd ./gitlab/
$ cp ./example/Vagrantfile_aws ./Vagrantfile
$ editor ./Vagrantfile
Provision
Vagrantfile
의 chef.json
또는 chef.run_list
를 Chef Solo
와 동일하게 편집합니다.vagrant provision
명령이 GitLab을 설치합니다.
$ vagrant up --provider=aws
$ eval $(vagrant ssh-config | awk '/HostName/ {print "HostName=" $2}')
$ sed -i.bak "s/example.com/$HostName/g" Vagrantfile
$ sed -i.bak 's/chef.run_list = \[\]/chef.run_list = \["gitlab::default"\]/g' Vagrantfile
$ vagrant provision
GitLab.org Production도 참조하십시오.
Reference
이 문제에 관하여(GitLab Cookbook with SSL), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
https://qiita.com/ogomr/items/1c1042976930fb888a8e
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)
$ ssh [email protected] mkdir .ssh
$ scp ~/.ssh/id_rsa.pub [email protected]:.ssh/authorized_keys
$ cat << __EOS__ >> ~/.ssh/config
Host example.com
User ubuntu
IdentityFile ~/.ssh/id_rsa
__EOS__
$ ssh example.com
ubuntu@example:~$ sudo editor /etc/ssh/sshd_config
ubuntu@example:~$ sudo service ssh restart
$ nslookup -q=txt example.com
Server: 192.168.0.1
Address: 192.168.0.1#53
Non-authoritative answer:
example.com text = "v=spf1 ip4:93.184.216.119 -all"
$ openssl genrsa -out server.key 2048
$ openssl req -new -key server.key -out server.csr
$ openssl rsa -in server.key -out server.key
$ openssl x509 -req -days 3650 -in server.csr -signkey server.key -out server.crt
Chef Solo
다음은 Chef 도구로 GitLab을 설치합니다.
Download
설치에는 knife-solo 및 Berkshelf을 사용합니다.
$ gem install berkshelf
$ gem install knife-solo
$ knife configure
$ knife solo init ./gitlab_chef
$ cd ./gitlab_chef/
$ curl -o Berksfile https://gitlab.com/gitlab-org/cookbook-gitlab/raw/master/Berksfile
$ sed -i.bak '/^metadata$/d' Berksfile
$ echo "cookbook 'gitlab', git: 'https://gitlab.com/gitlab-org/cookbook-gitlab.git'" >> Berksfile
$ berks vendor
Provision
ssl_certificate
및 ssl_certificate_key
에서 証明書
및 秘密鍵
의 내용을 편집합니다. (개행은 \n
입니다.)knife solo
명령이 GitLab을 설치합니다.$ cat << __EOS__ > ./nodes/example.com.json
{
"gitlab": {
"host": "example.com",
"port": "443",
"email_from": "[email protected]",
"url": "https://git.example.com/",
"ssl_certificate": "-----BEGIN CERTIFICATE-----\nfoo\nbar\nbaz\n-----END CERTIFICATE-----",
"ssl_certificate_key": "-----BEGIN RSA PRIVATE KEY-----\nqux\nquux\ncorge\n-----END RSA PRIVATE KEY-----"
}
"run_list": [
"gitlab::default"
]
}
__EOS__
$ knife solo prepare example.com --bootstrap-version 11.4.4
$ knife solo cook example.com
Self-signed certificate
자체 서명 인증서는
config.yml
의 self_signed_cert
를 true
로 편집합니다.$ ssh example.com
ubuntu@example:~$ sudo editor /home/git/gitlab-shell/config.yml
메일(SMTP)
Postfix
메일을 보낼 때
Postfix
를 사용합니다. main.cf
를 편집하고 다시 시작합니다.$ ssh example.com
ubuntu@example:~$ sudo apt-get install postfix
ubuntu@example:~$ sudo editor /etc/postfix/main.cf
ubuntu@example:~$ sudo service postfix restart
Gitlab
production.rb
의 config.action_mailer.delivery_method = :sendmail
다음 줄에 다음 config.action_mailer.sendmail_settings
를 추가합니다.config.action_mailer.sendmail_settings = {
location: '/usr/sbin/sendmail',
arguments: '-i -t'
}
production.rb
를 편집하고 다시 시작합니다.$ ssh example.com
ubuntu@example:~$ sudo editor /home/git/gitlab/config/environments/production.rb
ubuntu@example:~$ sudo service gitlab restart
Inspect
새 사용자를 만들고 프로젝트를 만듭니다.
추가 공개 키를 추가하면 세 개의 이메일이 수신됩니다.
Actions
메일 Subject
New User
Account was created for you
새로운 프로젝트
Access to project was granted
Add SSH Key
SSH key was added to your account
이것으로 올레올레 GitLab이 완성됩니다.
Tips
Vagrant
Vagrant 및 Amazon EC2은 GitLab을 더 쉽게 설치할 수 있습니다.
Download
Vagrantfile
, access_key_id
, secret_access_key
, private_key_path
및 keypair_name
를 편집합니다.
$ gem install berkshelf
$ vagrant plugin install vagrant-berkshelf
$ vagrant plugin install vagrant-omnibus
$ vagrant plugin install vagrant-aws
$ vagrant box add dummy https://github.com/mitchellh/vagrant-aws/raw/master/dummy.box
$ git clone https://gitlab.com/gitlab-org/cookbook-gitlab.git ./gitlab
$ cd ./gitlab/
$ cp ./example/Vagrantfile_aws ./Vagrantfile
$ editor ./Vagrantfile
Provision
Vagrantfile
의 chef.json
또는 chef.run_list
를 Chef Solo
와 동일하게 편집합니다.vagrant provision
명령이 GitLab을 설치합니다.
$ vagrant up --provider=aws
$ eval $(vagrant ssh-config | awk '/HostName/ {print "HostName=" $2}')
$ sed -i.bak "s/example.com/$HostName/g" Vagrantfile
$ sed -i.bak 's/chef.run_list = \[\]/chef.run_list = \["gitlab::default"\]/g' Vagrantfile
$ vagrant provision
GitLab.org Production도 참조하십시오.
Reference
이 문제에 관하여(GitLab Cookbook with SSL), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
https://qiita.com/ogomr/items/1c1042976930fb888a8e
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)
Vagrant
Vagrant 및 Amazon EC2은 GitLab을 더 쉽게 설치할 수 있습니다.
Download
Vagrantfile
, access_key_id
, secret_access_key
, private_key_path
및 keypair_name
를 편집합니다.$ gem install berkshelf
$ vagrant plugin install vagrant-berkshelf
$ vagrant plugin install vagrant-omnibus
$ vagrant plugin install vagrant-aws
$ vagrant box add dummy https://github.com/mitchellh/vagrant-aws/raw/master/dummy.box
$ git clone https://gitlab.com/gitlab-org/cookbook-gitlab.git ./gitlab
$ cd ./gitlab/
$ cp ./example/Vagrantfile_aws ./Vagrantfile
$ editor ./Vagrantfile
Provision
Vagrantfile
의 chef.json
또는 chef.run_list
를 Chef Solo
와 동일하게 편집합니다.vagrant provision
명령이 GitLab을 설치합니다.$ vagrant up --provider=aws
$ eval $(vagrant ssh-config | awk '/HostName/ {print "HostName=" $2}')
$ sed -i.bak "s/example.com/$HostName/g" Vagrantfile
$ sed -i.bak 's/chef.run_list = \[\]/chef.run_list = \["gitlab::default"\]/g' Vagrantfile
$ vagrant provision
GitLab.org Production도 참조하십시오.
Reference
이 문제에 관하여(GitLab Cookbook with SSL), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/ogomr/items/1c1042976930fb888a8e텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)