After discussing the CI/CD evolution of GitLab in the previous article, I mentioned that the current version of GitLab is a bit heavy for teams who only want to use basic code storage capabilities. This article will discuss how to use older versions of GitLab to save some server and local hardware resources.

Writing in the front

For team use, I still strongly recommend using the latest stable version if the hardware is a little more affluent.

This article only describes how to build and use GitLab with the official version of the old image. Applications older than V8.0 can build their own container image. Again, if you read the previous article, any application below V8.0 is not recommended because it lacks too many core CI features.

Of course, if you use a script and an external service to get the code through account authentication, that’s still an option.

Containerized using GitLab 8.0.0

The configuration can be simpler than the advanced version of GitLab shared earlier:

Version: "3" services: gitlab: restart: always image: gitlab/gitlab-ce:8.0.0-ce.0 container_name: gitlab.lab.io hostname: gitlab.lab.io ports: - "80:80" - "22:22" volumes: - ./config:/etc/gitlab - ./logs:/var/log/gitlab - ./data:/var/opt/gitlabCopy the code

Save the content as docker-compose. Yml, then start the service with docker-compose up -d, then continue to observe the log with docker-compose logs -f, you will see the familiar log output:

Creating gitlab.lab.io ... done Attaching to gitlab.lab.io gitlab.lab.io | Thank you for using GitLab Docker Image! gitlab.lab.io | Current version: Gitlab - ce = 8.0.0 - ce. 0 gitlab. Lab. IO | gitlab. Lab. IO | Configure gitlab for system by editing the/etc/gitlab/gitlab rb file gitlab.lab.io | And restart this container to reload settings. gitlab.lab.io | To do it use docker exec: gitlab.lab.io | gitlab.lab.io | docker exec -it gitlab vim /etc/gitlab/gitlab.rb gitlab.lab.io | docker restart gitlab gitlab.lab.io | gitlab.lab.io | For a comprehensive list of configuration options please see the Omnibus GitLab readme gitlab.lab.io | https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/README.md gitlab.lab.io | gitlab.lab.io | If this container fails to start due to permission problems try to fix it by executing: gitlab.lab.io | gitlab.lab.io | docker exec -it gitlab update-permissions gitlab.lab.io | docker restart gitlab gitlab.lab.io | ...Copy the code

Until the following log appears, GitLab is ready to start.

