Upgrade Q3-2020 auf R1-2021 "Iris"

Quelle: Upgrade-Protokoll  folio-hbz1 vom 

# Upgrade Q3-2020 Hotfix #2 => R1-2021 "Iris" vom 28. - 31.05.2021

# Voraussetzung: Q3 2020 Hotfix #2 (oder Hotfix #3) ist installiert.
# Annahme: der Standard-Mandant (hier: diku) ist abgesichert (supertenant-Modul mod-authoken a); ansonsten entfallen einige Schritte dieser Anleitung
# Snapshots der beteiligten Rechner machen (lassen): folio-server (Frontend, Backend-Module, Okapi), dbserver (Postgres-DB)
# Datenbankinhalte sichern auf dbserver
  ssh folio@dbserver
  cd db-backup
# Dump all roles on the source database
  pg_dumpall -g > roles.psql
# Dump Database contents
  pg_dump okapi > okapi.psql
  pg_dump folio > folio.psql


# Für Ubuntu-Server: Vielleicht erstmal Ubuntu hochziehen. Vor einem Release-Upgrade sollte man das machen, falls zwischendurch nicht geschehen.

  ssh folio@folio-server
# Welcome to Ubuntu 18.04.5 LTS

  sudo apt-get update
  sudo apt-get upgrade
  sudo apt dist-upgrade
# Evtl. sogar Ubuntu Release-Upgrade machen:
  sudo reboot
  sudo do-release-upgrade
    Checking for a new Ubuntu release...
# Ubuntu Upgrade auch auf folio-hbz1-dbserver
  ssh folio@dbserver
  sudo apt-get update
  sudo apt autoremove
  sudo apt-get upgrade
  sudo apt dist-upgrade
  sudo reboot

# ***************************************************************************************************************
# Upgrade der Okapi-Version (das muss man machen! Sonst kann man die neuen Module nicht ziehen) / Neustart Okapi
# ****************************************************************************************************************
# Installieren und konfigurieren Sie Okapi
# Importieren Sie den FOLIO-Signaturschlüssel, fügen Sie das FOLIO apt-Repository hinzu und installieren Sie Okapi (dieser Version).
  ssh folio@folio-server
  mkdir /usr/folio/upgrade
# okapi.conf sichern:
  sudo su
  cp -p /etc/folio/okapi/okapi.conf /usr/folio/upgrade/
#
  wget --quiet -O - https://repository.folio.org/packages/debian/folio-apt-archive-key.asc | sudo apt-key add -
OK
  sudo add-apt-repository "deb https://repository.folio.org/packages/ubuntu focal/"
  sudo apt-get update
  sudo apt-get -y --allow-change-held-packages install okapi=4.7.2-1    # R1-2021 Version
  # okapi.conf : Y or I : install the package maintainer's version
# okapi.conf zurückspielen:
  sudo cp -p /usr/folio/upgrade/okapi.conf /etc/folio/okapi/okapi.conf
  sudo apt-mark hold okapi
# Neustart Okapi:
  sudo systemctl daemon-reload
  sudo systemctl restart okapi.service
  # Nun das Log verfolgen ! Das läuft ein paar Minuten !
  # in /var/log/folio/okapi/okapi.log kommt
INFO DeploymentManager fast shutdown
# und direkt im Anschluss
INFO InternalModule InternalModule starting okapiversion=4.7.2
...
... Okpai startet die Module wieder an (das abwarten)
INFO MainVerticle Deploy completed succesfully


