Friday, 30 June 2017

GitLab on the Raspberry Pi 3

Software version control systems (VCS) are among essential (almost life-saving) tools when programming in team. Also while working by themselves they can reveal a big deal useful. I had Mercurial and Mercurial-server installed on my desktop computer time ago and used them to backup and synchronize my programming experiments between the netbook and the desktop computer.
Since I installed Mercurial I went trough a couple of desktop full-reinstall, of course, I also had to reinstall and reconfigure the version control system tools. So, when I bought the Raspberry Pi 3, I did put using it as VCS server on top of my personal wish-list.

Why Git? Why GitLab?

I must say I have no complaints against Mercurial, it always worked without any problem, but I’ve become a GitHub user so, passing to Git also at home seemed me the natural thing to do. At the beginning I was thinking about a plain bare-bone Git installation, without any graphical user interface, just like it was for Mercurial-server. While I was looking for a suitable git-on-raspberry how-to page I literally stumbled on this GitLab Installation how-to.
GitLab is a Git server full featured with web interface, projects and users management. GitLab is Open-source, or at least exists a community version, but what triggered my decision is that it’s quite easy to install. Installing GitLab is not harder than installing a bare-bone Git server, so … here I am.

Installing GitLab

Installing GitLab has been a simple four-step process, at the end of installation process GitLab was ready-and-running without any need of configuration.
First I installed some required dependencies. Because of previous installations on my Raspberry the only one I had to install has been Postfix mail server.
sudo apt install curl openssh-server ca-certificates postfix apt-transport-https
Then I added GitLab repositories and keys to Raspbian sources:
curl | sudo apt-key add -
sudo curl -o /etc/apt/sources.list.d/gitlab_ce.list "" && sudo apt-get update
I then installed GitLab with a simple apt-get command
sudo apt-get install gitlab-ce
At last I executed the GitLab reconfiguration command in order to make configuration effective.
sudo gitlab-ctl reconfigure
I edited GitLab configuration file (located in /etc/gitlab/gitlab.rb) only to change two configuration details: I placed GitLab repository folder on Raspberry external USB disk
git_data_dirs({"default" => "/media/usbdisk/gitlab"})
And I set GitLab web server in order to work on a HTTP port different from default one.
external_url 'http://raspberrypi3:8887'
After any change of GitLab configuration file the reconfigure command must be executed in order to see them effective. In spite of changing GitLab web port SFPG picture gallery I had installed on the Raspberry stopped working, I’ll have to solve this in the near future.

First login

On the very first access to GitLab web page user is asked to change administrator password
Then I’ve been able to login as administrator user.
Into the Admin area there are many configuration and management options
From here I added a new user with a proper projects limit.
Eventually I logged out from the administrator and logged in as the newly created user.
In my next post I’ll show about creating projects and pushing commits up to the server.

Stay tuned …

No comments:

Post a Comment