Skip to end of banner
Go to start of banner

Single-Server Release-Wechsel unter Erhalt der Daten

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

  • Skizze für den Release-Wechsel Q3-2020 ==> Q1-2021,  hier müssen noch die Modul-Versionen auf Q2-2021 angepasst werden
  • Jeweils Komplettinstallation (platform-complete), unter Erhalt der Daten (automatische Migration der Datenbankschemata)
  • Für einen Single Server, Ubuntu 18.04.5 LTS


# Erstmal Ubuntu hochziehen
sudo apt-get update
sudo apt-get upgrade
sudo reboot


# nach System-Neustart startet folgendes von selber wieder an:
- 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.


# Neueste Sourcen - oder stabiles Release - von folio-install holen (für Installationsskripte )
cd ~/folio-install
git fetch
# * [neues Tag] q1-2021
LATEST=$(git describe --tags `git rev-list --tags --max-count=1`); echo $LATEST
git checkout q1-2021


# Okapi ist z.Zt. /usr/share/folio/okapi/lib/okapi-core-fat.jar
# ******************************************
# Upgrade der Okapi-Version / 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).
# 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
# kommen Warnungen und eine Fehlermeldung von https://apt.dockerproject.org/ ==> ignorieren
sudo apt-get -y --allow-change-held-packages install okapi=4.3.3-1 # Q1-2021 Version anpassen !
# kommen Rückfragen:
# okapi.conf : Y or I : install the package maintainer's version
Installing new version of config file /etc/folio/okapi/okapi.conf ...
Okapi upgraded but not restarted. To restart Okapi: s.u.
# okapi.conf zurückspielen:
sudo cp -p okapi.conf /etc/folio/okapi/okapi.conf
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
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
curl -w '\n' -XGET http://localhost:9130/_/proxy/tenants/diku/modules

# Wayne: Load PostgreSQL extensions in the public schema of the 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)
psql -U folio
\c folio
ALTER EXTENSION pg_trgm SET SCHEMA public;
ALTER EXTENSION
\q


# Moduldeskriptoren aus dem zentralen Register abrufen:
cd ~
vim folio-install/runbooks/single-server/scripts/okapi-pull.json
{
"urls": [
"http://folio-registry-umweg.hbz-nrw.de"
]
}
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

2020-12-09T18:32:50,183 INFO ProxyContext 636181/proxy REQ 0:0:0:0:0:0:0:1%0:40416 supertenant GET /_/proxy/tenants/diku/modules okapi-4.3.3
2020-12-09T18:32:50,223 INFO ProxyContext 636181/proxy RES 200 29704us okapi-4.3.3 /_/proxy/tenants/diku/modules
2020-12-09T18:38:37,036 INFO ProxyContext 338553/proxy REQ 0:0:0:0:0:0:0:1%0:40418 supertenant POST /_/proxy/pull/modules okapi-4.3.3
2020-12-09T18:38:39,151 INFO PullManager Remote registry at http://folio-registry-umweg.hbz-nrw.de is version 2.38.0
2020-12-09T18:38:39,152 INFO PullManager pull smart
2020-12-09T18:39:00,036 INFO PullManager pull: 3353 MDs to insert
2020-12-09T18:39:01,717 WARN ? Thread Thread[vert.x-eventloop-thread-0,5,main] has been blocked for 2343 ms, time limit is 2000 ms
2020-12-09T18:39:02,717 WARN ? Thread Thread[vert.x-eventloop-thread-0,5,main] has been blocked for 3343 ms, time limit is 2000 ms
2020-12-09T18:39:05,937 INFO ProxyContext 338553/proxy RES 200 28900301us okapi-4.3.3 /_/proxy/pull/modules


# Aktivieren Sie das interne Okapi-Modul (neue Version) für den Mandanten
curl -w '\n' -D - -X POST -H "Content-type: application/json" -d '{"id":"okapi"}' http://localhost:9130/_/proxy/tenants/diku/modules
HTTP/1.1 201 Created
vary: origin
Content-Type: application/json
Location: /_/proxy/tenants/diku/modules/okapi-4.3.3
X-Okapi-Trace: POST okapi-4.3.3 /_/proxy/tenants/diku/modules : 201 104230us
content-length: 26

