Upgrade R1-2021 auf R2-2021 "Juniper"
Upgrade R1-2021 => R2-2021 "Juniper"
Auf Basis von "platform-complete"
mit automatischer Migration der Datenbankinhalte
Deployment mit Okapi, "Single Server" auf BS Ubuntu 20.04.2 LTS
Server-Hardware erhĂśhenÂ
BenĂśtigt fĂźr den Upgrade R1 -> R2 werden:
 8 CPUs
 40 GB RAM
 empfohlen: 350 GB SSD HD
Ubuntu Updates installieren
 sudo apt-get update
 sudo apt-get upgrade
 sudo reboot
Nach System-Neustart muss folgendes von selber wieder anstarten:
- postgres
systemctl start postgresql (läuft schon)
- docker
systemctl start docker.service (läuft schon)
- okapi
systemctl start okapi.service (läuft schon)
- nginx
systemctl start nginx (läuft schon)
==> Das System fährt nach Reboot selbständig wieder hoch; man kann sich sofort wieder anmelden.
Upgrade der Okapi-Version / Neustart Okapi
Das muss man machen, sonst kann man die neuen Module nicht ziehen.
Installation und Konfiguration Okapi
 Die Okapi-Version steht in der Datei platform-complete/install.json, also muss zunächst eine aktuelle Version dieser Datei heruntergeladen werden:
# Klone das Repositorium platform-complete, falls noch nicht geschehen
# git clone https://github.com/folio-org/platform-complete
 Wechsle in das Verzeichnis
 cd ~/platform-complete
 git fetch
# neuer Branch R2-2021, neuer Tag R2-2021-GA
# Leihe den Branch aus.
# Lokale Ănderungen zwischenspeichern. Das sollte nur stripes.config.js betreffen.
# Verwerfe Ănderungen an install.json etc:
 git restore install.json
 git restore okapi-install.json
 git restore stripes-install.json
 git restore package.json
 git stash save
 git checkout master
 git pull
 git checkout R2-2021-GA
 git stash pop
 # Lies R2-Okapi-Version aus install.json: okapi-4.8.2
 Okapi als Debian-Paket von repository.folio.org holen
Importieren Sie den FOLIO-SignaturschlĂźssel, fĂźgen Sie das FOLIO apt-Repository hinzu und installieren Sie Okapi (dieser Version).
Zuerst 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.8.2-1 # R2-2021 Okapi Version
 # okapi.conf zurßckspielen:
 sudo cp -p ~/upgrade/okapi.conf /etc/folio/okapi/okapi.conf
 Evtl. Port-Bereich in okapi.conf erweitern (9131-9350); Gucken, wie viele Ports schon belegt sind (sudo docker ps --all | wc)
 Es mßssen noch mindestens 60 Ports frei sein !
 sudo apt-mark hold okapi
okapi set on hold.
Neustart Okapi
 sudo systemctl daemon-reload
 sudo systemctl restart okapi.service
 In /var/log/folio/okapi/okapi.log muss kommen:
INFO DeploymentManager fast shutdown
# und direkt im Anschluss
INFO InternalModule InternalModule starting okapiversion=4.3.3
...
INFO MainVerticle Deploy completed succesfully
# Hole die Liste der Module fĂźr diesen Mandanten (rein informativ)
curl -w '\n' -XGET http://localhost:9130/_/proxy/tenants/diku/modules
...
}, {
 "id" : "okapi-4.8.2"
} ]
# 8x edge, 50x folio_ (Frontend), 60x mod- (Backend) = die R1-Module + das R2-Okapi
Moduldeskriptoren aus dem zentralen Register abrufen
 vim ~/folio-install/runbooks/single-server/scripts/okapi-pull.json
 {
  "urls": [
    "https://folio-registry.dev.folio.org"
   ]
 }
 cd ~
 curl -w '\n' -D - -X POST -H "Content-type: application/json" -d @folio-install/runbooks/single-server/scripts/okapi-pull.json http://localhost:9130/_/proxy/pull/modules
