Gitolite and gitweb on Synology DS415+ with standard packages

Recently I put my hands on a Synology DS415+ Network-Attached Storage-unit. This device does a lot more than just storage. A whole bunch of services and applications can be installed via a web-interface. The device itself is running, by default, a “lightweight” Linux based on busybox and is filled up with custom builds of services and applications.

Synology DS415+

When I was asked to install a git-server/-service on it, there were already a lot of other services running. There are two git-servers provided via the Synology-package-manager: Gitlab and a “git-server”. I tried Gitlab which comes in a Docker-container. This was too much for the DS415+ – CPU and Memory consumption was going up immediately and finally crashing the whole system. I de-installed everything after a reboot.

The “git-server” was very simplistic and not exactly what the team was looking for. Installing git-repos on a per-user basis was too simple compared to the needs expressed by the team. However, git-server has to be installed and activated in order to have a git-executable available.

I’m always opting for gitolite in this kind of situations. I looked into how the internet was suggesting to install it on such a device. All of the How-Tos I found were suggesting to bootstrap the installation with ipkg to have the possibility to install much more packages from the nslu2-project.

The team wanted to keep the possibility of updating the DS415+ with the Synology-update process and was thus hesitant to add this package-source. Especially as the bootstrapping description mentioned explicitly that the “official” update-process might suffer after installation.

I finally succeeded to install gitolite and a gitweb-clone (gitphp) on the DS415+ without spoiling the system with external package-systems. Here is what I did:

1- Create user ‘git’ via the standard user-interface (have it creating a home-dir). Login with ssh as root to and  change to /sbin/no-login to /bin/sh for ‘git’ (/etc/passwd)
2- Login as user ‘git’ via ssh and
chmod 755 $PWD

This is necessary to make ssh-logins work with the public-private-key-method.

3- Create a directory for the user git to keep executables and add this path it to the user’s PATH variable.
mkdir ~/bin
echo 'export PATH=$PWD/bin:$PATH' >> .profile
4- Install mktemp for synology-intel-platform

Get the mktemp-package file (ipkg), unpack it (on a PC preferably) and copy /opt/bin/mktemp-mktemp from the archive to /usr/local/bin . This is actually a kludge to get mktemp which is not enabled by default. Installing it to /usr/local/bin should make it survived updates in the future.

5- Install Perl via the standard Synology package-manager.
6- Put your ssh-public-key to git’s directory as <your-future-gitolite-username>.pub
7- Logged in a ‘git’ install gitolite. I simply followed this guide.
gitolite/install -ln
gitolite setup -pk
8- Everything is readly now and gitolite-admin can be cloned (on your host as the user who owns the corresponding private key).
git clone git@host:gitolite-admin

The rest is standard gitolite administration stuff. Read .

9- Gitweb with Gitphp

I was unable to master the perl/cgi-setup of the DS415+ and gave up quickly when trying to make run gitweb. I found Gitphp which is a Gitweb-clone written in PHP. It was quite simple to set it up.

I had to enable the “Web Service” via the admin-interface. I also ticked ‘Enable personal website’. This way I could install gitphp directly to ~/www of the git-user.

mkdir ~/www
cd ~/www
git clone .

I started with a simple configuration by adjusting some self-explaining variables in ~/www/config/gitphp.conf.php
after having it copied from gitphp.conf.php.example. More configuration remains to be done.