39th Chapter Gitlab Construction and use (Docker version)

Source: Internet
Author: User
Tags ssh port docker run

First, download the Docker image

Prerequisite: The Docker engine is already installed.

    • Docker Pull Gitlab/gitlab-ce

Second, start the application

    • Docker run-d- H gitlab.zhaojigang.com -p 80:80-v/etc/gitlab/:/etc/gitlab/-v/var/log/gitlab/:/var/log/ gitlab/-v/var/opt/gitlab/:/var/opt/gitlab/--name Gitlab docker.io/gitlab/gitlab-ce

Description: This is enabled to generate a configuration file.

    • /etc/gitlab/: The directory where the configuration file resides
    • /var/log/gitlab: directory where the log is located
    • /var/opt/gitlab: directory where data resides

Third, modify the configuration file

Vi/etc/gitlab/gitlab.rb

Two places:

    • External_url '//gitlab.zhaojigang.com:8929' (set the HTTP port to 8929 instead of the default 80)
    • gitlab_rails[' gitlab_shell_ssh_port ' = 2289 (the SSH port is set to 2289 instead of the default 22 port, 22 shorts may already be running SSH service)

Iv. specifying the port to start

    • Docker run-d-H gitlab.zhaojigang.com-p 8929:8929-p 2289:2289-v/etc/gitlab/:/etc/gitlab/-v/var/log/gitlab/:/var/log /gitlab/-v/var/opt/gitlab/:/var/opt/gitlab/--name Gitlab docker.io/gitlab/gitlab-ce

Description

    • -H gitlab.zhaojigang.com
      • Hostname: gitlab.zhaojigang.com as a domain name Access Gitlab requires Domain name mapping in DNS
    • -P 8,929:8,929
      • 8929:http Port
    • -P 2,289:2,289
      • 2289:SSH Port

Note: If there is a problem that IPv4 cannot forward, first use:

    • Sysctl-w net.ipv4.ip_forward=1

v. Browser access (direct use of IP does not use the hostname specified above)

    • http://10.211.55.3:8929/
      • Where 10.211.55.3 is the address of the machine where Gitlab resides.

Here, create the password (eg.123456) and log in using the username (root) and password (123456).

Vi. New Group

Description: Store all the MicroServices code under the Services group, the visibility of which is internal (you can specify it yourself)

    • Private: All items under this group can only be seen by members of the group
    • Internal: All logged-in users can see all items under this group

Failed to create Group!!! Because services is a reserved word, you cannot make a group name. It is possible to change to a service.

Vii. New Project

Viii. Push the original project (Myframework) to the remote master

    • CD desktop/microservice/myframework/
    • Git init
    • Git remote add Origin http://gitlab.zhaojigang.com:8929/service/myframework.git
    • git add--all
    • Git commit-m "Init"
    • Git push Origin Head:master

Note: During the push process, there may be cases where the host cannot be resolved by gitlab.zhaojigang.com,

    • sudo vi/etc/hosts, add the following line map
10.211. 55.3     Gitlab.zhaojigang.com

This will result in 2 branches, a local master, and a remote master.

Ix. Creating a dev Branch

1. Create a remote Dev branch on the page as above (the branch is created from master).

2. Create a dev branch locally

    • git checkout-b Dev

At this point, "Git Branch-a" sees only three branches, local dev, master, and remote master.

After modifying some of the code,

3. Local Dev Tracking remote dev

    • git add--all
    • git commit-m "xxx"
    • Git push Origin Head:dev

At this point, git branch-a can see 4 branches, local dev, master, and remote Dev, master.

4. Merge the remote Dev Branch code into the remote Master branch '

Legacy issues:

    • Host DNS Resolution
    • . Gitignore does not work
    • SSH mode Connect refused

39th Chapter Gitlab Construction and use (Docker version)

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.