2021-08-25T13:11:06,833 INFO  ProxyContext     619855/proxy REQ 127.0.0.1:45316 supertenant POST /_/proxy/pull/modules  okapi-4.8.2
2021-08-25T13:11:17,625 INFO  PullManager      Remote registry at https://folio-registry.dev.folio.org is version 4.7.1
2021-08-25T13:11:17,625 INFO  PullManager      pull smart
2021-08-25T13:11:31,578 INFO  PullManager      pull: 2457 MDs to insert
2021-08-25T13:11:33,823 INFO  ProxyContext     619855/proxy RES 200 26989705us okapi-4.8.2 /_/proxy/pull/modules
Ein kompatibles FOLIO-Backend bereitstellen und fĂźr den Mandanten aktivieren.
Umgebungsvariablen zur Verwendung durch die bereitgestellten Module in der Okapi-Umgebung verĂśffentlichen:
 curl -w '\n' -D - -X POST -H "Content-Type: application/json" -d "{\"name\":\"DB_HOST\",\"value\":\"10.9.2.62\"}" http://localhost:9130/_/env;
 curl -w '\n' -D - -X POST -H "Content-Type: application/json" -d "{\"name\":\"DB_PORT\",\"value\":\"5432\"}" http://localhost:9130/_/env;
 curl -w '\n' -D - -X POST -H "Content-Type: application/json" -d "{\"name\":\"DB_DATABASE\",\"value\":\"folio\"}" http://localhost:9130/_/env;
 curl -w '\n' -D - -X POST -H "Content-Type: application/json" -d "{\"name\":\"DB_USERNAME\",\"value\":\"folio\"}" http://localhost:9130/_/env;
 curl -w '\n' -D - -X POST -H "Content-Type: application/json" -d "{\"name\":\"DB_PASSWORD\",\"value\":\"folio123\"}" http://localhost:9130/_/env;
 curl -w '\n' -D - -X POST -H "Content-Type: application/json" -d "{\"name\":\"KAFKA_HOST\",\"value\":\"10.9.2.85\"}" http://localhost:9130/_/env;
 curl -w '\n' -D - -X POST -H "Content-Type: application/json" -d "{\"name\":\"KAFKA_PORT\",\"value\":\"9092\"}" http://localhost:9130/_/env;
 curl -w '\n' -D - -X POST -H "Content-Type: application/json" -d "{\"name\":\"OKAPI_URL\",\"value\":\"http://10.9.2.85:9130\"}" http://localhost:9130/_/env;
# Rein informativ: Schauen, wie viele Docker-Container jetzt schon laufen:
sudo docker ps | grep -v "^CONTAINER" | wc -l
# es laufen ca. 60 Container des R1-Releases
Zuerst die Umgebungsvariablen fßr mod_pubsub ändern, wg. Kommunikation mit Kafka
KAFKA_HOST und OKAPI_URL auf die aktuelle IP-Adresse setzen:
 cd ~/upgrade
 # Die R2-Version von pubsub ist mod-pubsub-2.3.3.
 # Die R2-2021-Versionen fßr die einzelnen Module stehen in der Datei ~/platform-complete/okapi-install.json
 wget https://folio-registry.dev.folio.org/_/proxy/modules/mod-pubsub-2.3.3 -O pubsub-module-descriptor.json
 vim pubsub-module-descriptor.json
 # Im Launch-Deskriptor anpassen:
  }, {
   "name" : "KAFKA_HOST",
   "value" : "10.9.2.85"
  }, {
   "name" : "OKAPI_URL",
   "value" : "http://10.9.2.85:9130"
  }, {
   "name" : "SYSTEM_USER_PASSWORD",
   "value" : "***geheim***"
  } ],
 curl -X DELETE -D - -w '\n' http://localhost:9130/_/proxy/modules/mod-pubsub-2.3.3
 curl -i -w '\n' -X POST -H 'Content-type: application/json' -d @pubsub-module-descriptor.json http://localhost:9130/_/proxy/modules
 Das gleiche auch (ohne OKAPI_URL) machen fßr diese Module
Die R2-Versionen der Module in der okapi-install.json nachgucken:
 mod-data-import
 mod-data-export-spring
 mod-data-export-worker
 mod-ebsconet
 mod-inventory
 mod-inventory-storage
 mod-invoice
 mod-quick-marc
 mod-remote-storage
 # mod-search ==> das nicht installieren, sonst muss auch elasticsearch installiert werden
 mod-source-record-manager
 mod-source-record-storage
