Updated on 2024-09-27 GMT+08:00

Using GitLab to Manage Teams and Projects

Application Scenario

GitLab is a DevOps platform that provides a complete solution for software development and operations, aiming to help teams collaborate on project development. On GitLab, you can protect your applications, and manage, plan, create, validate, package, release, configure, and monitor project source code. Supported By FlexusL, the GitLab image uses Ubuntu 22.04 and is deployed using Docker. The Nginx and Docker have been preconfigured in the image. This section describes how to use GitLab to manage teams and projects.

Resource Planning and Costs

This practice uses the following resource planning as an example. You can adjust it as required.

Resource

Configuration

Description

Cloud server

vCPUs: 2

Memory: 8 GiB

Select appropriate instance specifications based on your service requirements.

Image

GitLab

Select the GitLab application image.

Security group

Inbound rule:
  • Protocol/Application: TCP
  • Port: 80,9000,9001
  • Source: 0.0.0.0/0
  • 80: Specifies the internal forwarding port of application images.
  • 9000: Allows external access to the application O&M dashboard.
  • 9001: Allows external access to the application management page.

Domain name

wpwebsite.com

  • If the website is only used for personal development or testing, there is no need to add a domain name.
  • If the website is open to the public, add and resolve a domain name for the cloud server.

Process

Procedure

Description

Step 1: Purchase a FlexusL Instance

Purchase a FlexusL instance and select the GitLab application image.

Step 2: Configure Security Groups

Add inbound security group rules to ensure that the application preinstalled in the image can be accessed.

Step 3: Initialize GitLab

Log in to GitLab and select the desired language for the management page.

Step 4: Use GitLab

Create a project, add project members, and integrate codes.

Step 1: Purchase a FlexusL Instance

  1. Log in to the FlexusLconsole and click Buy FlexusL.
  2. Specify required parameters for the FlexusL instance.

    Parameter

    Example

    Description

    Region

    CN-Hong Kong

    For low network latency and quick resource access, select the region nearest to your target users. After a FlexusL instance is created, the region cannot be changed. Exercise caution when selecting a region.

    Application Images

    GitLab

    Select the GitLab application image.

    Instance Specifications

    2 vCPUs | 8 GiB memory

    Select instance specifications as needed.

    Instance Name

    GitLab-Example

    Customize an instance name that is easy to identify, for example, GitLab-Example.

    (Optional) Associated Services

    • Data disk: 10 GiB
    • Host security
    • Cloud backup vault: 170 GiB

    You can bundle any of the services to your FlexusL instances as needed: EVS, HSS (basic edition), and CBR and set specifications as needed.

    Required Duration

    1 month

    The minimum duration of a purchase is one month and the maximum duration is three years.

    Auto-renew is enabled by default, which means the purchased FlexusL instances will be automatically renewed before they expire. If you do not enable auto-renew during the purchase process, you can still enable it later after the instances are created. For more information about auto-renewal rules, see Auto-Renewal Rules.

    Quantity

    1

    Set the number of FlexusL instances to be purchased.

  3. Click Buy Now and complete the payment as prompted.
  4. Go back to the FlexusL console and view the purchased FlexusL instance.

    After a FlexusL instance is created using an application image, wait until the image with the pre-installed application is up and running. Then, you can perform operations such as restarting or stopping the instance, or resetting the password. Otherwise, the installation may fail and you cannot log in to the image application dashboard.

Step 2: Configure Security Groups

Add inbound security group rules to ensure that the application preinstalled in the image can be accessed.

  1. Log in to the FlexusL console and click a resource card to go to the instance details page.
  2. In the navigation pane on the left, choose Cloud Servers. Locate the server and click its name.

  3. On the Security Groups tab, click Add Rule. In the displayed dialog box, add rules displayed in the following figure and click OK.

    The following figure only displays common rules. You can add more rules as needed.

    Table 1 Security group rules

    Priority

    Action

    Type

    Protocol & Port

    Source

    Description

    1

    Allow

    IPv4

    TCP: 80

    0.0.0.0/0

    Specifies the internal forwarding port of application images

    1

    Allow

    IPv4

    TCP: 9000

    0.0.0.0/0

    Allows external access to the application O&M dashboard.

    1

    Allow

    IPv4

    TCP: 9001

    0.0.0.0/0

    Allows external access to the application dashboard.

