项目作者: steevepay

项目描述 :
Gitlab CE + Docker Compose + Let's Encrypt (auto generate/renew)
高级语言:
项目地址: git://github.com/steevepay/gitlab-docker-letsencrypt.git
创建时间: 2019-12-15T15:56:53Z
项目社区:https://github.com/steevepay/gitlab-docker-letsencrypt

开源协议:

下载


Gitlab CE + Docker Compose running with auto generate/renew Let’s Encrypt Certificate

With this repo you will be able to set up self hosted Gitlab CE as a container over SSL auto generated and auto renewed by a web proxy.

PREREQUISITES

In order to use this compose file (docker-compose.yml) you must have:

HOW TO USE

  1. Close this repository
  1. $ git clone https://github.com/steevepay/gitlab-docker-letsencrypt.git
  1. Make a copy of the .env.example and rename it to .env:

Update this file with your preferences.

  1. #
  2. # Container name for your Portainer
  3. #
  4. CONTAINER_NAME=my-gitlab-container
  5. #
  6. # Path where your Gitlab files will be located
  7. #
  8. GITLAB_DATA_PATH=/data/gitlab/
  9. #
  10. # Your domain (or domains)
  11. #
  12. VIRTUAL_HOST=gitlab.domain.com,www.gitlab.domain.com
  13. #
  14. # Your domain (or domains) for SSL certificate
  15. #
  16. LETSENCRYPT_HOST=gitlab.domain.com,www.gitlab.domain.com
  17. #
  18. # Your email for Let's Encrypt register
  19. #
  20. LETSENCRYPT_EMAIL=your_email@domain.com
  21. #
  22. # Main domain for SSL certificate and gitlab
  23. #
  24. MAIN_DOMAIN=gitlab.domain.com
  25. #
  26. # Network name
  27. #
  28. # Your container app must use a network conencted to your webproxy
  29. # https://github.com/evertramos/docker-compose-letsencrypt-nginx-proxy-companion
  30. #
  31. NETWORK=webproxy
  1. Validate and view the docker-compose configuration before starting.
  1. $ docker-compose config
  1. Start the container.

During the build time, the environment variables are injected into the image.

  1. $ docker-compose up -d

Please keep in mind that when starting for the first time it may take a few moments (even a couple minutes) to get your Let’s Encrypt certificates generated

Pre-configure Gitlab CE

You can pre-configure the GitLab Docker image by adding the environment variable GITLAB_OMNIBUS_CONFIG to the docker-compose file. This variable can contain any gitlab.rb setting and will be evaluated before loading the container’s gitlab.rb file. That way you can easily configure GitLab’s external URL, make any database configuration or any other option from the Omnibus GitLab template.

Here is an example of pre-configuring OVH STMP server for the gitlab:

  1. version: "3.7"
  2. services:
  3. gitlab-letsencrypt:
  4. image: 'gitlab/gitlab-ce:latest'
  5. container_name: ${CONTAINER_NAME}
  6. restart: always
  7. hostname: ${MAIN_DOMAIN}
  8. volumes:
  9. - '${GITLAB_DATA_PATH}config:/etc/gitlab'
  10. - '${GITLAB_DATA_PATH}logs:/var/log/gitlab'
  11. - '${GITLAB_DATA_PATH}data:/var/opt/gitlab'
  12. restart: unless-stopped
  13. env_file:
  14. - ./.env
  15. environment:
  16. GITLAB_OMNIBUS_CONFIG: |
  17. gitlab_rails['smtp_enable'] = true
  18. gitlab_rails['smtp_address'] = 'ssl0.ovh.net'
  19. gitlab_rails['smtp_port'] = 465
  20. gitlab_rails['smtp_user_name'] = 'hello@mail.com'
  21. gitlab_rails['smtp_password'] = ''
  22. gitlab_rails['smtp_domain'] = 'ssl0.ovh.net'
  23. gitlab_rails['smtp_authentication'] = 'login'
  24. gitlab_rails['smtp_enable_starttls_auto'] = true
  25. gitlab_rails['smtp_tls'] = true
  26. gitlab_rails['smtp_openssl_verify_mode'] = 'none'
  27. networks:
  28. - default
  29. networks:
  30. default:
  31. external:
  32. name: ${NETWORK}

For more options about configuring GitLab please check the Omnibus GitLab documentation.