Gitlab. Lab. IO | = = > / var/log/gitlab/SSHD/current < = = gitlab. Lab. IO | 2021-02-24 _03:30:59. 76266 Server listening on 0.0.0.0 port 22. Gitlab. Lab. IO | 2021-02-24 _03:30:59. 76327 Server listening on: : port 22. gitlab.lab.io | gitlab.lab.io | ==> /var/log/gitlab/unicorn/current <== gitlab.lab.io | The 2021-02-24 _03: have. 97319 starting the new unicorn master gitlab. Lab. IO | _03:2021-02-24 kinds, 56361 adopted the new unicorn master 345 gitlab.lab.io | gitlab.lab.io | ==> /var/log/gitlab/unicorn/unicorn_stderr.log <== gitlab.lab.io | I, [2021-02-24T03:31:50.533072 #425] INFO -- : The worker = 4 ready gitlab. Lab. IO | I, [the 2021-02-24 T03: lacketh. 534841 # 428] the INFO - : The worker = 5 spawned pid = 428 gitlab. Lab. IO | I, [the 2021-02-24 T03: lacketh. 535726 # 428] the INFO - : The worker = 5 ready gitlab. Lab. IO | I, [the 2021-02-24 T03: lacketh. 537802 # 431] the INFO - : The worker = 6 spawned pid = 431 gitlab. Lab. IO | I, [the 2021-02-24 T03: lacketh. 538715 # 431] the INFO - : The worker = 6 ready gitlab. Lab. IO | I, [the 2021-02-24 T03: lacketh. 541528 # 434] the INFO - : The worker = 7 spawned pid = 434 gitlab. Lab. IO | I, [the 2021-02-24 T03: lacketh. 542476 # 434] the INFO - : The worker = 7 ready gitlab. Lab. IO | I, [the 2021-02-24 T03: lacketh. 542860 # 345] the INFO - : Master the process ready gitlab. Lab. IO | I, [the 2021-02-24 T03: lacketh. 543272 # 437] the INFO - : The worker = 8 spawned pid = 437 gitlab. Lab. IO | I, [the 2021-02-24 T03: lacketh. 544152 # 437] the INFO - : the worker = 8 readyCopy the code

Open a browser and the port we declared, such as port 80 in our example, should look like this:

Example Initialize an administrator account

The old version of GitLab used a fixed account password, so we need to use root and 5iveL! Fe to complete the first landing.

After logging in, a new interface will appear asking us to input a new password. After setting up, we will return to the login interface again and use our new password to complete the login.

Once logged in, you can start setting up new accounts, configuring warehouse groups, monitoring services, and adding CI.

Observe resource usage

Compared to v10, the old Version of GitLab looks much “milder” compared to v10, which started at 2G and used 5% to 6% CPU in “standby” state.

CONTAINER ID NAME CPU % MEM USAGE/LIMIT MEM % NET I/O BLOCK I/O PIDS 0b6FC22e5280 gitlab.lab. IO 0.83% 1021MiB / 7.778GiB 12.82% 15kB / 19kB 0B / 10.9MB 123Copy the code

Older versions have fewer components and lower resource usage than more recent versions, and running a set of GitLab locally feels less heavy. So running a “code repository + document repository” locally as a temporary project store, integrating with a local CI to do some local automation, is another option.

Make GitLab Chinese

A few years ago, when the Chinese language pack was not officially released, one of my classmates made a Chinese version of the community version, which happened to include the V8.0.0 version we used this time.

The way to make a Chinese patch is very simple, first use Git to download the repository code:

git clone https://gitlab.com/larryli/gitlab.git
Copy the code

Then, using the diff command, build the code difference patch:

git diff origin/8-0-stable.. origin/8-0-zh > patch.diffCopy the code

Then copy the Chinese package inside the warehouse container:

docker cp patch.diff gitlab.lab.io:/tmp
Copy the code

Apply the patch and restart the service:

docker exec -it gitlab.lab.io bash -c "patch -d /opt/gitlab/embedded/service/gitlab-rails -p1 < /tmp/patch.diff ; gitlab-ctl restart;"
Copy the code

Wait for the service to restart, the Chinese GitLab will be completed.

Trivia: A BUG that has existed for several years

If I remember correctly, this little problem of not finding executable files has also been present in recent releases.

Gitlab. Lab. IO | 2021-02-24 _03:31:52. 72016, the 2021-02-24 T03:31:52. 719 z 366 TID - kr4jk Devise: : Async: : Backend: : Sidekiq JID - 2 b138dc5149b8928a54d7ca5 INFO: start gitlab. Lab. IO | _03:2021-02-24 for the 10703 sh: 1: / usr/sbin/sendmail: Not found gitlab. Lab. IO | _03:2021-02-24 for the 12222 2021-02-24 T03: for the 122 z 366 TID - kr4jk Devise: : Async: : Backend: : Sidekiq JID - 2 b138dc5149b8928a54d7ca5 INFO: done: 0.402 SEC gitlab. Lab. IO |Copy the code

The last

As mentioned in the previous article, I will talk about the use of Gitea + Drone next.

–EOF


This article is published under a SIGNATURE 4.0 International (CC BY 4.0) license. Signature 4.0 International (CC BY 4.0)

Author: Su Yang

Creation time: feb 24, 2021 statistical word count: 1972 words reading time: 4 minutes to read this article links: soulteary.com/2021/02/24/…