iT邦幫忙

0

【淺談 Docker 基礎】GitLab 篇:設定 Gmail 郵件

之前使用 docker-compose 來架設 GitLab【淺談 Docker 基礎】GitLab 篇:簡易架設
今天則要來簡單記錄一下,如何在 GitLab 設定 Gmail 郵件伺服器

設定 Gmail

  1. 修改 docker-compose.yml 檔案,在原來的設定檔後,加上
environment:
  GITLAB_OMNIBUS_CONFIG: |
    gitlab_rails['smtp_enable'] = true
    gitlab_rails['smtp_address'] = "smtp.gmail.com"
    gitlab_rails['smtp_port'] = 587
    gitlab_rails['smtp_user_name'] = "{your_account}@gmail.com"
    gitlab_rails['smtp_password'] = "{your_password}"
    gitlab_rails['smtp_domain'] = "smtp.gmail.com"
    gitlab_rails['smtp_authentication'] = "login"
    gitlab_rails['smtp_enable_starttls_auto'] = true
    gitlab_rails['smtp_tls'] = false
    gitlab_rails['smtp_openssl_verify_mode'] = 'peer'
  1. 加上後,完整的檔案如下
version: "3.6"
services:
  gitlab:
    image: gitlab/gitlab-ce:latest
    restart: always
    privileged: true
    ports:
      - '80:80'
      - '443:443'
      - '22:22'
    volumes:
      - '~/gitlab/data:/var/opt/gitlab'
      - '~/gitlab/logs:/var/log/gitlab'
      - '~/gitlab/config:/etc/gitlab'
    environment:
      GITLAB_OMNIBUS_CONFIG: |
        gitlab_rails['smtp_enable'] = true
        gitlab_rails['smtp_address'] = "smtp.gmail.com"
        gitlab_rails['smtp_port'] = 587
        gitlab_rails['smtp_user_name'] = "{your_account}@gmail.com"
        gitlab_rails['smtp_password'] = "{your_password}"
        gitlab_rails['smtp_domain'] = "smtp.gmail.com"
        gitlab_rails['smtp_authentication'] = "login"
        gitlab_rails['smtp_enable_starttls_auto'] = true
        gitlab_rails['smtp_tls'] = false
        gitlab_rails['smtp_openssl_verify_mode'] = 'peer'
  1. 執行 docker-compose 建立並啟動 gitlab
docker-compose up -d

若設定沒有問題,之後系統就能正常的發送相關的郵件了


尚未有邦友留言

立即登入留言