# Hole die Liste der Module für diesen Mandanten (nur informativ !)
  cd /usr/folio/upgrade
  export TOKEN=$( curl -s -S -D - -H "X-Okapi-Tenant: supertenant" -H "Content-type: application/json" -H "Accept: application/json" -d '{ "tenant" : "supertenant", "username" : "****", "password" : "****" }' http://localhost:9130/authn/login | grep -i "^x-okapi-token: " )
  echo $TOKEN
  export TENANT=supertenant
  curl -w '\n' -XGET -H "$TOKEN" -H "X-Okapi-Tenant: $TENANT" http://localhost:9130/_/proxy/tenants/diku/modules
  [ {
...
}, {
  "id" : "okapi-4.7.2"
} ]
  # ==> 106 Module (Edge, Frontend & Backend) (Q3 2020 Hotfix #1 Release) + 1 Okapi-Modul (R1 2021 Release)

# Hole die Liste der Module für den Super-Mandanten (nur informativ !)
  curl -w '\n' -XGET -H "$TOKEN" -H "X-Okapi-Tenant: $TENANT" http://localhost:9130/_/proxy/tenants/supertenant/modules
[ {
  "id" : "mod-authtoken-2.6.0"
}, {
  "id" : "mod-login-7.1.1"
}, {
  "id" : "mod-permissions-5.12.2"
}, {
  "id" : "mod-users-17.2.2"
}, {
  "id" : "okapi-4.7.2"
} ]


  # Wayne: Load PostgreSQL extensions in the public schema of each RMB module's database with the command ALTER EXTENSION pg_trgm SET SCHEMA public; (if all module schemas are in one database, obviously only need to do once; this is a database-level operation)
  ssh folio@dbserver
  psql -U folio
  \c folio
  ALTER EXTENSION pg_trgm SET SCHEMA public;
  ALTER EXTENSION
  \q

# Modulbeschreibungen aus dem zentralen Register abrufen:
  ssh folio@folio-server
  vim /usr/folio/folio-install/runbooks/single-server/scripts/okapi-pull.json
  {
  "urls": [
  "https://folio-registry.dev.folio.org"
  ]
  }
  curl -w '\n' -D - -X POST -H "$TOKEN" -H "X-Okapi-Tenant: $TENANT" -H "Content-type: application/json" -d @/usr/folio/folio-install/runbooks/single-server/scripts/okapi-pull.json http://localhost:9130/_/proxy/pull/modules
  2021-05-19T18:15:51,851 INFO  PullManager          Remote registry at https://folio-registry.dev.folio.org is version 4.7.1
  2021-05-19T18:15:51,852 INFO  PullManager          pull smart
  2021-05-19T18:16:16,171 INFO  PullManager          pull: 270 MDs to insert
  2021-05-19T18:16:23,919 INFO  ProxyContext         877575/proxy RES 200 37240045us okapi-4.7.2 /_/proxy/pull/modules


# Erstellen Sie die neueste Version der FOLIO Stripes-Plattform (Alfons & Ingolf)
  # Move to NodeJS LTS
  sudo n lts
  # installed : v14.17.0 (with npm 6.14.13)
  # Klone das Repositorium platform-complete, wechsle in das Verzeichnis
  # git clone https://github.com/folio-org/platform-complete
  cd /usr/folio/platform-complete
  git fetch
  # neuer Branch R1-2021, neuer Tag R1-2021-GA
  # Leihe den Zweig (s.u.) aus.
  # Lokale Änderungen zwischenspeichern. Das sollte nur stripes.config.js betreffen. Aber auch yarn.lock
  git add yarn.lock
  git stash save
  git checkout master
  git pull
  git checkout R1-2021
  git stash pop # das löscht auch den Zwischenspeicher
  # Installiere npm-Pakete
  sudo su
  yarn install
  # Done in 132.36s.
  vim ./stripes.config.js
  # => okapi: { 'url':'https://folio-hbz1.hbz-nrw.de/okapi', 'tenant':'diku' },
  # Achtung ! Hier muss eine URL rein, die über https zugänglich ist, also für die es ein Zertifikat gibt, wenn man auch auf die index.html per https zugreift !
  # Ungesicherte URLs wie z.B. http://folio-hbz1.hbz-nrw.de:9130 gehen nicht, dann kommt in der JS Konsole: "Mixed Content: The page at 'https://folio-hbz1.hbz-nrw.de/' was loaded over HTTPS, but requested an insecure resource 'http://folio-hbz1.hbz-nrw.de:9130/saml/check'. This request has been blocked; the content must be served over HTTPS."
  # in stripes.config.js kann man auch ein anderes Logo und Favoriten-Bildchen referenzieren (z.B. hbz- oder Kunden-Logo)

  # Dale 10.05.2021:
  Remove @folio/inventory-es from stripes.config.js

  NODE_ENV=production yarn build output   # dauert etwas
  # Done in 631.24s.


# Bei dieser Gelegenheit: Aufräumen der Docker-Container
  # siehe hier https://linuxize.com/post/how-to-remove-docker-images-containers-volumes-and-networks/
  sudo su
  docker system prune
  # This will remove:
  #       - all stopped containers
  #       - all networks not used by at least one container
  #       - all dangling images
  #       - all build cache
  # Total reclaimed space: 673.1kB
  # Remove unused images:
  docker image prune -a
  # total reclaimed space: 3.004GB


  # Stellen Sie ein kompatibles FOLIO-Backend bereit und aktivieren Sie es für den Mandanten

  # 1. Veröffentlichen Sie Datenquelleninformationen zur Verwendung durch bereitgestellte Module in der Okapi-Umgebung
  # Das muss man nur machen, wenn die Datenbank "folio" gelöscht wurde.
  curl -w '\n' -D - -X POST -H "$TOKEN" -H "X-Okapi-Tenant: $TENANT" -H "Content-Type: application/json" -d "{\"name\":\"DB_HOST\",\"value\":\"10.9.2.61\"}" http://localhost:9130/_/env;   # 10.9.2.61 = dbserver
  curl -w '\n' -D - -X POST -H "$TOKEN" -H "X-Okapi-Tenant: $TENANT" -H "Content-Type: application/json" -d "{\"name\":\"DB_PORT\",\"value\":\"5432\"}" http://localhost:9130/_/env;
  curl -w '\n' -D - -X POST -H "$TOKEN" -H "X-Okapi-Tenant: $TENANT" -H "Content-Type: application/json" -d "{\"name\":\"DB_DATABASE\",\"value\":\"folio\"}" http://localhost:9130/_/env;
  curl -w '\n' -D - -X POST -H "$TOKEN" -H "X-Okapi-Tenant: $TENANT" -H "Content-Type: application/json" -d "{\"name\":\"DB_USERNAME\",\"value\":\"folio\"}" http://localhost:9130/_/env;
  curl -w '\n' -D - -X POST -H "$TOKEN" -H "X-Okapi-Tenant: $TENANT" -H "Content-Type: application/json" -d "{\"name\":\"DB_PASSWORD\",\"value\":\"folio123\"}" http://localhost:9130/_/env;
  curl -w '\n' -D - -X POST -H "$TOKEN" -H "X-Okapi-Tenant: $TENANT" -H "Content-Type: application/json" -d "{\"name\":\"KAFKA_HOST\",\"value\":\"193.30.112.85\"}" http://localhost:9130/_/env;   # 193.30.112.85 = folio-server
  curl -w '\n' -D - -X POST -H "$TOKEN" -H "X-Okapi-Tenant: $TENANT" -H "Content-Type: application/json" -d "{\"name\":\"KAFKA_PORT\",\"value\":\"9092\"}" http://localhost:9130/_/env;
  curl -w '\n' -D - -X POST -H "$TOKEN" -H "X-Okapi-Tenant: $TENANT" -H "Content-Type: application/json" -d "{\"name\":\"OKAPI_URL\",\"value\":\"https://folio-hbz1.hbz-nrw.de/okapi\"}" http://localhost:9130/_/env;

  sudo docker ps | grep -v "^CONTAINER" | wc -l
  # 55 Container laufen, 53 Backend-Module der Version Q3 2020 Hotfix #2, dazu Kafka und Tierpfleger.


  # 2. Melde die Liste der Werkstatt-Module (Backend) an, um sie bereitzustellen und zu aktivieren
  # Das zieht auch die Docker-Abbilder von folioci.
  # Das wird die Module im lokalen System aufbringen und sie für den Mandanten aktivieren.
  # Bemerkung: Es läuft sehr lange, denn alle Docker-Abbilder müssen vom Docker-Hub gezogen werden. Du kannst den Fortschritt im Okapi-Log verfolgen, bei /var/log/folio/okapi/okapi.log
  # Fortschritt kann so überwacht werden: sudo docker ps | grep -v "^CONTAINER" | wc -l

  # IK: Zuerst Umgebungsvariablen für mod_pubsub ändern, wg. Kommunikation mit Kafka: siehe https://folio-org.atlassian.net/wiki/pages/viewpage.action?pageId=1770331 ; KAFKA_HOST und OKAPI_URL auf aktuelle IP-Adresse setzen
  # Das auch für diese Module machen (in R1-2021 kommunzieren diese mit Kafka): Quelle: Settings and configuration details for Data Import (applicable from R1 2021 Iris release onwards)
  mod-data-import
  mod-source-record-manager
  mod-source-record-storage
  mod-inventory
  mod-inventory-storage
  * mod-inventory-storage       The module now depends on Kafka message broker. Kafka should be up and running before module install.   Inventory-storage APIs (instances/holding-records/items - create, update, delete actions) will fail with 500 status code if Kafka is unreachable.       Make sure KAFKA_PORT and KAFKA_HOST environment variables are set and propagated to the mod-inventory-storage container before module installation.
Bohdan Suprun Mikhail Fokanov Oleksii Petrenko:
The same approach as for mod-pubsub may be used here. We tried to follow the same naming for the properties.
  cd /usr/folio/upgrade
  # Modulversion für R1 2021: 2.0.7
  wget https://folio-registry.dev.folio.org/_/proxy/modules/mod-pubsub-2.0.7 -O pubsub-module-descriptor.json
  vim pubsub-module-descriptor.json
  # Im Launch-Deskriptor anpassen:
    }, {
      "name" : "KAFKA_HOST",
      "value" : "193.30.112.85"
    }, {
      "name" : "KAFKA_PORT",
      "value" : "9092"
    }, {
      "name" : "OKAPI_URL",
      "value" : "http://193.30.112.85:9130"
    } ],
  curl -X DELETE -D - -w '\n' -H "$TOKEN" -H "X-Okapi-Tenant: $TENANT" http://localhost:9130/_/proxy/modules/mod-pubsub-2.0.7
  curl -i -w '\n' -X POST -H "$TOKEN" -H "X-Okapi-Tenant: $TENANT" -H 'Content-type: application/json' -d @pubsub-module-descriptor.json http://localhost:9130/_/proxy/modules

  Das gleiche auch (ohne OKAPI_URL) machen für
  # mod-data-import 2.0.2
  wget https://folio-registry.dev.folio.org/_/proxy/modules/mod-data-import-2.0.2 -O data-import-module-descriptor.json
  vim data-import-module-descriptor.json
  curl -X DELETE -D - -w '\n' -H "$TOKEN" -H "X-Okapi-Tenant: $TENANT" http://localhost:9130/_/proxy/modules/mod-data-import-2.0.2
  curl -i -w '\n' -X POST -H "$TOKEN" -H "X-Okapi-Tenant: $TENANT" -H 'Content-type: application/json' -d @data-import-module-descriptor.json http://localhost:9130/_/proxy/modules
  # mod-inventory 16.3.2
  wget https://folio-registry.dev.folio.org/_/proxy/modules/mod-inventory-16.3.2 -O inventory-module-descriptor.json
  vim inventory-module-descriptor.json
  curl -X DELETE -D - -w '\n' -H "$TOKEN" -H "X-Okapi-Tenant: $TENANT" http://localhost:9130/_/proxy/modules/mod-inventory-16.3.2
  curl -i -w '\n' -X POST -H "$TOKEN" -H "X-Okapi-Tenant: $TENANT" -H 'Content-type: application/json' -d @inventory-module-descriptor.json http://localhost:9130/_/proxy/modules
  # mod-inventory-storage 20.2.1 => NEIN, da steht der symbolische Wert "kafka" drin
  wget https://folio-registry.dev.folio.org/_/proxy/modules/mod-inventory-storage-20.2.1 -O inventory-storage-module-descriptor.json
  vim inventory-storage-module-descriptor.json
  # mod-source-record-manager 3.0.7
  wget https://folio-registry.dev.folio.org/_/proxy/modules/mod-source-record-manager-3.0.7 -O source-record-manager.json
  vim source-record-manager.json
  curl -X DELETE -D - -w '\n' -H "$TOKEN" -H "X-Okapi-Tenant: $TENANT" http://localhost:9130/_/proxy/modules/mod-source-record-managaer-3.07
  curl -i -w '\n' -X POST -H "$TOKEN" -H "X-Okapi-Tenant: $TENANT" -H 'Content-type: application/json' -d @sourec-record-manager.json http://localhost:9130/_/proxy/modules
  # mod-source-record-storage 5.0.4
  wget https://folio-registry.dev.folio.org/_/proxy/modules/mod-source-record-storage-5.0.4 -O source-record-storage-module-descriptor.json
  vim source-record-storage-module-descriptor.json
  curl -X DELETE -D - -w '\n' -H "$TOKEN" -H "X-Okapi-Tenant: $TENANT" http://localhost:9130/_/proxy/modules/mod-source-record-storage-5.0.4
  curl -i -w '\n' -X POST -H "$TOKEN" -H "X-Okapi-Tenant: $TENANT" -H 'Content-type: application/json' -d @source-record-storage-module-descriptor.json http://localhost:9130/_/proxy/modules

