Skip to content

Instantly share code, notes, and snippets.

@boiyama
Created April 6, 2017 07:51
Show Gist options
  • Save boiyama/c5109dc2d8c2d83ac5f8365daf8e3921 to your computer and use it in GitHub Desktop.
Save boiyama/c5109dc2d8c2d83ac5f8365daf8e3921 to your computer and use it in GitHub Desktop.
docker-compose.yml configuring GitLab with Container Registry, Pages, CI, Mattermost (enabled WebRTC), and some other options
version: '2'
services:
gitlab:
container_name: gitlab
image: gitlab/gitlab-ce:latest
restart: always
environment:
GITLAB_OMNIBUS_CONFIG: |
## GitLab configuration settings
##! Check out the latest version of this file to know about the different
##! settings that can be configured by this file, which may be found at:
##! https://gitlab.com/gitlab-org/omnibus-gitlab/raw/master/files/gitlab-config-template/gitlab.rb.template
## GitLab URL
##! URL on which GitLab will be reachable.
##! For more details on configuring external_url see:
##! https://docs.gitlab.com/omnibus/settings/configuration.html#configuring-the-external-url-for-gitlab
external_url 'http://gitlab.example.com'
################################################################################
## gitlab.yml configuration
##! Docs: https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/doc/settings/gitlab.yml.md
################################################################################
gitlab_rails['gitlab_ssh_host'] = 'ssh.gitlab.example.com'
gitlab_rails['time_zone'] = 'UTC'
### Email Settings
# gitlab_rails['gitlab_email_enabled'] = true
# gitlab_rails['gitlab_email_from'] = 'example@example.com'
# gitlab_rails['gitlab_email_display_name'] = 'Example'
# gitlab_rails['gitlab_email_reply_to'] = 'noreply@example.com'
# gitlab_rails['gitlab_email_subject_suffix'] = ''
### Default project feature settings
# gitlab_rails['gitlab_default_projects_features_issues'] = true
# gitlab_rails['gitlab_default_projects_features_merge_requests'] = true
# gitlab_rails['gitlab_default_projects_features_wiki'] = true
# gitlab_rails['gitlab_default_projects_features_snippets'] = true
# gitlab_rails['gitlab_default_projects_features_builds'] = true
# gitlab_rails['gitlab_default_projects_features_container_registry'] = true
### Backup Settings
###! Docs: https://docs.gitlab.com/omnibus/settings/backups.html
# gitlab_rails['backup_upload_connection'] = {
# 'provider' => 'AWS',
# 'region' => 'eu-west-1',
# 'aws_access_key_id' => 'AKIAKIAKI',
# 'aws_secret_access_key' => 'secret123'
# }
# gitlab_rails['backup_upload_remote_directory'] = 'my.s3.bucket'
### 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
################################################################################
## GitLab Nginx
##! Docs: https://docs.gitlab.com/omnibus/settings/nginx.html
################################################################################
# nginx['ssl_certificate'] = '/etc/gitlab/ssl/certificate.pem'
# nginx['ssl_certificate_key'] = '/etc/gitlab/ssl/certificate.key'
# nginx['listen_port'] = 80
# nginx['listen_https'] = false
################################################################################
## Container Registry settings
##! Docs: https://docs.gitlab.com/ce/administration/container_registry.html
################################################################################
registry_external_url 'http://registry.gitlab.example.com'
### Registry backend storage
###! Docs: https://docs.gitlab.com/ce/administration/container_registry.html#container-registry-storage-driver
# registry['storage'] = {
# 's3' => {
# 'accesskey' => 'AKIAKIAKI',
# 'secretkey' => 'secret123',
# 'bucket' => 'gitlab-registry-bucket-AKIAKIAKI'
# }
# }
### Registry notifications endpoints
# registry['notifications'] = [
# {
# 'name' => 'test_endpoint',
# 'url' => 'https://gitlab.example.com/notify2',
# 'timeout' => '500ms',
# 'threshold' => 5,
# 'backoff' => '1s',
# 'headers' => {
# 'Authorization' => ['AUTHORIZATION_EXAMPLE_TOKEN']
# }
# }
# ]
################################################################################
## Registry NGINX
################################################################################
# registry_nginx['ssl_certificate'] = '/etc/gitlab/ssl/certificate.pem'
# registry_nginx['ssl_certificate_key'] = '/etc/gitlab/ssl/certificate.key'
# registry_nginx['listen_port'] = 80
# registry_nginx['listen_https'] = false
################################################################################
## GitLab Pages
##! Docs: https://docs.gitlab.com/ce/pages/administration.html
################################################################################
##! Define to enable GitLab Pages
pages_external_url 'http://pages.example.com/'
################################################################################
## GitLab Pages NGINX
################################################################################
# pages_nginx['ssl_certificate'] = '/etc/gitlab/ssl/certificate.pem'
# pages_nginx['ssl_certificate_key'] = '/etc/gitlab/ssl/certificate.key'
# pages_nginx['listen_port'] = 80
# pages_nginx['listen_https'] = false
################################################################################
## GitLab Mattermost
##! Docs: https://docs.gitlab.com/omnibus/gitlab-mattermost
################################################################################
mattermost_external_url 'http://mattermost.example.com'
# mattermost['aws'] = {'S3AccessKeyId' => '123', 'S3SecretAccessKey' => '123', 'S3Bucket' => 'aa', 'S3Region' => 'bb'}
# mattermost['email_enable_sign_up_with_email'] = true
# mattermost['email_enable_sign_in_with_email'] = true
# mattermost['email_enable_sign_in_with_username'] = false
# mattermost['email_send_email_notifications'] = false
# mattermost['email_require_email_verification'] = false
# mattermost['email_smtp_username'] = nil
# mattermost['email_smtp_password'] = nil
# mattermost['email_smtp_server'] = nil
# mattermost['email_smtp_port'] = nil
# mattermost['file_amazon_s3_access_key_id'] = nil
# mattermost['file_amazon_s3_bucket'] = nil
# mattermost['file_amazon_s3_secret_access_key'] = nil
# mattermost['file_amazon_s3_region'] = nil
# mattermost['file_amazon_s3_endpoint'] = nil
# mattermost['file_amazon_s3_bucket_endpoint'] = nil
# mattermost['file_amazon_s3_location_constraint'] = false
# mattermost['file_amazon_s3_lowercase_bucket'] = false
# mattermost['file_amazon_s3_ssl'] = true
# mattermost['privacy_show_email_address'] = true
# mattermost['privacy_show_full_name'] = true
# mattermost['localization_server_locale'] = 'en'
# mattermost['localization_client_locale'] = 'en'
# mattermost['localization_available_locales'] = 'en,es,fr,ja,pt-BR'
mattermost['webrtc_enable'] = true
mattermost['webrtc_gateway_websocket_url'] = 'ws://mattermost.example.com:8188'
mattermost['webrtc_gateway_admin_url'] = 'http://mattermost.example.com:7088/admin'
mattermost['webrtc_gateway_admin_secret'] = 'janusoverlord'
# mattermost['webrtc_gateway_stun_uri'] = nil
# mattermost['webrtc_gateway_turn_uri'] = nil
# mattermost['webrtc_gateway_turn_username'] = nil
# mattermost['webrtc_gateway_turn_shared_key'] = nil
################################################################################
## Mattermost NGINX
################################################################################
# mattermost_nginx['ssl_certificate'] = '/etc/gitlab/ssl/certificate.pem'
# mattermost_nginx['ssl_certificate_key'] = '/etc/gitlab/ssl/certificate.key'
# mattermost_nginx['listen_port'] = 80
# mattermost_nginx['listen_https'] = false
################################################################################
## Prometheus
##! Docs: https://docs.gitlab.com/ce/administration/monitoring/prometheus/
################################################################################
# prometheus['enable'] = true
# prometheus['monitor_kubernetes'] = true
################################################################################
## Prometheus Gitlab monitor
##! Docs: https://docs.gitlab.com/ce/administration/monitoring/prometheus/gitlab_monitor_exporter.html
################################################################################
# gitlab_monitor['enable'] = true
# To completely disable prometheus, and all of it's exporters, set to false
# prometheus_monitoring['enable'] = true
################################################################################
## Gitaly
##! Docs:
################################################################################
gitaly['enable'] = true
volumes_from:
- gitlab-data
ports:
- "80:80"
- "2222:22"
gitlab-data:
image: busybox
volumes:
- /etc/gitlab
- /var/log/gitlab
- /var/opt/gitlab
gitlab-runner:
container_name: gitlab-runner
image: gitlab/gitlab-runner:alpine
restart: always
volumes_from:
- gitlab-runner-data
volumes:
- "/var/run/docker.sock:/var/run/docker.sock"
- "$HOME/.docker/config.json:/root/.docker/config.json"
gitlab-runner-data:
image: busybox
volumes:
- /etc/gitlab-runner
mattermost-webrtc:
container_name: mattermost-webrtc
image: mattermost/webrtc:latest
restart: always
ports:
- "7088:7088"
- "8188:8188"
@trash-anger
Copy link

Have you ever try to make it work with nginx-proxy and docker-letsencrypt-nginx-proxy-companion ?

@boiyama
Copy link
Author

boiyama commented Sep 24, 2017

@trash-anger No, I haven't. But I have made it work with AWS ELB and Certificate Manager.
For example, if you use https via proxy, configure like this

external_url 'https://gitlab.example.com'
nginx['listen_port'] = 80
nginx['listen_https'] = false

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment