Dashboard out-dir default → /var/www/trade/gold-dashboard (live portal docroot)
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Wc9ZoqKLYBT2QJcpRWKoGm
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user