{
"id" : "okapi-4.3.3"
}
# Die alte Version ist weiterhin aktiviert, wird weiter unten deaktiviert.


# Erstellen Sie die neueste Version der FOLIO Stripes-Plattform (Alfons & Ingolf)
# Move to NodeJS LTS
sudo n lts
# installed : v14.15.1 (with npm 6.14.8)
# 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] q1-2021
# 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 <TAB> # dann gucken, was es alles gibt
git checkout q1-2021
git stash pop # das löscht auch den Zwischenspeicher
# Installiere npm-Pakete
sudo su
# evtl. yarn aktualisieren (mit yast2 ?)
yarn install
# Done in 115.71s.
# Ändere Zeile in
# vim ./stripes.config.js
# => okapi: { 'url':'https://folio-demo.hbz-nrw.de/okapi', 'tenant':'diku' },
# in stripes.config.js kann man auch ein anderes Logo und Favoriten-Bildchen referenzieren (ist schon)
NODE_ENV=production yarn build output # dauert etwas
# Done in 465.99s.


# Aufräumen der Docker-Container
# s. 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
# II. Docker-Neustart um Ports freizugeben# this releases ports 9131-9230 ==> muss ich nicht machen
# systemctl stop docker.service ==> muss ich nicht machen
# systemctl start docker.service
# falls das nicht anstartet (z.B. timeout), so:
# sudo su
# PATH=$PATH:/usr/sbin/containerd; export PATH
# containerd
# ctrl-Z; bg
# systemctl start docker.service


# 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
# Muss ich das noch einmal machen ? Wenn Datenbank "folio" gelöscht wurde.
Dennis: Das brauche ich nicht mehr machen.

curl -w '\n' -D - -X POST -H "Content-Type: application/json" -d "{\"name\":\"DB_HOST\",\"value\":\"193.30.112.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
;

# 2. Melde die Liste der Werkstatt-Module (Backend) an, um sie bereitzustellen und zu aktivieren
# Das zieht auch die Docker-Abbilder von folioci.
# Sie wird die Module im lokalen System bereitstellen 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

# Wayne (FOLIO-2662) Als erstes Upgrade the Okapi API to the new version:
curl -w '\n' -D - -X POST -H "Content-type: application/json" -d '[ { "id": "okapi-4.3.3", "action": "enable" } ]' http://localhost:9130/_/proxy/tenants/diku/install?deploy=true\&preRelease=false
[ {
"id" : "okapi-4.3.3",
"action" : "uptodate"

} ]

sudo docker ps | grep -v "^CONTAINER" | wc -l
# Fortschritt kann so überwacht werden: sudo docker ps | grep -v "^CONTAINER" | wc -l
# Beobachtung: wurstmeister/kafka und wurstmeister/tierpfleger laufen jetzt (als einzige)

# Wayne (FOLIO-2662): Dann das hier POSTen (Modul-Versionen aus Q1-2021 benutzen !):
# Jason 22.01.2021: Upgrade mod-pubsub along with its dependencies:

# IK: Zuerst Umgebungsvariablen für mod_pubsub ändern, wg. Kommunikation mit Kafka: https://info.gbv.de/pages/viewpage.action?pageId=561872965 ; KAFKA_HOST und OKAPI_URL auf aktuelle IP-Adresse setzen

curl -w '\n' -D - -X POST -H "Content-type: application/json" -d '[ { "id" : "mod-pubsub-1.3.3", "action" : "enable" } ]' http://localhost:9130/_/proxy/tenants/diku/install?simulate=true
# Sind das hier vielleicht die Dependencies ? Gibt es noch mehr Abhängigkeitem ? Prüfen !
# Die Versionsnummern durch die Versionnummer aus okapi-install.json ersetzen, z.B. mod-login-7.2.0 durch mod-login.7.1.1 ersetzen. 
# curl -w '\n' -D - -X POST -H "Content-type: application/json" -d '[ { "id" : "mod-permissions-5.12.2", "action" : "enable" }, { "id" : "mod-authtoken-2.6.0", "action" : "enable" }, { "id" : "mod-pubsub-1.3.3", "action" : "enable" } ]' http://localhost:9130/_/proxy/tenants/diku/install?deploy=true\&preRelease=false\&tenantParameters=loadReference%3Dtrue
curl -w '\n' -D - -X POST -H "Content-type: application/json" -d '[ { "id" : "mod-pubsub-1.3.3", "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.3.3 /_/proxy/tenants/diku/install.. : 200 45599468us
content-length: 290

