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
+14 -8
View File
@@ -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://<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:
```apache
<Directory "/var/www/html/gold-dashboard">
<Directory "/var/www/trade/gold-dashboard">
<FilesMatch "\.json$">
Header set Cache-Control "no-cache"
</FilesMatch>