GitLab System Administration - Hands-on Lab: Use GitLab Administration Commands
Estimated time to complete: 30 minutes
Objectives
The objective of this lab is to show various gitlab-ctl commands you can use to manage your GitLab instance via the CLI. These commands can be run after installation. For a full list of all the commands you can use with gitlab-ctl, please click here.
Task A. Run basic service status commands
-
From a terminal prompt, SSH into your training virtual machine if not already logged in.
-
Use the
gitlab-ctl
maintenance command to check the status of GitLab services:sudo gitlab-ctl status
-
The output of this command will appear similar to this:
run: alertmanager: (pid 21371) 205s; run: log: (pid 21114) 254s run: gitaly: (pid 21327) 208s; run: log: (pid 20429) 399s run: gitlab-exporter: (pid 21346) 207s; run: log: (pid 21012) 270s run: gitlab-kas: (pid 20689) 380s; run: log: (pid 20700) 379s run: gitlab-workhorse: (pid 21309) 208s; run: log: (pid 20851) 290s run: logrotate: (pid 20319) 414s; run: log: (pid 20327) 413s run: nginx: (pid 21320) 208s; run: log: (pid 20917) 282s run: node-exporter: (pid 21338) 208s; run: log: (pid 20965) 278s run: postgres-exporter: (pid 21380) 204s; run: log: (pid 21149) 248s run: postgresql: (pid 20496) 391s; run: log: (pid 20517) 388s run: prometheus: (pid 21356) 206s; run: log: (pid 21077) 258s run: puma: (pid 20768) 303s; run: log: (pid 20781) 300s run: redis: (pid 20365) 408s; run: log: (pid 20378) 405s run: redis-exporter: (pid 21348) 207s; run: log: (pid 21039) 266s run: sidekiq: (pid 20798) 297s; run: log: (pid 20806) 296s
To learn more about these components and how they interact, check out the documentation.
-
In the output, you will see the
pid
, or process ID of each GitLab service. This process ID verifies that the process is actively running on the system. -
Often, you may need to stop or restart a service for troubleshooting purposes. To demonstrate this process, stop the
nginx
service.sudo gitlab-ctl stop nginx
-
To verify that the service is down, run
sudo gitlab-ctl status
. Note the value displayed fornginx
.down: nginx: 13s, normally up; run: log: (pid 20917) 1782s
-
Attempt to navigate to GitLab in your web browser, or refresh the page if already there. You should see some variation of “can not connect”. This is because we just turned off the web server on the GitLab instance.
-
Restart the
nginx
web service.sudo gitlab-ctl start nginx
-
Run
sudo gitlab-ctl status
to verify thatnginx
is up and running again.run: nginx: (pid 22369) 7s; run: log: (pid 20917) 1852s
-
Navigate to GitLab in your web browser. The application should now load properly.
Task B. Change visibility settings
-
Log into your GitLab web instance with your
root
user and password from Lab 1. -
In the bottom left corner of the main screen in the sidebar, click Admin Area.
-
You will first adjust default project visibility settings. Scroll to the bottom of the left hand navigation pane and click Settings > General.
-
Under Visibility and access controls, click Expand.
-
Change the
Default project visibility
to Internal by clicking the associated radio button. -
Change the
Default group visibility
to Internal by clicking on the associated radio button. -
Select Save changes at the bottom of the Visibility and access controls section to apply these changes.
Task C. Locate sign-in settings
-
The second setting we will update are Sign-In restrictions. Still under Settings > General, click Collapse next to Visibility and access controls.
-
Under Sign-in restrictions, click Expand.
-
Under Two-factor authentication, click the checkbox next to Enforce two-factor authentication.
-
Select Save changes at the end of the Sign-in restrictions section to apply this change.
-
Click Collapse next to Sign-in restrictions to close the menu.
-
After applying this change, you will be redirected to a page to setup 2FA on your administrator account. You can either enabled 2FA on your account, or disable the 2FA setting to avoid this notification.
To disable the 2FA setting:
-
Select Configure it later on the 2FA page.
-
Select Admin Area in the left sidebar.
-
Select Settings > General.
-
Select Expand next to Sign-in restrictions.
-
Uncheck Enforce two-factor authentication.
-
Select Save Changes at the end of the Sign-in restrictions section
Task D. Update the header logo
You can personalize your GitLab instance by uploading a header logo.
-
On the left hand side panel, click Settings > Appearance.
-
Under the Navigation Bar section, click Choose File.
-
Select an appropriate picture from your computer to serve as a header logo, and click Open.
-
Click the Update appearance settings to save the changes. You should see your picture in the top left corner of the screen.
Lab Guide Complete
You have completed this lab exercise. You can view the other lab guides for this course.
Suggestions?
If you’d like to suggest changes to the GitLab System Admin Hands-on Guide, please submit them via merge request.
8f6ffe56
)