Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Send email with Gitlab docker image

Here's my goal, I would like to configure emails for my Gitlab server. I followed a lot of tutorials but I can't make it work.

My configuration is the following, I've got a reverse-proxy in a Docker container and my Gitlab server also in a Docker container.

About versions :

Docker version 17.09.0-ce, build afdb6d4
docker-compose version 1.16.1, build 6d1ac21

Here's my docker-compose.yml file

version: '3.3'

networks:
   proxy: 
     external: true
   internal:
     external: false

services:
  gitlab:
    image: gitlab/gitlab-ce:latest
    container_name: gitlab
    environment:
        - TZ=Europe/Paris
        - GITLAB_TIMEZONE=Paris
        - [email protected]
        - IMAP_PASSWORD=MYGMAILPASS
        - GITLAB_INCOMING_EMAIL_ADDRESS=USERGMAIL+%{key}@gmail.com
    volumes:
        - /srv/gitlab/config:/etc/gitlab
        - /srv/gitlab/logs:/var/log/gitlab
        - /srv/gitlab/data:/var/opt/gitlab
    restart: always
    labels:
        - traefik.backend=gitlab
        - traefik.frontend.rule=Host:git.domain.com
        - traefik.docker.network=proxy
        - traefik.port=80
        - traefik.frontend.entryPoints=http,https
    networks:
        - internal
        - proxy

I followed this tutorial which seems to be good :

https://github.com/sameersbn/docker-gitlab#available-configuration-parameters

I must miss something in my configuration but I can't figure out what is it ...

Does anyone can help me to configure email sending ? I don't know either the proper way to test email sending from GitLab.

Is the best way is to configure from docker-compose environment variables or directly from gitlab.rb file ?

Some help would be much appreciated

like image 207
Hurobaki Avatar asked Nov 25 '17 10:11

Hurobaki


People also ask

Can GitLab send emails?

Sending emails to users from GitLab On the left sidebar, select Overview > Users. Select Send email to users. Compose an email and choose where to send it (all users or users of a chosen group or project). The email body only supports plain text messages.

Can we push Docker image to GitLab?

GitLab CI/CD can be used with Docker to build Docker images. For example, you can create a Docker image of your application and push it to a GitLab's Container Registry.


Video Answer


1 Answers

The instructions you followed are for a different docker image than the one you're actually using. You also set up IMAP, which is for receiving emails. In GitLab's case, it's for replying to issues by email.

What you want are the SMTP settings. The GitLab docker image does not come with sendmail installed, so you will have to follow the instructions here to set up SMTP in GitLab: https://docs.gitlab.com/omnibus/settings/smtp.html#example-configuration

You can dump gitlab.rb configuration right in your docker-compose under the environment section. My Fastmail setup for reference:

environment:
    GITLAB_OMNIBUS_CONFIG: |
        gitlab_rails['smtp_enable'] = true 
        gitlab_rails['smtp_address'] = "***"
        gitlab_rails['smtp_port'] = 465    
        gitlab_rails['smtp_user_name'] = "***"
        gitlab_rails['smtp_password'] = "***"
        gitlab_rails['smtp_enable_starttls_auto'] = true
        gitlab_rails['smtp_tls'] = true    
        gitlab_rails['smtp_openssl_verify_mode'] = 'peer'
like image 119
cbrst Avatar answered Nov 07 '22 22:11

cbrst