From 78fedc59cf4c0bb8d2e0bdbed79ae99dbc587ab7 Mon Sep 17 00:00:00 2001 From: striker Date: Thu, 21 May 2026 03:31:33 +0300 Subject: [PATCH] =?UTF-8?q?ci:=20cron-=D0=B0=D0=B3=D1=80=D0=B5=D0=B3=D0=B0?= =?UTF-8?q?=D1=82=D0=BE=D1=80=20=D0=B2=D0=BD=D0=B5=D1=88=D0=BD=D0=B8=D1=85?= =?UTF-8?q?=20RSS=20(scripts/package.json=20+=20install-cron.sh)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Изолированный scripts/package.json с одним fast-xml-parser, чтобы не раздувать root node_modules на хосте - scripts/install-cron.sh — настройка cron /etc/cron.d/pushkino-rss-aggregator, hourly /usr/bin/node pull-external-rss.mjs → data/news.json - logrotate weekly × 4 для /var/log/pushkino-rss-aggregator.log - Bind-mount data/ уже подцеплен в docker-compose как /var/lib/pushkino/data:ro --- package.json | 1 - scripts/install-cron.sh | 42 +++++++++++++++++++++++++++++++++++++++++ scripts/package.json | 9 +++++++++ 3 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 scripts/install-cron.sh create mode 100644 scripts/package.json diff --git a/package.json b/package.json index 510db04..a40a75e 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,6 @@ }, "devDependencies": { "@types/sanitize-html": "^2.16.0", - "fast-xml-parser": "^4.5.0", "sharp": "^0.34.5" } } diff --git a/scripts/install-cron.sh b/scripts/install-cron.sh new file mode 100644 index 0000000..0e9501e --- /dev/null +++ b/scripts/install-cron.sh @@ -0,0 +1,42 @@ +#!/usr/bin/env bash +# Установка cron-агрегатора внешних RSS на web.hhivp.com. +# Запуск: sudo bash scripts/install-cron.sh +set -euo pipefail + +DEPLOY_PATH="${DEPLOY_PATH:-/opt/docker/sites/pushkinohistory-ru-v2}" +DATA_DIR="$DEPLOY_PATH/data" +CRON_FILE="/etc/cron.d/pushkino-rss-aggregator" +LOG_FILE="/var/log/pushkino-rss-aggregator.log" + +cd "$DEPLOY_PATH/scripts" +echo "==> installing fast-xml-parser into $DEPLOY_PATH/scripts/node_modules" +sudo -u striker npm install --no-audit --no-fund --omit=dev 2>&1 | tail -3 + +mkdir -p "$DATA_DIR" +chown striker:docker "$DATA_DIR" +chmod 775 "$DATA_DIR" + +cat > "$CRON_FILE" <> $LOG_FILE 2>&1 +EOF +chmod 644 "$CRON_FILE" + +cat > /etc/logrotate.d/pushkino-rss-aggregator < done. cron file: $CRON_FILE | log: $LOG_FILE" diff --git a/scripts/package.json b/scripts/package.json new file mode 100644 index 0000000..b2ba426 --- /dev/null +++ b/scripts/package.json @@ -0,0 +1,9 @@ +{ + "name": "pushkinohistory-cron", + "type": "module", + "private": true, + "description": "Standalone cron-скрипт для агрегации внешних RSS. Изолирован от основного app package.json.", + "dependencies": { + "fast-xml-parser": "^4.5.0" + } +}