Zuerst mod-pubsub hochziehen und aktivieren:
 curl -w '\n' -D - -X POST -H "Content-type: application/json" -d '[ { "id" : "mod-pubsub-2.3.3", "action" : "enable" } ]' http://localhost:9130/_/proxy/tenants/diku/install?simulate=true
 curl -w '\n' -D - -X POST -H "Content-type: application/json" -d '[ { "id" : "mod-pubsub-2.3.3", "action" : "enable" } ]' http://localhost:9130/_/proxy/tenants/diku/install?deploy=true\&preRelease=false\&tenantParameters=loadReference%3Dtrue
SchlieĂlich alle Backend-Module bereitstellen und aktivieren:
- Elasticsearch (u.a.) nicht installieren !
 cd ~/platform-complete
 Entferne mod-search und folio_inventory-es aus install.json. Entferne auch mod-kb-ebsco-java, folio_search, edge-caiasoft, edge-dematic, mod-gobi, mod-ebsconet und mod-codex-ekb, falls diese nicht unbedingt benÜtigt werden.
 Enferne mod-search aus okapi-install.json. Entferne auch mod-kb-ebsco-java, mod-gobi, mod-ebsconet, mod-codex-ekb.
 Entferne folio_inventory-es aus stripes-install.json. Entferne aucg folio_search, edge-caiasoft, edge-dematic.
 Entferne @folio/inventory-es aus package.json. Entferne auch @folio/search.
# *****************************************************************************************
# Die Module einzeln bereitstellen. FĂźr jedes Modul wird ein Container hochgefahren.
# *****************************************************************************************
 # **********************************************
 # Alles deployen, was noch nicht deployed ist.
 # **********************************************
FĂźr ein einzelnes Modul geht es so:
 cat > circulation-deployment-descriptor.json <<END {  "srvcId": "mod-circulation-22.0.4",  "nodeId": "10.9.2.85" } END  curl -w '\n' -D - -X POST -H "Content-type: application/json" -d @circulation-deployment-descriptor.json http://localhost:9130/_/discovery/modules
Die Liste okapi-install.json Modul fßr Modul durch gehen und deployen !
 => Jetzt sind die R2-Container deployed, aber nicht aktiviert.
   AuĂerdem laufen auf dem System noch die R1-Container. Diese sind aktiviert. D.h. aktuell ist das System noch im Zustand "R1-2021", bis auf das Okapi (das aber abwärtskompatibel auf R1 ist).
Die R2-Backend-Module fĂźr den Mandanten aktivieren
 # Jetzt nur aktivieren, nicht deployen, da der Container schon läuft. Es muss die gesamte Liste okapi-install.json ßbergeben werden, sonst werden die Abhängigkeiten falsch aufgelÜst (also nicht auf die gewßnschten R2-Versionen):
 curl -w '\n' -D - -X POST -H "Content-type: application/json" -d @/usr/folio/platform-complete/okapi-install.json http://localhost:9130/_/proxy/tenants/diku/install?simulate=true\&preRelease=false
 curl -w '\n' -D - -X POST -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.8.2 /_/proxy/tenants/diku/install.. : 200 3670882us
Rein informativ: Bereitgestellte Module auflisten lassen (nur Backend)
 curl -w '\n' -D - http://localhost:9130/_/discovery/modules | grep srvcId | wc
Rein informativ: Aktivierte Module auflisten lassen (Frontend + Backend)
 curl -w '\n' -XGET http://localhost:9130/_/proxy/tenants/diku/modules | grep id | wc
Melde die Liste der Frontend-Module an, um sie fĂźr den Mandanten zu aktivieren
Aktivieren aber nicht bereitzustellen; es sind ja keine Container
 curl -w '\n' -D - -X POST -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 "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
vary: origin
Content-Type: application/json
X-Okapi-Trace: POST okapi-4.8.2 /_/proxy/tenants/diku/install.. : 200 8014004us
Installation Frontend: Eine R2-Version der FOLIO Stripes-Plattform erstellen
Installation von Stripes und nginx in einem Docker-Container
# Quelle: https://github.com/folio-org/platform-complete
Docker-File und nginx-Konfiguration anpassen
 cd ~/platform-complete
 vim docker/Dockerfile
  ARG OKAPI_URL=http://10.9.2.85:9130 # die IP des Servers anpassen
  ARG TENANT_ID=diku
 vim docker/nginx.conf
