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

APP_NOM=ntfy
APP_VERSION=v2.38.3
APP_IMAGES="binwiederhier/ntfy:v2.38.3@sha256:874299b207a9815e7a0cf551b3a094241db7604fa2d274bbd86f569154b6ea51"
APP_FICHIERS="compose.yaml server.yml comptes.sh"
APP_SANTE="http://10.30.0.207:2586/v1/health"
APP_SANTE_MOTIF='"healthy":true'
APP_DONNEES="lib"            # folders of /opt/banc/app whose size is measured
APP_UNITE="message"          # unit of the disk growth

# Simulated users per profile; the idle profile has none.
app_utilisateurs() {
  case "$1" in
    idle) echo 0 ;;
    light) echo 10 ;;
    sustained) echo 50 ;;
  esac
}

# Size of the reference dataset: 12 h of the profile's traffic (N / 10 messages per second).
app_jeu_de_donnees() { echo $(( $1 * 4320 )); }

# Lays the files out in the measured container (server.yml goes to etc/).
app_poser() {
  local ct=$1 src=$2
  pct exec "$ct" -- mkdir -p /opt/banc/app/etc /opt/banc/app/lib
  pct push "$ct" "$src/compose.yaml" /opt/banc/app/compose.yaml
  pct push "$ct" "$src/server.yml" /opt/banc/app/etc/server.yml
  pct push "$ct" "$src/comptes.sh" /opt/banc/comptes.sh --perms 755
}
