sameersbn / sameersbn/docker-gitlab

SMTP config bug

Open
#682 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

wontfix
Dominant language
Shell
Stars
8.1k
Forks
2.1k
Avg merge
17h 47m
Merged PRs (30d)
7

Description

Hello and first of all thanks for creating this image.

I'm in the process of trying to dockerize everything and was setting up gitlab and trying to configure it to use my postfix server (also dockerized).

I used these env variables:

    - SMTP_ENABLED=true
    - SMTP_DOMAIN=mydomain
    - SMTP_HOST=mydomain
    - SMTP_PORT=25
    - SMTP_USER=gitlab
    - SMTP_PASS=mypassword
    - SMTP_STARTTLS=false
    - SMTP_AUTHENTICATION=login

I did not get any emails and the strange thing was that I had no logs at all on the postfix side.

I went into gitlab container, checked out the production.log and saw:

[ActiveJob] [ActionMailer::DeliveryJob] [d64852d3-159c-4fa2-8938-6411bd606591] Performing ActionMailer::DeliveryJob from Sidekiq(mailers) with arguments: "DeviseMailer", "reset_password_instructions", "deliver_now", gid://gitlab/User/2, "ekwftvuoTnsos3tF52_W", {}
[ActiveJob] [ActionMailer::DeliveryJob] [d64852d3-159c-4fa2-8938-6411bd606591]
Sent mail to me@gmail.com (306.1ms)

I installed and used telnet from within gitlab container, connected to postfix and was able to send email just fine.

It took me a lot of time, but in the end I checked out config/initializers/smtp_settings.rb:

if Rails.env.production?
  Rails.application.config.action_mailer.delivery_method = :smtp

  ActionMailer::Base.smtp_settings = {
    address: "gitlab.gdematerial.ru",
    port: 25,
    user_name: "gitlab",
    password: "mypassword",
    domain: "mydomain",
    authentication: "'login'",
    enable_starttls_auto: false,
    openssl_verify_mode: "none",
    tls: false
  }
end

I removed single quotes around "login", restarted unicorn via supervisor and that fixed it.

P.S. SMTP_AUTHENTICATION being commented out results in the same smtp_settings.rb

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with config/initializers/smtp_settings.rb and compare its generated ActionMailer SMTP settings with the SMTP_* environment variables in the issue. Reproduce the configuration in a Dockerized GitLab instance, verify the resulting authentication value, and confirm delivery through the configured Postfix server.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, gitlab
Domain
devops
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.