diff --git a/rpm/INSTALL.rst b/rpm/INSTALL.rst index c42029bb26c27bb05a57ecdb0c429a69ecca234a..95abe3b86b3537b7c851b8e3531a459656051da2 100644 --- a/rpm/INSTALL.rst +++ b/rpm/INSTALL.rst @@ -15,14 +15,15 @@ The main steps are * Install `PostgreSQL <https://www.postgresql.org/>`_ and set up a database. -* Install and configure `Apache Tomcat <https://tomcat.apache.org/>`_. +* Install and configure `Apache Tomcat 8.5 or higher <https://tomcat.apache.org/>`_. * Install the MINERVA RPM. +* Data migration from version 13.2.x and lower. PostgreSQL ---------- -Install PostgreSQL and initialise it with +Install PostgreSQL and initialize it with .. code:: shell @@ -58,17 +59,72 @@ Create the MINERVA database user and the database Apache Tomcat ------------- -Install Apache Tomcat with +Create a new tomcat group and tomcat user .. code:: shell - yum install -y tomcat + sudo groupadd tomcat + sudo useradd -M -s /bin/nologin -g tomcat -d /opt/tomcat tomcat -In ``/etc/sysconfig/tomcat``, adjust the memory settings, e.g. +Download Tomcat Binary -.. code:: +.. code:: shell + + wget https://www-eu.apache.org/dist/tomcat/tomcat-8/v8.5.46/bin/apache-tomcat-8.5.46.tar.gz + sudo mkdir /opt/tomcat + sudo tar xvf apache-tomcat-8*tar.gz -C /opt/tomcat --strip-components=1 + +Update Permissions + +.. code:: shell + + cd /opt/tomcat + sudo chgrp -R tomcat /opt/tomcat + sudo chmod -R g+r conf + sudo chmod g+x conf + sudo chown -R tomcat webapps/ work/ temp/ logs/ + +Install Systemd Unit File. Create a file `/etc/systemd/system/tomcat.service` (you might want to change memory settings specified in CATALINA_OPTS): + + # Systemd unit file for tomcat + [Unit] + Description=Apache Tomcat Web Application Container + After=syslog.target network.target - JAVA_OPTS="-Xms2048M -Xmx4096M" + [Service] + Type=forking + + Environment=JAVA_HOME=/usr/lib/jvm/jre + Environment=CATALINA_PID=/opt/tomcat/temp/tomcat.pid + Environment=CATALINA_HOME=/opt/tomcat + Environment=CATALINA_BASE=/opt/tomcat + Environment='CATALINA_OPTS=-Xms2048M -Xmx4096M -server -XX:+UseParallelGC' + Environment='JAVA_OPTS=-Djava.awt.headless=true -Djava.security.egd=file:/dev/./urandom' + + ExecStart=/opt/tomcat/bin/startup.sh + ExecStop=/bin/kill -15 $MAINPID + + User=tomcat + Group=tomcat + UMask=0007 + RestartSec=10 + Restart=always + + [Install] + WantedBy=multi-user.target + +Reload Systemd to load the Tomcat unit file + +.. code:: shell + + sudo systemctl daemon-reload + +Enable and start Tomcat + +.. code:: shell + + sudo systemctl enable tomcat + sudo systemctl start tomcat Make sure to open the port (by default port 8080) to allow incoming connections, e.g. using ``firewalld`` this can be accomplished with @@ -83,14 +139,6 @@ connections, e.g. using ``firewalld`` this can be accomplished with hardcoded, therefore make sure the MINERVA cannot be accessed from distrusted hosts until the password was changed. -Enable and start Tomcat - -.. code:: shell - - systemctl enable tomcat - systemctl start tomcat - - MINERVA ------- @@ -118,3 +166,20 @@ e.g. on a local network this could be Login with the username ``admin`` and the password ``admin``. Click on the ``INFO`` tab in the left panel, and click on ``MANUAL`` to get more information about administrating and using MINERVA. + +Migration from MINERVA 13.2 and lower +------- + +MINERVA 13.2 and earlier versions used tomcat7 that was in most cases installed +from rpm. Starting from MINERVA 14.0.0 tomcat8 or higher is required. Before +you install new version of minerva you would need to remove old tomcat: +.. code:: + sudo yum remove tomcat + +And install new tomcat manually as described in the section above. Tomcat7 +stored data in different place than manually installed tomcat8. Move the data +to tomcat8 folder: + +.. code:: + sudo mv /var/lib/tomcat/webapps/map_images /opt/tomcat/webapps/ + sudo mv /var/lib/tomcat/webapps/minerva-big /opt/tomcat/webapps/ diff --git a/rpm/buildrpm.sh b/rpm/buildrpm.sh index e425be4ede226c578132a70bf6a68a49d42a845c..712723a8c464098f17e465258ab17f807da29dcb 100755 --- a/rpm/buildrpm.sh +++ b/rpm/buildrpm.sh @@ -36,7 +36,7 @@ if [[ "$RPMBUILD_TEMP" =~ ' ' ]]; then fi # current date (for automatic changelog) -CURDATE=$(date +"%a %b %d %Y") +CURDATE=$(LC_ALL=C date +"%a %b %d %Y") # clean build directories rm -rf "$RPMBUILD_TEMP" diff --git a/rpm/minerva.spec.in b/rpm/minerva.spec.in index 555ba6d81f680d1020472e63f27393518da7c358..d1819417b77b5c1c22993a85b93a431d31ca97a2 100644 --- a/rpm/minerva.spec.in +++ b/rpm/minerva.spec.in @@ -7,7 +7,7 @@ License: AGPLv3 URL: http://r3lab.uni.lu/web/minerva-website/ Source0: https://git-r3lab.uni.lu/piotr.gawron/minerva/repository/archive.tar.gz?ref=v%{version} -Requires: tomcat, postgresql +Conflicts: tomcat < 8.0 BuildArch: noarch %description @@ -18,7 +18,10 @@ used and managed via a webbrowser. %preun -p /bin/bash if [ $1 == 1 ]; then # remove old unpacked ("exploded") directory of war file + # version 13.2 and below rm -rf %{_sharedstatedir}/tomcat/webapps/%{name} + # version 14.0 and upper + rm -rf /opt/tomcat/webapps/%{name} fi %install @@ -27,15 +30,15 @@ mkdir -p %{buildroot}/%{_datadir}/%{name} install -m 0644 %{name}.war %{buildroot}/%{_datadir}/%{name}/%{name}.war mkdir -p %{buildroot}/%{_sysconfdir}/logrotate.d install -m 0644 logrotate_minerva %{buildroot}/%{_sysconfdir}/logrotate.d/minerva -mkdir -p %{buildroot}/%{_sharedstatedir}/tomcat/webapps -ln -s %{_datadir}/%{name}/%{name}.war %{buildroot}/%{_sharedstatedir}/tomcat/webapps/ +mkdir -p %{buildroot}/opt/tomcat/webapps +ln -s %{_datadir}/%{name}/%{name}.war %{buildroot}/opt/tomcat/webapps/ %files %defattr(-,root,root,-) %doc README.md CHANGELOG INSTALL.rst %{_datadir}/%{name}/%{name}.war %config(noreplace) %{_sysconfdir}/logrotate.d/minerva -%attr(-,tomcat,tomcat) %{_sharedstatedir}/tomcat/webapps/%{name}.war +%attr(-,tomcat,tomcat) /opt/tomcat/webapps/%{name}.war %changelog * __DATE__ - %{version}-%{release}