Support per-instance media proxy deploy config
This commit is contained in:
@@ -46,6 +46,10 @@ cd "$REPO_ROOT"
|
|||||||
./deploy/scripts/deploy_client.sh "$REPO_ROOT" "$PUBLISH_DIR" "$BASE_PATH"
|
./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
|
## 4) Install/Reload Service Unit
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@@ -67,6 +71,9 @@ cd "$REPO_ROOT"
|
|||||||
./deploy/scripts/up.sh "$REPO_ROOT" "$PUBLISH_DIR" "$BASE_PATH" "$UNIT_NAME"
|
./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
|
## 6) Apache Websocket Proxy
|
||||||
|
|
||||||
Install your vhost include from the provided snippet:
|
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`.
|
`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.
|
If you deploy the PHP proxy some other way, you can still provide `CHGRID_HOST_ORIGIN` directly through your PHP/web-server environment.
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|||||||
REPO_ROOT="${1:-$(cd "$SCRIPT_DIR/../.." && pwd)}"
|
REPO_ROOT="${1:-$(cd "$SCRIPT_DIR/../.." && pwd)}"
|
||||||
PUBLISH_DIR="${2:-$REPO_ROOT/deploy/publish/chgrid}"
|
PUBLISH_DIR="${2:-$REPO_ROOT/deploy/publish/chgrid}"
|
||||||
BASE_PATH="${3:-/chgrid/}"
|
BASE_PATH="${3:-/chgrid/}"
|
||||||
|
SERVER_CONFIG_PATH="${4:-$REPO_ROOT/server/config.toml}"
|
||||||
CLIENT_DIR="$REPO_ROOT/client"
|
CLIENT_DIR="$REPO_ROOT/client"
|
||||||
PHP_PROXY_DIR="$REPO_ROOT/deploy/php"
|
PHP_PROXY_DIR="$REPO_ROOT/deploy/php"
|
||||||
SERVER_ENV_FILE="$REPO_ROOT/server/.env"
|
SERVER_ENV_FILE="$REPO_ROOT/server/.env"
|
||||||
@@ -45,7 +46,7 @@ if [[ -n "${CHGRID_HOST_ORIGIN:-}" ]]; then
|
|||||||
config_python="$SERVER_VENV_PYTHON"
|
config_python="$SERVER_VENV_PYTHON"
|
||||||
fi
|
fi
|
||||||
session_check_url="$(
|
session_check_url="$(
|
||||||
"$config_python" - "$REPO_ROOT/server/config.toml" <<'PY'
|
"$config_python" - "$SERVER_CONFIG_PATH" <<'PY'
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
@@ -105,3 +106,4 @@ find "$PUBLISH_DIR" -type f -exec chmod 644 {} +
|
|||||||
|
|
||||||
echo "client deploy complete: $PUBLISH_DIR"
|
echo "client deploy complete: $PUBLISH_DIR"
|
||||||
echo "client base path: $BASE_PATH"
|
echo "client base path: $BASE_PATH"
|
||||||
|
echo "server config path: $SERVER_CONFIG_PATH"
|
||||||
|
|||||||
@@ -6,7 +6,8 @@ REPO_ROOT="${1:-$(cd "$SCRIPT_DIR/../.." && pwd)}"
|
|||||||
PUBLISH_DIR="${2:-$REPO_ROOT/deploy/publish/chgrid}"
|
PUBLISH_DIR="${2:-$REPO_ROOT/deploy/publish/chgrid}"
|
||||||
BASE_PATH="${3:-/chgrid/}"
|
BASE_PATH="${3:-/chgrid/}"
|
||||||
SERVICE_NAME="${4:-chat-grid.service}"
|
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 restart "$SERVICE_NAME"
|
||||||
sudo systemctl status "$SERVICE_NAME" --no-pager
|
sudo systemctl status "$SERVICE_NAME" --no-pager
|
||||||
|
|||||||
Reference in New Issue
Block a user