GitLab Construction and Sinicization

Preface

Last article The advantages of Git and its application are briefly introduced. This article will introduce the construction of GitLab.

As a company, you certainly don't want your code on someone else's website, so it's necessary to build your own Git warehouse (of course, if your company doesn't care, that's no problem). GitLab It's a Git repository that can be built on its own server.

And GitLab is very simple to build, just three or four steps to operate.

  1. First of all, we need a server, which is the most basic.

    • But there are a few points to note:
    • GitLab's official website strongly recommends that servers hosting GitLab run allocate at least 4 GB of memory to GitLab.
    • Servers using the following operating systems are recommended. Omnibus package installation method can be used, and the operation is simple.

  2. open GitLab or GitLab Chinese Network Select the corresponding operating system and install it according to the prompt. Recommend using Omnibus package installation method for installation!

    • There are also some points to note here:
    • After selecting the corresponding operating system, there will be two versions of the installation method.
    • Community Edition: Community Edition (free)
    • Enterprise Edition: Enterprise Edition (Fees)
    • But it's recommended to install the enterprise version here. If the enterprise version is not paid, it will have the same function as the community version. After paying, the enterprise version can be used directly. The community version needs to be redeployed if it is to be upgraded to the enterprise version.
  3. Configure SMTP

    • Enter the / etc/gitlab/gitlab.rb file and cancel and modify the comments for the following configuration
    gitlab_rails['smtp_enable'] = true
    gitlab_rails['smtp_address'] = "smtp.server"
    gitlab_rails['smtp_port'] = 465
    gitlab_rails['smtp_user_name'] = "smtp user"
    gitlab_rails['smtp_password'] = "smtp password"
    gitlab_rails['smtp_domain'] = "example.com"
    gitlab_rails['smtp_authentication'] = "login"
    gitlab_rails['smtp_enable_starttls_auto'] = true
    gitlab_rails['smtp_openssl_verify_mode'] = 'peer'
    
    # If the SMTP service you use is the default'From:gitlab@localhost'
    # You can modify the value of'From'here.
    gitlab_rails['gitlab_email_from'] = 'gitlab@example.com'
    gitlab_rails['gitlab_email_reply_to'] = 'noreply@example.com'
    
    
    • Note: The above is just an example, the specific SMTP configuration also needs to be modified according to the actual situation (remember to execute sudo gitlab-ctl reconfiguration to make the configuration effective after modifying the configuration)
    • Common SMTP configuration examples can go Here See.
    • When the configuration is complete, you can use the Rails console to verify that the mail is sent successfully. On the GitLab server, execute gitlab-rails console to enter the console. Then enter the following command at the console prompt to send a test email:
     irb(main):003:0> Notify.test_email('destination_email@address.com', 'Message Subject', 'Message Body').deliver_now
        # Example
        Notify.test_email('Recipient mailbox', 'Mail title', 'Body').deliver_now
    

If your test email has been sent successfully, congratulations, GitLab has been built and can be used as much as possible.

The following is the Chinesization of GitLab. Personally, the Chinesization is not very complete. As a result, some pages are mixed with Chinese and English. Of course, most of them have been Chinesized.

First confirm the version:

sudo cat /opt/gitlab/embedded/service/gitlab-rails/VERSION

V7-v8.8 version clone below warehouse to local:

git clone https://gitlab.com/larryli/gitlab.git

After v8.9 version clone below warehouse to local:

git clone https://gitlab.com/xhang/gitlab.git

After the success of clone warehouse, comparing the Chinese branch and the original branch, the diff file for patch is derived.

// Replace ${gitlab_version} with the version you identified above
git diff v${gitlab_version} v${gitlab_version}-zh > ../${gitlab_version}-zh.diff

After execution, the current version of the patch file, such as 9.0.0-zh.diff, will be generated.

Import Chinese patches:

# Stop gitlab
sudo gitlab-ctl stop
sudo patch -d /opt/gitlab/embedded/service/gitlab-rails -p1 < 9.0.0-zh.diff

Make sure there is No. rej file. Restart GitLab.

sudo gitlab-ctl start

Keywords: GitLab git sudo network

Added by justin15 on Sun, 19 May 2019 07:09:11 +0300