server {
 listen 80;
 server_name folio-hbz2.hbz-nrw.de;
 charset utf-8;
 access_log  /var/log/nginx/host.access.log  combined;
 # front-end requests:
 # Serve index.html for any request not found
 location / {
  # Set path
  root     /usr/share/nginx/html;
  index    index.html index.htm;
  include mime.types;
  types {
   text/plain lock;
  }
  try_files $uri /index.html;
 }
 # back-end requests:
 location /okapi {
  rewrite ^/okapi/(.*) /$1 break;
  proxy_pass http://10.9.2.85:9130/;
 }
}
 vim stripes.config.js
  Mandant (tenant) und Okapi-URL anpassen:
   okapi: { 'url':'http://folio-hbz2.hbz-nrw.de/okapi', 'tenant':'diku' },
   Die URL muss von auĂen erreichbar sein, als vom Browser. Der Endpoint "/okapi" wird in der nginx.conf auf den internen Port 9130 umgeleitet.
  Diese Zeile entfernen (die search-App nicht installieren) :
     '@folio/search' : {},
In stripes.config.js auch Logo und Favoriten-Bildchen anpassen, falls gewĂźnscht
 Den Docker-Container bauen
 sudo su
 docker build -f docker/Dockerfile --build-arg OKAPI_URL=http://10.9.2.85:9130 --build-arg TENANT_ID=diku -t stripes .
Sending build context to Docker daemon  1.138GB
Step 1/19 : FROM node:15-alpine as stripes_build
...
Step 19/19 : ENTRYPOINT ["/usr/bin/entrypoint.sh"]
 ---> Running in a47dce4e3b3e
Removing intermediate container a47dce4e3b3e
 ---> 48a532266f21
Successfully built 48a532266f21
Successfully tagged stripes:latest
# Läuft ca. 15 Minuten lang.
Den Docker-Container starten.
Dabei Port 80 von auĂen auf Port 80 des Containers umleiten. FĂźr SSL muss auch der Port 443 umgeleitet werden (nicht Teil dieser Doku):
 nohup docker run -d -p 80:80 stripes
 nginx auf dem Server anhalten:
 sudo service nginx stop
 # Mal einloggen in den Docker Container
 docker exec -it <id> sh
 ßberprufen, ob die Konfig-Datei richtig angekommen ist:
 vi /etc/nginx/conf.d/default.conf
 # das Webserver-Log in dem Container verfolgen
 tail -f /var/log/nginx/host.access.log
Aufräumen.
Diese Schritt ist wichtig, das sonst leicht die Perfomance des Servers in die Knie gehen kann. Besonders beim nächsten Upgrade !!
Nicht mehr benutzte Container zurĂźckziehen (undeploy)
 cd ~/upgrade
 # Welche Container sind jetzt aktiviert ?
 curl -w '\n' -XGET http://localhost:9130/_/proxy/tenants/supertenant/modules
 curl -w '\n' -XGET http://localhost:9130/_/proxy/tenants/diku/modules
 # Welche Container sind im Discovery und laufen ?
 curl -w '\n' -XGET http://localhost:9130/_/discovery/modules | jq '.[] | .srvcId + "/" + .instId' > dockerps.sh
 # Das sollte noch die Modulversionen des alten Releases enthalten
 # => Backend-Module (mod-*) des alten Releases + Backend-Module des neuen Releases (das sollten ca. 120 Module sein).
 # Nicht mehr benutzte, also nicht aktivierte, Versionen so lÜschen:
 z.B.: curl -w '\n' -D - -XDELETE http://localhost:9130/_/discovery/modules/mod-orders-12.0.1
 wird jeweils mit "HTTP/1.1 204 No Content" quittiert.
# Jetzt noch einmal die bereitgestellten Module auflisten lassen:
 curl -w '\n' -D - http://localhost:9130/_/discovery/modules | grep srvcId | wc
 60
 # Das sollte nur die Modulversionen des neuen Releases enthalten
 # Vergleich mit der Anzahl laufenden Docker-Containern:
 docker ps --all | wc
   63   788  15088
 # ziehe Kafka, Zookeeper und die Ăberschriftszeile ab => 60 Container mit Backend-Modulen (Die Summen stimmen Ăźberein).
FERTIG
Melden Sie sich als "diku_admin:admin" (oder mit Ihrem Systemadministrator-Login) auf http://folio-hbz2.hbz-nrw.de (durch Ihren Server-Namen ersetzen) an.
PrĂźfen Sie, ob die alten Daten noch da sind ! Z.B im Katalog, unter Benutzerverwaltung etc.