docker-composegitlabemailqnap

QNAP Container Station Gitlab Email Server


I have a QNAP TS453a NAS. In the Container Station I installed sameersbn's Docker Gitlab 10.4.2. But I couldn't find any manual how to configure an email server so that Gitlab can send emails when someone forgets his password for example. Can anyone help me?


Solution

  • I installed the Sameersbn version of Gitlab in Container Station as well and I found it quite restrictive. My personal recommendation would be to just use the standard CE version that Gitlab provide.

    However at the time I used Sameersbn version of Gitlab there was no way that I could find to successfully configure the email server (Not saying there isn't I just couldn't figure it out). However it doesn't mean you can't do it yourself manually.

    I would recommend that you mount your volumes to somewhere on disk instead of within the Container Station so it makes it easier to reconfigure any settings manually.

    Here is what my docker-compose file looks like. Very simple and really the only things you need to care about are the volumes and where you are mounting them too.

    web:
        image: 'gitlab/gitlab-ce:latest'
        restart: always
        hostname: <HOTST_NAME>
    environment:
        GITLAB_OMNIBUS_CONFIG: |
           external_url <EXTERNAL_URL>
    ports:
        - '10080:80' // Insecure port 
        - '10443:443' // Secure port 
        - '10020:22' // SSH port 
    volumes:
        - '/share/Gitlab/config:/etc/gitlab' // To configure the Email Server we care about this one.
        - '/share/Gitlab/logs:/var/log/gitlab'
        - '/share/Gitlab/data:/var/opt/gitlab'
    

    The one we care about is '/share/Gitlab/config:/etc/gitlab'. If you don't know much about volumes and mounting them it is pretty much like this '<your_local_location>:<container_location>'. So if I navigate to /share/Gitlab/config on my QNAP NAS I will find all the configuration for my GitLab instance.

    In /share/Gitlab/config you should see a file called gitlab.rb, this is a ruby file that contains all the configuration for your GitLab instance. If you search in this file you will find the configuration below:

    ### GitLab email server settings
    ###! Docs: https://docs.gitlab.com/omnibus/settings/smtp.html
    ###! **Use smtp instead of sendmail/postfix.**
    
    # gitlab_rails['smtp_enable'] = true
    # gitlab_rails['smtp_address'] = "smtp.server"
    # gitlab_rails['smtp_port'] = 465
    # gitlab_rails['smtp_user_name'] = "smtp user"
    # gitlab_rails['smtp_password'] = "smtp password"
    # gitlab_rails['smtp_domain'] = "example.com"
    # gitlab_rails['smtp_authentication'] = "login" 
    # gitlab_rails['smtp_enable_starttls_auto'] = true
    # gitlab_rails['smtp_tls'] = false
    

    All you need to do is uncomment (# means comment so just remove) and fill in your SMTP details.

    This will require you to reconfigure your Gitlab instance. So you will need to ssh into your GitLab Container and just run reconfigure command.

    Essentially you need to find away of getting to the gitlab.rb file so you can amend the SMTP Email Server Settings.

    Some good reading material for installing GitLab via Docker are:

    (Please note that there could be some additional configuration to allow your system to write to /share/Gitlab/config you can do this with chmod command via ssh)