【GitLab】在 QNAP Container Station 使用 Docker-Compose 建置 GitLab

買 QNAP 不用內建 Container Station 來建置系統會覺得很可惜
剛開始架設站台第一直覺使用 Virtualization Station 架設 CentOS 然後再安裝 GitLab
但發現站台在 VM上運作很吃 QNAP 的資源
甚至會影響原本 QNAP APP 運作速度
因此就轉向使用 Container Station 內建「gitlab-ce」
但使用內建安裝後需自行調整 SMTP, Docker Hostname
稍微麻煩
因此, 身為一位工程師
懶還要更懶
全部在Docker-Compose設定完就可以運作

version: '3'
services:
  gitlab:
    environment:
      DEBUG: 'false'
      GITLAB_PORT: 10080
      GITLAB_SECRETS_DB_KEY_BASE: qcs-gitlab-app
      GITLAB_SECRETS_OTP_KEY_BASE: qcs-gitlab-app
      GITLAB_SECRETS_SECRET_KEY_BASE: qcs-gitlab-app
      GITLAB_SSH_PORT: 10022
      GITLAB_OMNIBUS_CONFIG: |
                      external_url 'http://127.0.0.1:10080'
                      gitlab_rails['gitlab_shell_ssh_port'] = 23
                      nginx['listen_port'] = 80
                      gitlab_rails['smtp_enable'] = true
                      gitlab_rails['smtp_address'] = "smtp.gmail.com"
                      gitlab_rails['smtp_port'] = 587
                      gitlab_rails['smtp_user_name'] = "gmail帳號"
                      gitlab_rails['smtp_password'] = "gmail密碼"
                      gitlab_rails['smtp_domain'] = "smtp.gmail.com"
                      gitlab_rails['gitlab_email_from'] = "寄送者mail address"
                      gitlab_rails['smtp_authentication'] = "login"
                      gitlab_rails['smtp_enable_starttls_auto'] = true
                      gitlab_rails['smtp_tls'] = false
                      gitlab_rails['smtp_openssl_verify_mode'] = 'peer'
    image: gitlab/gitlab-ce:latest
    links:
    - redis:redisio
    - postgresql:postgresql
    ports:
    - '10080:80'
    # SSH Port
    - '10022:22'
    restart: always
    hostname: '127.0.0.1:10080'
    deploy:
        resources:
          limits:
            cpus: '0.3'
            memory: 1024M
          reservations:
            cpus: '0.3'
            memory: 1024M
  postgresql:
    environment:
      DB_EXTENSION: pg_trgm
      DB_NAME: gitlabhq_production
      DB_PASS: password
      DB_USER: gitlab
    image: sameersbn/postgresql:9.6-2
    restart: always
  redis:
    command:
    - --loglevel warning
    image: sameersbn/redis:latest
    restart: always

Enjoy!

留言

Top