Merge pull request 'fix(deploy): ensure writer-pipeline var is writable by www-data (BIT-25140/BIT-25141)' (#21) from task/BIT-25140-writer-var-eacces into main
Tests / writer-pipeline tests (push) Failing after 17s
Tests / bridge tests (push) Successful in 42s
Tests / frontend lib tests (push) Successful in 49s

fix(deploy): ensure writer-pipeline var is writable by www-data
This commit was merged in pull request #21.
This commit is contained in:
spark committed 2026-06-14 21:13:11 +01:00
commit 58e1fb85eb
3 files changed
+15

No files matched your search

+2
View File
@@ -120,6 +120,8 @@ chown -R www-data:www-data "$APP_DIR/frontend/dist" 2>/dev/null || true
chown -R www-data:www-data "$APP_DIR/bridge/dist" 2>/dev/null || true
mkdir -p "$APP_DIR/bridge/config/writers"
chown www-data:www-data "$APP_DIR/bridge/config/writers"
mkdir -p "$APP_DIR/writer-pipeline/var"
chown -R www-data:www-data "$APP_DIR/writer-pipeline/var"
log ""
log "=== Deployment complete ==="
+12
View File
@@ -98,4 +98,16 @@ fi
bash "$APP_DIR/deploy/scripts/wordpress-sync-options-url.sh" || log "wordpress-sync-options-url skipped or failed"
# Rebuild writer-pipeline if changed (systemd oneshots run as www-data)
if git diff --name-only "$LOCAL" "$REMOTE" | grep -q "^writer-pipeline/"; then
log "Writer pipeline changed — rebuilding..."
cd "$APP_DIR/writer-pipeline"
npm ci --silent
npm run build
log "Writer pipeline rebuilt."
fi
mkdir -p "$APP_DIR/writer-pipeline/var"
chown -R www-data:www-data "$APP_DIR/writer-pipeline/var"
log "Deploy complete at $REMOTE."
@@ -114,6 +114,7 @@ Add for **aggregator / writer-pipeline**:
| Single failed ingest; self-heals on retry | Log in issue; no escalation. |
| Repeated ingest errors or copyright/licensing uncertainty | Pause automated ingest for the suspect feed; involve **editorial** + **CTO**. |
| Data corruption suspicion on `aggregated-items.json` | Stop aggregator; take a **file backup**; restore from known good or re-ingest; involve **CTO** before destructive deletes. |
| **`EACCES`** on `writer-pipeline/var/aggregated-items.json` (systemd `User=www-data`) | `var/` or the JSON store was created as **root** (manual run, deploy gap). On CT222: `sudo mkdir -p /opt/news-platform/writer-pipeline/var && sudo chown -R www-data:www-data /opt/news-platform/writer-pipeline/var`; re-run `news-writer-andebol.service` / `news-writer-newsproject.service`. Deploy scripts enforce ownership on every pull (**BIT-25140**). |
### 4.2 Paperclip and queue hygiene