본문 바로가기

Automation Tools/Ansible

4.1 ansible | [gitlab] docker를 이용한 설치

반응형

awx와 inventory, playbook, role 등을 연동할 gitlab을 docker를 사용하여 설치함.

## 필수 패키지 설치
yum -y install epel-release yum-utils git
 
 
## docker repo 추가
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
 
 
## docker, docker-compose 설치
yum -y install docker-ce
yum -y install python3 python3-pip
pip3 install --upgrade pip
pip3 install docker-compose
 
 
## docker-compose PATH 환경 변수 추가
vim /etc/bashrc
...
PATH=$PATH:/usr/local/bin
...
 
 
## gitlab docker-compose 작성
## gitlab 이미지는 현재 운영과 같이 11.2.3으로 설치
## zabbix가 80을 사용중이므로 8080으로 변경
## gitlab config, log, data, backup 디렉토리는 host 볼룸에 연결.
[root@gitlab gitlab-docker]# pwd
/opt/gitlab-docker
[root@gitlab gitlab-docker]# cat docker-compose.yml
web:
  image: 'gitlab/gitlab-ce:11.2.3-ce.0'
  restart: always
  hostname: '{gitlab ip}:8080'
  container_name: gitlab
  environment:
    GITLAB_OMNIBUS_CONFIG: |
      external_url 'http://{gitlab ip}:8080'
      # Add any other gitlab.rb configuration here, each on its own line
  ports:
    - '8080:80'
    - '8443:443'
    - '8022:22'
  volumes:
    - '/opt/gitlab-docker/config:/etc/gitlab'
    - '/opt/gitlab-docker/logs:/var/log/gitlab'
    - '/opt/gitlab-docker/data:/var/opt/gitlab'
    - '/opt/gitlab-docker/backups:/var/opt/gitlab/backups'
 
#docker run --detach --hostname {gitlab ip} --publish 8443:443 --publish 8080:80 --publish 8022:22 --name gitlab --restart always --volume /opt/gitlba-docker/config:/etc/gitlab --volume /opt/gitlba-docker/logs:/var/log/gitlab --volume /opt/gitlba-docker/data:/var/opt/gitlab gitlab/gitlab-ce:11.2.3.-ce.0
 
## gitlab docker 설치
docker-compose up -d
 
 
## 확인
[root@MONITOR-NEW-BACKUP config]# docker-compose ps
 Name        Command          State                                     Ports                             
-----------------------------------------------------------------------------------------------------------
gitlab   /assets/wrapper   Up (healthy)   0.0.0.0:8022->22/tcp, 0.0.0.0:8443->443/tcp, 0.0.0.0:8080->80/tcp
반응형