aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore3
-rw-r--r--Dockerfile36
-rw-r--r--README.md48
-rw-r--r--docker-compose.yml21
-rwxr-xr-xentrypoint.sh32
5 files changed, 140 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..986e34b
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,3 @@
+instance/
+.*.swp
+git/
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..7b90a2c
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,36 @@
+# Startdate: 2023-06-15-5 11:49
+# Purpose: docker image for newspipe
+# Usage:
+# docker build . --tag newspipe:latest
+# docker run -p 5938:8081 --mount type=bind,source=./instance,destination=/newspipe/instance -it --rm newspipe:latest
+FROM devuan/devuan:unstable
+MAINTAINER bgstack15@gmail.com
+
+ENV NEWSPIPE_CONFIG=sqlite.py
+ENV FLASK_APP=runserver.py
+ENV FLASK_DEBUG=1
+ENV PATH="${PATH}":/
+# Instructions from https://git.sr.ht/~cedric/newspipe
+RUN apt-get update && \
+ apt-get -y install --no-install-recommends git npm python3-poetry python3-babel python3-flask && \
+ rm -rf /var/lib/apt/lists/* || : ; \
+ git clone https://bgstack15.ddns.net/cgit/newspipe /newspipe && \
+ git config --global --add safe.directory /newspipe && \
+ cd newspipe && \
+ git checkout ldap-auth && \
+ npm install && \
+ npm ci
+WORKDIR /newspipe
+# ldap3 line is required for only branch ldap-auth
+RUN poetry install --no-dev && \
+ poetry run pip3 install ldap3 dnspython && \
+ poetry run pybabel compile -d newspipe/translations && \
+ poetry run flask db_create || : ; \
+ poetry run flask db_init ; \
+ cp -prf instance orig
+ # if you want to hardcode this in the image:
+ #cp -prf instance orig && \
+ #poetry run flask create_admin --nickname "admin" --password "1234567890"
+COPY entrypoint.sh /
+EXPOSE 8081
+CMD [ "/entrypoint.sh" ]
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..80bd986
--- /dev/null
+++ b/README.md
@@ -0,0 +1,48 @@
+<!--
+.. 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"
+
+# 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"
+
+# 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>
diff --git a/docker-compose.yml b/docker-compose.yml
new file mode 100644
index 0000000..492dc69
--- /dev/null
+++ b/docker-compose.yml
@@ -0,0 +1,21 @@
+version: '3.5'
+# File: docker-compose.yml
+# Project: newspipe-docker
+# Startdate: 2023-06-15-5 14:52
+#
+services:
+ newspipe:
+ build: .
+ image: newspipe:latest
+ ports:
+ - 5004:5004
+ environment:
+ ADMIN_NICKNAME: "admin"
+ ADMIN_PASSWORD: "1234567890"
+ NEWSPIPE_HOST: "0.0.0.0"
+ NEWSPIPE_PORT: 5004
+ NEWSPIPE_BRANCH: "stackrpms-branding"
+ volumes:
+ # Enable this if you wish to develop the app live, after git cloning to this ./git directory.
+ #- "./git:/newspipe"
+ - "./instance:/newspipe/instance"
diff --git a/entrypoint.sh b/entrypoint.sh
new file mode 100755
index 0000000..7e67c87
--- /dev/null
+++ b/entrypoint.sh
@@ -0,0 +1,32 @@
+#!/bin/sh
+# File: entrypoint.sh
+# Project: newspipe-docker
+# Startdate: 2023-06-15
+
+# For first run:
+test ! -f /newspipe/instance/config.py && { cp -pf /newspipe/orig/config.py /newspipe/instance/ 2>/dev/null ; }
+test ! -f /newspipe/instance/sqlite.py && { cp -pf /newspipe/orig/sqlite.py /newspipe/instance/ 2>/dev/null ; }
+test ! -f /newspipe/instance/newspipe.db && { cp -pf /newspipe/orig/newspipe.db /newspipe/instance/ 2>/dev/null ; }
+test -z "${NEWSPIPE_BRANCH}" && NEWSPIPE_BRANCH=ldap-auth
+
+# Options
+case "${1}" in
+ "init" | "create_admin")
+ _nick="${2:-${ADMIN_NICKNAME}}"
+ _pass="${3:-${ADMIN_PASSWORD}}"
+ poetry run flask create_admin --nickname "${_nick}" --password "${_pass}"
+ ;;
+ *)
+ cd /newspipe
+ git fetch || : ;
+ git checkout "${NEWSPIPE_BRANCH}" || { echo "Invalid branch ${NEWSPIPE_BRANCH}" 1>&2 ; exit 1 ; }
+ git pull || : ;
+ _host="${1:-${NEWSPIPE_HOST}}"
+ _port="${2:-${NEWSPIPE_PORT}}"
+ set -x
+ # If you need to add new pip packages quickly:
+ #poetry run pip3 install dnspython
+ poetry run flask db_init || :
+ poetry run flask run -h "${_host:-0.0.0.0}" -p "${_port:-8081}"
+ ;;
+esac
bgstack15