Dashboard publishes directly into /var/www/trade (no subfolder)
Adds exactly three files next to the portal: dashboard.html, snapshot.json, news.json. README covers chown vs setfacl for write access. Claude-Session: https://claude.ai/code/session_01Wc9ZoqKLYBT2QJcpRWKoGm
This commit is contained in:
@@ -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/trade/gold-dashboard
|
Out dir precedence: --out → DASHBOARD_OUT_DIR env → /var/www/trade
|
||||||
"""
|
"""
|
||||||
|
|
||||||
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/trade/gold-dashboard"
|
DEFAULT_OUT_DIR = "/var/www/trade"
|
||||||
SCAN_BUFFER_SECONDS = 10
|
SCAN_BUFFER_SECONDS = 10
|
||||||
SNAPSHOT_FILE = "snapshot.json"
|
SNAPSHOT_FILE = "snapshot.json"
|
||||||
NEWS_FILE = "news.json"
|
NEWS_FILE = "news.json"
|
||||||
|
|||||||
+16
-11
@@ -19,17 +19,21 @@ venv/bin/python test_all.py # optional sanity: suite must be green
|
|||||||
|
|
||||||
No new Python dependencies are required.
|
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
|
The dashboard publishes straight into the portal docroot `/var/www/trade/`
|
||||||
own subfolder so its three files never mix with the portal's:
|
(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
|
```bash
|
||||||
sudo mkdir -p /var/www/trade/gold-dashboard
|
# if the portal files can be owned by the daemon user:
|
||||||
sudo chown Forex: /var/www/trade/gold-dashboard # the user the daemon runs as
|
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.)
|
line, or `--out` for one-off runs.)
|
||||||
|
|
||||||
SELinux (RHEL/Alma/CentOS enforcing): directories under `/var/www` normally
|
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:
|
no action is usually needed. If Apache 403s despite correct permissions:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
sudo restorecon -R /var/www/trade/gold-dashboard
|
sudo restorecon -R /var/www/trade
|
||||||
```
|
```
|
||||||
|
|
||||||
## 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/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://<server>/gold-dashboard/dashboard.html` — all four
|
Then open `http://<server>/dashboard.html` (path relative to however the
|
||||||
timeframe cards, the calendar, and the newswire should populate.
|
vhost maps `/var/www/trade`) — all four timeframe cards, the calendar, and
|
||||||
|
the newswire should populate.
|
||||||
|
|
||||||
## 4. Install the daemon
|
## 4. Install the daemon
|
||||||
|
|
||||||
@@ -71,7 +76,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/trade/gold-dashboard">
|
<Directory "/var/www/trade">
|
||||||
<FilesMatch "\.json$">
|
<FilesMatch "\.json$">
|
||||||
Header set Cache-Control "no-cache"
|
Header set Cache-Control "no-cache"
|
||||||
</FilesMatch>
|
</FilesMatch>
|
||||||
|
|||||||
@@ -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/trade/gold-dashboard
|
Environment=DASHBOARD_OUT_DIR=/var/www/trade
|
||||||
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
|
||||||
|
|||||||
Reference in New Issue
Block a user