Initial commit: update3
This commit is contained in:
23
hmi-scripts/deploy-env.sh
Normal file
23
hmi-scripts/deploy-env.sh
Normal 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."
|
||||
10
hmi-scripts/deploy-war.sh
Normal file
10
hmi-scripts/deploy-war.sh
Normal file
@@ -0,0 +1,10 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
TARGET="${1:-}"
|
||||
if [[ -z "$TARGET" || ! -f "$TARGET/backend/pom.xml" ]]; then echo 'Usage: deploy-war.sh /path/to/Workbench' >&2; exit 2; fi
|
||||
command -v npm >/dev/null || { echo 'npm fehlt' >&2; exit 2; }
|
||||
command -v mvn >/dev/null || { echo 'mvn fehlt' >&2; exit 2; }
|
||||
(cd "$TARGET/hmi-frontend" && npm install && npm run build)
|
||||
(cd "$TARGET/backend" && mvn clean package)
|
||||
echo 'WAR wurde gebaut. Bitte zunächst nach DEV deployen und HMI-Schema / Rollen prüfen.'
|
||||
find "$TARGET/backend/target" -maxdepth 1 -name '*.war' -printf '%p\n'
|
||||
Reference in New Issue
Block a user