diff --git a/dashboard_publisher.py b/dashboard_publisher.py index 263f370..496241f 100644 --- a/dashboard_publisher.py +++ b/dashboard_publisher.py @@ -32,7 +32,7 @@ duplicate-fetch dedup (providers have no in-flight dedup; Oanda has no throttle). Keep it sequential. Run: python dashboard_publisher.py [--once] [--out DIR] -Out dir precedence: --out → DASHBOARD_OUT_DIR env → /var/www/trade/gold-dashboard +Out dir precedence: --out → DASHBOARD_OUT_DIR env → /var/www/trade """ import argparse @@ -71,7 +71,7 @@ TF_INTERVAL_MINUTES = { Timeframe.M5: 5, Timeframe.M15: 15, Timeframe.H1: 60, Timeframe.H4: 240, } -DEFAULT_OUT_DIR = "/var/www/trade/gold-dashboard" +DEFAULT_OUT_DIR = "/var/www/trade" SCAN_BUFFER_SECONDS = 10 SNAPSHOT_FILE = "snapshot.json" NEWS_FILE = "news.json" diff --git a/deploy/README-dashboard.md b/deploy/README-dashboard.md index 9103a54..7107fe0 100644 --- a/deploy/README-dashboard.md +++ b/deploy/README-dashboard.md @@ -19,17 +19,21 @@ venv/bin/python test_all.py # optional sanity: suite must be green No new Python dependencies are required. -## 2. Create the web folder +## 2. Make the web folder writable -The portal docroot on this server is `/var/www/trade/`; the dashboard gets its -own subfolder so its three files never mix with the portal's: +The dashboard publishes straight into the portal docroot `/var/www/trade/` +(owner decision 2026-08-03) — it adds exactly three files there: +`dashboard.html`, `snapshot.json`, `news.json`. The daemon user must be able +to write them: ```bash -sudo mkdir -p /var/www/trade/gold-dashboard -sudo chown Forex: /var/www/trade/gold-dashboard # the user the daemon runs as +# if the portal files can be owned by the daemon user: +sudo chown Forex: /var/www/trade +# otherwise grant write without changing ownership: +sudo setfacl -m u:Forex:rwx /var/www/trade ``` -(Any other path works too — set it in the unit's `Environment=DASHBOARD_OUT_DIR=` +(A different path is one edit away: the unit's `Environment=DASHBOARD_OUT_DIR=` line, or `--out` for one-off runs.) SELinux (RHEL/Alma/CentOS enforcing): directories under `/var/www` normally @@ -37,18 +41,19 @@ already carry `httpd_sys_content_t`, and new files inherit the parent label, so no action is usually needed. If Apache 403s despite correct permissions: ```bash -sudo restorecon -R /var/www/trade/gold-dashboard +sudo restorecon -R /var/www/trade ``` ## 3. Smoke-test once ```bash venv/bin/python dashboard_publisher.py --once -ls /var/www/trade/gold-dashboard # dashboard.html snapshot.json news.json +ls /var/www/trade # dashboard.html snapshot.json news.json added next to the portal ``` -Then open `http:///gold-dashboard/dashboard.html` — all four -timeframe cards, the calendar, and the newswire should populate. +Then open `http:///dashboard.html` (path relative to however the +vhost maps `/var/www/trade`) — all four timeframe cards, the calendar, and +the newswire should populate. ## 4. Install the daemon @@ -71,7 +76,7 @@ The page cache-busts its JSON fetches (`?t=`), so no Apache config is strictly needed. To be explicit anyway: ```apache - + Header set Cache-Control "no-cache" diff --git a/deploy/gold-dashboard.service b/deploy/gold-dashboard.service index c2975cc..320f023 100644 --- a/deploy/gold-dashboard.service +++ b/deploy/gold-dashboard.service @@ -14,7 +14,7 @@ Type=simple # Adjust to the account that owns /home/Forex/ForexBot2: User=Forex WorkingDirectory=/home/Forex/ForexBot2 -Environment=DASHBOARD_OUT_DIR=/var/www/trade/gold-dashboard +Environment=DASHBOARD_OUT_DIR=/var/www/trade ExecStart=/home/Forex/ForexBot2/venv/bin/python dashboard_publisher.py Restart=always RestartSec=30