GitLab

From My Wiki
Jump to: navigation, search

Installing gitlab using Docker

See: Docker, Git

There will be two docker containers. one hosting the application (gitlab) and the database (mysql) and the key-value data store (redis).

docker pull sameersbn/gitlab:latest
docker pull sameersbn/postgresql:latest
docker pull sameersbn/redis:latest

Create mount points for these containers

mkdir -p /opt/gitlab/data
mkdir -p /opt/postgresql/data

run the redis container like so:

docker run --name=redis -d sameersbn/redis:latest

this will be linked to the other containers.

run the postgresql container in daemon mode. automatically create database and logins by passing in details as parameters. after linking these details will be transferred to the gitlab container.

docker run --name=postgresql -d \
-e 'DB_NAME=gitlabhq_production' -e 'DB_USER=gitlab' -e 'DB_PASS=password' \
-v /opt/postgresql/data:/var/lib/postgresql \
sameersbn/postgresql:latest

Then run the gitlab application

docker run --name=gitlab -d \
--link postgresql:postgresql \
--link redis:redisio \
-e "GITLAB_HOST=git.alaning.me" \
--env 'GITLAB_SECRETS_DB_KEY_BASE=mbVH43FRqNWNWzzWWRWn3trb9VHf7zvXzgKMPmKnLLPbVcqwxqgKqjm9tkjcRv4K' \
-p 10022:22 -p 10080:80 \
-v /opt/gitlab/data:/home/git/data \
sameersbn/gitlab:latest

web browser go to port 10080 (may need to wait for startup)

Maintainence

Backups stored at data/backups

create backup. (docker stop gitlab and docker rm gitlab container before doing this)

docker run --name=gitlab -i -t --rm \
--link postgresql:postgresql \
--link redis:redisio \
--env 'GITLAB_SECRETS_DB_KEY_BASE=mbVH43FRqNWNWzzWWRWn3trb9VHf7zvXzgKMPmKnLLPbVcqwxqgKqjm9tkjcRv4K' \
-v /opt/gitlab/data:/home/git/data \
sameersbn/gitlab:latest app:rake gitlab:backup:create

restore backup

docker run --name=gitlab -i -t --rm \
--link postgresql:postgresql \
--link redis:redisio \
--env 'GITLAB_SECRETS_DB_KEY_BASE=mbVH43FRqNWNWzzWWRWn3trb9VHf7zvXzgKMPmKnLLPbVcqwxqgKqjm9tkjcRv4K' \
-v /opt/gitlab/data:/home/git/data \
sameersbn/gitlab:latest app:rake gitlab:backup:restore


if you run into permissions issue when trying to restore, do chmod 0644 on the backup file before restoring.

Upgrade

upgrade by stopping and rm'ing gitlab container, pull the latest one and then run docker container.

Ref