My experience with Self Hosting NewsBlur

My experience with Self Hosting NewsBlur

This is not so much a guide as a place for me to document things, so that I can come back to them later.

I really like NewsBlur, especially the filtering system being built into the user interface. I tried TTRSS, which was also good, but which needed the filtering to be set up in a different area (albeit with the option of numerical weighting)
I like the idea of the weighting, but to be honest most of my preferences are actually binary (I don't want to see fashion or football for example so they end up with a score of -1000, which is the same as a "Thumbs Down" in NewsBlur). The subtleties of weighting could have a use, of course, but in my case the hassle & implementation weren't worth the results.
On the flip side, I'm more a consumer of news & blogs than a sharer of my thoughts on them (& where I do share it's usually targeted to specific people & via conventional social media). Which means that I have much less use for NewsBlur's social sharing features.
So, in short choosing to self host NewsBlur makes the most sense for me.

There is a bit of an issue with self hosting NewsBlur though - it's in the process of moving from a baremetal hosted, evolved/developed collection of software elements into a collection of docker containers which may be being installed/created in a "virgin" system. Which means that it can be hard to get up & running & that there are assumptions in the installation & documentation which are not either implied, explicitly covered or spelled out for a new hoster.
It is getting better, but the focus is understandably on delivering the best experience for the subscribers on the developer's hosted website. Expect some challenges, at least for now.

Where do I get NewsBlur from?

https://github.com/samuelclay/NewsBlur is the main repository. You'll need to have a linux system with docker & docker-compose installed in it. There are another couple of requirements which aren't so well spelled out & which I needed to do some detective work to figure out...

* You may need to `sudo apt install nodejs npm`
* Github SSH keys. 

The first is pretty obvious - you'll get complaints when you try to make nb if you don't have node.
SSH keys: You may meet this error in the output of the make nb command though: The authenticity of host 'github.com (140.82.121.3) can't be established. This is because the creation of NewsBlur requires access to a another, different, repository.
In this is the case you need to access Github direct & accept the key, after verifying it here (https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/githubs-ssh-key-fingerprints) & make sure that you have an SSH key associated with your Github account (https://docs.github.com/en/authentication/troubleshooting-ssh/error-permission-denied-publickey)

Read me before trying to install NewsBlur!

You need to decide right from the outset whether you want to run Newsblur from localhost, or to access it using a different domain. Once you've run make nb the easiest way to make a change to the domain is to wipe everything & start again!

I ended up writing a script to make the changes in the right places in a single step.

Open a bash shell & navigate to the Newsblur directory. Put the code into a  (text) file called mydomain.sh & ensure that the mydomain.sh script is executable ('sudo chmod +x' if it isn't).
Type ./mydomain.sh <domain name> (where  is the domain that you want to use to access Newsblur.
If you need to fix a typo then you can use ./mydomain.sh <old domain> <new domain>

#! /bin/bash
if [ $# -eq 0 ]
  then
    echo "No arguments supplied"
  else
    if [ $# -eq 1 ]
     then
     echo "$(tput setaf 1)Changinging newsblur_web/docker_local_settings.py:$(tput setaf 2) localhost to $1$(tput sgr 0)"
     sed -i'.bak'  -e "/NEWSBLUR_URL/ s/localhost/$1/" -e "/SESSION_COOKIE_DOMAIN/ s/localhost/$1/" './newsblur_web/docker_local_settings.py'
     head -20 './newsblur_web/docker_local_settings.py'
     echo "$(tput setaf 1)Changinging config/fixtures/bootstrap.json:$(tput setaf 2) localhost to $1$(tput sgr 0)"
     sed -i'.bak' "/domain/ s/localhost/$1/" './config/fixtures/bootstrap.json'
     head -10 './config/fixtures/bootstrap.json'
    else
      if [ $# -eq 2 ]
      then
       echo "$(tput setaf 1)Changinging newsblur_web/docker_local_settings.py: $(tput setaf 2)$1 to $2$(tput sgr 0)"
       sed -i'bak' -e "/NEWSBLUR_URL/ s/$1/$2/" -e "/SESSION_COOKIE_DOMAIN/ s/$1/$2/" './newsblur_web/docker_local_settings.py' 
       head -20 './newsblur_web/docker_local_settings.py'
       echo "$(tput setaf 1)Changinging config/fixtures/bootstrap.json: $(tput setaf 2)$1 to $2$(tput sgr 0)"
       sed -i'bak' -e "/domain/ s/$1/$2/" './config/fixtures/bootstrap.json'
       head -10 './config/fixtures/bootstrap.json'
      fi
    fi
fi

Unable to Register

Try setting AUTO_ENABLE_NEW_USERS = True in docker_local_settings.py
&/Or comment out the DNS check in apps/reader/forms.py around the line if not query(domain, 'MX') (I ended up doing both)
See https://github.com/samuelclay/NewsBlur/issues/1114

        try:
            domain = email.rsplit('@', 1)[-1]
            if not query(domain, 'MX'):
                raise forms.ValidationError('Sorry, that email is invalid.')
        except (NXDOMAIN, NoNameservers, NoAnswer):
            raise forms.ValidationError('Sorry, that email is invalid.')
        except NoResolverConfiguration as e:
            logging.info(f" ***> ~FRFailed to check spamminess of domain: ~FY{domain} ~FR{e}")
            pass
This section has the DNS (MX) query in it

Unable to log in after registering?

A way to make sure you updated all the correct places (thanks to Djagatahel via Reddit):

* Go to the website address in your browser
* Open developer tools and look at the network tab
* Try to login
* Look again at the developer tools, there should be a POST call to /login
* Observe the Response headers for that call
* The value of the "set-cookie" header should contain a "Domain=" string

If the string after Domain= is not the domain you are using to access the website, then your configuration is missing a piece. You can also confirm that there is a domain name mismatch in the database by running make shell & typing Site.objects.all()[0] to show the domain that Newsblur is using.

Currently unresolved

  • I can't link NewsBlur with Twitter, nor change my avatar via photo upload. These seem to be connected to an error that references an S3 bucket - which I don't have.
    That said, I don't need an avatar for myself & I've got nitter set up to generate very lightweight Twitter RSS feeds (which may actually be a better solution for me anyway).
  • The logs for the task-celery container report a permissions issue. The docker-compose specifies the user ID & Group ID, but the log file is owned by root:root. My fix was to go to the NewsBlur/logs directory & run these commands (replace the <...> with the user who will run make nb
sudo chgrp <my user> newsblur.log
sudo chown <my user> newsblur.log
[9/1/21: This seems to be fixed on a new install] I have a persisting error with redis being unable to save dump.rdp (it reports a permission error). This may or may not be related to the strange finding that redis_docker.conf in NewsBlur/config is an empty directory & not a file. (I need to find time to look into that, it isn't in the original repo)
  • It seems (not formally tested) that the best way to start a new upload of OPML feeds "ticking" is to Instafetch each one. That might just be me being impatient.
  • There are a few niggles with the android app, but these are cosmetic (folders with no unread content sometimes stay visible when they should be filtered).