Home  >  Article  >  Development Tools  >  How to deploy documents on GitLab

How to deploy documents on GitLab

PHPz
PHPzOriginal
2023-03-31 09:19:431487browse

GitLab is a Git-based web platform used to manage git warehouses, issue tracking, CI/CD and other software project collaboration functions. Document deployment on GitLab can realize centralized management, version control, permission control, automated deployment and other functions of documents.

This article will introduce how to deploy documents on GitLab. It mainly includes the following contents: document creation, GitLab Pages configuration, and domain name binding.

1. Document creation

First, we need to create a new warehouse on GitLab to store our documents.

Open the GitLab homepage and click the "New project" button in the upper right corner to enter the project creation page. Fill in the project name and project slug in "Project name" and "Project slug", select "Empty project" as the project type, and then click the "Create project" button to complete the project creation.

Next, click the "Create file" button on the project homepage, enter the file name and file content, and then click the "Commit changes" button to submit. This completes the creation of the document.

2. GitLab Pages configuration

GitLab Pages is a service provided by GitLab for hosting static web pages. We can realize automated deployment of documents through GitLab Pages.

On the warehouse homepage, click the "Settings" button in the left menu bar, then click the "Pages" and "New domain" buttons in sequence. Next, we need to fill in some necessary information:

  1. Domain name: Fill in the domain name we want to use, such as docs.example.com.
  2. Document root: Fill in the document root directory, usually "public" or "docs".
  3. TLS/SSL certificate: If you use HTTPS protocol, you need to upload the certificate.

After completing the filling, click the "Create new domain" button to save. At this point we have completed the basic configuration of GitLab Pages.

Next, we need to upload the document to GitLab Pages. Click the "CI/CD" button in the left menu bar on the warehouse homepage, and then select "New pipeline". Click the "Run pipeline" button on the "New pipeline" page to trigger the automated deployment process of GitLab Pages.

3. Domain name binding

After completing the configuration of GitLab Pages, we need to resolve the domain name to the IP address provided by GitLab Pages to bind the domain name to the document.

First, we need to obtain the corresponding IP address in GitLab Pages. Click the "Settings" button in the left menu bar of the warehouse homepage, then click the "Pages" and "Domain" buttons in sequence to view the IP address of GitLab Pages.

Next, perform domain name resolution operations on the domain name management platform. Taking Alibaba Cloud as an example, open Alibaba Cloud's domain name management console, select the domain name to be resolved, click the "Add Record" button, and fill in the following information in the "Resolution Settings" page:

  1. Record Type :A record
  2. Host record: Fill in the subdomain name to be resolved, such as docs.example.com.
  3. Analysis line: default line/operator line.
  4. Record value: Fill in the IP address provided by GitLab Pages.
  5. TTL: Set as needed, usually 600 seconds.

After completing the filling, click the "Confirm" button to save the settings. After the DNS resolution takes effect, we can access our documents by visiting docs.example.com.

Summary

This article introduces how to deploy documents on GitLab, including document creation, GitLab Pages configuration and domain name binding. Through GitLab's centralized management, version control, permission control, automated deployment and other functions, we can achieve more efficient document management and release.

The above is the detailed content of How to deploy documents on GitLab. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn