Merge branch 'gitlab-omnibus-config' into 'master'

Add GITLAB_OMNIBUS_CONFIG to docker image

It allows to preconfigure GitLab image by adding GITLAB_OMNIBUS_CONFIG for `docker run`

/cc @marin @sytses 



See merge request !575
This commit is contained in:
Marin Jankovski 2015-12-29 10:40:40 +00:00
commit bfe5cb8187
3 changed files with 24 additions and 2 deletions

View File

@ -67,6 +67,25 @@ sudo docker restart gitlab
For more options for configuring the container please check [Omnibus GitLab documentation](https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md#configuration).
### Preconfigure Docker container
It's possible to preconfigure the GitLab image by adding the environment variable: `GITLAB_OMNIBUS_CONFIG` to docker run command. This variable can contain any `gitlab.rb` variable. The `GITLAB_OMNIBUS_CONFIG` will be evaluated before loading the container's `gitlab.rb` file. It makes it possible to easily configure GitLab external URL, database configuration or any other option from [Omnibus GitLab documentation](https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md#configuration).
```bash
sudo docker run --detach \
--hostname gitlab.example.com \
--env GITLAB_OMNIBUS_CONFIG="external_url 'http://my.domain.com/'; gitlab_rails['lfs_enabled'] = true;"
--publish 8443:443 --publish 8080:80 --publish 2222:22 \
--name gitlab \
--restart always \
--volume /srv/gitlab/config:/etc/gitlab \
--volume /srv/gitlab/logs:/var/log/gitlab \
--volume /srv/gitlab/data:/var/opt/gitlab \
gitlab/gitlab-ce:latest
```
Every time you execute a `docker run` command you need to provide the GITLAB_OMNIBUS_CONFIG option, the content of GITLAB_OMNIBUS_CONFIG is not preserved between subsequent runs.
## Diagnose potential problems
Read container logs:

View File

@ -9,5 +9,8 @@ manage_accounts['enable'] = false
host = `hostname`.strip
external_url "http://#{host}"
# Load /etc/gitlab/gitlab.rb
# Load custom config from environemt variable: GITLAB_OMNIBUS_CONFIG
eval ENV["GITLAB_OMNIBUS_CONFIG"].to_s
# Load configuration stored in /etc/gitlab/gitlab.rb
from_file("/etc/gitlab/gitlab.rb")

View File

@ -56,7 +56,7 @@ mkdir -p /var/log/gitlab/sshd
# Start service manager
echo "Starting services..."
/opt/gitlab/embedded/bin/runsvdir-start &
GITLAB_OMNIBUS_CONFIG= /opt/gitlab/embedded/bin/runsvdir-start &
# Configure gitlab package
echo "Configuring GitLab..."