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:
Harwinder Sekhon
2026-08-03 17:17:37 -04:00
parent 0445a20a76
commit be5dd4a25b
3 changed files with 19 additions and 14 deletions
+16 -11
View File
@@ -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://<server>/gold-dashboard/dashboard.html` — all four
timeframe cards, the calendar, and the newswire should populate.
Then open `http://<server>/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=<epoch>`), so no Apache config is
strictly needed. To be explicit anyway:
```apache
<Directory "/var/www/trade/gold-dashboard">
<Directory "/var/www/trade">
<FilesMatch "\.json$">
Header set Cache-Control "no-cache"
</FilesMatch>
+1 -1
View File
@@ -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