Support per-instance media proxy deploy config

This commit is contained in:
Jage9
2026-03-09 00:13:06 -04:00
parent 11ce019766
commit d10f45d4e2
3 changed files with 13 additions and 3 deletions

View File

@@ -46,6 +46,10 @@ cd "$REPO_ROOT"
./deploy/scripts/deploy_client.sh "$REPO_ROOT" "$PUBLISH_DIR" "$BASE_PATH"
```
Optional 4th arg:
- server config path used when generating `media_proxy.config.php`
- use this for secondary grids that do not use `server/config.toml`
## 4) Install/Reload Service Unit
```bash
@@ -67,6 +71,9 @@ cd "$REPO_ROOT"
./deploy/scripts/up.sh "$REPO_ROOT" "$PUBLISH_DIR" "$BASE_PATH" "$UNIT_NAME"
```
Optional 5th arg:
- server config path used when generating the media proxy session-check URL
## 6) Apache Websocket Proxy
Install your vhost include from the provided snippet:
@@ -108,7 +115,7 @@ ProxyPassReverse /listen/8000/ http://127.0.0.1:8000/
`deploy/php/media_proxy.php` is copied into your publish directory by `deploy_client.sh`.
When `server/.env` contains `CHGRID_HOST_ORIGIN`, `deploy_client.sh` also generates `media_proxy.config.php` in the publish directory so the proxy can enforce the same origin and validate authenticated sessions without extra Apache-specific config. The generated file derives the local auth-check URL from `server/config.toml`, so custom signaling ports continue to work, and the proxy reuses `CHGRID_HOST_ORIGIN` for its internal auth check.
When `server/.env` contains `CHGRID_HOST_ORIGIN`, `deploy_client.sh` also generates `media_proxy.config.php` in the publish directory so the proxy can enforce the same origin and validate authenticated sessions without extra Apache-specific config. The generated file derives the local auth-check URL from the selected server config file (default `server/config.toml`), so custom signaling ports and secondary grid configs continue to work, and the proxy reuses `CHGRID_HOST_ORIGIN` for its internal auth check.
If you deploy the PHP proxy some other way, you can still provide `CHGRID_HOST_ORIGIN` directly through your PHP/web-server environment.

View File

@@ -5,6 +5,7 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO_ROOT="${1:-$(cd "$SCRIPT_DIR/../.." && pwd)}"
PUBLISH_DIR="${2:-$REPO_ROOT/deploy/publish/chgrid}"
BASE_PATH="${3:-/chgrid/}"
SERVER_CONFIG_PATH="${4:-$REPO_ROOT/server/config.toml}"
CLIENT_DIR="$REPO_ROOT/client"
PHP_PROXY_DIR="$REPO_ROOT/deploy/php"
SERVER_ENV_FILE="$REPO_ROOT/server/.env"
@@ -45,7 +46,7 @@ if [[ -n "${CHGRID_HOST_ORIGIN:-}" ]]; then
config_python="$SERVER_VENV_PYTHON"
fi
session_check_url="$(
"$config_python" - "$REPO_ROOT/server/config.toml" <<'PY'
"$config_python" - "$SERVER_CONFIG_PATH" <<'PY'
from pathlib import Path
import sys
@@ -105,3 +106,4 @@ find "$PUBLISH_DIR" -type f -exec chmod 644 {} +
echo "client deploy complete: $PUBLISH_DIR"
echo "client base path: $BASE_PATH"
echo "server config path: $SERVER_CONFIG_PATH"

View File

@@ -6,7 +6,8 @@ REPO_ROOT="${1:-$(cd "$SCRIPT_DIR/../.." && pwd)}"
PUBLISH_DIR="${2:-$REPO_ROOT/deploy/publish/chgrid}"
BASE_PATH="${3:-/chgrid/}"
SERVICE_NAME="${4:-chat-grid.service}"
SERVER_CONFIG_PATH="${5:-$REPO_ROOT/server/config.toml}"
"$REPO_ROOT/deploy/scripts/deploy_client.sh" "$REPO_ROOT" "$PUBLISH_DIR" "$BASE_PATH"
"$REPO_ROOT/deploy/scripts/deploy_client.sh" "$REPO_ROOT" "$PUBLISH_DIR" "$BASE_PATH" "$SERVER_CONFIG_PATH"
sudo systemctl restart "$SERVICE_NAME"
sudo systemctl status "$SERVICE_NAME" --no-pager