Gitlab is installed on http://workbench.dachary.org using docker images. redis is installed first, as an independant container:
docker pull sameersbn/redis:latest docker run --name=redis -d sameersbn/redis:latest
then MySQL
docker pull sameersbn/mysql:latest docker run --name=mysql -d \ -e 'DB_NAME=gitlabhq_production' \ -e 'DB_USER=gitlab' \ -e 'DB_PASS=XXXXXXXXXXXX' \ -v /opt/mysql/data:/var/lib/mysql \ sameersbn/mysql:latest
and finally gitlab
docker pull sameersbn/gitlab:latest docker run --name='gitlab' -it -d \ --link mysql:mysql --link redis:redisio \ -e 'GITLAB_EMAIL=gitlab@workbench.dachary.org' \ -e 'SMTP_ENABLED=true' \ -e 'SMTP_DOMAIN=workbench.dachary.org' \ -e 'SMTP_USER=' \ -e 'SMTP_HOST=172.17.42.1' \ -e 'SMTP_PORT=25' \ -e 'SMTP_STARTTLS=false' \ -e 'SMTP_OPENSSL_VERIFY_MODE=none' \ -e 'SMTP_AUTHENTICATION=:plain' \ -e 'GITLAB_SIGNUP=true' \ -e 'GITLAB_PORT=80' \ -e 'GITLAB_HOST=workbench.dachary.org' \ -e 'OAUTH_ALLOW_SSO=true' \ -e 'OAUTH_BLOCK_AUTO_CREATED_USERS=false' \ -e 'OAUTH_GITHUB_API_KEY=github Client ID' \ -e 'OAUTH_GITHUB_APP_SECRET=github Client Secret' \ -e 'GITLAB_SSH_PORT=22' \ -p 22:22 -p 80:80 \ -v /var/run/docker.sock:/run/docker.sock \ -v /opt/gitlab/data:/home/git/data \ -v $(which docker):/bin/docker \ sameersbn/gitlab
The ssh server of the server will need to bind another port by editing /etc/ssh/sshd_config, changing the Port value and restarting the server with stop ssh ; start ssh.
The OmniAuth single sign on is configured following gitlab instructions, except for editing the config.yml file: the OAUTH_GITHUB_* are set instead, using information found in the applications settings github page.
It uses the automagic dockerlinks to connect it to the MySQL and redis servers (–link mysql:mysql –link redis:redisio). The SMTP server is configured using variables from the documentation to point to the server running on the host (172.17.42.1 is the IP of the docker0 bridge on which all containers are connected and in the same IP range as the dynamic IP they are given). A postfix server is installed on the host:
$ sudo apt-get install postfix ... chose internet server ...
and it is configured to accept to relay mails from any docker contain in the 172.0.0.0/8 IP range:
$ cat /etc/postfix/main.cf ... myhostname = workbench.dachary.org alias_maps = hash:/etc/aliases alias_database = hash:/etc/aliases myorigin = /etc/mailname mydestination = workbench.dachary.org, localhost, localhost.localdomain, localhost relayhost = mynetworks = 172.0.0.0/8 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 ...
A working SMTP server is required to allow sign up as required with GITLAB_SIGNUP=true. The gitlab persistent data is in /opt/mysql/data (bind mounted with -v /opt/mysql/data:/var/lib/mysql) for the MySQL database and /opt/gitlab/data (bind mounted with -v /opt/gitlab/data:/home/git/data) for repositories, gitlab assets etc. When the host reboots, the containers can be restarted as above, they only contains non persistent information.