Make deploy defaults host-agnostic and support Enter auth submit

This commit is contained in:
Jage9
2026-02-25 00:31:23 -05:00
parent a63e7027cd
commit f41e03a671
9 changed files with 64 additions and 26 deletions

View File

@@ -1,5 +1,5 @@
// Maintainer-controlled web client version. // Maintainer-controlled web client version.
// Format: YYYY.MM.DD Rn (example: 2026.02.20 R2) // Format: YYYY.MM.DD Rn (example: 2026.02.20 R2)
window.CHGRID_WEB_VERSION = "2026.02.25 R256"; window.CHGRID_WEB_VERSION = "2026.02.25 R257";
// Optional display timezone for timestamps. Falls back to America/Detroit if unset/invalid. // Optional display timezone for timestamps. Falls back to America/Detroit if unset/invalid.
window.CHGRID_TIME_ZONE = "America/Detroit"; window.CHGRID_TIME_ZONE = "America/Detroit";

View File

@@ -2690,6 +2690,19 @@ function setupUiHandlers(): void {
dom.registerEmail.addEventListener('input', () => { dom.registerEmail.addEventListener('input', () => {
updateConnectAvailability(); updateConnectAvailability();
}); });
const submitAuthOnEnter = (event: KeyboardEvent): void => {
if (event.key !== 'Enter') return;
if (dom.connectButton.disabled) return;
event.preventDefault();
connect();
};
dom.authUsername.addEventListener('keydown', submitAuthOnEnter);
dom.authPassword.addEventListener('keydown', submitAuthOnEnter);
dom.registerUsername.addEventListener('keydown', submitAuthOnEnter);
dom.registerPassword.addEventListener('keydown', submitAuthOnEnter);
dom.registerPasswordConfirm.addEventListener('keydown', submitAuthOnEnter);
dom.registerEmail.addEventListener('keydown', submitAuthOnEnter);
} }
setupInputHandlers(); setupInputHandlers();

View File

@@ -1,4 +1,4 @@
# Add inside your SSL VirtualHost include for bestmidi.com. # Add inside your SSL VirtualHost include for your domain.
# Keep your existing main DocumentRoot unchanged when hosting Chat Grid under /chgrid. # Keep your existing main DocumentRoot unchanged when hosting Chat Grid under /chgrid.
# Required modules: proxy, proxy_http, proxy_wstunnel # Required modules: proxy, proxy_http, proxy_wstunnel
# Optional but recommended modules for client update freshness: headers, setenvif # Optional but recommended modules for client update freshness: headers, setenvif

View File

@@ -1,8 +1,9 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -euo pipefail set -euo pipefail
REPO_ROOT="${1:-/home/bestmidi/chgrid}" SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PUBLISH_DIR="${2:-/home/bestmidi/public_html/chgrid}" REPO_ROOT="${1:-$(cd "$SCRIPT_DIR/../.." && pwd)}"
PUBLISH_DIR="${2:-$REPO_ROOT/deploy/publish/chgrid}"
BASE_PATH="${3:-/chgrid/}" BASE_PATH="${3:-/chgrid/}"
CLIENT_DIR="$REPO_ROOT/client" CLIENT_DIR="$REPO_ROOT/client"
PHP_PROXY_DIR="$REPO_ROOT/deploy/php" PHP_PROXY_DIR="$REPO_ROOT/deploy/php"

View File

@@ -1,14 +1,15 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -euo pipefail set -euo pipefail
REPO_ROOT="${1:-/home/bestmidi/chgrid}" SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO_ROOT="${1:-$(cd "$SCRIPT_DIR/../.." && pwd)}"
INCLUDE_PATH="${2:-}" INCLUDE_PATH="${2:-}"
RESTART_CMD="${3:-/usr/local/cpanel/scripts/restartsrv_httpd}" RESTART_CMD="${3:-/usr/local/cpanel/scripts/restartsrv_httpd}"
SNIPPET_PATH="$REPO_ROOT/deploy/apache/chgrid-vhost-snippet.conf" SNIPPET_PATH="$REPO_ROOT/deploy/apache/chgrid-vhost-snippet.conf"
if [[ -z "$INCLUDE_PATH" ]]; then if [[ -z "$INCLUDE_PATH" ]]; then
echo "usage: $0 <repo_root> <apache_include_path> [restart_cmd]" >&2 echo "usage: $0 <repo_root> <apache_include_path> [restart_cmd]" >&2
echo "example: $0 /home/bestmidi/chgrid /etc/apache2/conf.d/userdata/ssl/2_4/bestmidi/example.com/chgrid.conf" >&2 echo "example: $0 $REPO_ROOT /etc/apache2/conf.d/userdata/ssl/2_4/account/example.com/chgrid.conf" >&2
exit 1 exit 1
fi fi

View File