# Zuerst mod-pubsub hochziehen:
# Jason 22.01.2021: Upgrade mod-pubsub along with its dependencies:
# Wayne (FOLIO-2662): Das hier POSTen (Modul-Version aus R1-2021 benutzen):
# Das zieht auch die Container der neuen, abhängigen Module hoch:

  curl -w '\n' -D - -X POST -H "$TOKEN" -H "X-Okapi-Tenant: $TENANT" -H "Content-type: application/json" -d '[ { "id" : "mod-pubsub-2.0.7", "action" : "enable" } ]' http://localhost:9130/_/proxy/tenants/diku/install?simulate=true

HTTP/1.1 200 OK
vary: origin
X-Okapi-Trace: POST mod-authtoken-2.6.0 http://193.30.112.85:9132/_/proxy/tenants/diku/install.. : 202 476151us
Content-Type: application/json
X-Okapi-Trace: POST okapi-4.7.2 /_/proxy/tenants/diku/install.. : 200 6097559us
content-length: 89

[ {
  "id" : "mod-pubsub-2.0.7",
  "from" : "mod-pubsub-1.3.3",
  "action" : "enable"
} ]

  curl -w '\n' -D - -X POST -H "$TOKEN" -H "X-Okapi-Tenant: $TENANT" -H "Content-type: application/json" -d '[ { "id" : "mod-pubsub-2.0.7", "action" : "enable" } ]' http://localhost:9130/_/proxy/tenants/diku/install?deploy=true\&preRelease=false\&tenantParameters=loadReference%3Dtrue

