Harbot Private Docker Repository 설치
우리는 HARBOR를 통해서 docker hub 에서 이미지를 받거나 올리지 않고 회사 별도로 이미지를 업로드하거나 다운받을 수 있게 저장소를 만들었다.
HARBOR 인스턴스 세팅
Hardware
Resource |
Capacity |
Description |
CPU |
minimal 2 CPU |
4 CPU is prefered |
Mem |
minimal 4GB |
8GB is prefered |
Disk |
minimal 40GB |
160GB is prefered |
우선, hardware의 요구사항을 확인하여 t2.medium으로 세팅해주고
추가적으로 EBS volume으로 100GB 정도의 저장소를 두어야 한다.
EBS volume 생성
- 100Gb volume을 생성하고 action에서 해당 인스턴스에 attach를 한다.
- 해당 volume을 mount 한다.
[ec2-user ~]$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
xvdf 202:80 0 100G 0 disk
xvda1 202:1 0 8G 0 disk /
mkfs -t ext4 /dev/xvdf
( volume 초기화 ! 만약 데이터가 존재한다면 초기화 하지 말아야 한다. )
mkdir /data
( volume 저장소 디렉토리 만들기 )
mount /dev/xvdf /data
( mount )
3. instance에 harbor 세팅
- docker 를 설치한다.
- https://github.com/vmware/harbor/releases 에서 source code ( tar.gz ) 설치
data 디렉토리에서 작업해준다.
ex ) 받고 압축풀기
wget https://storage.googleapis.com/harbor-releases/release-1.4.0/harbor-offline-installer-v1.4.0.tgz
tar -zxvf harbor-offline-installer-v1.4.0.tgz
- harbor.cfg 파일 custom
1. hostname = ( custom url )
2. ui_url_protocol = http
3. ssl_cert / ssl_cert_key => 인증키 등록
- run ./install.sh
install 완료되면 다음과 같이 확인이 가능하며 만약 Harbor's의 config를 바꾸고 싶다면
$ sudo docker-compose down -v $ vim harbor.cfg $ sudo prepare $ sudo docker-compose up -d
command를 작성하면 된다.
마지막으로 만약 다른 nginx 세팅된 instance에 harbor instance를 붙이게 된다면 다음과 같은 Trobleshooting이 발생할 수 있다.
- proxy already has similar settings => 이는 harbor instance에서 다음 파일을 command out 처리해주어 해결가능하다.
common/templates/nginx.http.conf
location /, location /v2/ , location /service /
# proxy_set_header X-Forwarded-Proto $scheme;
'infra' 카테고리의 다른 글
좌충우돌 스타트업의 CI/CD 적용기 1탄 (0) | 2018.11.14 |
---|---|
(AWS / Jenkins 환경) Nexus 3.0을 사용한 사설 저장소 구축하기 (0) | 2018.11.05 |
도커와 AWS 로 wordpress blog 구축 (0) | 2018.11.02 |