aboutsummaryrefslogtreecommitdiff
path: root/README.md
blob: 50b6dd7a279a400f1daad3748e5958a777c6830a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<!--
.. File: README.md
.. Location: https://bgstack15.ddns.net/cgit/newspipe-docker
.. Author: bgstack15
.. Startdate: 2023-06-15-5 14:50
.. Title: Docker materials for newspipe
.. Project: newspipe-docker
.. Purpose: Docker image and docker-compose for newspipe
.. History:
.. Usage:
.. Reference: See heading References
.. Improve: See heading Improve
.. Dependencies:
..    Docker
-->

# Overview
This project consists of the elements to assemble a [docker](https://www.docker.com/) image and [docker-compose](https://docs.docker.com/compose/) instructions of [newspipe](https://git.sr.ht/~cedric/newspipe), the rss feed aggregator web app.

# Why this project exists
Of category [awesome-selfhosted#feed-readers](https://github.com/awesome-selfhosted/awesome-selfhosted#feed-readers), only so many projects where written in Python/Flask, and of those (including [JARR](https://1pxsolidblack.pl/jarr-en.html) and [Temboz](https://github.com/fazalmajid/temboz)), newspipe was the only one I could get installed at all, which I did in a container because I didn't want to contaminate any real system with the likes of npm and some of the other dependencies of this app.

# Using
Basic docker experience should suffice. You can make a directory, e.g., `instance`, to mount inside the container which will receive the initial configurations from the app, which you can then configure before restarting.

    docker run -p 5004:5004 --mount type=bind,source=./instance,destination=/newspipe/instance -it --rm newspipe:latest entrypoint.sh create_admin admin "1234567890"

To use a reverse proxy, you need to set config variable in your `sqlite.py` or `config.py`:

    PREFIX = "/newspipe"

And here is an example apache httpd directive:

    <Location /newspipe>
       ProxyPass http://newspipe.vm.example.com:5004/ retry=0
       ProxyPassReverse http://newspipe.vm.example.com:5004/
       # You might be tempted to try the following, but it does not work in flask or newspipe.
       # a2enmod headers. These are extra ones that are not provided by Apache natively.
       #RequestHeader append X-Forwarded-Prefix "/newspipe"
       #RequestHeader append X-Script-Name "/newspipe"
    </Location>

# Operations
## Create admin user
If you are using bare docker:

    docker run -p 5004:5004 --mount type=bind,source=./instance,destination=/newspipe/instance -it --rm newspipe:latest entrypoint.sh create_admin admin "1234567890"

Or if it is currently running in docker-compose:

    docker-compose exec newspipe entrypoint.sh create_admin admin "123456789"

## Fetching feeds
Because I'm too lazy to change the container to use uwsgi-python or something that can handle the jobs parts of flask, I wrote a cron job to run this shell script:

    #!/bin/sh
    cd ~/newspipe-docker
    docker-compose exec newspipe /usr/bin/poetry run flask fetch_asyncio

Here's the cron entry:

    25 3,15 * * *  root  /home/newspipe/newspipe-docker/contrib/newspipe_cron.sh 1>/dev/null 2>&1 &

These files are in directory `contrib/`.

# Improve
Future improvements include:

* add option for using postgresql in networked container
* (underlying project: add ldap auth)

# References

1. <https://stackoverflow.com/questions/72465421/how-to-use-poetry-with-docker>
2. <https://git.sr.ht/~cedric/newspipe>
3. FreeIPA auth (ldap+kerberos) for a different rss reader, in a different language <https://git.sacredheartsc.com/ttrss-freeipa/tree/auth_freeipa/init.php>
4. Apache httpd config syntax from <https://radicale.org/v3.html#reverse-proxy>
bgstack15