HTTP/1.1 200 OK
vary: origin
Content-Type: application/json
X-Okapi-Trace: POST okapi-4.7.2 /_/proxy/tenants/diku/install.. : 200 45399904us
content-length: 89

[ {
  "id" : "mod-pubsub-2.0.7",
  "from" : "mod-pubsub-1.3.3",
  "action" : "enable"
} ]


- Elasticsearch nicht installieren !
# Dale 10.05.2021: To build without inventory-es, do the following:
  cd ~/platform-complete
  Remove mod-search and folio_inventory-es entries from install.json
  Remove mod-search from okapi-install.json
  Remove folio_inventory-es from stripes-install.json
  Remove @folio/inventory-es from package.json

# Jakub Skoczen 10.02.21 im #sys-ops Slack: for Honeysuckle -> Iris upgrade we will ask you to run mod-permissions migration last (put it at the very end of you install.json file). This will ensure that mod-permissions upgrades after all other modules have upgraded to Iris versions where duplicate permissions are already cleaned up.
  vim install.json ==> mod-permissions ganz nach unten schieben
  vim okapi-install.json ==> mod-permissions ganz nach unten schieben
  Wayne (28.05.2021): mod-aes ist aus okapi-install.conf entfernt worden (falls nicht (alte Version!), das manuell entfernen).


  # Zuerst den Supertenant hochziehen auf das neue Release (er hat kein mod-pubsub):
  curl -w '\n' -D - -X POST -H "$TOKEN" -H "X-Okapi-Tenant: $TENANT" -H "Content-type: application/json" -d @/usr/folio/platform-complete/okapi-install.json http://localhost:9130/_/proxy/tenants/supertenant/install?simulate=true\&preRelease=false
