aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB. Stack <bgstack15@gmail.com>2023-08-30 18:54:10 -0400
committerB. Stack <bgstack15@gmail.com>2023-08-30 19:00:54 -0400
commit20a6fe7e28467b319cfab2af6c2fe465b73a01bc (patch)
tree1df790ffbc6761a463e1d694a62446fa56e9b8f7
parentWIP: a few prefix parts work, but will need to fix link generation? (diff)
downloadnewspipe-docker-20a6fe7e28467b319cfab2af6c2fe465b73a01bc.tar.gz
newspipe-docker-20a6fe7e28467b319cfab2af6c2fe465b73a01bc.tar.bz2
newspipe-docker-20a6fe7e28467b319cfab2af6c2fe465b73a01bc.zip
prepare documentationreverse-proxy
-rw-r--r--README.md16
-rw-r--r--docker-compose.yml2
-rwxr-xr-xentrypoint.sh37
3 files changed, 41 insertions, 14 deletions
diff --git a/README.md b/README.md
index 4ec3a1d..50b6dd7 100644
--- a/README.md
+++ b/README.md
@@ -25,6 +25,21 @@ Basic docker experience should suffice. You can make a directory, e.g., `instanc
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:
@@ -59,3 +74,4 @@ Future improvements include:
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>
diff --git a/docker-compose.yml b/docker-compose.yml
index 76d2e59..d64b94d 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -15,6 +15,8 @@ services:
NEWSPIPE_HOST: "0.0.0.0"
NEWSPIPE_PORT: 5004
NEWSPIPE_BRANCH: "reverse-proxy"
+ # pass any hardcoded arguments to entrypoint.sh with this:
+ #command: /entrypoint.sh sleep
volumes:
# Enable this if you wish to develop the app live, after git cloning to this ./git directory.
#- "./git:/newspipe"
diff --git a/entrypoint.sh b/entrypoint.sh
index 89a6ee4..04cca64 100755
--- a/entrypoint.sh
+++ b/entrypoint.sh
@@ -9,6 +9,22 @@ test ! -f /newspipe/instance/sqlite.py && { cp -pf /newspipe/orig/sqlite.py /new
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
+prepare() {
+ cd /newspipe
+ git fetch || : ;
+ test -f instance/sqlite.py && cp -pf instance/sqlite.py instance/sqlite.py1
+ git checkout -f "${NEWSPIPE_BRANCH}" || { echo "Invalid branch ${NEWSPIPE_BRANCH}" 1>&2 ; exit 1 ; }
+ git pull || : ;
+ test -f instance/sqlite.py1 && mv -f instance/sqlite.py1 instance/sqlite.py
+ test "${1}" = "sleep" && shift
+ _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 || :
+}
+
# Options
case "${1}" in
"init" | "create_admin")
@@ -16,21 +32,14 @@ case "${1}" in
_pass="${3:-${ADMIN_PASSWORD}}"
poetry run flask create_admin --nickname "${_nick}" --password "${_pass}"
;;
- *)
- cd /newspipe
- git fetch || : ;
- test -f instance/sqlite.py && cp -pf instance/sqlite.py instance/sqlite.py1
- git checkout -f "${NEWSPIPE_BRANCH}" || { echo "Invalid branch ${NEWSPIPE_BRANCH}" 1>&2 ; exit 1 ; }
- git pull || : ;
- test -f instance/sqlite.py1 && mv -f instance/sqlite.py1 instance/sqlite.py
- _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 || :
+ sleep)
+ prepare "${@}"
sleep 80000
# and now connect to this container and run in bash:
- # poetry run flask run -h "${_host:-0.0.0.0}" -p "${_port:-8081}"
+ #poetry run flask run -h "${_host:-0.0.0.0}" -p "${_port:-8081}"
+ ;;
+ *)
+ prepare "${@}"
+ poetry run flask run -h "${_host:-0.0.0.0}" -p "${_port:-8081}"
;;
esac
bgstack15