Using Docker to build Gitlab practices

Source: Internet
Author: User
Tags ldap version control system

Using Docker to build Gitlab practicesBoth SVN and git need to be

The current versioning system (version control System,vcs) has a centralized version-versioning system (centralized version control system, referred to as CVCS) and a distributed versioning system (distributed Version Control System, referred to as DVCS).
The representative of the centralized version control system is SVN, the representative of the distributed version control system is git.

Familiar with SVN has been two years, played Svnkit, SVN CLI, PYSVN, of course, also built the SVN server.
The Git,web interface provides powerful, easy-to-use features that are often used occasionally via github or [email protected].
And SVN in the industry has not found the open source of mature like GitHub, such a solution;
GitLab, known as the Open source implementation of GitHub, has features similar to GitHub, where [email protected] is based on the GITLAB project.
Have always had the idea to build Gitlab, to experience, use, familiar with it.
And read too much about the Gitlab of the official document or blog, deeply feel the building process is too cumbersome, not a day of work, so build Gitlab plan was stranded.
Of course, there are also third parties that provide one-click installation of GitLab solutions (such as Bitnami GitLab installers), but not very cold and do not try.

Docker, making Gitlab installation easier

Today, Docker is popular, making it easier to deploy software installations, with Docker mirroring and containers to quickly take care of these tedious, repetitive installation deployment processes and mirroring portability.
Prior to deploying Jenkins and Reviewboard with Docker, I experienced the convenience of Docker.
With the prior knowledge and practice of Docker, the practice of using Docker to build Gitlab has begun.
Gitlab's Docker image has been done by Daniel and has been maintained with the upgrade of the Gitlab version, as described in its GitHub warehouse, and the documentation is sound.

Using Docker to build Gitlab practicesQuick Start Gitlab with Docker-compose
wget up
Three steps to run the Gitlab container.1. Run a PostgreSQL container
Docker run--name gitlab-postgresql-d--env ' db_name=gitlabhq_production '--env ' Db_user=gitlab '--env ' DB_PASS= Password '--volume/srv/docker/gitlab/postgresql:/var/lib/postgresql sameersbn/postgresql:9.4-2
2. Running a Redis container
Docker run--name gitlab-redis-d--volume/srv/docker/gitlab/redis:/var/lib/redis sameersbn/redis:latest
3. Running Gitlab container
Docker run--name gitlab-d--link gitlab-postgresql:postgresql--link gitlab-redis:redisio--publish 10022:22--publish 1 0080:80--env ' gitlab_port=10080 '--env ' gitlab_ssh_port=10022 '--volume/srv/docker/gitlab/gitlab:/home/git/data sameersbn/gitlab:7.13.1

Note: The startup of the Gitlab application takes several minutes.

View Gitlab related containers via Csphere

Visit Gitlab

Access address: http://localhost:10080, log in with the default user name and password.
Default User name:root
Default password:5ivel!fe

The new logo was launched shortly before Gitlab, and the interface layout changed:

Gitlab More Configurations

The Gitlab container has been quickly started with the above steps, and can be used for testing, but a series of configurations are required to use Gitlab in a production environment.
GitLab's array of configuration information (such as Gitlab_host, Mail, LDAP, etc.) is currently not configurable from the Web interface.
Docker-gitlab provides a series of configurable parameters in the form of environment variables.
These environment variables need to be specified when the Gitlab image is started.
If the current Gitlab container is started, you can stop, delete, and then specify environment variables based on the Gitlab image and then create and start a new container.

Gitlab_host Configuration

gitlab_host:the hostname of the GITLAB server. Defaults to localhost
This value is Gitlab used to generate the repo link, so it must be set. Otherwise, in the created repo, all repo links are found to be hostname with localhost.

Mail configuration

Mail can be used to send information about email authentication links to users when they register.
The default mail configuration uses Gmail and requires a username and password to log on to the Gmail server.
Of course, you can also use other mailboxes (such as QQ mailboxes, NetEase mailboxes) as mail servers by specifying a series of SMTP-related environment variables.

Time zone configuration

Gitlab The default time zone is UTC and the Beijing time zone is the utc+8 area.
You can change the time zone by specifying the environment variable gitlab_timezone=beijing.

including but not limited to the above configuration, Gitlab can also customize more configuration information, such as LDAP, SSL, Omniauth integration, and more, please refer to the official documentation.

Docker-gitlab problems encountered in buildingInsufficient disk space

The PostgreSQL container shuts down quickly after booting, and it does so again, and no error message is given.
obtained by using Docker logs gitlab-postgresql to view the container log: No space left on device, the problem is resolved after clearing disk space on the host.

The page provides an inaccurate default user name and password for access Gitlab (currently fixed)

The page provides a default password of password, login failed, and later use 5ivel!fe this login succeeds.
View the Docker-gitlab submission log for the default password, as follows:

At the same time, issue 389 is associated with it:

Make a contribution to Docker-gitlab

When reading Docker-gitlab's readme, it was found that the document had a used fig (the predecessor of Docker-compose),
Then fork the source of the Docker-gitlab, and submitted a pull request to modify the fig to Docker-compose,
At present, the PR has been merged, is honored to become a Docker-gitlab contributor.

Follow-up Docker-gitlab research Program
    • Study other configurations of Docker-gitlab such as LDAP, SSL, Omniauth integration, etc.

    • Research Docker-gitlab installation configuration file (Docker-gitlab/assets)

    • Study the Dockerfile of Docker-gitlab

    • Study Docker-gitlab's (the shell script is nearly thousands of lines)

    • Docker-gitlab Official documentation

    • Docker-gitlab deployment (from Segmentfault)

Using Docker to build Gitlab practices

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.