Commit Graph
29 Commits
Author SHA1 Message Date
José Alves cba153cfc1 fix(docs): update CT222 IP from 10.10.50.140 to 10.10.50.204 — BIT-24053
Tests / bridge tests (push) Successful in 29s
Tests / writer-pipeline tests (push) Successful in 30s
Tests / frontend lib tests (push) Successful in 31s
Tests / writer-pipeline tests (pull_request) Successful in 28s
Tests / bridge tests (pull_request) Successful in 28s
Tests / frontend lib tests (pull_request) Successful in 26s
CT222 news-project-test changed IP following DHCP re-lease (BIT-24050
emergency fix). IP is now static at 10.10.50.204 via systemd-networkd.
Update all doc references, deploy script post-install notes, and
wordpress/README direct-access URLs.

Paperclip-Agent: Tiago Neves (devops; id 5d084b36-f38f-42a5-a92a-520005afda4f)
Paperclip-Issue: BIT-24053
Paperclip-Run: 9c69919d-4c21-48b0-8eb7-2b9745bed65c
2026-06-01 13:12:36 +00:00
Artur MoreiraandCursor 7c0a515368 feat(writer-pipeline): newsproject.bitreport.pt writer cycle and WP env split
Tests / writer-pipeline tests (push) Failing after 5s
Tests / bridge tests (push) Failing after 6s
Tests / frontend lib tests (push) Successful in 14s
Tests / writer-pipeline tests (pull_request) Successful in 11s
Tests / bridge tests (pull_request) Successful in 13s
Tests / frontend lib tests (pull_request) Successful in 14s
Add site-scoped WP credentials (NEWSPROJECT_* vs ANDEBOL_*), RSS sources
config, systemd oneshot/timer offset from andebol, env template, and
deployment docs so BIT-22288 covers both stacks.