Step 3: Initialize GitLab

The image application dashboard needs to be initialized only when you log in for the first time.

  1. Obtain the administrator username and password for logging in to GitLab.

    1. In the address bar of a local browser, enter http://EIP:9000 to log in to the application O&M dashboard.

      The username and password for logging in to the dashboard are the root user and password of the FlexusL instance. A FlexusL instance does not have an initial password. Reset the password and use it to log in to the dashboard.

    2. Choose My Apps and click the App icon.
    3. Choose Access and click Initial Account to view the username and password of the administrator.

  2. On the Overview page, click Access in the Dashboard field in the Image area.

    If the dashboard of WordPress cannot be accessed, it may be because the port for accessing the dashboard is not allowed or the application has not been up and running. To solve this problem, see Why Can't I Open the Dashboard of the Application Pre-installed in the Application Image?

  3. Enter the username and password obtained in step 1.

  4. Click Sign in to access the GitLab Admin Area.

After initializing GitLab, you will have a server that uses the GitLab application image. You can start using GitLab or follow the steps in Step 4: Use GitLab to create a project, add project members, and integrate codes.

Step 4: Use GitLab

This section describes how to use GitLab to create a project, add project members, and integrate codes.

Step 1: Create a Project

This example demonstrates that how an administrator creates a project, initializes the project, adds a development branch dev, and hides the master branch main from developers.

  1. Click in the upper left corner and choose admin to access the management center.
  2. Choose Projects and click New project.

  3. Click Create blank project.
  4. Configure parameters for the project and click Create project.
    • Project name: Enter a project name that is easy to identify, for example, Project-example.
    • Project URL: It consists of the public IP address of the cloud service and the administrator account. Select root.

    Retain the default values for other parameters.

  5. Choose Repository > Files, click > New file, add the index.html file to main, and click Commit changes.

  6. Choose Repository > Branches, click New branch, and configure the development branch dev.
    • Branch name: dev
    • Create from: main

  7. Click Create branch. Then you can view the created development branch dev.

Step 2: Add Project Members

After registering an account, users cannot directly log in to GitLab. To let them log in, the administrator needs to approve their registration, invite them to be members of the project, and assign permissions to them.

  1. Register an account.
    1. Visit http://public IP address of the server or http://domain name.
    2. Click Register now, enter registration information, and click Register.

  2. The administrator approves the registration.
    1. Click in the upper left corner and select admin.
    2. On the Users page, select Pending approval, and click Approve.

  3. The administrator invites users to join the project team and assigns permissions to them.
    1. Click in the upper left corner, choose Projects > View all projects, and click Administrator/Project-example.
    2. Choose Project information > Members and click Invite members.
    3. Enter the username or email address, assign Developer permission to users, and click Invite.

      You can assign users the following five roles: Guest, Reporter, Developer, Maintainer, or Owner.

      • Guest: allows users to create issues and post comments, and denies them to read or write the repository.
      • Reporter: allows users to clone codes, and denies them to submit code.
      • Developer: allows users to clone, develop, submit, and push code.
      • Master: allows users to create projects, add tags, protect branches, add new members to the project, and edit projects.
      • Owner: allows users to assign permissions to access projects, delete or migrate projects, and manage project team members.
  4. Visit http://Public IP address of the server or http://Domain name. Enter the username and password to log in to GitLab.

    When members log in to GitLab for the first time, select a role for better experience.

Step 3: Integrate Codes

  1. The developers edit and submit code.
    1. Visit http://Public IP address of the server or http://Domain name to log in to GitLab.
    2. Choose Projects and click the target project name.

    3. Choose Repository > Branch and click dev.

    4. Click Web IED, select a file to edit. For example, edit the index.html file.

    5. Choose on the left navigation pane to go to the SOURCE CONTROL, and click Commit & Push.

      Click No when Commit to a new branch? is displayed.

    6. Choose Repository > Files on the project menu bar. You can view Update file index.html. Click Create merge request

    7. Set request information and click Create merge request.

      Specify the Reviewer to Administrator and retain the default values for other parameters.

  2. The administrator reviews the merge request.
    1. Click in the upper right corner, choose Merge requests > New merge request, and click the specific request title.

    2. Click Merge to merge the index.html file from dev into main.