Dashboard out-dir default → /var/www/trade/gold-dashboard (live portal docroot)

Claude-Session: https://claude.ai/code/session_01Wc9ZoqKLYBT2QJcpRWKoGm
This commit is contained in:
Harwinder Sekhon
2026-08-03 17:14:08 -04:00
parent 4e654b5edb
commit 0445a20a76
3 changed files with 17 additions and 11 deletions
+2 -2
View File
@@ -32,7 +32,7 @@ duplicate-fetch dedup (providers have no in-flight dedup; Oanda has no
throttle). Keep it sequential. throttle). Keep it sequential.
Run: python dashboard_publisher.py [--once] [--out DIR] 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 import argparse
@@ -71,7 +71,7 @@ TF_INTERVAL_MINUTES = {
Timeframe.M5: 5, Timeframe.M15: 15, Timeframe.H1: 60, Timeframe.H4: 240, 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 SCAN_BUFFER_SECONDS = 10
SNAPSHOT_FILE = "snapshot.json" SNAPSHOT_FILE = "snapshot.json"
NEWS_FILE = "news.json" NEWS_FILE = "news.json"
+14 -8
View File
@@ -21,24 +21,30 @@ No new Python dependencies are required.
## 2. Create the web folder ## 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 ```bash
sudo mkdir -p /var/www/html/gold-dashboard sudo mkdir -p /var/www/trade/gold-dashboard
sudo chown Forex: /var/www/html/gold-dashboard # the user the daemon runs as 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 (Any other path works too — set it in the unit's `Environment=DASHBOARD_OUT_DIR=`
(the daemon writes as a normal user; only httpd is SELinux-confined): 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 ```bash
sudo semanage fcontext -a -t httpd_sys_content_t '/var/www/html/gold-dashboard(/.*)?' sudo restorecon -R /var/www/trade/gold-dashboard
sudo restorecon -R /var/www/html/gold-dashboard
``` ```
## 3. Smoke-test once ## 3. Smoke-test once
```bash ```bash
venv/bin/python dashboard_publisher.py --once 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://<server>/gold-dashboard/dashboard.html` — all four Then open `http://<server>/gold-dashboard/dashboard.html` — all four
@@ -65,7 +71,7 @@ The page cache-busts its JSON fetches (`?t=<epoch>`), so no Apache config is
strictly needed. To be explicit anyway: strictly needed. To be explicit anyway:
```apache ```apache
<Directory "/var/www/html/gold-dashboard"> <Directory "/var/www/trade/gold-dashboard">
<FilesMatch "\.json$"> <FilesMatch "\.json$">
Header set Cache-Control "no-cache" Header set Cache-Control "no-cache"
</FilesMatch> </FilesMatch>
+1 -1
View File
@@ -14,7 +14,7 @@ Type=simple
# Adjust to the account that owns /home/Forex/ForexBot2: # Adjust to the account that owns /home/Forex/ForexBot2:
User=Forex User=Forex
WorkingDirectory=/home/Forex/ForexBot2 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 ExecStart=/home/Forex/ForexBot2/venv/bin/python dashboard_publisher.py
Restart=always Restart=always
RestartSec=30 RestartSec=30