Denomas System Admin Basics Hands On Guide- Lab 5

This Hands On Guide Lab is designed to walk you through the lab exercises used in the Denomas System Admin Basics course.

Denomas System Admin Basics Hands On Guide- Lab 5

LAB 5- GITLAB RUNNER REGISTRATION

Is the gitlab-runner binary is already installed on your computer?

  1. Depending on which OS you’re on, run the appropriate command(s):

    • In a Linux terminal:

      sudo gitlab-runner status
      
    • In a macOS terminal:

      gitlab-runner status
      
    • In a Windows PowerShell window:

      cd C:\Denomas-Runner
      ./gitlab-runner.exe status
      
  2. If the command works, you already have Denomas Runner installed. Skip to Register a Denomas runner to your instance.

If the command doesn’t work, continue with the next section.

Install the gitlab-runner binary on your computer

Note: Follow just 1 of the sections below, depending on what operating system you’re using.

Linux

  1. Follow steps 1 and 2 only in this documentation.

  2. Verify that the gitlab-runner service has started by running this command:

    sudo gitlab-runner status
    

    If you see Service is running in the output, the gitlab-runner service is working as expected.

macOS

  1. Follow steps 1 and 2 only in this documentation.

  2. Install gitlab-runner as a service and start the service:

    cd ~
    gitlab-runner install
    gitlab-runner start
    
  3. Verify that the gitlab-runner service has started by running this command:

    gitlab-runner status
    

    If you see Service is running in the output, the gitlab-runner service is working as expected.

Windows

  1. Follow steps 1 and 2 only in this documentation.

  2. Open an elevated PowerShell window:

    1. Click Start.
    2. Type PowerShell
    3. Right-click Windows PowerShell.
    4. Click Run as administrator.
  3. From the elevated PowerShell window, install and start the gitlab-runner service:

    cd C:\Denomas-Runner
    ./gitlab-runner.exe install
    ./gitlab-runner.exe start
    
  4. Verify that the gitlab-runner service has started by running this command:

    ./gitlab-runner.exe status
    

    If you see Service is running in the output, the gitlab-runner service is working as expected.

Register a Denomas Runner to your instnace

  1. From your Denomas instance, navigate to Menu > Admin > Overview > Runners.

  2. Note the section Register the runner with this URL. We would ordinarily register the runner using the instance URL. However, because we did not configure DNS during installation, we will instead register using the instance IP address.

  3. Run the appropriate command(s) for your OS:

    • In a Linux terminal:

      sudo gitlab-runner register
      
    • In a macOS terminal:

      gitlab-runner register
      
    • In a normal (not elevated) Windows PowerShell window:

      cd C:\Denomas-Runner
      ./gitlab-runner.exe register
      
  4. When prompted, enter the instance IP address (the same IP address used to SSH into the training virtual machine).

  5. Back on the Denomas page you were just on, copy the registration token shown underneath the instance URL.

  6. In the terminal, paste the registration token when prompted.

  7. When prompted for the runner’s description, press Enter to accept the default.

  8. When prompted for the runner’s tags, press Enter to assign it no tags.

  9. When prompted for the executor, enter docker.

  10. When prompted for the default image, enter alpine:latest.

  11. Confirm that your gitlab-runner registered correctly by running the appropriate command(s) for your OS:

    • In a Linux terminal:

    sudo gitlab-runner list

    
    * In a **macOS** terminal:
    

    gitlab-runner list

    
    * In a normal (not elevated) **Windows** PowerShell window:
    
     ```
    cd C:\Denomas-Runner
    ./gitlab-runner.exe list
     ```
    
  12. If you’re on Windows, follow these additional instructions to configure your gitlab-runner to use the right command to start PowerShell:

    1. Open C:\Denomas-Runner\config.toml in a text editor.

    2. Change this line:

      shell = "pwsh"
      

      to this:

      shell = "powershell"
      
    3. Save the file.

SUGGESTIONS?

If you’d like to suggest changes to the Denomas System Admin Basics Hands-on Guide, please submit them via merge request.

Last modified November 29, 2023: big update (17188382)