Initial commit: update3

This commit is contained in:
chris
2026-10-23 19:29:37 +00:00
commit 1ca5e14cec
167 changed files with 20614 additions and 0 deletions

23
hmi-scripts/deploy-env.sh Normal file
View File

@@ -0,0 +1,23 @@
#!/usr/bin/env bash
set -euo pipefail
if [[ $# -ne 3 ]]; then
echo 'Usage: deploy-env.sh dev|demo|prod /path/to/Workbench /path/to/environment.env' >&2; exit 2
fi
ENVIRONMENT="$1"; TARGET="$2"; CONFIG="$3"
case "$ENVIRONMENT" in dev|demo|prod) ;; *) echo 'Environment must be dev|demo|prod' >&2; exit 2;; esac
if [[ "$ENVIRONMENT" == 'prod' && "${I_ACCEPT_PROD_DEPLOY:-}" != 'true' ]]; then
echo 'PROD deployment blocked: after backup/review set I_ACCEPT_PROD_DEPLOY=true explicitly.' >&2;exit 2
fi
[[ -f "$CONFIG" ]] || { echo 'Missing environment config' >&2;exit 2; }
# shellcheck disable=SC1090
source "$CONFIG"
: "${ASADMIN_HOST:?}" "${ASADMIN_PORT:?}" "${ASADMIN_USER:?}" "${ASADMIN_PASSWORD_FILE:?}" "${CONTEXT_ROOT:?}"
[[ -r "$ASADMIN_PASSWORD_FILE" ]] || { echo 'asadmin password file unreadable' >&2;exit 2; }
command -v asadmin >/dev/null || { echo 'GlassFish asadmin not on PATH' >&2;exit 2; }
shopt -s nullglob
WARS=("$TARGET"/backend/target/*.war)
[[ ${#WARS[@]} -eq 1 ]] || { echo 'Expected exactly one WAR in backend/target; build with mvn first.' >&2;exit 2; }
echo "Deploying $ENVIRONMENT ${WARS[0]} to $ASADMIN_HOST ($CONTEXT_ROOT)."
asadmin --host "$ASADMIN_HOST" --port "$ASADMIN_PORT" --user "$ASADMIN_USER" --passwordfile "$ASADMIN_PASSWORD_FILE" \
deploy --force=true --name backend --contextroot "$CONTEXT_ROOT" "${WARS[0]}"
echo "Deployment submitted. Verify GlassFish logs for 'HMI Initialized' and test /$CONTEXT_ROOT/api/hmi/v1/status as HMI Admin."