Die folgende Installationsanleitung für den Goobi viewer bezieht sich auf Ubuntu Linux 20.04. Sie ist als Schritt für Schritt Anleitung von oben nach unten geschrieben, das bedeutet, dass Einstellungen und Konfigurationen aufeinander aufbauen. Wird die Reihenfolge nicht eingehalten, können unter Umständen bestimmte Befehle fehlschlagen.
Als Domainname wird in dieser Anleitung VIEWER.EXAMPLE.ORG verwendet und muss an den eigenen DNS Namen angepasst werden.
Zuerst auf dem Server auf dem der Goobi viewer installiert werden soll anmelden und root Rechte erlangen:
ssh VIEWER.EXAMPLE.ORGsudo -i
Anschließend ein Passwort für die Goobi viewer Datenbank und einen Token generieren und als Variable in der Session ablegen. Dort wird ebenfalls der DNS Name hinterlegt:
export PW_SQL_VIEWER=SECRETPASSWORTexport TOKEN=$(uuidgen)export VIEWER_HOSTNAME=VIEWER.EXAMPLE.ORG
Nun die folgenden Pakete installieren:
apt -y install git maven
Zum Schluss der Vorbereitung muss ein temporäres Verzeichnis für die Installation angelegt und das Goobi viewer Connector, Goobi viewer Indexer und Goobi viewer Core Config Repository geklont werden. Darin sind für die Installation notwendige Dateien enthalten:
install=/tmp/installmkdir -p $installcd $installgit clone https://github.com/intranda/goobi-viewer-connector.gitgit clone https://github.com/intranda/goobi-viewer-indexer.gitgit clone https://github.com/intranda/goobi-viewer-core-config.git
Es empfiehlt sich zum jetzigen Zeitpunkt einen DNS Eintrag für den Server gesetzt zu haben.
Folgende Aliase in die /root/.bash_aliases
hinzufügen:
cat << "EOF" >/root/.bash_aliasesalias cata='journalctl -u tomcat9 -n 1000 -f'alias ct='chown tomcat:tomcat *'alias ctr='chown -R tomcat:tomcat *'alias ind='tail -n 1000 -f /opt/digiverso/logs/indexer.log'alias vl='tail -n 1000 -f /opt/digiverso/logs/viewer.log'EOF
Übernahme der Änderungen in der aktuellen Session:
. /root/.bashrc
Folgenden Pakete inklusive aller Abhängigkeiten installieren:
apt -y install openjdk-11-jdk-headless tomcat9 mariadb-server apache2 ttf-mscorefonts-installer unzip
SYSTEMD_EDITOR=tee systemctl edit tomcat9 << "EOF"[Service]LogsDirectoryMode=755CacheDirectoryMode=755ProtectSystem=trueNoNewPrivileges=trueReadWritePaths=EOF
In der /etc/default/tomcat9
den Speicher unter -Xmx dem verfügbaren Maschinenspeicher angepassen, vernünftige Garbage Collector Optionen wählen und urandom für schnelleren Tomcat start nutzen:
patch /etc/default/tomcat9 << "EOF"@@ -11,6 +11,15 @@# To enable remote debugging uncomment the following line.# You will then be able to use a Java debugger on port 8000.#JAVA_OPTS="${JAVA_OPTS} -agentlib:jdwp=transport=dt_socket,address=8000,server=y,suspend=n"+JAVA_OPTS="-Djava.awt.headless=true -Xmx4g -Xms2g"+JAVA_OPTS="${JAVA_OPTS} -XX:+UseG1GC"+JAVA_OPTS="${JAVA_OPTS} -XX:+ParallelRefProcEnabled"+JAVA_OPTS="${JAVA_OPTS} -XX:+DisableExplicitGC"+JAVA_OPTS="${JAVA_OPTS} -XX:+CMSClassUnloadingEnabled"+JAVA_OPTS="${JAVA_OPTS} -Djava.security.egd=file:/dev/./urandom"+JAVA_OPTS="${JAVA_OPTS} -Dfile.encoding='utf-8'"++UMASK=0022# Java compiler to use for translating JavaServer Pages (JSPs). You can use all# compilers that are accepted by Ant's build.compiler property.@@ -20,4 +29,4 @@#SECURITY_MANAGER=true# Whether to compress logfiles older than today's-#LOGFILE_COMPRESS=1+LOGFILE_COMPRESS=1EOF
Weitere Konfigurationen werden in /etc/tomcat9/server.xml
vorgenommen. Dabei werden die appContextProtection für den JreMemoryLeakPreventionListener ausgeschaltet, sowie einen HTTP connector (mit korrektem proxyName) und einen AJP Connector auf localhost eingerichtet. Weiter wird ein Crawler Session Manager Valve aktiviert:
sed -e "s|VIEWER.EXAMPLE.ORG|${VIEWER_HOSTNAME}|g" << "EOF" | patch /etc/tomcat9/server.xml@@ -66,59 +66,22 @@APR (HTTP/AJP) Connector: /docs/apr.htmlDefine a non-SSL/TLS HTTP/1.1 Connector on port 8080-->- <Connector port="8080" protocol="HTTP/1.1"+ <Connector address="127.0.0.1" port="8080" protocol="HTTP/1.1"connectionTimeout="20000"- redirectPort="8443" />- <!-- A "Connector" using the shared thread pool-->- <!--- <Connector executor="tomcatThreadPool"- port="8080" protocol="HTTP/1.1"+ redirectPort="8443"+ maxThreads="400"+ URIEncoding="UTF-8"+ enableLookups="false"+ disableUploadTimeout="true"+ proxyName="VIEWER.EXAMPLE.ORG"+ proxyPort="80" />++ <Connector address="127.0.0.1" port="8009" protocol="AJP/1.3"+ secretRequired="false"connectionTimeout="20000"- redirectPort="8443" />- -->- <!-- Define an SSL/TLS HTTP/1.1 Connector on port 8443- This connector uses the NIO implementation. The default- SSLImplementation will depend on the presence of the APR/native- library and the useOpenSSL attribute of the- AprLifecycleListener.- Either JSSE or OpenSSL style configuration may be used regardless of- the SSLImplementation selected. JSSE style configuration is used below.- -->- <!--- <Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol"- maxThreads="150" SSLEnabled="true">- <SSLHostConfig>- <Certificate certificateKeystoreFile="conf/localhost-rsa.jks"- type="RSA" />- </SSLHostConfig>- </Connector>- -->- <!-- Define an SSL/TLS HTTP/1.1 Connector on port 8443 with HTTP/2- This connector uses the APR/native implementation which always uses- OpenSSL for TLS.- Either JSSE or OpenSSL style configuration may be used. OpenSSL style- configuration is used below.- -->- <!--- <Connector port="8443" protocol="org.apache.coyote.http11.Http11AprProtocol"- maxThreads="150" SSLEnabled="true" >- <UpgradeProtocol className="org.apache.coyote.http2.Http2Protocol" />- <SSLHostConfig>- <Certificate certificateKeyFile="conf/localhost-rsa-key.pem"- certificateFile="conf/localhost-rsa-cert.pem"- certificateChainFile="conf/localhost-rsa-chain.pem"- type="RSA" />- </SSLHostConfig>- </Connector>- -->+ maxThreads="400"+ URIEncoding="UTF-8" />- <!-- Define an AJP 1.3 Connector on port 8009 -->- <!--- <Connector protocol="AJP/1.3"- address="::1"- port="8009"- redirectPort="8443" />- --><!-- An Engine represents the entry point (within Catalina) that processesevery request. The Engine implementation for Tomcat stand alone@@ -161,9 +124,14 @@<!-- Access log processes all example.Documentation at: /docs/config/valve.htmlNote: The pattern used is equivalent to using pattern="common" -->+ <!--<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"prefix="localhost_access_log" suffix=".txt"pattern="%h %l %u %t "%r" %s %b" />+ -->+ <Valve className="org.apache.catalina.valves.CrawlerSessionManagerValve"+ crawlerUserAgents=".*[bB]ot.*|.*Yahoo! Slurp.*|.*Feedfetcher-Google.*|.*Apache-HttpClient.*|.*[Ss]pider.*|.*[Cc]rawler.*|.*nagios.*|.*Yandex.*"+ sessionInactiveInterval="60"/></Host></Engine>EOF
Die Sessionpersistenz in der /etc/tomcat9/context.xml
deaktivieren, indem der folgende Patch ausgeführt wird.
patch /etc/tomcat9/context.xml << "EOF"@@ -25,7 +25,5 @@<WatchedResource>${catalina.base}/conf/web.xml</WatchedResource><!-- Uncomment this to disable session persistence across Tomcat restarts -->- <!--<Manager pathname="" />- --></Context>EOF
Apache muss eingerichtet werden, um den Viewer extern zur Verfügung zu stellen. Dafür die folgenden Module aktivieren:
a2enmod proxy_ajpa2enmod proxy_httpa2enmod proxy_wstunnela2enmod rewritea2enmod expiresa2enmod headers
Die folgende Datei nach /etc/apache2/sites-available/${VIEWER_HOSTNAME}.conf
legen:
sed -e "s|VIEWER.EXAMPLE.ORG|${VIEWER_HOSTNAME}|g" << "EOF" >/etc/apache2/sites-available/${VIEWER_HOSTNAME}.conf<VirtualHost *:80>ServerAdmin support@intranda.comServerName VIEWER.EXAMPLE.ORGDocumentRoot /var/www## make sure rewrite is enabledRewriteEngine On## search engines: do not follow certain urlsRewriteCond %{HTTP_USER_AGENT} ^.*bot.*$ [NC,OR]RewriteCond %{HTTP_USER_AGENT} ^.*Yandex.*$ [NC,OR]RewriteCond %{HTTP_USER_AGENT} ^.*spider.*$ [NC,OR]RewriteCond %{HTTP_USER_AGENT} ^.*rawler.*$ [NC]ReWriteRule ^(.*);jsessionid=[A-Za-z0-9]+(.*)$ $1$2 [L,R=301]RewriteCond %{HTTP_USER_AGENT} ^.*bot.*$ [NC,OR]RewriteCond %{HTTP_USER_AGENT} ^.*Yandex.*$ [NC,OR]RewriteCond %{HTTP_USER_AGENT} ^.*spider.*$ [NC,OR]RewriteCond %{HTTP_USER_AGENT} ^.*rawler.*$ [NC]ReWriteRule ^(.*)viewer/!(.*)$ $1viewer/$2 [L,R=301]RewriteCond %{HTTP_USER_AGENT} ^.*bot.*$ [NC,OR]RewriteCond %{HTTP_USER_AGENT} ^.*Yandex.*$ [NC,OR]RewriteCond %{HTTP_USER_AGENT} ^.*spider.*$ [NC,OR]RewriteCond %{HTTP_USER_AGENT} ^.*rawler.*$ [NC]ReWriteRule ^(.*)/[Ll][Oo][Gg]_(.*)$ $1/ [L,R=301]## compress output<IfModule mod_deflate.c>AddOutputFilterByType DEFLATE text/plain text/html text/xmlAddOutputFilterByType DEFLATE text/css text/javascriptAddOutputFilterByType DEFLATE application/xml application/xhtml+xmlAddOutputFilterByType DEFLATE application/rss+xmlAddOutputFilterByType DEFLATE application/javascript application/x-javascript</IfModule>## general proxy settingsProxyPreserveHost OnSetEnv force-proxy-request-1.0 1SetEnv proxy-nokeepalive 1<Proxy *>Require local</Proxy>## CORS for IIIFHeader set Access-Control-Allow-Origin "*"Header always set Access-Control-Allow-Methods "GET, OPTIONS"Header always set Access-Control-Max-Age "600"Header always set Access-Control-Allow-Headers "Authorization, Content-Type"Header always set Access-Control-Expose-Headers "Content-Security-Policy, Location"RewriteCond %{REQUEST_METHOD} OPTIONSRewriteRule ^(.*)$ $1 [R=200,L]# make sure ETag headers are forwarded correctly# Post Apache 2.4 have a look at# https://httpd.apache.org/docs/trunk/mod/mod_deflate.html#deflatealteretagRequestHeader edit "If-None-Match" '(.*)-gzip"$' '$1", $1-gzip"'## Enable WebSockets to check concurrent accessRewriteCond %{HTTP:Upgrade} websocket [NC]RewriteCond %{HTTP:Connection} upgrade [NC]RewriteRule /?(.*) ws://localhost:8080/$1 [P,L]## Viewerredirect 301 /index.html http://VIEWER.EXAMPLE.ORG/viewer/redirect 301 /viewer http://VIEWER.EXAMPLE.ORG/viewer/RewriteRule ^/viewer/oai/oai2.xsl$ http://VIEWER.EXAMPLE.ORG/viewer/oai2.xslProxyPassMatch ^/viewer/(oai.*)$ ajp://localhost:8009/M2M/$1 retry=0<LocationMatch ^/viewer/(oai.*)$>Forcetype text/xmlProxyPassReverse ajp://localhost:8009/M2M/$1</LocationMatch>ProxyPassMatch ^/viewer/(sru.*)$ ajp://localhost:8009/M2M/$1 retry=0<LocationMatch ^/viewer/(sru.*)$>Forcetype text/xmlProxyPassReverse ajp://localhost:8009/M2M/$1</LocationMatch>ProxyPassMatch ^/viewer/(.*)$ ajp://localhost:8009/viewer/$1 retry=0<LocationMatch ^/viewer/(.*)$>ProxyPassReverse ajp://localhost:8009/viewer/$1<IfModule mod_expires.c>ExpiresActive onExpiresByType image/jpg "access plus 1 months"ExpiresByType image/gif "access plus 1 months"ExpiresByType image/jpeg "access plus 1 months"ExpiresByType image/png "access plus 1 months"ExpiresByType font/ttf "access plus 1 year"ExpiresByType application/x-font-woff "access plus 1 year"ExpiresByType application/vnd.ms-fontobject "access plus 1 year"</IfModule>Require all granted</LocationMatch>## solrredirect 301 /solr http://VIEWER.EXAMPLE.ORG/solr/<Location /solr/>Require localProxyPass http://localhost:8983/solr/ retry=0ProxyPassReverse http://localhost:8983/solr/</Location>## loggingCustomLog /var/log/apache2/VIEWER.EXAMPLE.ORG_access.log combinedErrorLog /var/log/apache2/VIEWER.EXAMPLE.ORG_error.log# Possible values include: debug, info, notice, warn, error, crit, alert, emerg.LogLevel warn</VirtualHost>EOF
Den Goobi viewer vhost aktivieren, den default vhost deaktivieren und den Apache Webserver neu starten:
a2dissite 000-defaulta2ensite ${VIEWER_HOSTNAME}.confsystemctl restart apache2.service
Zum Schluss noch eine robots.txt anlegen:
sed -e "s|VIEWER.EXAMPLE.ORG|${VIEWER_HOSTNAME}|g" << "EOF" >/var/www/robots.txtUser-agent: *Disallow: /viewer/content*action=pdfDisallow: /viewer/search/Disallow: /viewer/tags/Disallow: /viewer/term/Disallow: /viewer/oaiDisallow: /viewer/nextHit/Disallow: /viewer/prevHit/#Sitemap: http://VIEWER.EXAMPLE.ORG/viewer/sitemap_index.xmlCrawl-delay: 10EOF
Goobi viewer benötigt eine Datenbank und einen eigenen Nutzer. Dies wird mit dem folgenden Befehl angelegt:
mysql -e "CREATE DATABASE viewer;CREATE USER 'viewer'@'localhost' IDENTIFIED BY '$PW_SQL_VIEWER';GRANT ALL PRIVILEGES ON viewer.* TO 'viewer'@'localhost' WITH GRANT OPTION;FLUSH PRIVILEGES;"
Das Datenbankschema wird beim ersten Start der Applikation automatisch erstellt.
Dieser Punkt ist nur relevant, wenn Goobi workflow ebenfalls installiert ist/wird, und das nicht auf der gleichen Maschine erfolgt.
Dann muss der Ordner /opt/digiverso/viewer
zu dem Goobi workflow Server exportiert werden. Hierfür wird NFS genutzt. Die Anpassungen dafür sind hier:
export IP_GOOBI=1.2.3.4 # IP-Adresse des Goobi workflow Serversapt install nfs-kernel-server -yecho "/opt/digiverso/viewer/hotfolder ${IP_GOOBI}/255.255.255.255(rw,sync,no_subtree_check,all_squash,anonuid=$(id -u tomcat),anongid=$(id -g tomcat))" >> /etc/exportssystemctl restart nfs-kernel-server.service
Der Port für NFSv4 ist TCP 2049, falls UFW benutzt wird:
ufw allow from $IP_GOOBI proto tcp to any port 2049
Die Anpassungen für Goobi workflow können in der dortigen Installationsanleitung nachgelesen werden:
Mit den folgenden Befehlen wird die notwendige Ordnerstruktur erzeugt und die Dateien aus dem Repository an die erwartete Stelle verschoben:
mkdir -p /opt/digiverso/{config/bin,indexer,logs,tomcat-lib,viewer/{abbyy,cmdi,deleted_mets,hotfolder,media,orig_lido,orig_denkxweb,success,ugc,alto,cms_media,error_mets,indexed_lido,mix,pdf,tei,updated_mets,cache,config/{PDFTitlePage,watermark},fulltext,indexed_mets,oai/token,ptif,themes,wc,bin}}chown -R tomcat: /opt/digiverso
Im folgenden ist die Installation der benötigten Komponenten beschrieben.
Die aktuelle Solr 8.x Version herunterladen und das Installationsskript entpacken:
cd $installwget http://archive.apache.org/dist/lucene/solr/8.5.2/solr-8.5.2.tgztar -xzf solr-8.5.2.tgz solr-8.5.2/bin/install_solr_service.sh --strip-components=2
Nun den Ordner /opt/digiverso/solr
anlegen und dorthin installieren:
mkdir -p /opt/digiverso/solr/./install_solr_service.sh solr-8.5.2.tgz -i /opt/digiverso/solr -d /opt/digiverso/solr -u solr -s solr -p 8983 -n
Nun die Limits für den Benutzer solr anpassen:
cat << "EOF" >/etc/security/limits.d/solr.confsolr hard nofile 65535solr soft nofile 65535solr hard nproc 65535solr soft nproc 65535EOF
Um Streaming Expressions zu nutzen wird Solr nicht im Standalone, sondern in der SolrCloud Variante installiert. Allerdings nutzen wir nur einen Node. Für die Konfiguration wird Zookeeper verwendet:
apt install -y zookeeperd
Zookeeper nun Solr bekannt machen und den Standardspeicher für die JVM erhöhen:
patch /etc/default/solr.in.sh << "EOF"@@ -28,7 +28,7 @@#SOLR_STOP_WAIT="180"# Increase Java Heap as needed to support your indexing / query needs-#SOLR_HEAP="512m"+SOLR_HEAP="2048m"# Expert: If you want finer control over memory options, specify them directly# Comment out SOLR_HEAP if you are using this though, that takes precedence@@ -64,7 +64,7 @@# Set the ZooKeeper connection string if using an external ZooKeeper ensemble# e.g. host1:2181,host2:2181/chroot# Leave empty if not using SolrCloud-#ZK_HOST=""+ZK_HOST="127.0.0.1:2181"# Set the ZooKeeper client timeout (for SolrCloud mode)#ZK_CLIENT_TIMEOUT="15000"@@ -113,7 +113,7 @@# Changes the logging level. Valid values: ALL, TRACE, DEBUG, INFO, WARN, ERROR, FATAL, OFF. Default is INFO# This is an alternative to changing the rootLogger in log4j2.xml-#SOLR_LOG_LEVEL=INFO+SOLR_LOG_LEVEL=ERROR# Location where Solr should write logs to. Absolute or relative to solr start dir#SOLR_LOGS_DIR=logsEOF
Nun das Solr Skript ausführbar machen:
chmod 755 /opt/digiverso/solr/solr/bin/solr
Jetzt wird die Konfiguration in einem neuen configset abgelegt:
cd /opt/digiverso/solr/solr/server/solr/configsets/cp -a _default/ goobiviewercd goobiviewer/conf/rm managed-schemawget -O schema.xml https://raw.githubusercontent.com/intranda/goobi-viewer-indexer/master/goobi-viewer-indexer/src/main/resources/other/schema.xmlcp lang/stopwords_de.txt lang/stopwords.txtwget https://raw.githubusercontent.com/intranda/goobi-viewer-indexer/master/goobi-viewer-indexer/src/main/resources/other/mapping-ISOLatin1Accent.txtpatch solrconfig.xml << "EOF"@@ -21,6 +21,8 @@this file, see http://wiki.apache.org/solr/SolrConfigXml.--><config>+ <schemaFactory class="ClassicIndexSchemaFactory"/>+<!-- In all configuration below, a prefix of "solr." for class namesis an alias that causes solr to search appropriate packages,including org.apache.solr.(search|update|request|core|analysis)@@ -57,6 +59,10 @@<lib dir="./lib" />-->+ <lib dir="${solr.install.dir:../../../..}/contrib/analysis-extras/lib" regex=".*\.jar" />+ <lib dir="${solr.install.dir:../../../..}/contrib/analysis-extras/lucene-libs" regex=".*\.jar" />+ <lib dir="${solr.install.dir:../../../..}/dist/" regex="solr-analysis-extras-\d.*\.jar" />+<!-- A 'dir' option by itself adds any files found in the directoryto the classpath, this is useful for including all jars in a@@ -773,7 +779,7 @@<initParams path="/update/**,/query,/select,/spell"><lst name="defaults">- <str name="df">_text_</str>+ <str name="df">DEFAULT</str></lst></initParams>@@ -1108,7 +1114,7 @@</updateProcessor><!-- The update.autoCreateFields property can be turned to false to disable schemaless mode -->- <updateRequestProcessorChain name="add-unknown-fields-to-the-schema" default="${update.autoCreateFields:true}"+ <updateRequestProcessorChain name="add-unknown-fields-to-the-schema" default="${update.autoCreateFields:false}"processor="uuid,remove-blank,field-name-mutating,parse-boolean,parse-long,parse-double,parse-date,add-schema-fields"><processor class="solr.LogUpdateProcessorFactory"/><processor class="solr.DistributedUpdateProcessorFactory"/>EOFchown -R solr. *
Das neue configset jetzt in Zookeeper hochladen:
cd /opt/digiverso/solr/solr/sudo -u solr bin/solr zk upconfig -n goobiviewer -d server/solr/configsets/goobiviewer/
Für die Suche nach Geokoordinaten wird noch die JTS Bibliothek benötigt:
wget -O /opt/digiverso/solr/solr/server/solr-webapp/webapp/WEB-INF/lib/jts-core-1.17.0.jar https://github.com/locationtech/jts/releases/download/1.17.0/jts-core-1.17.0.jarchown solr. /opt/digiverso/solr/solr/server/solr-webapp/webapp/WEB-INF/lib/jts-core-1.17.0.jar
Am Ende den Dienst starten und eine neue Collection für den Goobi viewer mit dessen Konfigurationsdateien anlegen:
systemctl start solrsudo -u solr bin/solr create -c collection1 -n goobiviewer
Zuerst wird die Applikation kompiliert. Danach werden die benötigten Dateien nach /opt/digiverso/indexer/ kopiert und dabei die indexerconfig_solr.xml nach solr_indexerconfig.xml umbenannt, der Tomcat Port kontrolliert und gegebenenfalls C:
durch /opt
ersetze. Zum Schluss wird die systemd Service Unit aktiviert:
mvn -f $install/goobi-viewer-indexer/goobi-viewer-indexer packagemv $install/goobi-viewer-indexer/goobi-viewer-indexer/target/solr-Indexer.jar /opt/digiverso/indexer/solrIndexer.jarsed -e 's/8081/8983/g' -e 's/C:/\/opt/g' $install/goobi-viewer-indexer/goobi-viewer-indexer/target/classes/indexerconfig_solr.xml -e 's/collection2/collection1/g' > /opt/digiverso/indexer/solr_indexerconfig.xmlmv $install/goobi-viewer-indexer/goobi-viewer-indexer/src/main/resources/other/solrindexer.service /etc/systemd/system/systemctl enable solrindexer.service
Den Tomcat Dienst stoppen:
systemctl stop tomcat9
Danach die folgende Datei nach /etc/tomcat9/Catalina/localhost/viewer.xml
legen:
sed -e "s|PW_SQL_VIEWER|${PW_SQL_VIEWER}|g" << "EOF" >/etc/tomcat9/Catalina/localhost/viewer.xml<?xml version='1.0' encoding='UTF-8'?><Context><Resources><PreResourcesclassName="org.apache.catalina.webresources.DirResourceSet"base="/opt/digiverso/tomcat-lib/"webAppMount="/WEB-INF/lib" /><PreResourcesclassName="org.apache.catalina.webresources.DirResourceSet"base="/opt/digiverso/viewer/themes/goobi-viewer-theme-reference/goobi-viewer-theme-reference/WebContent/resources/themes/"webAppMount="/resources/themes" /></Resources><Resourcename="viewer"auth="Container"factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"type="javax.sql.DataSource"driverClassName="org.mariadb.jdbc.Driver"username="viewer"password="PW_SQL_VIEWER"maxActive="100"maxIdle="30"minIdle="4"maxWait="10000"testOnBorrow="true"testWhileIdle="true"validationQuery="SELECT SQL_NO_CACHE 1"removeAbandoned="true"removeAbandonedTimeout="600"url="jdbc:mysql://localhost/viewer?characterEncoding=UTF-8&autoReconnect=true&autoReconnectForPools=true" /></Context>EOF
Nun die Dateirechte anpassen, damit die Datei bei einem Update nicht mit gelöscht wird:
chown -R root.tomcat /etc/tomcat9/Catalinachmod -R g-w /etc/tomcat9/Catalina
Das Theme wird als externes Theme eingebunden:
mkdir -p /opt/digiverso/viewer/themes/cd /opt/digiverso/viewer/themes/git clone https://github.com/intranda/goobi-viewer-theme-reference.git
Nun den Goobi viewer kompilieren und an die erwartete Stelle im Dateisystem verschieben:
mvn -f /opt/digiverso/viewer/themes/goobi-viewer-theme-reference/goobi-viewer-theme-reference packagemv /opt/digiverso/viewer/themes/goobi-viewer-theme-reference/goobi-viewer-theme-reference/target/viewer.war /var/lib/tomcat9/webapps/viewer.war
Zum Schluss noch letzte Konfigurationsdateien verschieben und danach den Tomcat Dienst wieder starten:
mv $install/goobi-viewer-core-config/goobi-viewer-core-config/src/main/resources/install/* /opt/digiverso/viewer/config/chown -R tomcat: /opt/digiverso/viewer/systemctl start tomcat9
Für die Installation der OAI und SRU Schnittstelle muss zuerst die Applikation kompiliert werden:
mvn -f $install/goobi-viewer-connector/goobi-viewer-connector package
Danach müssen die war-Datei und die Konfigurationsdateien an die erwartete Stelle verschoben werden:
mv $install/goobi-viewer-connector/goobi-viewer-connector/target/M2M.war /opt/digiverso/viewer/bin/M2M.warmv $install/goobi-viewer-connector/goobi-viewer-connector/target/M2M/WEB-INF/classes/*.xsl /opt/digiverso/viewer/oai/chown -R tomcat: /opt/digiverso/viewer/bin/chown -R tomcat: /opt/digiverso/viewer/oai/
Danach die folgende Datei nach /etc/tomcat9/Catalina/localhost/M2M.xml
legen:
cat << "EOF" >/etc/tomcat9/Catalina/localhost/M2M.xml<?xml version="1.0" encoding="UTF-8"?><ContextdocBase="/opt/digiverso/viewer/bin/M2M.war"crossContext="true"reloadable="true"></Context>EOF
Extraktion der config_oai.xml
:
unzip -p /opt/digiverso/viewer/bin/M2M.war WEB-INF/classes/config_oai.xml > /opt/digiverso/viewer/config/config_oai.xml
Anpassen der Einstellungen auf die korrekte URL, damit die Resolver-Links funktionieren und sicherstellen, dass der Port des Tomcats auf dem der Solr Dienst läuft 8080 entspricht:
sed -i -e "s|http://localhost:8080/viewer/oai|http://${VIEWER_HOSTNAME}/viewer/oai|g" -e "s|http://localhost:8080/viewer/resolver|http://${VIEWER_HOSTNAME}/viewer/resolver|g" -e "s|http://localhost:8080/viewer/piresolver|http://${VIEWER_HOSTNAME}/viewer/piresolver|g" -e "s|http://localhost:8081/solr|http://localhost:8983/solr/collection1|g" /opt/digiverso/viewer/config/config_oai.xml
Für regelmäßige Aufgaben muss ein Cronjob eingerichtet werden:
sed -e "s|VIEWER.EXAMPLE.ORG|${VIEWER_HOSTNAME}|g" -e "s|TOKEN|${TOKEN}|g" << "EOF" >/etc/cron.d/intranda-goobiviewerPATH=/usr/bin:/bin:/usr/sbin/MAILTO=admin@intranda.com## Regular cron jobs for the Goobi viewer### This REST call triggers the email notification about new search hits for users,## that enabled notifications for saved searches42 8,12,17 * * * root curl -s -H "Content-Type: application/json" -H "token:TOKEN" -d '{"type":"NOTIFY_SEARCH_UPDATE"}' http://localhost:8080/viewer/api/v1/tasks/ 1>/dev/null## This REST call creates an XML sitemap for the Goobi viewer instance. Please always## call it on it's external URL because otherwise the protocol (http/https) might not## be detected correctly18 1 * * * root curl -s -H "Content-Type: application/json" -H "token:TOKEN" -d '{"type":"UPDATE_SITEMAP"}' http://localhost:8080/viewer/api/v1/tasks/ 1>/dev/null## These two scripts pull the theme git repository regulary. The @daily part is only## a reminder for the 1-minute schedule#*/1 * * * * root cd /opt/digiverso/viewer/themes/goobi-viewer-theme-reference; git pull | grep -v -e "Already up.to.date." -e "Bereits aktuell."#@daily root echo "Please look at the git checkout interval for the Goobi viewer theme" | mail -s "Reference: Theme repository is checked out every minute" admin@intranda.com## Optimize the Solr search index once a month@monthly root curl -s http://localhost:8983/solr/collection1/update?optimize=true&waitFlush=falseEOF
In der lokalen config_viewer.xml
müssen verschiedene Einstellungen hinterlegt werden, hierbei müssen Domain und gegebenenfalls das Protokoll angepasst werden:
sed -e "s|VIEWER.EXAMPLE.ORG|${VIEWER_HOSTNAME}/viewer|g" -e "s|TOKEN|${TOKEN}|g" << "EOF" >/opt/digiverso/viewer/config/config_viewer.xml<?xml version="1.0" encoding="UTF-8" ?><config><urls><metadata><mets>http://VIEWER.EXAMPLE.ORG/oai?verb=GetRecord&metadataPrefix=mets&identifier=</mets><marc>http://VIEWER.EXAMPLE.ORG/oai?verb=GetRecord&metadataPrefix=marcxml&identifier=</marc><dc>http://VIEWER.EXAMPLE.ORG/oai?verb=GetRecord&metadataPrefix=oai_dc&identifier=</dc><ese>http://VIEWER.EXAMPLE.ORG/oai?verb=GetRecord&metadataPrefix=europeana&identifier=</ese></metadata><contentServerWrapper>http://VIEWER.EXAMPLE.ORG/content/</contentServerWrapper><download>http://VIEWER.EXAMPLE.ORG/download/</download><rest>http://VIEWER.EXAMPLE.ORG/api/v1/</rest></urls><viewer><theme subTheme="false" mainTheme="reference" discriminatorField="" autoSwitch="true" addFilterQuery="false" filterQueryVisible="false"><rootPath>/opt/digiverso/goobi-viewer-theme-reference/goobi-viewer-theme-reference/WebContent/resources/themes/</rootPath></theme></viewer><rss><numberOfItems>50</numberOfItems><title>Goobi viewer RSS Feed</title><description>new items</description><copyright>(c) Goobi viewer using institution </copyright></rss><webapi><authorization><token>TOKEN</token></authorization></webapi></config>EOF
Der Goobi viewer verfügt über ein Backend. Mit dem folgenden Kommando wird ein Testaccount mit dem Benutzernamen goobi@intranda.com
und dem Passwort viewer
in die Datenbank eingefügt:
mysql -e 'USE viewer;INSERT INTO users (active,email,password_hash,score,superuser) VALUES (1,"goobi@intranda.com","$2a$10$Z5GTNKND9ZbuHt0ayDh0Remblc7pKUNlqbcoCxaNgKza05fLtkuYO",0,1);'