# SPDX-License-Identifier: MIT
# Node-RED on the measured requirements bench: what passage.sh needs to know about the application.
# Sourced by passage.sh, on the Proxmox host.

APP_NOM=node-red
APP_VERSION=5.0.10
APP_IMAGES="nodered/node-red:5.0.10@sha256:3622786c15b6f57f61bf1d0ece59d06a18b742c5c8955f588d189b6bee8dc97d"
APP_SANTE="http://10.30.0.207:1880/"
APP_SANTE_MOTIF='Node-RED'
APP_DONNEES="data"
APP_UNITE="flow"

# Simulated users per profile: one automation (a flow) and the device that feeds it.
app_utilisateurs() {
  case "$1" in
    idle) echo 0 ;;
    light) echo 10 ;;
    sustained) echo 50 ;;
  esac
}

# The reference dataset: one flow of 9 nodes per simulated user, deployed by the Admin API.
app_jeu_de_donnees() { echo "$1"; }

# Lays the files out in the measured container; /data belongs to the container's user 1000.
app_poser() {
  local ct=$1 src=$2
  pct exec "$ct" -- mkdir -p /opt/banc/app/data
  pct exec "$ct" -- chown 1000:1000 /opt/banc/app/data
  pct push "$ct" "$src/compose.yaml" /opt/banc/app/compose.yaml
  pct push "$ct" "$src/comptes.sh" /opt/banc/comptes.sh --perms 755
}