[ {
  "id" : "mod-users-17.3.0",
  "from" : "mod-users-17.2.2",
  "action" : "enable"
}, {
  "id" : "mod-login-7.2.0",
  "from" : "mod-login-7.1.1",
  "action" : "enable"
}, {
  "id" : "mod-authtoken-2.7.0",
  "from" : "mod-authtoken-2.6.0",
  "action" : "enable"
}, {
  "id" : "mod-permissions-5.13.2",
  "from" : "mod-permissions-5.12.2",
  "action" : "enable"
} ]
  # => mod-users, mod-login, mod-authtoken und mod-permissions wird hoch gezogen
  # Also nur eine Liste mit diesen 4 Modulen schicken, nicht platform-complete !
  cp /usr/folio/platform-complete/okapi-install.json /usr/folio/upgrade/supertenant-install.json
  vim supertenant-install.json # alles bis auf diese 4 Module herauswerfen
  curl -w '\n' -D - -X POST -H "$TOKEN" -H "X-Okapi-Tenant: $TENANT" -H "Content-type: application/json" -d @/usr/folio/upgrade/supertenant-install.json http://localhost:9130/_/proxy/tenants/supertenant/install?deploy=false\&preRelease=false\&tenantParameters=loadReference%3Dtrue
HTTP/1.1 200 OK

  # Schließlich alle (restlichen) Werkstatt-Module für den Mandanten bereitstellen und aktivieren:
  # Jason 22.01.2021: post the list of modules to enable for the tenant and Okapis tenant API will upgrade them for you.
  curl -w '\n' -D - -X POST -H "$TOKEN" -H "X-Okapi-Tenant: $TENANT" -H "Content-type: application/json" -d @/usr/folio/platform-complete/okapi-install.json http://localhost:9130/_/proxy/tenants/diku/install?simulate=true\&preRelease=false
