Gitlab Dreamhost SMTP
1 min read

Gitlab Dreamhost SMTP

Gitlab Dreamhost SMTP

The other day I've tried to install GitLab on Docker because I've got a Synology NAS which does support Docker :) I've found that if I create an user, it sends a confirmation email (of course it does!) and, unlike with Django, I'm not that versed in RoR to reconfigure to use logs instead of real SMTP.

My SMTP of choice is Dreamhost and, since it's not listed I had to do some digging. Without further ado, here's the docker command I used:

docker run --name laurivan_gitlab -d \
    -h [GITLAB.WEB.NAME] \
    --link laurivan_postgres:postgresql --link laurivan_redis:redisio \
    --publish 58013:22 --publish 32770:80 \
    --env 'GITLAB_PORT=32770' --env 'GITLAB_SSH_PORT=58013' \
    --env 'GITLAB_SECRETS_DB_KEY_BASE=[SOME_REALLY_LONG.STRING]' \
    --env 'GITLAB_HOST=[GITLAB.WEB.NAME]' \
    --env 'SMTP_ENABLED=true' \
    --env 'SMTP_DOMAIN=www.[DOMAIN.NAME]' \
    --env 'SMTP_HOST=mail.[DOMAIN.NAME]' \
    --env 'SMTP_PORT=465' \
    --env 'SMTP_USER=[USER]@[DOMAIN.NAME]' \
    --env 'SMTP_PASS=[WEBMAIL Password]' \
    --env 'SMTP_OPENSSL_VERIFY_MODE=none' \
    --env 'SMTP_TLS=true' \
    --volume /volume1/docker/laurivan/gitlab/gitlab:/home/git/data \
    laurivan/docker-gitlab:latest

where:

  • [GITLAB.WEB.NAME] is the host name of your gitlab container. Since it's on an internal network, I used gitlab.laurivan.home and made it available via hostfile
  • [SOME_REALLY_LONG.STRING] a private string used for DB.
  • [DOMAIN.NAME] is your dreamhost domain name. Make sure you have mail enabled for it.
  • [USER] is your user capable of receiving/sending emails
  • [WEBMAIL Password] is your webmail password

You need the other SMTP-related fields (SMTP_OPENSSL_VERIFY_MODE=none, SMTP_TLS=true, SMTP_PORT=465 and SMTP_ENABLED=true) to make it work.

HTH,