reversed(top()) code tags rss about

Take off GitHub with RocketGit

December 10, 2018
[git] [rant]

Announcement of GitHub being acquired by Microsoft prompted many people to consider migrating away from it. Yet this isn't really something new as one could hear similar thoughts expressed even before that (see) and I personally chose not to publish a fork of one popular project on GitHub months before the announcement.

The sad truth is that there aren't that many real alternatives there and even if one reaches for self-hosting solutions instead of a third-party service, they tend to be disappointing in some way.

Recently I have discovered a project which looks like it might be a solution I was looking for.

Why is there pretty much no alternatives

While there is a number of so called "GitHub alternatives" closer look reveals that they tend to be more similar to GitHub than different and therefore susceptible to similar problems. Specifically:

Some of them are proprietary solutions just like GitHub

This isn't to say that one should avoid closed source as a plague. There are situations where it's bearable. However, in case of making your own code publicly available it feels weird, if not hypocritical.

They breed centralization

Centralization might be convenient simply because it collects many things in one place and sort of standardizes processes and/or conventions. However, at some point it becomes annoying at least to some of the users. This seems to be inevitable as centralized systems tend to treat members as if they are identical even when it's not the case (the usual situation).

Even more important is the fact that centers become single point of failure for the whole infrastructure. If there are more independent centers over which user base is distributed more or less evenly, the overall complex is more resilient to unexpected changes or issues (DB failures, privacy breaches, censorship, etc.).

There are a number of attempts of implementing truly distributed code publishing services, however they weren't very successful so far even though some look promising (like one in ZeroNet). Luckily one doesn't need to choose between heavily centralized or completely decentralized solutions, something in between might be good enough.

A significant number of them is not about code

Too often one can see an emphasis on the social aspect or editing capabilities or something else which isn't really what code hosting should be about.

I expect from my code hosting to be first and foremost about hosting the damn code.

This doesn't preclude anything else from being there, however those auxiliary things should not be pushed to the front and ideally should not be mandatory to use (i.e., could be disabled at will).

Performance isn't great

Now popular obsession with maintenance over performance and responsiveness and useless animations over straightforward interfaces results in huge code bloat which—in the age of previously unseen computational power—is responsible for all the lags (or at least most of them).

It is just disappointing how unreasonably slow browsing a repository can be...

Conditions are bad

If one reads terms of use (and one usually doesn't) of a number of code hosting services, it becomes obvious that they tend to be, to say the least, geared towards users having no rights. While it's reasonable to require users to be responsible for their actions, services usually go even further and demand more than that while simultaneously denying basic conveniences to users (like warning them about changes in terms of use beforehand or providing date/version or the current version of the terms along with previous copies for comparison).

Some aren't original

There aren't that many actually original things and there is nothing wrong about collecting good ideas from different sources to build something out of that, but some projects actually have copying another solution as their goal, while others had it in the past.

Being just a clone isn't very promising as for me. I'd rather use an original project with its own goals instead of one following someone else's roadmap.

The potential alternative

In short, it could be RocketGit. Not much is written about it, but there are good reasons why it deserves attention. I find its default design not very readable and so I chose to not provide the link right away. Now, after the warning, comes the link. Once there, check list of features. A somewhat modified theme will be demonstrated later.

Once you understand the amount of stuff it already has, you start to really appreciate amount of work done by its author.

The site provides a free hosting with seemingly better conditions than other ones, but for me it's more interesting to consider it for self-hosting as I want to eventually stop moving between third-party services.

I spent quite some time staring at hosting comparison charts and trying some of them online or by installing them locally. I don't think there is anything that can come close to RocketGit's combination of features and low demand of resources.

I won't say that all features work well out of the box, I hit a number of bugs, but it wasn't all that hard to fix them. I think with a bigger user base it can mature rather quickly.

Another thing is that some features I'm used too (like highlighting or even line numbers) are missing and need to be implemented, but with everything else in place, this shouldn't be a big deal (for example, I did implement displaying of README in current directory easily).

I must also explicitly call out ability to create pull requests or write comments anonymously without bothering contributors with registration. Introducing something like question captcha for that would be useful, I guess.

Giving RocketGit a try

I've already setup an instance here to see how it looks in action. Feel free to browse it.

If you wish to try creating users, repositories, bugs, etc., I'd recommend running it in a VM. Below I'll explain how to make one using vagrant with a Debian 9 box for Apache with and without systemd. There are other ways described on RocketGit's site for different configurations (here).

Building a package

This is a common step which can be performed on an existing system or in a virtual machine.

# `local` branch contains all changes from code.reversed.top instance
# `dev` branch contains changes which should be OK to merge with upstream
git clone --branch local https://code.reversed.top/user/xaizek/rocketgit
cd rocketgit
# build dependencies might be needed to install, see output of the command
dpkg-buildpackage
# use ../rocketgit_0.70_all.deb file
Making and running a box
vagrant init generic/debian9
vagrant ssh
Installing from Debian package (with sysvinit)

1) Install the package: apt install ./rocketgit_0.70_all.deb

2) Create a PostgreSQL user and database

su - postgres
createuser --createdb --no-createrole --no-superuser rocketgit
createdb -O rocketgit rocketgit

3) Enable rocketgit-fpm service: update-rc.d rocketgit-fpm defaults

4) Start rocketgit-fpm service: service rocketgit-fpm start

5) Enable required Apache modules: a2enmod proxy_fcgi rewrite

6) Disable default site: a2dissite 000-default.conf

7) Enable RocketGit site: a2ensite rocketgit.conf

8) Restart Apache to apply changes: service apache2 restart

9) If you want to make git:// protocol work, install xinetd or do service xinetd restart if you already have it

Installing from Debian package (with systemd)

1) Install the package: apt install ./rocketgit_0.70_all.deb

2) Create a PostgreSQL user and database

su - postgres
createuser --createdb --no-createrole --no-superuser rocketgit
createdb -O rocketgit rocketgit

3) Enable rocketgit-fpm service: systemctl enable rocketgit-fpm.service

4) Start rocketgit-fpm service: systemctl start rocketgit-fpm.service

5) Enable required Apache modules: a2enmod proxy_fcgi rewrite

6) Disable default site: a2dissite 000-default.conf

7) Enable RocketGit site: a2ensite rocketgit.conf

8) Restart Apache to apply changes: systemctl restart apache2

9) If you want to make git:// protocol work, install xinetd or do systemctl restart xinetd.service if you already have it

Connecting

Just point your browser to IP address of VM and create yourself an admin account following the instructions.

In case of issues

Since I've dealt with it extensively recently, I don't mind trying to help if something won't work for you. No guarantee that I'll be of use in all cases though (e.g., I didn't try it with nginx).

Impression so far

RocketGit strikes me as an overlooked hosting software that deserves more attention than it have received. It scores high compared to alternatives according to criteria outlined in the first part of the post.

I am going to continue trying it out and attempt to add some of the missing features. If everything will be fine, I'll stick with it. Hopefully, it will be fine, because it seems to be the most promising implementation of code hosting as far as I'm concerned.