"A human being should be able to change a diaper, plan an invasion, butcher a hog, conn a ship, design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, fight efficiently, die gallantly. Specialization is for insects." (Robert A. Heinlein)
Showing posts with label DVCS. Show all posts
Showing posts with label DVCS. Show all posts

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 https://packages.gitlab.com/gpg.key | sudo apt-key add -
sudo curl -o /etc/apt/sources.list.d/gitlab_ce.list "https://packages.gitlab.com/install/repositories/gitlab/raspberry-pi2/config_file.list?os=debian&dist=jessie" && 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

Wednesday, 14 August 2013

Mercurial and Mercurial-server : playing with DVCS (part 2)

In my previous post I moved my first steps with Mercurial DVCS, now I'll install a Mercurial server implementation and configure both my computers to access it using SSH protocol.

Mercurial-server

With DVCS you don't have to use a central server, repositories could be shared over LAN using shared folders, but this doesn't mean you can't have one. Various mercurial server side implementations exists, using different protocols. May be I'm too server-client minded but I didn't feel satisfied by just sharing repositories over a shared folder so I decided to install Mercurial-server.
Installing Mercurial-server is an easy task the command
sudo apt-get install mercurial-server
complete the installation process and the creation of the application user (hg). A bit more complex is configuring SSH for accessing the server, I mainly followed instructions from here and from Mercurial-server documentation.
Mercurial-server uses public-key authentication and SSH-Agent in order to grant access to its clients, so the first step has been to generate a keys couple for SSH. The ssh-keygen command does this interactively.
maxx@VeritonS661:~$ ssh-keygen -t dsa
Generating public/private dsa key pair.
Enter file in which to save the key (/home/maxx/.ssh/id_dsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/maxx/.ssh/id_dsa.
Your public key has been saved in /home/maxx/.ssh/id_dsa.pub.
I then copied the public key in mercurial-server keys configuration path and told mercurial-server to refresh its authentication files, using the following commands:
ssh-add -L > maxx.key
sudo mkdir /etc/mercurial-server/keys/root/maxx
sudo cp maxx.key /etc/mercurial-server/keys/root/maxx /veritons661
sudo -u hg /usr/share/mercurial-server/refresh-auth
the usual path for mercurial-server keys is (for root users)
/etc/mercurial-server/keys/root/<user-name>
but if the same user must be accessed from different machines a different path is used:
/etc/mercurial-server/keys/root/<user-name>/<machine-name>
since I was going to add the maxx user from the EEEPC too I had to use, of course, the second from. On the EEEPC side I generated SSH keys at the same manner then, after logging to the desktop computer (the server) with:
ssh -A veritons661
and I eventually registered EEEPC's maxx user like this
ssh-add -L > eeepc900.key
sudo cp eeepc900.key /etc/mercurial-server/keys/root/maxx/eeepc900
sudo -u hg /usr/share/mercurial-server/refresh-auth

Wednesday, 31 July 2013

Mercurial and Mercurial-server : playing with DVCS (part 1)

Version control systems (VCS) are an indispensable tool when programming and sharing code even for small groups. Even while programming alone, but on different computers, a version control system could easily prove useful for securely sharing code between desktop and laptop computer. I use daily SVN, as version control while at work. For my homely experiments, instead, I decided to install something different: Mercurial, a distributed version control system (DVCS). Distributed version control systems, most famous are Git and Mercurial, do not rely on a central server to keep the code repository, in DVCS every developing computer keeps its own copy of the repository. What interested me in DVCS was the capability to do version control also when off-line and also, of course, the chance to learn something new.

Installing Mercurial (command-line and plugged-in)

Installing Mercurial command-line version it's quite trivial:
sudo apt-get install mercurial
Both Eclipse and Netbeans offers their plug-ins to interface with Mercurial. Netbeans plug-in is already provided with version 7.3.1 I have installed on the EEEPC. On Eclipse, desktop-side, installing the MercurialEclipse plug-in has been as simple as selecting it from the Eclipse Marketplace and following installation wizard.