Migration 1.3 -> 1.5 under Centos 7

Questions about WAPT Server / Requests and help related to the WAPT server
Forum Rules
Community Forum Rules
* English support on www.reddit.com/r/wapt
* French community support is available on this forum
* Please prefix the topic title with [RESOLVED] if it is resolved.
* Please do not edit a topic that is tagged [RESOLVED]. Open a new topic referencing the old one.
* Specify the installed WAPT version, full version, and build number (2.2.1.11957 / 2.2.2.12337 / etc.) as well as the Enterprise/Discovery edition.
* Versions 1.8.2 and earlier are no longer supported. The only questions accepted regarding version 1.8.2 are related to upgrading to a supported version (2.1, 2.2, etc.).
* Specify the server OS (Linux/Windows) and version (Debian Buster/Bullseye - CentOS 7 - Windows Server 2012/2016/2019).
* Specify the OS of the administration/package creation machine and the machine with the problematic agent, if applicable (Windows 7/10/11/Debian 11/etc.).
* Avoid asking multiple questions when opening a topic, otherwise it may be ignored. If there are multiple topics, open separate topics, preferably one after the other and not all at the same time (i.e., do not spam the forum).
* Include code snippets, screenshots, and other images directly in the post. Links to Pastebin, Bitly, and other third-party sites will be systematically removed.
* As with any community forum, support is provided voluntarily by members. If you require commercial support, you can contact Tranquil IT's sales department at 02.40.97.57.55
Locked
CLAM
Messages: 1
Registration: March 30, 2018 - 2:31 PM

March 30, 2018 - 2:54 PM

Good morning,

I followed the procedure as explained on page https://www.wapt.fr/fr/doc/waptserver_u ... entos.html but I encountered some errors during the procedure.

In case this might be useful to others, here are the changes I had to make to successfully complete the migration:

To uninstall wapt 1.3:

Code: Select all

yum remove tis-waptrepo tis-waptsetup tis-waptserver
systemctl stop apache2
systemctl disable apache2
becomes :

Code: Select all

yum remove tis-waptrepo tis-waptsetup tis-waptserver
systemctl stop httpd
systemctl disable httpd


In the section Update the CentOS / Red Hat server :

Code: Select all

yum install postgresql94-server postgresql94-contrib
becomes :

Code: Select all

yum install postgresql94-server postgresql94-contrib mongodb
(MongoDB is split into two packages under CentOS: mongodb-server and mongodb. The mongodb package contains mongoexport, which is used by the migration script.)

I also executed the following command so that the migration script could check for the presence of the lock file:

Code: Select all

chmod 755 /var/lib/mongodb
I patched the file /opt/wapt/waptserver/waptserver_upgrade.py (I only used (current_distrib != "centos linux" because I don't have a rhel7 machine on hand to test if the initial script also needs modification to work):

Code: Select all

--- /opt/wapt/waptserver/waptserver_upgrade.py.orig	2018-03-29 15:00:58.908069144 +0200
+++ /opt/wapt/waptserver/waptserver_upgrade.py	2018-03-29 15:12:00.480088326 +0200
@@ -67,7 +67,10 @@
     """Connect to a mongo instance and write all wapt.hosts collection as json into a file"""
     if platform.system()=='Linux':
         mongo_datadir = '/var/lib/mongodb/'
-        if 'dbpath' in subprocess.check_output('mongoexport --help',shell=True):
+	distrib_tuple = platform.linux_distribution()
+	current_distrib = distrib_tuple[0].lower()
+	print ('detected distrib : %s ' % current_distrib)
+        if ('dbpath' in subprocess.check_output('mongoexport --help',shell=True)) and (current_distrib != "centos linux"):
             data = subprocess.check_output('mongoexport -d wapt -c hosts --jsonArray --dbpath=%s' % mongo_datadir,shell=True)
         else:
             data = subprocess.check_output('mongoexport -c hosts --jsonArray --db wapt',shell=True)
I also patched the /opt/wapt/waptserver/scripts/postconf.py file because under CentOS the daemon is not called mongodb but mongod:

Code: Select all

--- /opt/wapt/waptserver/scripts/postconf.py.orig	2018-03-29 15:51:46.261262372 +0200
+++ /opt/wapt/waptserver/scripts/postconf.py	2018-03-29 15:52:12.043380391 +0200
@@ -234,8 +234,12 @@
 def upgrade2postgres(configfilename):
     print ("mongodb process running, need to migrate")
     run_verbose('sudo -u wapt PYTHONPATH=/opt/wapt PYTHONHOME=/opt/wapt /opt/wapt/bin/python /opt/wapt/waptserver/waptserver_upgrade.py upgrade2postgres -c "%s"' % configfilename)
-    run_verbose("systemctl stop mongodb")
-    run_verbose("systemctl disable mongodb")
+    if type_redhat():
+        run_verbose("systemctl stop mongod")
+        run_verbose("systemctl disable mongod")
+    else:
+        run_verbose("systemctl stop mongodb")
+        run_verbose("systemctl disable mongodb")
 
 def nginx_set_worker_limit(nginx_conf):
     already_set=False
To resign packages from the repository, modify the commands specified on the page https://www.wapt.fr/fr/doc/waptserver_u ... regenerate by changing /var/www/wapt/... to /var/www/html/wapt/...

Code: Select all

PYTHONPATH=/opt/wapt PYTHONHOME=/opt/wapt python /opt/wapt/wapt-signpackages.py -i -s --message-digest=sha256,sha1 -c /root/wapt-private-20180312-1522.crt /var/www/html/wapt/*.wapt

PYTHONPATH=/opt/wapt PYTHONHOME=/opt/wapt python /opt/wapt/wapt-signpackages.py -i -s --message-digest=sha256,sha1 -c /root/wapt-private-20180312-1522.crt /var/www/html/wapt-host/*.wapt
Locked