SMTP with docker-compose
- 1 docker-compose.yml
- 2 작업
- 3 참조
docker-compose.yml
version: '3.8'
services:
web:
image: 'gitlab/gitlab-ce:14.2.3-ce.0'
hostname: 'version.ice.i-on.net'
restart: always
container_name: gitlab-ce
environment:
GITLAB_OMNIBUS_CONFIG: |
external_url 'http://version.ice.i-on.net'
nginx['redirect_http_to_https'] = false
letsencrypt['enable'] = false
gitlab_rails['time_zone'] = 'Asia/Seoul'
gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = 'smtp.gmail.com'
gitlab_rails['smtp_port'] = 587
gitlab_rails['smtp_user_name'] = 'ice@ion.net'
gitlab_rails['smtp_password'] = 'dkdldhs!QAZ1'
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'
ports:
- '80:80'
- '443:443'
- '10022:22'
- '5050:5050'
volumes:
- './etc/gitlab:/etc/gitlab'
- './log/gitlab:/var/log/gitlab'
- './data/gitlab:/var/opt/gitlab'
- './backup/gitlab:/var/opt/gitlab/backups'
작업
$ docker-compose restart
$ docker exec -it gitlab-ce gitlab-rails console
--------------------------------------------------------------------------------
Ruby: ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [x86_64-linux]
GitLab: 14.2.3 (2324101daeb) FOSS
GitLab Shell: 13.19.1
PostgreSQL: 12.7
--------------------------------------------------------------------------------
Loading production environment (Rails 6.1.3.2)
irb(main):001:0>
irb(main):002:0> Notify.test_email('ice@i-on.com', 'Message Subject', 'Message Body').deliver_now
Delivered mail 616669deae47_5d95a64786ae@version.ice.i-on.net.mail (3899.8ms)
=> #<Mail::Message:152780, Multipart: false, Headers: <Date: Wed, 13 Oct 2021 05:08:46 +0000>, <From: GitLab <gitlab@version.ice.i-on.net>>, <Reply-To: GitLab <noreply@version.ice.i-on.net>>, <To: ice@i-on.com>, <Message-ID: <616669deae47_5d95a64786ae@version.ice.i-on.net.mail>>, <Subject: Message Subject>, <Mime-Version: 1.0>, <Content-Type: text/html; charset=UTF-8>, <Content-Transfer-Encoding: 7bit>, <Auto-Submitted: auto-generated>, <X-Auto-Response-Suppress: All>>
irb(main):003:0> Notify.test_email('deuxksy@naver.com', 'Message Subject', 'Message Body').deliver_now
Delivered mail 616669eccdeee_5d95a64787d3@version.ice.i-on.net.mail (3526.4ms)
=> #<Mail::Message:152800, Multipart: false, Headers: <Date: Wed, 13 Oct 2021 05:09:00 +0000>, <From: GitLab <gitlab@version.ice.i-on.net>>, <Reply-To: GitLab <noreply@version.ice.i-on.net>>, <To: deuxksy@naver.com>, <Message-ID: <616669eccdeee_5d95a64787d3@version.ice.i-on.net.mail>>, <Subject: Message Subject>, <Mime-Version: 1.0>, <Content-Type: text/html; charset=UTF-8>, <Content-Transfer-Encoding: 7bit>, <Auto-Submitted: auto-generated>, <X-Auto-Response-Suppress: All>>
irb(main):004:0> Notify.test_email('ksymailing@gmail.com', 'Message Subject', 'Message Body').deliver_now
Delivered mail 616669f952476_5d95a64788af@version.ice.i-on.net.mail (3313.0ms)
=> #<Mail::Message:152820, Multipart: false, Headers: <Date: Wed, 13 Oct 2021 05:09:13 +0000>, <From: GitLab <gitlab@version.ice.i-on.net>>, <Reply-To: GitLab <noreply@version.ice.i-on.net>>, <To: ksymailing@gmail.com>, <Message-ID: <616669f952476_5d95a64788af@version.ice.i-on.net.mail>>, <Subject: Message Subject>, <Mime-Version: 1.0>, <Content-Type: text/html; charset=UTF-8>, <Content-Transfer-Encoding: 7bit>, <Auto-Submitted: auto-generated>, <X-Auto-Response-Suppress: All>>
irb(main):005:0> Notify.test_email('ice@i-on.net', 'Message Subject', 'Message Body').deliver_now
Delivered mail 61666a196ed79_5d95a647895b@version.ice.i-on.net.mail (3534.7ms)
=> #<Mail::Message:152840, Multipart: false, Headers: <Date: Wed, 13 Oct 2021 05:09:45 +0000>, <From: GitLab <gitlab@version.ice.i-on.net>>, <Reply-To: GitLab <noreply@version.ice.i-on.net>>, <To: ice@i-on.net>, <Message-ID: <61666a196ed79_5d95a647895b@version.ice.i-on.net.mail>>, <Subject: Message Subject>, <Mime-Version: 1.0>, <Content-Type: text/html; charset=UTF-8>, <Content-Transfer-Encoding: 7bit>, <Auto-Submitted: auto-generated>, <X-Auto-Response-Suppress: All>>
irb(main):006:0> Notify.test_email('ice@i-on.net', 'Message Subject', 'Message Body').deliver_now
Delivered mail 61666a2cb0297_5d95a64790f4@version.ice.i-on.net.mail (3436.8ms)
=> #<Mail::Message:152860, Multipart: false, Headers: <Date: Wed, 13 Oct 2021 05:10:04 +0000>, <From: GitLab <gitlab@version.ice.i-on.net>>, <Reply-To: GitLab <noreply@version.ice.i-on.net>>, <To: ice@i-on.net>, <Message-ID: <61666a2cb0297_5d95a64790f4@version.ice.i-on.net.mail>>, <Subject: Message Subject>, <Mime-Version: 1.0>, <Content-Type: text/html; charset=UTF-8>, <Content-Transfer-Encoding: 7bit>, <Auto-Submitted: auto-generated>, <X-Auto-Response-Suppress: All>>
irb(main):007:0> Notify.test_email('crong@i-on.net', 'Message Subject', 'Message Body').deliver_now
Delivered mail 61666a8d8252b_5d95a64791c7@version.ice.i-on.net.mail (3486.1ms)
=> #<Mail::Message:152880, Multipart: false, Headers: <Date: Wed, 13 Oct 2021 05:11:41 +0000>, <From: GitLab <gitlab@version.ice.i-on.net>>, <Reply-To: GitLab <noreply@version.ice.i-on.net>>, <To: crong@i-on.net>, <Message-ID: <61666a8d8252b_5d95a64791c7@version.ice.i-on.net.mail>>, <Subject: Message Subject>, <Mime-Version: 1.0>, <Content-Type: text/html; charset=UTF-8>, <Content-Transfer-Encoding: 7bit>, <Auto-Submitted: auto-generated>, <X-Auto-Response-Suppress: All>>
irb(main):008:0> exit
메일 발송을 위한 SMTP 설정 및 gitlab-rails console 를 이용한 메일 발송 테스트