Co-authored-by: Cursor <[email protected]>
2026-05-14 14:40:09 +00:00
spark 9d03d489e0 Merge pull request 'feat(writer-pipeline): WebDAV archive fallback + handball shortlist (BIT-22292 / BIT-22288)' (#11) from feat/bit-21912-cf-cache-rules-script into main
Tests / writer-pipeline tests (push) Failing after 10s
Tests / bridge tests (push) Successful in 14s
Tests / frontend lib tests (push) Successful in 16s
2026-05-14 15:27:09 +01:00
Artur Moreira 11cea53dab fix(frontend): auth redirects use strict false-check for auth_links (BIT-22298)
Tests / writer-pipeline tests (push) Successful in 13s
Tests / bridge tests (push) Successful in 12s
Tests / frontend lib tests (push) Successful in 12s
Tests / writer-pipeline tests (pull_request) Successful in 11s
Tests / bridge tests (pull_request) Successful in 13s
Tests / frontend lib tests (pull_request) Successful in 14s
/entrar and /registar redirected to / because !config.auth_links is
truthy when auth_links is undefined (config fallback).  Change both
pages to config.auth_links === false so only an explicit opt-out sends
the user home; missing or true both forward to wp-login.php.

Also add Cache-Control: no-store to the redirect response so edge
proxies never cache auth flows, and extend smoke-andebol.sh to assert
/entrar and /registar resolve to a wp-login URL.

Paperclip-Issue: BIT-22298
Paperclip-Agent: d706f4e6-5d05-4cec-b6e8-f8fb1f203aae
2026-05-14 13:48:27 +00:00
Artur MoreiraandCursor 6819297e0d feat(writer-pipeline): WebDAV federation archive fallback for featured images
Tests / writer-pipeline tests (push) Successful in 14s
Tests / bridge tests (push) Successful in 14s
Tests / frontend lib tests (push) Successful in 15s
When RSS/HTML provide no image, optional WRITER_WEBDAV_* env enables PROPFIND
depth-1 listing, headline-based file pick, Basic-auth GET, and WP caption from
Credit___filename pattern or WRITER_WEBDAV_DEFAULT_CREDIT (BIT-22292).

Co-authored-by: Cursor <[email protected]>
2026-05-14 13:02:14 +00:00
Artur Moreira 95dbcbd9af fix(deploy): correct cf-cache-rules-apply.sh for CF Free plan (BIT-21922)
Tests / bridge tests (push) Successful in 16s
Tests / writer-pipeline tests (push) Successful in 19s
Tests / frontend lib tests (push) Successful in 16s
Five bugs found and fixed during live application to andebol.net and
newsproject.bitreport.pt:

- Endpoint was /entrypoints (plural); CF API requires /entrypoint (singular)
- origin_cache_control alone does not cache HTML on CF Free; added
  edge_ttl: {mode: override_origin, default: 60} which is required
- starts_with operator not supported on CF Free plan; replaced with contains
- newsproject.bitreport.pt has no own CF zone; zone lookup must use bitreport.pt
- Verification used curl -I (HEAD); rule expression matches GET only, so
  verification must use GET requests (-D - -o /dev/null)

Paperclip-Issue: BIT-21922
2026-05-12 22:37:55 +00:00
Artur Moreira 938a59dc3d feat(deploy): add cf-cache-rules-apply.sh for BIT-21912 / BIT-21847
Tests / writer-pipeline tests (push) Successful in 15s
Tests / bridge tests (push) Successful in 14s
Tests / frontend lib tests (push) Successful in 14s
Tests / writer-pipeline tests (pull_request) Successful in 11s
Tests / bridge tests (pull_request) Successful in 12s
Tests / frontend lib tests (pull_request) Successful in 13s
Cloudflare HTML Cache Rule apply + verify script for andebol.net and
newsproject.bitreport.pt. Needs CF_API_TOKEN (Cache Rules write); auto-
discovers zone IDs, upserts the rule from deployment.md runbook expression,
and runs double-curl verification. Ready to run once token is injected.

Paperclip-Issue: BIT-21912
2026-05-12 11:22:15 +00:00
Artur Moreira 6282e73926 feat(BIT-2079): add systemd service+timer for andebol.net writer pipeline
Tests / writer-pipeline tests (push) Successful in 18s
Tests / bridge tests (push) Successful in 17s
Tests / frontend lib tests (push) Successful in 17s
Daily oneshot cycle at 06:00 UTC via news-writer-andebol.timer;
env template covers ANDEBOL_WP_* credentials; deployment.md updated
with install steps, log tailing, and manual test run instructions.

Paperclip-Issue: BIT-2079
2026-05-11 21:51:33 +00:00
Artur Moreira 085ee7be88 Fix SSR 503 when bridge is unhealthy and correct systemd boot order
resolveSsrBridge now treats non-2xx /health as failure in production.
news-bridge no longer waits for news-frontend; frontend Wants+After
bridge so the API is up when Astro starts. Document the PT 503 string
and recovery commands in the BIT-746 runbook.
2026-04-23 10:36:22 +01:00
Artur Moreira f5b9a5d058 docs(monitoring): BIT-746 public URL probe, inventory, alert runbook
Extend healthcheck.sh with optional BRIDGE_DEEP_URL and PUBLIC_PAGE_URL
(customer-facing HTTPS with redirects). Document must-not-fail checks,
intervals, and escalation in docs/monitoring.md and a dedicated runbook.

Paperclip-Issue: BIT-746
Paperclip-Run: 04281f51-59ac-4267-a269-f12269dc2320
Paperclip-Agent: Tiago Neves (urlKey tiago-neves; id 5d084b36-f38f-42a5-a92a-520005afda4f)
Made-with: Cursor
2026-04-03 00:23:28 +00:00
Artur Moreira f15287e589 feat(monitoring): add service health monitoring with alerts (BIT-744)
Automated health monitoring for the news-platform services on CT222,
motivated by the bridge crash-loop incident (BIT-743) where 3,608
restarts went undetected until manual discovery.

Health endpoints:
- Bridge /health enhanced with optional ?checks=true for deep
  dependency probes (WordPress, Redis) and uptime reporting
- Frontend /health.json added as Astro API route

Monitoring infrastructure:
- healthcheck.sh: periodic probe script with HTTP checks, systemd
  restart-count detection, cooldown logic, and Ntfy push alerting
- news-healthcheck.timer: runs every 3 min (detection < 5 min)
- [email protected]: OnFailure template for instant crash alerts
- All three service units updated with OnFailure= directive
- deploy.sh updated to install monitoring units and env file

Paperclip-Agent: peter-spark
Paperclip-Issue: BIT-744
Paperclip-Run: 405ab587-8b8b-4963-8867-0feb95a994e3
2026-04-02 23:37:06 +00:00
Artur Moreira cccf26f657 fix(bridge): prevent WriterConfigService from crashing on EACCES
The module-level singleton called mkdirSync('config/writers') which
fatally crashed the bridge when running as www-data without write
permission to the working directory. The bridge has been crash-looping
with restart counter >3600, taking andebol.net offline.

Constructor now catches EACCES gracefully (warn + degrade) instead of
killing the process. Deploy scripts also ensure the directory exists
with correct ownership.

Paperclip-Agent: peter-spark
Paperclip-Issue: BIT-743
Paperclip-Run: 817ec0b4-3778-44ae-8c07-efd97a2bdd86
2026-04-02 23:28:50 +00:00
Artur MoreiraandPaperclip a77c293d0e feat(wordpress): nginx + PHP-FPM stacks; retire Apache images (BIT-578)
- Use wordpress:6-php8.3-fpm with nginx:alpine sidecars; keep host ports 8080/8081
- Add shared wp_html / wp_andebol_html volumes so nginx can serve the same docroot as FPM
- Nginx: try_files permalinks, proxy headers, HTTP_AUTHORIZATION for App Passwords
- Update deploy scripts to force-recreate nginx with wordpress when public URL is fixed
- Refresh README and deployment docs

Co-Authored-By: Paperclip <[email protected]>
Made-with: Cursor
2026-03-28 01:15:51 +00:00
Artur Moreira 50c5fafcd9 chore(deploy): extend andebol smoke for search/archive; fix Host header env (BIT-591)
- Assert GET /search, /search?q=te, /category/all return 200
- Use SMOKE_HOST instead of HOST for the vhost header (HOST=0.0.0.0 in agent envs caused 403)

Made-with: Cursor
2026-03-27 16:57:43 +00:00
Artur MoreiraandPaperclip f599f54709 fix(nginx): expose /wp-content/uploads/ publicly for article featured images
WordPress article images (featured_media) are served from /wp-content/uploads/.
The existing /wp-content/ block restricts access to RFC1918 IPs, blocking public
browsers from loading article images. Add a longer ^~ prefix match for the uploads
subdirectory so it wins over the restricted block, with 7d cache headers.

Paired with setting ANDEBOL_WORDPRESS_PUBLIC_URL=https://andebol.net in .env so
WordPress returns public image URLs instead of localhost:8081.

Co-Authored-By: Paperclip <[email protected]>
2026-03-27 11:25:27 +00:00
Artur MoreiraandPaperclip aff73455d0 feat(andebol): public WP login surface, auth nav, /entrar and /registar
- Nginx: proxy wp-login.php, wp-includes, wp-admin css/js/images, and
  wp-content/languages without RFC1918 allow (works with real_ip); keep
  rest of wp-admin, wp-content, wp-json restricted.
- Domain config: auth_links on andebol.net; optional DomainConfig field.
- Astro: Portuguese/English auth labels, header/footer links, redirects.
- Bridge: omit internal detail from 503 JSON (avoid leaking upstream msgs).
- Docs: deployment + domains schema for auth and membership.

Co-Authored-By: Paperclip <[email protected]>
Made-with: Cursor
2026-03-27 10:57:57 +00:00
738f847d36 feat: theme system + institutional theme + andebol.net domain config
Add domain-aware theme system (BIT-494, BIT-495, BIT-496, BIT-497):

- Theme architecture: move shared components into src/themes/sports/,
  create src/themes/institutional/ with handball-oriented design
- Domain config: andebol.net.json (institutional theme, pt-PT locale,
  handball categories, WP endpoint port 8081)
- theme.ts library: resolves theme components per domain config
- Updated layouts/pages to use theme-aware component loading
- Updated docs: domains.md, frontend.md with theme system docs
- Smoke test script for andebol.net
- WordPress .env.example with andebol env vars

Note: this work was completed in BIT-494/495/496/497 but was
never committed — committing now to unblock andebol.net deploy.

Co-Authored-By: Paperclip <[email protected]>
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
2026-03-27 08:38:41 +00:00
Artur Moreira e15e88ef6c fix(nginx): default_server for all NPM hostnames + WP port map
Use default_server and server_name _ so domains like andebol.net reach Astro
instead of the Debian nginx welcome page. Install map Host→WordPress port
(8080 default, andebol.net→8081). deploy.sh and webhook-deploy install
conf.d snippet and remove sites-enabled/default.

docs/deployment.md: document multi-domain NPM workflow.

Refs: BIT-345
2026-03-25 12:34:18 +00:00
Artur Moreira 67f655820a fix(wordpress): broaden proxy detection for WP_HOME inference (BIT-470)
- Treat X-Forwarded-Proto or X-Real-IP as sufficient proxy hints alongside X-Forwarded-For
- Normalize WORDPRESS_PUBLIC_URL in ensure-public-url script (trailing slash, any localhost:8080 substring)
- Update deployment.md and wordpress README

Made-with: Cursor
2026-03-24 19:47:35 +00:00
Artur Moreira 5e14e2df47 fix(deploy): auto-set WordPress public URL and sync wp_options on LXC
Add wordpress-ensure-public-url.sh (exit 2 when .env updated) and
wordpress-sync-options-url.sh to align siteurl/home with HTTPS. Wire
into deploy.sh and webhook-deploy.sh for /opt/news-platform only so
the board does not need manual .env or SQL for BIT-470/BIT-471.

Made-with: Cursor
2026-03-24 19:02:10 +00:00
Artur Moreira eee991400e fix(wordpress): wp-admin redirect behind NPM (BIT-470)
Preserve X-Forwarded-Proto from the edge proxy in CT nginx so WordPress
sees HTTPS. When WORDPRESS_PUBLIC_URL still defaults to localhost:8080,
derive WP_HOME/WP_SITEURL from Host and forwarded headers for proxied
requests (X-Forwarded-For present). Document behaviour in deployment and
wordpress README.

Made-with: Cursor
2026-03-24 18:53:25 +00:00
Artur Moreira 7095765669 feat(deploy): LXC bootstrap, smoke script, /health in nginx, deployment doc (BIT-426)
- Add deploy/lxc/setup.sh for Ubuntu 24 CT (nginx, redis, docker, node 22, pm2)
- Add deploy/scripts/smoke-newsproject.sh for /, /health, wp-json checks
- Proxy GET /health to Fastify in newsproject.bitreport.pt nginx config
- Update docs/deployment.md: remove stub, NPM hostname, bootstrap order, canonical nginx path

Made-with: Cursor
2026-03-24 02:03:40 +00:00
Artur MoreiraandPaperclip 642dec80dc docs(nginx): clarify wp-admin reachability behind NPM
Align README and deployment.md with reality: allow/deny use $remote_addr
on the CT, so a private-IP reverse proxy makes /wp-admin/ reachable from
the public Internet. Add nginx header comments and optional real_ip notes.

Co-Authored-By: Paperclip <[email protected]>
Made-with: Cursor
2026-03-23 23:13:35 +00:00
Artur MoreiraandPaperclip 7e61271bc5 feat(nginx): proxy wp-admin e wp-json com allow redes privadas
Co-Authored-By: Paperclip <[email protected]>
Made-with: Cursor
2026-03-23 20:07:55 +00:00
Artur MoreiraandPaperclip a8b71762d9 fix(news-platform): SSR domain routing, resilient homepage, Gitea deploy hook
- Forward X-Site-Host from Astro to the bridge so loopback calls use the public domain JSON
- Normalize newsproject.bitreport.pt.json (categories slug/label, wp on 127.0.0.1:8080)
- Degrade homepage/trending when WordPress is down instead of 500
- Extend webhook-deploy.sh for config/ and wordpress/ changes; add deploy-hook-server + systemd unit
- Document automatic Gitea webhook flow in docs/deployment.md; align DOMAINS_CONFIG_PATH env

Co-Authored-By: Paperclip <[email protected]>
Made-with: Cursor
2026-03-23 19:47:19 +00:00
Artur MoreiraandPaperclip 4948fc5c72 fix(deploy): add NODE_ENV=production to bridge.env.example
Without this, pino-pretty (devDep) was required at runtime causing
the bridge service to crash on first boot.

Co-Authored-By: Paperclip <[email protected]>
2026-03-23 19:39:03 +00:00
Artur MoreiraandPaperclip 0e27dd8359 fix(deploy): use full npm ci in webhook-deploy to include devDeps for tsc build
npm ci --omit=dev excluded TypeScript (devDep) causing the build step to fail.
Build needs devDeps; runtime doesn't because it runs compiled dist/.

Co-Authored-By: Paperclip <[email protected]>
2026-03-23 19:38:30 +00:00
Artur MoreiraandPaperclip 0e3a1afb3b feat: deploy pipeline — systemd units, Nginx, deploy scripts (BIT-352)
deploy/systemd/:
  - news-frontend.service (Astro SSR :4321)
  - news-bridge.service (Fastify :3200)
  - news-wordpress.service (Docker Compose wrapper)
  - frontend.env.example + bridge.env.example

deploy/nginx/:
  - newsproject.bitreport.pt.conf (reverse proxy → :4321, /api/ → :3200)
  - Nginx config validated OK on CT 222

deploy/scripts/:
  - deploy.sh — full from-scratch deploy (clone, build, install, start)
  - webhook-deploy.sh — incremental deploy on git push (cron-friendly)

Tested on CT 222 (10.10.50.140):
  - nginx -t → OK
  - systemd units installed (news-frontend/bridge/wordpress)
  - news-wordpress enabled; frontend/bridge pending Astro build

Remaining manual steps:
  - DHCP reservation for 10.10.50.140
  - NPM proxy host: newsproject.bitreport.pt → http://10.10.50.140
  - Run deploy.sh after bridge.env and frontend.env are configured

Co-Authored-By: Paperclip <[email protected]>
Made-with: Cursor
2026-03-23 15:48:43 +00:00
Tiago NevesandPaperclip f7274c9c4e chore: scaffold initial project structure
Creates the base directory layout for the news-platform:
frontend/, bridge/, wordpress/, config/domains/, docs/, deploy/.

Ref: BIT-346 — Create Gitea repo + scaffold project structure

Co-Authored-By: Paperclip <[email protected]>
Made-with: Cursor
2026-03-23 14:06:29 +00:00