Move to `skx/rss2email` for RSS-to-email transport
This allows us to move to a more configurable base, driven by service configuration files (which can be extended by private configuration) rather than systemd-driven configuration, which wasn't ever as robust as it should've been.
This commit is contained in:
parent
c21deced79
commit
e72f1bc607
|
@ -212,6 +212,14 @@ storage:
|
||||||
inline: |
|
inline: |
|
||||||
TEST_ENV=foobar
|
TEST_ENV=foobar
|
||||||
|
|
||||||
|
# Feed configuration for RSS2Email.
|
||||||
|
- path: /etc/coreos-home-server/rss2email/service/feeds/test@localhost/feeds.txt
|
||||||
|
mode: 0644
|
||||||
|
contents:
|
||||||
|
inline: |
|
||||||
|
https://feeds.bbci.co.uk/news/world/rss.xml
|
||||||
|
https://pluralistic.net/feed/
|
||||||
|
|
||||||
# Include pre-generated certificates for localhost domain, as we're not using Let's Encrypt in
|
# Include pre-generated certificates for localhost domain, as we're not using Let's Encrypt in
|
||||||
# generating certificates for the virtual host.
|
# generating certificates for the virtual host.
|
||||||
- path: /etc/ssl/private/localhost/fullchain.pem
|
- path: /etc/ssl/private/localhost/fullchain.pem
|
||||||
|
|
|
@ -28,17 +28,13 @@ DOVECOT_DATABASE_USERNAME=dovecot
|
||||||
DOVECOT_DATABASE_PASSWORD=password
|
DOVECOT_DATABASE_PASSWORD=password
|
||||||
|
|
||||||
# Configuration for Postfix.
|
# Configuration for Postfix.
|
||||||
POSTFIX_HOST=localhost
|
POSTFIX_HOST=postfix.localhost
|
||||||
POSTFIX_LOCAL_SMTP_USERNAME=noreply@localhost
|
POSTFIX_LOCAL_SMTP_USERNAME=noreply@postfix.localhost
|
||||||
POSTFIX_LOCAL_SMTP_PASSWORD=password
|
POSTFIX_LOCAL_SMTP_PASSWORD=password
|
||||||
|
|
||||||
# Configuration for rspamd.
|
# Configuration for rspamd.
|
||||||
RSPAMD_CONTROLLER_PASSWORD=password
|
RSPAMD_CONTROLLER_PASSWORD=password
|
||||||
|
|
||||||
# Configuration for RSS2Email.
|
|
||||||
RSS2EMAIL_FROM=noreply@localhost
|
|
||||||
RSS2EMAIL_TO=root@localhost
|
|
||||||
|
|
||||||
# Configuration for Rclone.
|
# Configuration for Rclone.
|
||||||
RCLONE_REMOTE_TYPE=local
|
RCLONE_REMOTE_TYPE=local
|
||||||
RCLONE_REMOTE_PATH=/data/rclone
|
RCLONE_REMOTE_PATH=/data/rclone
|
||||||
|
|
|
@ -1,18 +1,15 @@
|
||||||
FROM docker.io/debian:bullseye-slim@sha256:c6d9e246479d56687c1a579a7a0336956a5ce6f2bc26bd7925b0c7405e81dbff
|
FROM docker.io/golang:1.22-bookworm@sha256:925fe3fa28ba428cf67a7947ae838f8a1523117b40e3e6b5106c378e3f97fa29 AS builder
|
||||||
ARG VERSION=3.14 # renovate: datasource=github-tags depName=rss2email/rss2email extractVersion=^v(?<version>.*)$
|
ARG VERSION=3.2 # renovate: datasource=github-releases depName=skx/rss2email extractVersion=^release-(?<version>.*)$
|
||||||
|
|
||||||
RUN apt-get update -y && apt-get install -y --no-install-recommends \
|
RUN GOBIN=/build/usr/bin go install github.com/skx/rss2email@release-${VERSION}
|
||||||
ca-certificates git gettext gosu \
|
|
||||||
python3 python3-setuptools python3-feedparser python3-html2text python3-bs4
|
|
||||||
|
|
||||||
RUN git clone --branch v${VERSION} --depth 1 https://github.com/rss2email/rss2email /tmp/rss2email && \
|
FROM docker.io/debian:bookworm-slim@sha256:d02c76d82364cedca16ba3ed6f9102406fa9fa8833076a609cabf14270f43dfc
|
||||||
cd /tmp/rss2email && python3 setup.py install && \
|
RUN apt-get update -y && apt-get upgrade -y && apt-get install -y --no-install-recommends \
|
||||||
rm -Rf /tmp/rss2email
|
ca-certificates gettext gosu
|
||||||
|
|
||||||
RUN addgroup --system --gid 10000 rss2email
|
RUN adduser --system --group --uid 10000 --no-create-home rss2email
|
||||||
RUN adduser --system --uid 10000 --ingroup rss2email --home /var/lib/rss2email rss2email
|
|
||||||
|
|
||||||
COPY container/config /etc/rss2email
|
COPY --from=builder /build /
|
||||||
COPY container/run-rss2email /run-rss2email
|
COPY container/run-rss2email /run-rss2email
|
||||||
|
|
||||||
ENTRYPOINT ["/run-rss2email"]
|
ENTRYPOINT ["/run-rss2email"]
|
||||||
|
|
|
@ -1,36 +0,0 @@
|
||||||
[DEFAULT]
|
|
||||||
from = ${RSS2EMAIL_FROM}
|
|
||||||
to = ${RSS2EMAIL_TO}
|
|
||||||
user-agent = rss2email/1.0
|
|
||||||
use-publisher-email = True
|
|
||||||
date-header = True
|
|
||||||
html-mail = True
|
|
||||||
multipart-html = True
|
|
||||||
use-css = True
|
|
||||||
css =
|
|
||||||
html {
|
|
||||||
margin: 0 auto;
|
|
||||||
max-width: 900px;
|
|
||||||
padding: 1em 0;
|
|
||||||
}
|
|
||||||
h1, h2, h3, h4, h5, h6 {
|
|
||||||
margin: 0.5em 0;
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
|
||||||
img {
|
|
||||||
max-width: 100%;
|
|
||||||
}
|
|
||||||
p, ul, ol {
|
|
||||||
color: #1d1d1d;
|
|
||||||
font-family: sans-serif;
|
|
||||||
line-height: 1.5;
|
|
||||||
margin-bottom: 1em;
|
|
||||||
}
|
|
||||||
email-protocol = smtp
|
|
||||||
smtp-auth = True
|
|
||||||
smtp-username = ${RSS2EMAIL_SMTP_USERNAME}
|
|
||||||
smtp-password = ${RSS2EMAIL_SMTP_PASSWORD}
|
|
||||||
smtp-server = ${RSS2EMAIL_SMTP_HOST}
|
|
||||||
smtp-port = ${RSS2EMAIL_SMTP_PORT}
|
|
||||||
smtp-ssl = False
|
|
||||||
verbose = info
|
|
|
@ -1,16 +1,19 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
# Create configuration file from collected templates.
|
set -eu
|
||||||
mkdir -p /etc/rss2email
|
|
||||||
envsubst < /etc/rss2email/rss2email.conf.template > /etc/rss2email/rss2email.conf
|
|
||||||
|
|
||||||
if test -n "$(ls -A /etc/rss2email/conf.d)"; then
|
# Common-use variables.
|
||||||
cat /etc/rss2email/conf.d/*.conf >> /etc/rss2email/rss2email.conf
|
DATA_DIR=/var/lib/rss2email
|
||||||
fi
|
CONF_DIR=/etc/rss2email/feeds.d
|
||||||
|
|
||||||
# Correct permissions for data files.
|
# Parse invividual feed configuration directories.
|
||||||
mkdir -p /var/lib/rss2email
|
process() {
|
||||||
chown -R rss2email:rss2email /var/lib/rss2email
|
printf "Processing feeds for %s...\n" "$2"
|
||||||
|
install -D --owner rss2email --group rss2email --target-directory "$DATA_DIR/feeds/$2/.rss2email" "$1"/*
|
||||||
|
chown rss2email:rss2email "$DATA_DIR/feeds/$2/.rss2email"
|
||||||
|
gosu rss2email sh -c "HOME=$DATA_DIR/feeds/$2 rss2email cron -verbose $2"
|
||||||
|
}
|
||||||
|
|
||||||
# Run entrypoint under specific user.
|
for feed in "$CONF_DIR"/*/feeds.txt; do
|
||||||
gosu rss2email /usr/local/bin/r2e --config /etc/rss2email/rss2email.conf --data /var/lib/rss2email/data.json "$@"
|
process "$(dirname "$feed")" "$(basename "$(dirname "$feed")")"
|
||||||
|
done
|
||||||
|
|
|
@ -1,9 +1,5 @@
|
||||||
# Options for RSS-to-Email.
|
|
||||||
RSS2EMAIL_FROM=${RSS2EMAIL_FROM}
|
|
||||||
RSS2EMAIL_TO=${RSS2EMAIL_TO}
|
|
||||||
|
|
||||||
# Options for SMTP delivery mechanism.
|
# Options for SMTP delivery mechanism.
|
||||||
RSS2EMAIL_SMTP_HOST=${POSTFIX_HOST}
|
SMTP_HOST=${POSTFIX_HOST}
|
||||||
RSS2EMAIL_SMTP_PORT=587
|
SMTP_PORT=587
|
||||||
RSS2EMAIL_SMTP_USERNAME=${POSTFIX_LOCAL_SMTP_USERNAME}
|
SMTP_USERNAME=${POSTFIX_LOCAL_SMTP_USERNAME}
|
||||||
RSS2EMAIL_SMTP_PASSWORD=${POSTFIX_LOCAL_SMTP_PASSWORD}
|
SMTP_PASSWORD=${POSTFIX_LOCAL_SMTP_PASSWORD}
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
# Feed Configuration for RSS2Email
|
||||||
|
|
||||||
|
This folder contains feed configuration, each placed under its own folder named after the
|
||||||
|
destination email address, and each containing (at a minimum) a `feeds.txt` file with the list of
|
||||||
|
feeds to subscribe to.
|
|
@ -1,14 +0,0 @@
|
||||||
[Unit]
|
|
||||||
Description=RSS Feed Subscription for %I
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
Type=oneshot
|
|
||||||
RemainAfterExit=true
|
|
||||||
SyslogIdentifier=%N
|
|
||||||
ExecStart=/bin/sh -c "V=$(podman volume mount rss2email-feeds) && printf '[feed.%%s]\nurl = %I\n' $(md5sum <<< '%i' | cut -c-32) > $V/%i.conf"
|
|
||||||
ExecStartPost=/bin/podman volume unmount rss2email-feeds
|
|
||||||
ExecStop=/bin/sh -c "V=$(podman volume mount rss2email-feeds) && rm -f $V/%i.conf"
|
|
||||||
ExecStopPost=/bin/podman volume unmount rss2email-feeds
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
|
@ -8,9 +8,9 @@ Type=oneshot
|
||||||
SyslogIdentifier=%N
|
SyslogIdentifier=%N
|
||||||
ExecStart=/bin/podman run --replace --rm --name %N --net internal \
|
ExecStart=/bin/podman run --replace --rm --name %N --net internal \
|
||||||
--env-file %E/coreos-home-server/%N/%N.env \
|
--env-file %E/coreos-home-server/%N/%N.env \
|
||||||
--volume %N-feeds:/etc/%N/conf.d:z,ro \
|
--volume %E/coreos-home-server/%N/service/feeds:/etc/%N/feeds.d:z,ro \
|
||||||
--volume %N:/var/lib/%N:z \
|
--volume %N:/var/lib/%N:z \
|
||||||
localhost/%N:latest run
|
localhost/%N:latest
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=multi-user.target
|
WantedBy=multi-user.target
|
||||||
|
|
Loading…
Reference in New Issue