[ {
"id" : "mod-permissions-5.12.2",
"action" : "enable"
}, {
"id" : "mod-users-17.2.2",
"action" : "enable"
}, {
"id" : "mod-authtoken-2.6.0",
"action" : "enable"
}, {
"id" : "mod-login-7.1.1",
"action" : "enable"
}, {
"id" : "mod-pubsub-1.3.3",
"action" : "enable"

} ]

# Fortschritt kann so überwacht werden: sudo docker ps | grep -v "^CONTAINER" | wc -l
# Jetzt sind 7 Container deployed, diese 5 Module sowie Tierpfleger und Kafka.

# Schließlich alle Werkstatt-Module bereitstellen und aktivieren:
# Jason 22.01.2021: post the list of modules to enable for the tenant and Okapi’s tenant API will “upgrade” them for you.
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
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=true\&preRelease=false\&tenantParameters=loadReference%3Dtrue

# Fortschritt kann so überwacht werden: sudo docker ps | grep -v "^CONTAINER" | wc -l
# Hat 55 Container nach 2-3 Minuten hochgefahren.
# Macht sehr lange scheinbar gar nichts, aber wird dann nach 31 Minuten fertig.
HTTP/1.1 100 Continue

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

********
55 Docker-Abbilder gezogen:
sudo docker ps | grep -v "^CONTAINER" | wc -l
55

*************

# 3. Melde die Liste der Schaufenster-Module (Frontend) an, um sie zu 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
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

# -> 47 Frontend-Module (folio*) und 6 Edge-Module aktiviert und bereitgestellt.

# Bereitgestellte Module auflisten lassen:
curl -w '\n' -D - http://localhost:9130/_/discovery/modules | grep srvcId | wc
# Das sollte noch die Modulversionen des alten Releases enthalten
# => 53 Backend-Module (mod-*) des alten Releases + Backend-Module des neuen Releases.

# 4. Jetzt das alte Okapi-Modul für den Mandanten entfernen
curl -w '\n' -XDELETE http://localhost:9130/_/proxy/tenants/diku/modules/okapi-3.1.2
# Aktivierte Module auflisten lassen
curl -w '\n' -XGET http://localhost:9130/_/proxy/tenants/diku/modules | grep id | wc
# => es sind 107 Module für den Mandanten aktiviert, alle für das aktuelle Release.

# 5. Die Container des alten Releases zurückziehen (undeploy); inkl. Opkai des alten Releases
cd ~/upgrade
# schicke DELETE an /discovery/modules, aber nur für die Module des alten Releases ! (Wie filtert man die heraus ?)
curl -w '\n' -D - -X DELETE http://localhost:9130/_/discovery/modules/<moduleId>
# 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
- Das sollte nur die Modulversionen des neuen Releases enthalten
=> 53 Backend-Module (mod-*). Dazu gibt es 47 Frontend-Modul, 6 Edge-Modul und das Okapi-Modul = 107 Modul. Außerdem sind die Container wurstmeister/kafka und wurstmeister/tierpfleger am Laufen => 55 Container.


• MODS-Datensätze
beladen . nicht gemacht.
" Aber siehe die Anleitung in redeploy-Q3.2-2019.sh

Installiere und Bediene Edge-Modul für
plattformvervollständigt .


"Sichere die Okapi-Schnittstelle" ("Supertenant")
- nicht gemacht.
python3 /usr/folio/folio-install/runbooks/single-server/scripts/secure-supertenant.py -u folio -p <User-Passwort für diesen Server>

* *** FERTIG
*** Melden Sie sich als "diku_admin:admin" auf https://folio-demo.hbz-nrw.de
. Besteht aus 107 Modulen, davon 19 "App-Modul"

" Prüfen, ob alte Daten noch da sind !

" Noch weitere
Sachen einrichten: - E-Mail-Versand: https://info.gbv.de/pages/viewpage.action?pageId=559579223

  • No labels