본문 바로가기

시스템/Unity

Unity-Accelerator 설치(docker)

반응형

참조 : https://github.com/shiena/docker-unity-accelerator

 

GitHub - shiena/docker-unity-accelerator: Docker images for Unity Accelerator

Docker images for Unity Accelerator. Contribute to shiena/docker-unity-accelerator development by creating an account on GitHub.

github.com

 

 

CentOS 7 환경

 

docker, docker-compose, git 설치

yum install docker
yum install docker-compose
yum install git

 

 

docker-unity-accelerator.git clone

git clone https://github.com/shiena/docker-unity-accelerator.git

 

 

docker-compose.yml 수정

 - 443 사용하지 않음.

  accelerator:
  ...
    ports:
      - "10080:10080"
      - "8080:80"

 - depends_on 의 condition 삭제

  prometheus:
  ...
    depends_on:
      - accelerator
  ...
  grafana:
  ...
    depends_on:
      - prometheus
  ...

 

 - 전체 파일

version: '3'

volumes:
  accelerator-volume:
    driver: 'local'
  prometheus-volume:
    driver: 'local'
  grafana-volume:
    driver: 'local'

services:
  accelerator:
    image: unitytechnologies/accelerator
    volumes:
      - accelerator-volume:/agent
    env_file:
      - ./accelerator.env
    ports:
      - "10080:10080"
      - "8080:80"
    healthcheck:
        test: /bin/bash -c "echo > /dev/tcp/127.0.0.1/80" || exit 1
  prometheus:
    image: prom/prometheus
    volumes:
      - ./prometheus.yml:/etc/prometheus/prometheus.yml:ro
      - prometheus-volume:/prometheus
    ports:
      - "9090:9090"
    depends_on:
      - accelerator
    healthcheck:
        test: >
            netstat -t -n -l
            | awk '$$1 ~ /^tcp6?$$/ && $$4 ~ /:9090$$/{rc=1}END{exit !rc}'
  grafana:
    image: grafana/grafana
    volumes:
      - ./datasources-prometheus.yml:/etc/grafana/provisioning/datasources/datasources-prometheus.yml:ro
      - grafana-volume:/var/lib/grafana
    ports:
      - "3000:3000"
    depends_on:
      - prometheus
    healthcheck:
        test: /bin/bash -c "echo > /dev/tcp/127.0.0.1/3000" || exit 1

 

 

datasources-prometheus.yml 수정

 - url을 호스트 IP or domain 으로 수정

apiVersion: 1

deleteDatasources:
  - name: Unity Accelerator
    orgId: 1

datasources:
  - name: Unity Accelerator
    type: prometheus
    access: proxy
    url: http://172.16.10.103:9090
    orgId: 1
    isDefault: true
    version: 1
    editable: false

 

prometheus.yml 수정

 - targets를 호스트 accelerator web 경로로 수정

global:
  scrape_interval: 5s

scrape_configs:
  - job_name: 'unity-accelerator'
    static_configs:
      - targets:
        - 172.16.10.103:8080

 

 

docker image pull

docker-compose pull

 

 

docker-compose 실행

docker-compose up -d

 

 

docker 마운트 볼륨 호스트 경로

ls -al /var/lib/docker/volumes/
total 24
drwx------  5 root root   167 Nov 29 15:28 .
drwx--x--x 11 root root   135 Nov 29 15:21 ..
drwxr-xr-x  3 root root    19 Nov 29 15:28 dockerunityaccelerator_accelerator-volume
drwxr-xr-x  3 root root    19 Nov 29 15:28 dockerunityaccelerator_grafana-volume
drwxr-xr-x  3 root root    19 Nov 29 15:28 dockerunityaccelerator_prometheus-volume
-rw-------  1 root root 32768 Nov 29 15:28 metadata.db
반응형