From 7a281125e92132d49c09363ca25b9603b0170c56 Mon Sep 17 00:00:00 2001 From: Harwinder Sekhon Date: Mon, 3 Aug 2026 17:14:08 -0400 Subject: [PATCH] =?UTF-8?q?Dashboard=20out-dir=20default=20=E2=86=92=20/va?= =?UTF-8?q?r/www/trade/gold-dashboard=20(live=20portal=20docroot)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_01Wc9ZoqKLYBT2QJcpRWKoGm --- dashboard_publisher.py | 4 ++-- deploy/README-dashboard.md | 22 ++++++++++++++-------- deploy/gold-dashboard.service | 2 +- 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/dashboard_publisher.py b/dashboard_publisher.py index e303050..263f370 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/html/gold-dashboard +Out dir precedence: --out → DASHBOARD_OUT_DIR env → /var/www/trade/gold-dashboard """ 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/html/gold-dashboard" +DEFAULT_OUT_DIR = "/var/www/trade/gold-dashboard" 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 3d951da..9103a54 100644 --- a/deploy/README-dashboard.md +++ b/deploy/README-dashboard.md @@ -21,24 +21,30 @@ No new Python dependencies are required. ## 2. Create the web folder +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: + ```bash -sudo mkdir -p /var/www/html/gold-dashboard -sudo chown Forex: /var/www/html/gold-dashboard # the user the daemon runs as +sudo mkdir -p /var/www/trade/gold-dashboard +sudo chown Forex: /var/www/trade/gold-dashboard # the user the daemon runs as ``` -RHEL/Alma/CentOS with SELinux enforcing — label the folder so httpd may read it -(the daemon writes as a normal user; only httpd is SELinux-confined): +(Any other path works too — set it in the unit's `Environment=DASHBOARD_OUT_DIR=` +line, or `--out` for one-off runs.) + +SELinux (RHEL/Alma/CentOS enforcing): directories under `/var/www` normally +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 semanage fcontext -a -t httpd_sys_content_t '/var/www/html/gold-dashboard(/.*)?' -sudo restorecon -R /var/www/html/gold-dashboard +sudo restorecon -R /var/www/trade/gold-dashboard ``` ## 3. Smoke-test once ```bash venv/bin/python dashboard_publisher.py --once -ls /var/www/html/gold-dashboard # dashboard.html snapshot.json news.json +ls /var/www/trade/gold-dashboard # dashboard.html snapshot.json news.json ``` Then open `http:///gold-dashboard/dashboard.html` — all four @@ -65,7 +71,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 d186d79..c2975cc 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/html/gold-dashboard +Environment=DASHBOARD_OUT_DIR=/var/www/trade/gold-dashboard ExecStart=/home/Forex/ForexBot2/venv/bin/python dashboard_publisher.py Restart=always RestartSec=30