Make deploy defaults host-agnostic and support Enter auth submit
This commit is contained in:
@@ -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.
|
||||
# Required modules: proxy, proxy_http, proxy_wstunnel
|
||||
# Optional but recommended modules for client update freshness: headers, setenvif
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
REPO_ROOT="${1:-/home/bestmidi/chgrid}"
|
||||
PUBLISH_DIR="${2:-/home/bestmidi/public_html/chgrid}"
|
||||
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/}"
|
||||
CLIENT_DIR="$REPO_ROOT/client"
|
||||
PHP_PROXY_DIR="$REPO_ROOT/deploy/php"
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
#!/usr/bin/env bash
|
||||
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:-}"
|
||||
RESTART_CMD="${3:-/usr/local/cpanel/scripts/restartsrv_httpd}"
|
||||
SNIPPET_PATH="$REPO_ROOT/deploy/apache/chgrid-vhost-snippet.conf"
|
||||
|
||||
if [[ -z "$INCLUDE_PATH" ]]; then
|
||||
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
|
||||
fi
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
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"
|
||||
PYTHON_SPEC="${PYTHON_SPEC:-3.13}"
|
||||
|
||||
@@ -16,7 +17,7 @@ if [[ ! -d "$SERVER_DIR" ]]; then
|
||||
fi
|
||||
if [[ ! -f "$SERVER_DIR/pyproject.toml" ]]; then
|
||||
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
|
||||
fi
|
||||
|
||||
|
||||
@@ -1,24 +1,51 @@
|
||||
#!/usr/bin/env bash
|
||||
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}"
|
||||
SRC_UNIT="$REPO_ROOT/deploy/systemd/$UNIT_NAME"
|
||||
DST_UNIT="/etc/systemd/system/$UNIT_NAME"
|
||||
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
|
||||
echo "error: unit file not found: $SRC_UNIT" >&2
|
||||
if [[ ! -x "$RUN_SERVER" ]]; then
|
||||
echo "error: executable run script not found: $RUN_SERVER" >&2
|
||||
exit 1
|
||||
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
|
||||
sudo rm -f "$DROPIN_FILE"
|
||||
fi
|
||||
sudo install -d -m 0755 -o bestmidi -g bestmidi "$REPO_ROOT/server/runtime"
|
||||
sudo touch "$REPO_ROOT/server/runtime/server.log"
|
||||
sudo chown bestmidi:bestmidi "$REPO_ROOT/server/runtime/server.log"
|
||||
sudo install -d -m 0755 -o "$OWNER_USER" -g "$OWNER_GROUP" "$RUNTIME_DIR"
|
||||
sudo touch "$SERVER_LOG"
|
||||
sudo chown "$OWNER_USER:$OWNER_GROUP" "$SERVER_LOG"
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl enable --now "$UNIT_NAME"
|
||||
sudo systemctl restart "$UNIT_NAME"
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
REPO_ROOT="${1:-/home/bestmidi/chgrid}"
|
||||
PUBLISH_DIR="${2:-/home/bestmidi/public_html/chgrid}"
|
||||
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/}"
|
||||
SERVICE_NAME="${4:-chat-grid.service}"
|
||||
|
||||
|
||||
@@ -4,14 +4,8 @@ After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=bestmidi
|
||||
Group=bestmidi
|
||||
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
|
||||
# This file is a reference example.
|
||||
# Use deploy/scripts/install_service.sh to generate an environment-specific unit.
|
||||
Restart=always
|
||||
RestartSec=3
|
||||
|
||||
|
||||
Reference in New Issue
Block a user