[ {
  "id" : "mod-pubsub-2.0.7",
  "action" : "uptodate"
}, {
  "id" : "mod-user-import-3.3.2",
  "action" : "uptodate"
}, {
  # alle anderen stehen auf "enable"
  # mod-user-import hat keine Versionänderung erfahren, von Q3-2020 => R1-2021, alle anderen schon
  curl -w '\n' -D - -X POST -H "$TOKEN" -H "X-Okapi-Tenant: $TENANT" -H "Content-type: application/json" -d @/usr/folio/platform-complete/okapi-install.json http://localhost:9130/_/proxy/tenants/diku/install?deploy=true\&preRelease=false\&tenantParameters=loadReference%3Dtrue

  # Falls das auf Fehler läuft, noch einmal alle Module aus dem zentralen Register ziehen:
  # Bei deploy=true der Backend-Module müssen immer alle aktuellen Frontend-Module dem Discovery bekannt sein (auch wenn sie für dieses Release gar nicht benötigt werden)
  curl -w '\n' -D - -X POST -H "$TOKEN" -H "X-Okapi-Tenant: $TENANT" -H "Content-type: application/json" -d @/usr/folio/folio-install/runbooks/single-server/scripts/okapi-pull.json http://localhost:9130/_/proxy/pull/modules
  13 MDs to insert
  # Danach die restlichen Backend-Module aktivieren (kein Deploy mehr)
  curl -w '\n' -D - -X POST -H "$TOKEN" -H "X-Okapi-Tenant: $TENANT" -H "Content-type: application/json" -d @/usr/folio/platform-complete/okapi-install.json http://localhost:9130/_/proxy/tenants/diku/install?deploy=false\&preRelease=false\&tenantParameters=loadReference%3Dtrue
HTTP/1.1 100 Continue

HTTP/1.1 200 OK
vary: origin
Content-Type: application/json
X-Okapi-Trace: POST okapi-4.7.2 /_/proxy/tenants/diku/install.. : 200 368977635us
content-length: 6457

[ {
  "id" : "mod-finance-storage-7.0.3",
  "action" : "uptodate"
}, {
  "id" : "mod-orders-storage-12.0.1",
  "action" : "uptodate"
}, {
  "id" : "mod-configuration-5.6.0",
  "action" : "uptodate"
}, {
  "id" : "mod-inventory-storage-20.2.1",
  "action" : "uptodate"
}, {
  "id" : "mod-users-17.3.0",
  "action" : "uptodate"
}, {
  "id" : "mod-login-7.2.0",
  "action" : "uptodate"
}, {
  "id" : "mod-pubsub-2.0.7",
  "action" : "uptodate"
}, {
  "id" : "mod-circulation-storage-12.2.1",
  "action" : "uptodate"
}, {
  "id" : "mod-source-record-storage-5.0.4",
  "action" : "uptodate"
}, {
  "id" : "mod-inventory-16.3.2",
  "action" : "uptodate"
}, {
  "id" : "mod-organizations-storage-4.0.0",
  "action" : "uptodate"
}, {
  "id" : "mod-finance-4.1.2",
  "action" : "uptodate"
}, {
  "id" : "mod-calendar-1.11.0",
  "action" : "uptodate"
}, {
  "id" : "mod-event-config-1.7.0",
  "action" : "uptodate"
}, {
  "id" : "mod-template-engine-1.13.0",
  "action" : "uptodate"
}, {
  "id" : "mod-email-1.10.0",
  "action" : "uptodate"
}, {
  "id" : "mod-sender-1.5.0",
  "action" : "uptodate"
}, {
  "id" : "mod-notify-2.8.0",
  "action" : "uptodate"
}, {
  "id" : "mod-feesfines-16.0.1",
  "action" : "uptodate"
}, {
  "id" : "mod-patron-blocks-1.2.0",
  "action" : "uptodate"
}, {
  "id" : "mod-notes-2.11.0",
  "action" : "uptodate"
}, {
  "id" : "mod-circulation-20.1.6",
  "action" : "uptodate"
}, {
  "id" : "mod-tags-0.8.0",
  "action" : "uptodate"
}, {
  "id" : "mod-orders-12.0.1",
  "action" : "uptodate"
}, {
  "id" : "mod-agreements-4.0.1",
  "action" : "uptodate"
}, {
  "id" : "mod-user-import-3.3.2",
  "action" : "uptodate"
}, {
  "id" : "mod-licenses-3.1.0",
  "from" : "mod-licenses-3.0.1",
  "action" : "enable"
}, {
  "id" : "mod-audit-2.0.4",
  "from" : "mod-audit-1.0.4",
  "action" : "enable"
}, {
  "id" : "mod-courses-1.2.2",
  "from" : "mod-courses-1.1.2",
  "action" : "enable"
}, {
  "id" : "mod-data-export-4.0.1",
  "from" : "mod-data-export-3.0.5",
  "action" : "enable"
}, {
  "id" : "mod-data-import-converter-storage-1.10.2",
  "from" : "mod-data-import-converter-storage-1.9.2",
  "action" : "enable"
}, {
  "id" : "mod-source-record-manager-3.0.7",
  "from" : "mod-source-record-manager-2.4.3",
  "action" : "enable"
}, {
  "id" : "mod-data-import-2.0.2",
  "from" : "mod-data-import-1.11.1",
  "action" : "enable"
}, {
  "id" : "mod-kb-ebsco-java-3.7.0",
  "from" : "mod-kb-ebsco-java-3.6.5",
  "action" : "enable"
}, {
  "id" : "mod-erm-usage-4.0.0",
  "from" : "mod-erm-usage-3.0.2",
  "action" : "enable"
}, {
  "id" : "mod-data-export-spring-1.0.4",
  "action" : "enable"
}, {
  "id" : "mod-invoice-storage-5.0.1",
  "from" : "mod-invoice-storage-4.1.2",
  "action" : "enable"
}, {
  "id" : "mod-invoice-5.0.3",
  "from" : "mod-invoice-4.1.2",
  "action" : "enable"
}, {
  "id" : "mod-organizations-1.2.0",
  "from" : "mod-organizations-1.1.1",
  "action" : "enable"
}, {
  "id" : "mod-oai-pmh-3.4.2",
  "from" : "mod-oai-pmh-3.2.4",
  "action" : "enable"
}, {
  "id" : "mod-quick-marc-2.0.4",
  "from" : "mod-quick-marc-1.2.2",
  "action" : "enable"
}, {
  "id" : "mod-remote-storage-1.0.3",
  "action" : "enable"
}, {
  "id" : "mod-codex-mux-2.10.0",
  "from" : "mod-codex-mux-2.9.2",
  "action" : "enable"
}, {
  "id" : "mod-password-validator-2.0.2",
  "from" : "mod-password-validator-1.8.2",
  "action" : "enable"
}, {
  "id" : "mod-authtoken-2.7.0",
  "from" : "mod-authtoken-2.6.0",
  "action" : "enable"
}, {
  "id" : "mod-users-bl-6.2.0",
  "from" : "mod-users-bl-6.1.1",
  "action" : "enable"
}, {
  "id" : "mod-login-saml-2.1.1",
  "from" : "mod-login-saml-2.0.1",
  "action" : "enable"
}, {
  "id" : "mod-copycat-1.0.3",
  "action" : "enable"
}, {
  "id" : "mod-ncip-1.7.0",
  "from" : "mod-ncip-1.6.3",
  "action" : "enable"
}, {
  "id" : "mod-gobi-2.0.0",
  "from" : "mod-gobi-1.11.1",
  "action" : "enable"
}, {
  "id" : "mod-patron-4.4.0",
  "from" : "mod-patron-4.3.0",
  "action" : "enable"
}, {
  "id" : "mod-rtac-2.1.0",
  "from" : "mod-rtac-2.0.1",
  "action" : "enable"
}, {
  "id" : "mod-graphql-1.8.0",
  "action" : "enable"
}, {
  "id" : "mod-z3950-2.1.0",
  "action" : "enable"
}, {
  "id" : "mod-codex-inventory-1.9.0",
  "from" : "mod-codex-inventory-1.8.0",
  "action" : "enable"
}, {
  "id" : "mod-codex-ekb-1.8.0",
  "from" : "mod-codex-ekb-1.7.2",
  "action" : "enable"
}, {
  "id" : "mod-data-export-worker-1.0.6",
  "action" : "enable"
}, {
  "id" : "mod-erm-usage-harvester-3.0.2",
  "from" : "mod-erm-usage-harvester-2.0.2",
  "action" : "enable"
}, {
  "id" : "mod-permissions-5.13.2",
  "from" : "mod-permissions-5.12.2",
  "action" : "enable"
}, {
  "id" : "folio_plugin-find-po-line-2.3.100096",
  "from" : "folio_plugin-find-po-line-2.2.1",
  "action" : "enable"
}, {
  "id" : "folio_invoice-2.3.1000460",
  "from" : "folio_invoice-2.2.3",
  "action" : "enable"
}, {
  "id" : "folio_receiving-1.3.3000240",
  "from" : "folio_receiving-1.2.1",
  "action" : "enable"
}, {
  "id" : "folio_agreements-6.1.1000690",
  "from" : "folio_agreements-5.0.1",
  "action" : "enable"
}, {
  "id" : "folio_orders-2.3.10001051",
  "from" : "folio_orders-2.2.6",
  "action" : "enable"
}, {
  "id" : "folio_data-export-4.0.1000241",
  "from" : "folio_data-export-3.0.2",
  "action" : "enable"
}, {
  "id" : "folio_eholdings-6.0.3000937",
  "from" : "folio_eholdings-5.0.5",
  "action" : "enable"
}, {
  "id" : "folio_erm-comparisons-2.1.100087",
  "from" : "folio_erm-comparisons-1.1.1",
  "action" : "enable"
}, {
  "id" : "folio_plugin-find-eresource-2.1.100035",
  "from" : "folio_plugin-find-eresource-1.0.0",
  "action" : "enable"
}, {
  "id" : "folio_plugin-find-agreement-6.1.100097",
  "from" : "folio_plugin-find-agreement-5.0.0",
  "action" : "enable"
}, {
  "id" : "folio_local-kb-admin-4.1.1000176",
  "from" : "folio_local-kb-admin-3.0.0",
  "action" : "enable"
}, {
  "id" : "edge-sip2-2.0.0",
  "from" : "edge-sip2-1.4.0",
  "action" : "enable"
}, {
  "id" : "folio_users-6.0.10001480",
  "from" : "folio_users-5.0.9",
  "action" : "enable"
}, {
  "id" : "folio_circulation-5.0.1000679",
  "from" : "folio_circulation-4.0.2",
  "action" : "enable"
}, {
  "id" : "folio_erm-usage-5.0.1000307",
  "from" : "folio_erm-usage-4.0.2",
  "action" : "enable"
}, {
  "id" : "folio_stripes-smart-components-6.1.1000968",
  "from" : "folio_stripes-smart-components-5.0.4",
  "action" : "enable"
}, {
  "id" : "folio_notes-5.0.100096",
  "from" : "folio_notes-4.0.0",
  "action" : "enable"
} ]
# OK, wird fertig. Frontend-Module sind auf komischen Zwischenversionen.

  sudo docker ps | grep -v "^CONTAINER" | wc -l
119
  # davon sollten 59 Container von R1-2021 sein, sowie Tierpfleger und Kafka. Die anderen sind ältere Versionen.

  # Guck mal, was jetzt im Discovery ist:
  curl -w '\n' -D - -H "$TOKEN" -H "X-Okapi-Tenant: $TENANT" http://localhost:9130/_/discovery/modules | grep srvcId | wc
117

  # Gucke, was ist aktiviert für den Supertenant:
  curl -w '\n' -XGET -H "$TOKEN" -H "X-Okapi-Tenant: $TENANT" http://localhost:9130/_/proxy/tenants/supertenant/modules
[ {
  "id" : "mod-authtoken-2.7.0"
}, {
  "id" : "mod-login-7.2.0"
}, {
  "id" : "mod-permissions-5.13.2"
}, {
  "id" : "mod-users-17.3.0"
}, {
  "id" : "okapi-4.7.2"
} ]
  # Gut, das sind die R1 2021 Versionen.
  # Gucke, was ist aktiviert für den Mandanten
  curl -w '\n' -XGET -H "$TOKEN" -H "X-Okapi-Tenant: $TENANT" http://localhost:9130/_/proxy/tenants/diku/modules | grep "mod-" | wc
59 # Ja, das sind alle R1-2021 Backend-Module

# 3. Melde die Liste der Schaufenster-Module (Frontend) an, um sie zu aktivieren (aber nicht bereitzustellen; es sind ja keine Container)

# Für den Supertenant keine Frontend-Module installieren.
# Für den diku-Mandanten:
  curl -w '\n' -D - -X POST -H "$TOKEN" -H "X-Okapi-Tenant: $TENANT" -H "Content-type: application/json" -d @/usr/folio/platform-complete/stripes-install.json http://localhost:9130/_/proxy/tenants/diku/install?simulate=true\&preRelease=false
  curl -w '\n' -D - -X POST -H "$TOKEN" -H "X-Okapi-Tenant: $TENANT" -H "Content-type: application/json" -d @/usr/folio/platform-complete/stripes-install.json http://localhost:9130/_/proxy/tenants/diku/install?preRelease=false
HTTP/1.1 100 Continue

HTTP/1.1 200 OK
# OK, hat Zwischenversionen der Frontend-Module wieder entfernt.

  # -> 50 Frontend-Module (folio*) und 8 Edge-Module aktiviert und bereitgestellt.
  # Und hier die Zählsummen für das R1-2021 Release:
  # 59 Backend-Module (mod-aes gehört nicht dazu), 50 Frontend-Module, 8 Edge-Module und das Okapi-Module = 118 Module.
  # 59 Container + Kafka + Tierpfleger = 61 laufende Container.

  # Gucke, was ist aktiviert für den diku-Mandanten:
  curl -w '\n' -XGET -H "$TOKEN" -H "X-Okapi-Tenant: $TENANT" http://localhost:9130/_/proxy/tenants/diku/modules | grep "id" | wc
118
  # Gucke, was ist aktiviert für den Supertenant
  curl -w '\n' -XGET -H "$TOKEN" -H "X-Okapi-Tenant: $TENANT" http://localhost:9130/_/proxy/tenants/supertenant/modules
  # => 59 Container sind von diku und supertenant in Benutzung, 58 Container sind nicht in Benutzung. Außerdem laufen
  #       Tierpfleger und Kafka.

  # Entferne jetzt die 58 unbenutzten Container.
  # Erstelle eine Liste aller unbenutzen Module. Zunächst erstelle dazu eine Liste aller laufenden Container/Module:
  sudo docker ps --all > /usr/folio/upgrade/docker_ps.20210531.txt    # 119 Container

  # Alternativ kann man die Liste hieraus erstellen:

 # Gucken, was jetzt im Discovery ist:
  curl -w '\n' -D - -H "$TOKEN" -H "X-Okapi-Tenant: $TENANT" http://localhost:9130/_/discovery/modules     #  117 Module (Dieselben wie eben, außer Tierpfleger und Kafka)
  # schmeiße aus der neuen Liste alles raus, was benutzt wird
  cp docker_ps.20210531.txt modules_unused_in_R1-2021.txt
  # Schmeiße also alle Module raus, die in diesen Listen sind:
  curl -w '\n' -XGET -H "$TOKEN" -H "X-Okapi-Tenant: $TENANT" http://localhost:9130/_/proxy/tenants/supertenant/modules
  curl -w '\n' -XGET -H "$TOKEN" -H "X-Okapi-Tenant: $TENANT" http://localhost:9130/_/proxy/tenants/diku/modules
  # Över blifft (kann von Installation zu Installation variieren, je nachdem, wie viele "Altlasten" man mitgeschleppt hat):
  cat modules_unused_in_R1-2021.txt
mod-users-17.2.2
mod-audit-1.0.4
mod-codex-mux-2.9.2
mod-sender-1.4.0
mod-permissions-5.12.2
mod-finance-storage-5.0.2
mod-users-17.2.3
mod-data-export-3.0.4
mod-feesfines-15.9.2
mod-oai-pmh-3.2.4
mod-users-bl-6.1.1
mod-kb-ebsco-java-3.6.5
mod-login-saml-2.0.1
mod-orders-11.1.2
mod-login-7.1.1
mod-invoice-4.1.2
mod-licenses-3.0.1
mod-agreements-3.0.1
mod-finance-storage-6.0.1
mod-data-import-converter-storage-1.9.2
mod-template-engine-1.12.0
mod-courses-1.1.2
mod-patron-4.3.0
mod-finance-4.0.1
mod-courses-1.1.1
mod-organizations-storage-3.2.2
mod-erm-usage-3.0.2
mod-password-validator-1.8.2
mod-source-record-storage-4.1.3
mod-data-export-3.0.5
mod-inventory-16.1.3
mod-circulation-19.2.8
mod-orders-storage-11.1.4
mod-configuration-5.5.0
mod-notes-2.10.2
mod-user-import-3.3.0
mod-calendar-1.10.1
mod-erm-usage-harvester-2.0.2
mod-circulation-storage-12.1.4
mod-codex-inventory-1.8.0
mod-source-record-storage-4.1.4
mod-data-import-1.11.1
mod-codex-ekb-1.7.2
mod-tags-0.7.2
mod-organizations-1.1.1
mod-email-1.9.2
mod-notify-2.7.1
mod-invoice-storage-4.1.2
mod-event-config-1.6.1
mod-quick-marc-1.2.2
mod-source-record-manager-2.4.3
mod-ncip-1.6.3
mod-inventory-storage-19.4.4
mod-email-1.9.1
mod-patron-blocks-1.1.4
mod-authtoken-2.6.0
mod-gobi-1.11.1
mod-rtac-2.0.1
  # schicke DELETE an /discovery/modules, aber nur für die Module, die von keinem Mandanten mehr benutzt werden.
  curl -w '\n' -D - -X DELETE -H "$TOKEN" -H "X-Okapi-Tenant: $TENANT" http://localhost:9130/_/discovery/modules/<MODULE-ID>
  # z.B. curl -w '\n' -D - -X DELETE -H "$TOKEN" -H "X-Okapi-Tenant: $TENANT" http://localhost:9130/_/discovery/modules/mod-users-17.2.2
  ## wird jeweils mit "HTTP/1.1 204 No Content" quittiert.
  # Die DELETE-Befehle davor schreiben, dann die Datei ausführen:
  ./modules_unused_in_R1-2021.txt

  # Verfügbare Module auflisten lassen:
  curl -w '\n' -D - -H "$TOKEN" -H "X-Okapi-Tenant: $TENANT" http://localhost:9130/_/discovery/modules | grep srvcId | wc
59
  # Laufende Container:
  sudo docker ps | grep -v "^CONTAINER" | wc -l
61 # Die 59 Backend-Module des R1-2021 + Kafka + Tierpfleger

# *** FERTIG
Melden Sie sich an als "folio_admin:****" auf https://folio-hbz1.hbz-nrw.de
  Prüfen:
  - Funktioniert. Besteht aus 118 Modulen, davon 22 "App-Module" (siehe bei Einstellungen - Software-Versionen)
  - Referenzdaten sind da, z.B. Einstellungen - Katalog - Typen von Mitwirkenden : Übersetzer (Ueb) 7.1.2021 vom HBZ angelegt
  - sind die zuvor angelegten Benutzer da ? Ja, z.B. Suche nach "Ingolf" => username = ikuss
  - Sind im Katalog die zuvor angelegten Datensätze zu finden ? Ja, Suche z.B. nach "Kafka" im Titel => HRID 91059