Installing Leafnode-2 using Linuxbrew on uberspace

Last Updated: 2015-06-25

Leafnode-2 is an NNTP proxy news server which you can use to quite conveniently keep your un/read status synced over several newsreaders on different devices.

You can install Leafnode-2 on your uberspace using linuxbrew after you did a little bit of hacking, because there is now ready-made formula for it, unfortunately. Furthermore, it is quite a little bit to configure to make it all work.

Creating the leafnode2 formula for linuxbrew

You can use this formula for your own installation as well, but do not forget to change USER according to your username. Furthermore, what took me quite some while was finding out the actual url for the homepage, because all the redirects point to uni-dortmund.de instead of tu-dortmund.de, which gives you a 404 error.

$ cat .linuxbrew/Library/Formula/leafnode2.rb 
require 'formula'
class Leafnode2 < Formula
# homepage 'http://sourceforge.net/projects/leafnode/'
# url 'https://downloads.sourceforge.net/project/leafnode/leafnode/1.11.10/leafnode-1.11.10.tar.bz2'
# sha1 'c25a6cc36d9080a882836c2cc6516543a85d7fd7'
homepage 'http://www.dt.e-technik.tu-dortmund.de/~ma/leafnode/beta/'
url 'http://www.dt.e-technik.tu-dortmund.de/~ma/leafnode/beta/leafnode-2.0.0.alpha20140727b.tar.bz2'
sha1 '6f1a0f23a85cc46664392dbb3c77cd20881def6f'
depends_on 'pcre'
def install
system "./configure", "--disable-dependency-tracking", "--enable-runas-user=USER", "--prefix=#{prefix}"
system "make install"
end
end

TODO: Add this to the homebrew repository.

Installing leafnode version 2.0.0.alpha20140727b

Installing leafnode-2 with the aforementioned formula is done rather straight-forwardly with:

brew install leafnode2

Installing tcpserver

Leafnode needs x/inetd or tcpserver to run - which i would suggest to use and can be installed via:

brew install ucspi-tcp

Setting up Leafnode in conjunction with tcpserver and daemontools

Once installed, you have to create the run scripts for the daemontools. First, create a symbolic link ~/service/leafnode2 -> /home/USER/.linuxbrew/etc/leafnode2 and then create your run-file:

#!/bin/sh
exec 2>&1
exec \
tcpserver -v -x /home/USER/.linuxbrew/etc/tcprulesleafnode.cdb -X -H -c 10 0 PORT \
leafnode -vvv

Substituting USER and PORT with your actual username and the portnumber you want tcpserver to listen to for incoming connections. It is possible with tcprules to limit the access to your newsserver, see the tcprules readme for more details, principally, the cdb-file is created with the following line:

tcprules ~/.linuxbrew/etc/tcprulesleafnode.cdb ~/.linuxbrew/etc/tcprulesleafnode.tmp < ~/.linuxbrew/etc/tcprulesleafnode

Mind the reverse-pipe from the tcprulesleafnode-file, in which you actually write your rules, because tcprules itself only takes input from the stdinput.

You also need to create a log-directory inside the leafnode2 directory with a run-file in it:

#!/bin/sh
exec multilog t ./main

If you have set up these, you can start the leafnode daemon with svc -u ~/service/leafnode2.

Configuring Leafnode

To configure your leafnode server, you have to create your config file in ~/.linuxbrew/opt/leafnode2/etc/config - the crucial parts to run it successfully (on uberspace) are the following:

expire = 0
run_as_user = USER
debugmode = 1

server = news.server.com

You have to run fetchnews -vvv and texpire -vvv once to create all needed directories. After having done this, you are good to go. :)

Not yet rated