Docker:Gitlab
In der Standardkonfiguration besteht das Dockerimage aus
- redis
- postgresql
- gitlab
Es ist auch möglich eine mysql-Datenbank zu verwenden. Das kann man hier nachlesen.
Installation
gitlab:7.11.4-1
docker-compose.yml -d
postgresql:
image: sameersbn/postgresql:9.4
environment:
- DB_USER=gitlab
- DB_PASS=password
- DB_NAME=gitlabhq_production
volumes:
- /srv/docker/gitlab/postgresql:/var/lib/postgresql
gitlab:
image: sameersbn/gitlab:7.11.4-1
links:
- redis:redisio
- postgresql:postgresql
ports:
- "10080:80"
- "10022:22"
environment:
- TZ=Asia/Kolkata
- SMTP_ENABLED=false
- SMTP_DOMAIN=www.example.com
- SMTP_HOST=smtp.gmail.com
- SMTP_PORT=587
- SMTP_USER=mailer@example.com
- SMTP_PASS=password
- SMTP_STARTTLS=true
- SMTP_AUTHENTICATION=login
- GITLAB_TIMEZONE=Kolkata
- GITLAB_HOST=localhost
- GITLAB_PORT=10080
- GITLAB_SSH_PORT=10022
- GITLAB_EMAIL=admin@example.com
- GITLAB_EMAIL_REPLY_TO=noreply@example.com
- GITLAB_BACKUPS=daily
- GITLAB_BACKUP_TIME=01:00
volumes:
- /srv/docker/gitlab/gitlab:/home/git/data
redis:
image: sameersbn/redis:latest
volumes:
- /srv/docker/gitlab/redis:/var/lib/redis
gitlab:8.0.5-1
postgresql:
image: quay.io/sameersbn/postgresql:9.4-5
environment:
- DB_USER=gitlab
- DB_PASS=password
- DB_NAME=gitlabhq_production
volumes:
- /srv/docker/gitlab/postgresql:/var/lib/postgresql
gitlab:
image: quay.io/sameersbn/gitlab:8.0.5-1
links:
- redis:redisio
- postgresql:postgresql
ports:
- "10080:80"
- "10022:22"
environment:
- TZ=Asia/Kolkata
- GITLAB_TIMEZONE=Kolkata
- GITLAB_SECRETS_DB_KEY_BASE=long-and-random-alphanumeric-string
- GITLAB_HOST=localhost
- GITLAB_PORT=10080
- GITLAB_SSH_PORT=10022
- GITLAB_RELATIVE_URL_ROOT=
- GITLAB_NOTIFY_ON_BROKEN_BUILDS=true
- GITLAB_NOTIFY_PUSHER=false
- GITLAB_EMAIL=notifications@example.com
- GITLAB_EMAIL_REPLY_TO=noreply@example.com
- GITLAB_INCOMING_EMAIL_ADDRESS=reply@example.com
- GITLAB_BACKUPS=daily
- GITLAB_BACKUP_TIME=01:00
- SMTP_ENABLED=false
- SMTP_DOMAIN=www.example.com
- SMTP_HOST=smtp.gmail.com
- SMTP_PORT=587
- SMTP_USER=mailer@example.com
- SMTP_PASS=password
- SMTP_STARTTLS=true
- SMTP_AUTHENTICATION=login
- IMAP_ENABLED=false
- IMAP_HOST=imap.gmail.com
- IMAP_PORT=993
- IMAP_USER=mailer@example.com
- IMAP_PASS=password
- IMAP_SSL=true
- IMAP_STARTTLS=false
volumes:
- /srv/docker/gitlab/gitlab:/home/git/data
redis:
image: quay.io/sameersbn/redis:latest
volumes:
- /srv/docker/gitlab/redis:/var/lib/redis
gitlab:8.12.4-1
wget https://raw.githubusercontent.com/sameersbn/docker-gitlab/master/docker-compose.yml
docker-compose up
Upgrade
Ich habe gitlab:7.11.4-1 installiert und möchte auf gitlab:8.11.7 upgraden. Dazu muss ich über die Version gitlab:8.0.5-1 gehen.
docker pull sameersbn/gitlab:8.0.5-1
docker stop gitlab
docker rm gitlab
docker run --name gitlab -it sameersbn/gitlab:7.11.4 app:rake gitlab:backup:create
Starten der Dockercontainer
docker start b5eadf44029a # Redis starten
docker start 8fe4ed802222 # Postgresql starten
docker start fcba0988f6ef # Gitlab starten
Konsole
docker exec -it kluge_gitlab_1 bash
Upgrade
docker pull sameersbn/gitlab:latest
docker run --name gitlab -d \
--link gitlab-postgresql:postgresql --link gitlab-redis:redisio \ --publish 10022:22 --publish 10080:80 \ --env 'GITLAB_PORT=10080' --env 'GITLAB_SSH_PORT=10022' \ --env 'GITLAB_SECRETS_DB_KEY_BASE=long-and-random-alpha-numeric-string' \ --volume /srv/docker/gitlab/gitlab:/home/git/data \ sameersbn/gitlab:latest
Einfachste Weg
Im Browser http://localhost:10080 aufrufen und mit den folgenden Zugangsdaten einloggen:
- username: root
- password: 5iveL!fe
Der manuelle Weg
Ist hier nicht vollständig beschrieben: siehe hier
docker pull sameersbn/gitlab:latest
docker pull sameersbn/mysql:latest
docker run --name=mysql-gitlab -d \
--env='DB_NAME=gitlabhq_production' \
--env='DB_USER=gitlab' --env='DB_PASS=password' \
--volume=/srv/docker/gitlab/mysql:/var/lib/mysql \
sameersbn/mysql:latest
The above command will create a database named gitlabhq_production and also create a user named gitlab with the password password with full/remote access to the gitlabhq_production database.
docker run --name=redis-gitlab -d \
--volume=/srv/docker/gitlab/redis:/var/lib/redis \
sameersbn/redis:latest
docker run --name=gitlab -d --link=mysql-gitlab:mysql --link=redis-gitlab:redisio \
--publish=10022:22 --publish=10080:80 \
--env='GITLAB_PORT=10080' --env='GITLAB_SSH_PORT=10022' \
--volume=/srv/docker/gitlab/gitlab:/home/git/data \
sameersbn/gitlab:latest
Here the image will also automatically fetch the DB_NAME, DB_USER and DB_PASS variables from the mysql container as they are specified in the docker run command for the mysql container. This is made possible using the magic of docker links.