Setting up NewsBlur on Docker

I’ve been trying to get NewsBlur set up as a self-hosted Dockerised service at home although it’s been far from successful so far and I was wondering if anyone with experience in self hosting NewsBlur can point me in the right direction…

What I’ve done so far

  1. Clone the repo off Github
  2. Run docker-compose up inside the /NewsBlur directory

Based on the output from the CLI, all the requisite containers start up just fine (e.g. Mongo, Postgres, ES)

Where it goes wrong

  1. I can’t create an account/register.

    DNS Response errors

    When I try to register an account, it presumably tries to send a registration confirmation email. I get the following error message when trying to create a dummy account

    Username: dummy
    Email: dummy example com

    The error reported is:
    NoAnswer at /reader/signup
    The DNS response does not contain an answer to the question: example.com. IN MX

    Is there anyway to set this up without needing emails being sent out etc?

    Database Error
    Other times, when I try to sign up, I get another error altogether.

1 Like

You’re doing better than me! Newsblur didn’t even start up for me, although the various components (redis,mongodb, postgres …) seemed to be running fine.

What are you running docker on? I’m using it in a virtualbox environment in Windows.

I got this error:

DatabaseError at /
relation “django_site” does not exist
LINE 1: …“django_site”.“domain”, “django_site”.“name” FROM "django_si…
^
Request Method: GET
Request URL: http://192.168.99.100:8000/
Django Version: 1.5.12
Exception Type: DatabaseError
Exception Value:
relation “django_site” does not exist
LINE 1: …“django_site”.“domain”, “django_site”.“name” FROM "django_si…
^
Exception Location: /usr/local/lib/python2.7/site-packages/django/db/backends/postgresql_psycopg2/base.py in execute, line 54
Python Executable: /usr/local/bin/python
Python Version: 2.7.15
Python Path:
[’/opt/newsblur’,
‘/usr/local/bin’,
‘/opt/newsblur’,
‘/usr/local/lib/python27.zip’,
‘/usr/local/lib/python2.7’,
‘/usr/local/lib/python2.7/plat-linux2’,
‘/usr/local/lib/python2.7/lib-tk’,
‘/usr/local/lib/python2.7/lib-old’,
‘/usr/local/lib/python2.7/lib-dynload’,
‘/usr/local/lib/python2.7/site-packages’,
‘/opt/newsblur/utils’,
‘/opt/newsblur/vendor’,
‘/srv/newsblur’]

Hey Robert,

It seems to be a real mish-mash of errors for me to be honest.

I’m running Docker on a Ubuntu box but I can’t imagine that would result in any material difference given this is all containerised anyway?

It’s been a while since I’ve played around with this again but I did a fresh git clone and docker-compose up just now but got as far as this:

OperationalError at /
could not translate host name "postgres" to address: No address associated with hostname

Request Method:     GET
Request URL:        http://192.168.1.170:8000/
Django Version:     1.5.12
Exception Type:     OperationalError
Exception Value:    could not translate host name "postgres" to address: No address associated with hostname
Exception Location: /usr/local/lib/python2.7/site-packages/psycopg2/__init__.py in connect, line 164
Python Executable:  /usr/local/bin/python
Python Version:     2.7.15

Python Path:
['/opt/newsblur',
 '/usr/local/bin',
 '/opt/newsblur',
 '/usr/local/lib/python27.zip',
 '/usr/local/lib/python2.7',
 '/usr/local/lib/python2.7/plat-linux2',
 '/usr/local/lib/python2.7/lib-tk',
 '/usr/local/lib/python2.7/lib-old',
 '/usr/local/lib/python2.7/lib-dynload',
 '/usr/local/lib/python2.7/site-packages',
 '/opt/newsblur/utils',
 '/opt/newsblur/vendor',
 '/srv/newsblur']

Server time:     Sun, 23 Dec 2018 18:59:37 +0000

Assuming you did a clone of the latest master, it’s rather odd that we get two very different (broken) outcomes

So why the error? Turns out the postgres container is down. Looking at the logs for the postgres container reveals the following:

postgres_1       | REVOKE
postgres_1       | ERROR:  role "postgres" does not exist
postgres_1       | STATEMENT:  REVOKE ALL ON SCHEMA public FROM postgres;
postgres_1       | ERROR:  role "postgres" does not exist
newsblur_postgres_1 exited with code 3

That would explain why I’m getting errors about unresolved hostnames.

I suspect the reason for this is that the database dump that it’s trying to import is either outdated/incorrect, hence postgres falls over.

But again, this doesn’t explain why we’ve got such different errors! It seems that you’ve had more luck on the postgres front than I have?

Here’s a ticket you can also look at: https://github.com/samuelclay/NewsBlur/issues/1153

Hey @thencein and @newsrobert - I’m currently running a hacked-up, dockerized Newsblur instance [at least for now]. It’s hobbling along but I haven’t gotten it “production” ready due to a number of outstanding issues I’ve yet to resolve (some of which I’ve outlined here: https://forum.newsblur.com/t/self-hosting-documentation/7140; I did include some of the steps I found useful in setting up, notably you’ll want to look at the models.py modification if you want to keep your articles around for longer than 10 days or whatever the default is).

TBH, I don’t remember all of ths steps I took but I’m happy to try to help out here. Notably, you should be sure to update ./docker/local_settings.py [and docker-compose.yml to update the db password there] and ./docker/data.json, then ensure you’ve run the three docker-compose commands at https://github.com/samuelclay/NewsBlur/blob/master/docker/README.md to initialize the DB.

I tried setting up a net-new local dockerized NewsBlur instance earlier today to try to replicate the errors you two are seeing and to develop a reproducible build, but I failed at despite having a somewhat functioning reference setup. I’ll keep trying to get a local instance running so I can get you guys a reproducible build.

In any case, while trying to do that, I re-discovered a couple of things:

Is there anyway to set this up without needing emails being sent out etc?

Yep; the issue is that example.com doesn’t have an MX record; you can still give NewsBlur a fake email address but the domain needs to have a valid MX record. I was able register a dummy user using dummy@google.com [with my local, broken setup this will log me in only once and leave me in a state where I’m unable to perform basic actions including adding a feed which fails with a generic error message and not much else to go on].

I suspect the reason for this is that the database dump that it’s trying to import is either outdated/incorrect, hence postgres falls over.

I think you’re spot on here; my guess is that the init.sql.gz file that you have needs to be re-initialized and the existing one may be hanging around from the last time you were playing around with NewsBlur or something to that effect. I got the same error when I tried spinning up a local instance of NewsBlur on the same dev host I had used to configure my running NewsBlur instance and after clearing out some cruft and ensuring I was starting net-new, that specific error disappeared.

@newsrobert: the issue you’re running into looks like it could be an issue with your environment or a setting, maybe in local_settings.py or data.json. Do you recall what steps you took to set up your environment or what config changes you’ve made, if any?

@samuelclay: thank you for the pointer, however it’s unclear [to me, at least] how the link you provided relates to the issues reported in this thread.

I’ll keep poking at my local instance to see what I can dig up.

Hi there @no_the_other_foot! I tried following your steps there but things come to a screeching halt with this error message that I saw last time:

OperationalError: could not translate host name “postgres” to address: No address associated with hostname`

I notice that you suggest this is due to clutter from previous attempts at running NewsBlur but I’m not sure because this was a completely fresh attempt. I’d removed/deleted all prior traces of NewsBlur so it can’t be because of any prior “detritus”…right?

Out of interest, when you ran your new local instance, was this with the latest copy of master off GitHub? I’m confused how you were able to run an import successfully unless you’re using an older code-base?