@@ -1,7 +1,8 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -euo pipefail set -euo pipefail
REPO_ROOT="${1:-/home/bestmidi/chgrid}" SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO_ROOT="${1:-$(cd "$SCRIPT_DIR/../.." && pwd)}"
SERVER_DIR="$REPO_ROOT/server" SERVER_DIR="$REPO_ROOT/server"
PYTHON_SPEC="${PYTHON_SPEC:-3.13}" PYTHON_SPEC="${PYTHON_SPEC:-3.13}"
@@ -16,7 +17,7 @@ if [[ ! -d "$SERVER_DIR" ]]; then
fi fi
if [[ ! -f "$SERVER_DIR/pyproject.toml" ]]; then if [[ ! -f "$SERVER_DIR/pyproject.toml" ]]; then
echo "error: missing $SERVER_DIR/pyproject.toml" >&2 echo "error: missing $SERVER_DIR/pyproject.toml" >&2
echo " verify repository files were copied to /home/bestmidi/chgrid/server" >&2 echo " verify repository files were copied to the expected repo directory" >&2
exit 1 exit 1
fi fi

View File

@@ -1,24 +1,51 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -euo pipefail set -euo pipefail
REPO_ROOT="${1:-/home/bestmidi/chgrid}" SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO_ROOT="${1:-$(cd "$SCRIPT_DIR/../.." && pwd)}"
UNIT_NAME="${2:-chat-grid.service}" UNIT_NAME="${2:-chat-grid.service}"
SRC_UNIT="$REPO_ROOT/deploy/systemd/$UNIT_NAME"
DST_UNIT="/etc/systemd/system/$UNIT_NAME" DST_UNIT="/etc/systemd/system/$UNIT_NAME"
DROPIN_FILE="/etc/systemd/system/$UNIT_NAME.d/env.conf" DROPIN_FILE="/etc/systemd/system/$UNIT_NAME.d/env.conf"
OWNER_USER="$(stat -c '%U' "$REPO_ROOT")"
OWNER_GROUP="$(stat -c '%G' "$REPO_ROOT")"
SERVER_DIR="$REPO_ROOT/server"
RUNTIME_DIR="$SERVER_DIR/runtime"
RUN_SERVER="$SERVER_DIR/run_server.sh"
SERVER_LOG="$RUNTIME_DIR/server.log"
if [[ ! -f "$SRC_UNIT" ]]; then if [[ ! -x "$RUN_SERVER" ]]; then
echo "error: unit file not found: $SRC_UNIT" >&2 echo "error: executable run script not found: $RUN_SERVER" >&2
exit 1 exit 1
fi fi
sudo cp "$SRC_UNIT" "$DST_UNIT" sudo tee "$DST_UNIT" >/dev/null <<EOF
[Unit]
Description=Chat Grid signaling server
After=network.target
[Service]
Type=simple
User=$OWNER_USER
Group=$OWNER_GROUP
WorkingDirectory=$SERVER_DIR
Environment=PATH=$SERVER_DIR/.venv/bin:/usr/bin:/bin
ExecStartPre=/usr/bin/mkdir -p $RUNTIME_DIR
ExecStart=$RUN_SERVER
StandardOutput=append:$SERVER_LOG
StandardError=append:$SERVER_LOG
Restart=always
RestartSec=3
[Install]
WantedBy=multi-user.target
EOF
if [[ -f "$DROPIN_FILE" ]]; then if [[ -f "$DROPIN_FILE" ]]; then
sudo rm -f "$DROPIN_FILE" sudo rm -f "$DROPIN_FILE"
fi fi
sudo install -d -m 0755 -o bestmidi -g bestmidi "$REPO_ROOT/server/runtime" sudo install -d -m 0755 -o "$OWNER_USER" -g "$OWNER_GROUP" "$RUNTIME_DIR"
sudo touch "$REPO_ROOT/server/runtime/server.log" sudo touch "$SERVER_LOG"
sudo chown bestmidi:bestmidi "$REPO_ROOT/server/runtime/server.log" sudo chown "$OWNER_USER:$OWNER_GROUP" "$SERVER_LOG"
sudo systemctl daemon-reload sudo systemctl daemon-reload
sudo systemctl enable --now "$UNIT_NAME" sudo systemctl enable --now "$UNIT_NAME"
sudo systemctl restart "$UNIT_NAME" sudo systemctl restart "$UNIT_NAME"

View File

@@ -1,8 +1,9 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -euo pipefail set -euo pipefail
REPO_ROOT="${1:-/home/bestmidi/chgrid}" SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PUBLISH_DIR="${2:-/home/bestmidi/public_html/chgrid}" REPO_ROOT="${1:-$(cd "$SCRIPT_DIR/../.." && pwd)}"
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}"

View File

@@ -4,14 +4,8 @@ After=network.target
[Service] [Service]
Type=simple Type=simple
User=bestmidi # This file is a reference example.
Group=bestmidi # Use deploy/scripts/install_service.sh to generate an environment-specific unit.
WorkingDirectory=/home/bestmidi/chgrid/server
Environment=PATH=/home/bestmidi/chgrid/server/.venv/bin:/usr/bin:/bin
ExecStartPre=/usr/bin/mkdir -p /home/bestmidi/chgrid/server/runtime
ExecStart=/home/bestmidi/chgrid/server/run_server.sh
StandardOutput=append:/home/bestmidi/chgrid/server/runtime/server.log
StandardError=append:/home/bestmidi/chgrid/server/runtime/server.log
Restart=always Restart=always
RestartSec=3 RestartSec=3