diff --git a/roles/Singularity/README.md b/roles/Singularity/README.md new file mode 100644 index 0000000..17eb758 --- /dev/null +++ b/roles/Singularity/README.md @@ -0,0 +1,27 @@ +Singularity is our server-side RSS reader. + +# Etymology + +Singularity is named after a more scientific name for a "black hole". Similar to this event, Singularity pulls many disparate news sources into a single feed & location. User can then use client apps or a web browser to view this single source of truth. + +# Relevant Files and Software + +Prior to pushing this role, the admin will want to use `files/create-db.sh` to seed the initial database & schema. Afterwards, deploy this role to the host and front it with a [WebServer](../WebServer). + +## Backups + +[AniNIX/Aether](/AniNIX/Aether) will back up this system -- sample backup and recovery testing is in `files/test-backup.bash`. It's important to test these, as users won't want to find their feeds over again. + +# Available Clients + +There is an Android application on [the Play store](https://play.google.com/store/apps/details?id=org.ttrssreader). + +# Equivalents or Competition + +Android has a native Google Discover mode in the home screen on devices -- Windows also has news in the taskbar. + +CLI readers like [Newsraft](https://wiki.archlinux.org/title/Newsraft) or cloud readers like [Feedly](https://feedly.com) are also available. A number of Android apps can serve this function. + +# Additional Reference + +See [RFC 4287](https://www.rfc-editor.org/rfc/rfc4287) and [5023](https://www.rfc-editor.org/rfc/rfc5023) for details on the Atom format. diff --git a/roles/Singularity/files/create-db.bash b/roles/Singularity/files/create-db.bash new file mode 100755 index 0000000..236a9fe --- /dev/null +++ b/roles/Singularity/files/create-db.bash @@ -0,0 +1,6 @@ +#!/bin/bash +set -Eeo pipefail +sudo -u postgres createuser -W --createdb ttrss +sudo -u postgres createdb -U ttrss ttrss +sudo -u postgres psql ttrss -U ttrss -f /usr/share/webapps/tt-rss/sql/pgsql/schema.sql +sudo -u http php /usr/share/webapps/tt-rss/update.php --update-schema diff --git a/roles/Singularity/files/delete-db.bash b/roles/Singularity/files/delete-db.bash new file mode 100755 index 0000000..7e9a0b9 --- /dev/null +++ b/roles/Singularity/files/delete-db.bash @@ -0,0 +1,4 @@ +#!/bin/bash +set -Eeo pipefail +sudo -u postgres dropdb ttrss +sudo -u postgres dropuser ttrss diff --git a/roles/Singularity/files/test-backup.bash b/roles/Singularity/files/test-backup.bash new file mode 100644 index 0000000..ef5cec0 --- /dev/null +++ b/roles/Singularity/files/test-backup.bash @@ -0,0 +1,13 @@ +#!/bin/bash + +backupfile="$HOME"/tt-rss.sql + +function test-backup() { + sudo -u postgres pg_dump -d ttrss > "$backupfile" +} + +function test-restore() { + ./delete-db.bash + ./create-db.bash + cat "$backupfile" | sudo -u postgres psql -d ttrss +} diff --git a/roles/Singularity/files/tt-rss.hook b/roles/Singularity/files/tt-rss.hook new file mode 100644 index 0000000..dc14b70 --- /dev/null +++ b/roles/Singularity/files/tt-rss.hook @@ -0,0 +1,10 @@ +[Trigger] +Operation = Install +Operation = Upgrade +Type = Package +Target = tt-rss + +[Action] +Description = Updating TT-RSS Database +When = PostTransaction +Exec = /usr/bin/runuser -u http -- /usr/bin/php /usr/share/webapps/tt-rss/update.php --update-schema=force-yes diff --git a/roles/Singularity/tasks/main.yml b/roles/Singularity/tasks/main.yml new file mode 100644 index 0000000..ac03dd3 --- /dev/null +++ b/roles/Singularity/tasks/main.yml @@ -0,0 +1,41 @@ +--- + + - name: Install dependencies + become: yes + package: + state: present + name: + - tt-rss + + - name: Set permissions + become: yes + file: + path: /usr/share/webapps/tt-rss + owner: http + group: http + recurse: yes + + - name: Configure + become: yes + template: + src: config.php.j2 + dest: /usr/share/webapps/tt-rss/config.php + owner: http + group: http + mode: 0600 + + - name: Enable service + become: yes + service: + name: tt-rss.service + state: restarted + enabled: true + + - name: Update hook + become: yes + copy: + src: tt-rss.hook + dest: /etc/pacman.d/hooks/tt-rss.hook + owner: root + group: root + mode: 0644 diff --git a/roles/Singularity/templates/config.php.j2 b/roles/Singularity/templates/config.php.j2 new file mode 100644 index 0000000..f87453c --- /dev/null +++ b/roles/Singularity/templates/config.php.j2 @@ -0,0 +1,11 @@ +