Practices for building GitLab using Docker

Source: Internet
Author: User

Practices for building GitLab using Docker
SVN and GIT, both of which must be met

When the previous Version Control System (VCS) has a Centralized Version Control System (CVCS) and a Distributed Version Control System (Distributed Version Control System, (DVCS ).
SVN is the representative of the centralized version control system, and GIT is the representative of the distributed version control system.

I have been familiar with SVN for two years. I have played SVNKIT, svn cli, and pysvn, and of course I have also set up the SVN server.
Git is occasionally used through GitHub or GIT @ OSC. The web interface provides powerful functions and is easy to use.
SVN has not found any mature open-source solutions such as GitHub in the industry;
GitLab is known as the open-source implementation of GitHub and has similar functions as Github. Git @ OSC is built based on the GitLab project.
You have always had the idea to build your own GitLab to experience, use, and familiarize yourself with it.
After reading many official documents or blogs about how to build GitLab, I deeply felt that the building process was too cumbersome and did not work for a day, so the GitLab program was stranded.
Of course, some third parties also provide a one-click Gitlab installation solution (such as Bitnami GitLab Installers), but they are not very cold and have not tried it.

Docker makes GitLab installation and deployment easier

Nowadays, Docker is popular. It makes software installation and deployment easier. With Docker images and containers, you can quickly complete these tedious and repetitive installation and deployment processes, and the images can be transplanted.
I have deployed Jenkins and ReviewBoard with Docker before, And I have realized the convenience of Docker.
With the previous understanding and practices of Docker, we started to use Docker to build GitLab.
GitLab's Docker images have been well prepared by Daniel and are being maintained with the upgrade of GitLab. For details, see its GitHub repository and the documentation is sound.

Use Docker to build GitLab practice use docker-compose to quickly start Gitlab
wget https://raw.githubusercontent.com/sameersbn/docker-gitlab/master/docker-compose.ymldocker-compose up
Three steps to run 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. Run a Redis container
docker run --name gitlab-redis -d \--volume /srv/docker/gitlab/redis:/var/lib/redis \sameersbn/redis:latest
3. Run the GitLab container
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' \--volume /srv/docker/gitlab/gitlab:/home/git/data \sameersbn/gitlab:7.13.1

Note: It takes several minutes to start the GitLab application.

View gitlab containers using csphere

Access GitLab

Access address: http: // localhost: 10080. Use the default user name and password to log on.
Default username: root
Default password: 5 iveL! Fe

GitLab recently launched a new logo and the UI layout has changed:

More GitLab configurations

The GitLab container has been quickly started through the above steps and can be used for testing. However, a series of configurations are required to use GitLab in the production environment.
A series of GitLab configuration information (such as GitLab_HOST, Mail, and LDAP) cannot be configured on the web interface.
Docker-gitlab provides a series of configurable parameters in the form of environment variables.
These environment variables must be specified when the GitLab image is started.
If the current GitLab container has been started, you can stop and delete the container, and then specify the Environment Variable Based on the GitLab image to create and start the new container.

GITLAB_HOST Configuration

GITLAB_HOST: The hostname of the GitLab server. Defaults to localhost
This value is used by Gitlab to generate a repo link, so you must set it. Otherwise, in the created repo, we will find that all the repo links use localhost as the hostname.

MAIL configuration

Mail can be used to send email authentication link information to users during user registration.
The default mail configuration uses gmail and requires a user name and password to log on to the gmail server.
Of course, you can also specify a series of SMTP-related environment variables to use other mailboxes (such as QQ mailbox and Netease mailbox) as the mail server.

Time zone Configuration

The Default Time Zone of GitLab is UTC, and the Beijing Time Zone is UTC + 8.
You can change the time zone by specifying the environment variable GITLAB_TIMEZONE = Beijing.

GitLab can also customize more configuration information, such as LDAP, SSL, and OmniAuth Integration. For more information, see the official documentation.

Problems with Docker-GitLab setup: Insufficient disk space

The PostgreSQL container is quickly shut down after it is started. This is also true when it is started again, and no error message is provided.
When you use docker logs gitlab-postgresql to view container logs, you can obtain: No space left on device. This problem is solved after disk space is cleared on the host.

The default user name and password for accessing gitlab provided on the page are not accurate (corrected currently)

The default password provided on the page is password. logon failed, and later use 5 iveL! Fe is successfully logged on.
View the submission log of docker-gitlab. The default password is shown in the following figure:

At the same time, issue 389 is related to this:

Contribute to Docker-GitLab

When reading the README of docker-gitlab, we found that the fig (predecessor of docker-compose) used in this document ),
Therefore, fork used the source code of docker-gitlab and submitted a pull request to change fig to docker-compose,
At present, this PR has been Merged, and it is a great honor to be a contributor of docker-gitlab.

Subsequent Docker-GitLab research plan
  • Study other docker-gitlab configurations, such as LDAP, SSL, and OmniAuth Integration.

  • Study the docker-gitlab installation configuration file (docker-gitlab/assets)

  • Study docker-gitlab's Dockerfile

  • Study docker-gitlab's entrypoint. sh (this shell script has nearly a thousand lines)

Reference
  • Docker-gitlab official instructions

  • Docker-gitlab deployment

 

For more GitLab tutorials, see the following:

GitLab Installation Guide in Ubuntu 14.04

How to install Gitlab in Ubuntu Server 14.04

Install GitLab in Chinese with CentOS source code

Install GitLab on Ubuntu 12.04

GitLab 5.3 upgrade considerations

Deploy GitLab on CentOS (self-managed Git project repository)

Install GitLab 6.0.2 on RHEL6/CentOS6/ScientificLinux6

CentOS 6.5 GitLab installation tutorial and Related Problems

GitLab details: click here
GitLab: click here

This article permanently updates the link address:

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: info-contact@alibabacloud.com 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.