5. Restoring the WAPT Server¶
In case of a complete crash, restart a standard WAPT Server installation on your WAPT Server. But don’t launch the wapt postconfiguration. Then follow this procedure to restore your data.
By default, we recommend retaining the same IP address and Fully Qualified Domain Name (FQDN) on the new WAPT server.
To ensure that the new WAPT server has sufficient disk space for the repository, monitor the volume of your old WAPT server after performing the cleanup process. This will help you determine the appropriate disk space requirements for the new server.
For Debian and derivatives:
du -sh /var/www/
du -sh /opt/wapt/
For Redhat and derivatives:
du -sh /opt/wapt/
du -sh /var/www/html/
To display the size of the “C:\wapt” repository, follow these steps:
1- Open File Explorer and navigate to “This PC” or “My Computer.”
2- Locate and right-click on the “C:\wapt” folder.
3- From the context menu, select “Properties.”
4- In the Properties window, you will see various tabs. Ensure you are on the “General” tab.
5- Look for the “Size” and “Size on disk” lines, which will display the total size of the folder and its contents.
Alternatively, you can use the following script to retrieve the size programmatically.
Powershell script :
# Directory paths $waptPath = "C:\wapt\waptserver\repository\wapt" $wadsPath = "C:\wapt\waptserver\repository\wads" $wuaPath = "C:\wapt\waptserver\repository\waptwua" $wapthostPath = "C:\wapt\waptserver\repository\wapt-host" # Function to calculate the size of a directory function Get-DirectorySize { param ( [string]$path ) $size = (Get-ChildItem $path -Recurse -File -ErrorAction SilentlyContinue | Measure-Object -Property Length -Sum).Sum return $size } # Calculate sizes for each directory $waptSize = Get-DirectorySize -path $waptPath $wadsSize = Get-DirectorySize -path $wadsPath $wuaSize = Get-DirectorySize -path $wuaPath $wapthostSize = Get-DirectorySize -path $wapthostPath # Convert to GB and display $waptGB = [math]::Round($waptSize / 1GB, 2) $wadsGB = [math]::Round($wadsSize / 1GB, 2) $wuaGB = [math]::Round($wuaSize / 1GB, 2) $wapthostGB = [math]::Round($wapthostSize / 1GB, 2) Write-Output "Size of $waptPath : $waptSize octets ($waptGB GB)" Write-Output "Size of $wadsPath : $wadsSize octets ($wadsGB GB)" Write-Output "Size of $wuaPath : $wuaSize octets ($wuaGB GB)" Write-Output "Size of $wapthostPath : $wapthostSize octets ($wapthostGB GB)" # Combined total $totalSize = $waptSize + $wadsSize + $wuaSize + $wapthostSize $totalGB = [math]::Round($totalSize / 1GB, 2) Write-Output "Total size to migrate: $totalSize bytes ($totalGB GB)"
5.1. Linux¶
Follow the standard WAPT server installation process, but do NOT execute the postconf.py script.
For Debian and derivatives: installation guide
For Redhat and derivatives: installation guide
After installation, ensure the new WAPT server is renamed to match the exact server name and IP address of the previous server (srvwapt). Update the following configuration files accordingly:
/etc/hostname
/etc/hosts
/etc/network/interfaces
/etc/resolv.conf
Stop WAPT related services on the WAPT Server.
systemctl stop nginx && systemctl stop waptserver && systemctl stop waptserver-uwsgi && systemctl stop wapttasks
Restore the following directories.
C:\wapt\waptserver\repository\wapt => /var/www/wapt/
C:\wapt\waptserver\repository\wapt-host => /var/www/wapt-host/
C:\wapt\waptserver\repository\waptwua => /var/www/waptwua/
C:\wapt\waptserver\repository\wads => /var/www/wads/
C:\wapt\conf => /opt/wapt/conf/
C:\wapt\waptserver\nginx\ssl => /opt/wapt/waptserver/ssl/
C:\wapt\waptserver\repository\*.json => /var/www/*.json
Modify the data in the waptserver.ini
Go to /opt/wapt/conf/waptserver.ini, and correct the following sentences :
clients_signing_key = c:\wapt\conf\ca-srvwaptname.mydomain.lan.pem => clients_signing_key = /opt/wapt/conf/ca-srvwaptname.mydomain.lan.pem
clients_signing_certificate = c:\wapt\conf\ca-srvwaptname.mydomain.lan.crt => clients_signing_certificate = /opt/wapt/conf/ca-srvwaptname.mydomain.lan.crt
Change the path of the server certificate in /etc/nginx/sites-avalaible/wapt.conf
Modify following the sentence :
ssl_client_certificate "c:\wapt\conf\ca-srvwaptname.mydomain.lan.crt" => ssl_client_certificate "/opt/wapt/ca-srvwaptname.mydomain.lan.crt"
Recreate the symbolic link
ln -s /var/www/wapt/waptagent/waptsetup.exe waptsetup.exe
ln -s /var/www/wapt/waptagent/waptsetup.exe waptsetup-tis.exe
ln -s /var/www/wapt/waptagent/waptdeploy.exe waptdeploy.exe
C:\wapt\waptserver\repository\wapt => /var/www/html/wapt/
C:\wapt\waptserver\repository\wapt-host => /var/www/html/wapt-host/
C:\wapt\waptserver\repository\waptwua => /var/www/html/waptwua/
C:\wapt\waptserver\repository\wads => /var/www/html/wads/
C:\wapt\conf => /opt/wapt/conf/
C:\wapt\waptserver\nginx\ssl => /opt/wapt/waptserver/ssl/
C:\wapt\waptserver\repository\*.json => /var/www/html/*.json
Modify the data in the waptserver.ini
Go to /opt/wapt/conf/waptserver.ini, and correct the following sentences :
clients_signing_key = c:\wapt\conf\ca-srvwaptname.mydomain.lan.pem => clients_signing_key = /opt/wapt/conf/ca-srvwaptname.mydomain.lan.pem
clients_signing_certificate = c:\wapt\conf\ca-srvwaptname.mydomain.lan.crt => clients_signing_certificate = /opt/wapt/conf/ca-srvwaptname.mydomain.lan.crt
Change the path of the server certificate in /etc/nginx/sites-avalaible/wapt.conf
Modify following the sentence :
ssl_client_certificate "c:\wapt\conf\ca-srvwaptname.mydomain.lan.crt" => ssl_client_certificate "/opt/wapt/ca-srvwaptname.mydomain.lan.crt"
Recreate the symbolic link
ln -s /var/www/html/wapt/waptagent/waptsetup.exe waptsetup.exe
ln -s /var/www/html/wapt/waptagent/waptsetup.exe waptsetup-tis.exe
ln -s /var/www/html/wapt/waptagent/waptdeploy.exe waptdeploy.exe
/var/www/wapt/ => /var/www/html/wapt/
/var/www/wapt-host/ => /var/www/html/wapt-host/
/var/www/waptwua/ => /var/www/html/waptwua/
/var/www/wads/ => /var/www/html/wads/
/opt/wapt/conf/ => /opt/wapt/conf/
/opt/wapt/waptserver/ssl/ => /opt/wapt/waptserver/ssl/
/var/www/*.json => /var/www/html/*.json
Adapt news paths for parameter on your new server in the waptserver.ini
vi /opt/wapt/conf/waptserver.ini
wapt_folder = /var/www/html/wapt
waptwua_folder= /var/www/html/waptwua
wapt-host_folder= /var/www/html/wapt-host
wads_folder= /var/www/html/wads
Adapt path for the nginx configuration.
vi /etc/nginx/conf.d/wapt.conf
Root paths must point to "/var/www/html/"
Hint
If you use Kerberos to authenticate hosts and users, restore the file and rights.
sudo chown root:nginx /etc/nginx/http-krb5.keytab
sudo chmod 640 /etc/nginx/http-krb5.keytab
restorecon -v -R /etc/nginx/http-krb5.keytab
Recreate the symbolic link
ln -s /var/www/html/wapt/waptagent/waptsetup.exe waptsetup.exe
ln -s /var/www/html/wapt/waptagent/waptsetup.exe waptsetup-tis.exe
ln -s /var/www/html/wapt/waptagent/waptdeploy.exe waptdeploy.exe
/var/www/html/wapt/ => /var/www/wapt/
/var/www/html/wapt-host/ => /var/www/wapt-host/
/var/www/html/waptwua/ => /var/www/waptwua/
/var/www/html/wads/ => /var/www/wads/
/opt/wapt/conf/ => /opt/wapt/conf/
/opt/wapt/waptserver/ssl/ => /opt/wapt/waptserver/ssl/
/var/www/html/*.json => /var/www/*.json
Adapt news paths for parameter on your new server in the waptserver.ini
vi /opt/wapt/conf/waptserver.ini
wapt_folder = /var/www/wapt
waptwua_folder= /var/www/waptwua
wapt-host_folder= /var/www/wapt-host
wads_folder= /var/www/wads
Adapt path for the nginx configuration.
vi /etc/nginx/sites-available/wapt.conf
Root paths must point to "/var/www/"
Hint
If you use Kerberos to authenticate hosts and users, restore the file and rights.
sudo chmod 640 /etc/nginx/http-krb5.keytab
sudo chown root:www-data /etc/nginx/http-krb5.keytab
Recreate the symbolic link
ln -s /var/www/wapt/waptagent/waptsetup.exe waptsetup.exe
ln -s /var/www/wapt/waptagent/waptsetup.exe waptsetup-tis.exe
ln -s /var/www/wapt/waptagent/waptdeploy.exe waptdeploy.exe
/var/www/wapt/ => /var/www/wapt/
/var/www/wapt-host/ => /var/www/wapt-host/
/var/www/waptwua/ => /var/www/waptwua/
/var/www/wads/ => /var/www/wads/
/opt/wapt/conf/ => /opt/wapt/conf/
/opt/wapt/waptserver/ssl/ => /opt/wapt/waptserver/ssl/
/var/www/*.json => /var/www/*.json
Hint
If you use Kerberos to authenticate hosts and users, restore the file and rights.
sudo chmod 640 /etc/nginx/http-krb5.keytab
sudo chown root:www-data /etc/nginx/http-krb5.keytab
Recreate the symbolic link
ln -s /var/www/wapt/waptagent/waptsetup.exe waptsetup.exe
ln -s /var/www/wapt/waptagent/waptsetup.exe waptsetup-tis.exe
ln -s /var/www/wapt/waptagent/waptdeploy.exe waptdeploy.exe
/var/www/html/wapt/ => /var/www/html/wapt/
/var/www/html/wapt-host/ => /var/www/html/wapt-host/
/var/www/html/waptwua/ => /var/www/html/waptwua/
/var/www/html/wads/ => /var/www/html/wads/
/opt/wapt/conf/ => /opt/wapt/conf/
/opt/wapt/waptserver/ssl/ => /opt/wapt/waptserver/ssl/
/var/www/html/*.json => /var/www/html/*.json
Hint
If you use Kerberos to authenticate hosts and users, restore the file and rights.
sudo chown root:nginx /etc/nginx/http-krb5.keytab
sudo chmod 640 /etc/nginx/http-krb5.keytab
restorecon -v -R /etc/nginx/http-krb5.keytab
Recreate the symbolic link
ln -s /var/www/html/wapt/waptagent/waptsetup.exe waptsetup.exe
ln -s /var/www/html/wapt/waptagent/waptsetup.exe waptsetup-tis.exe
ln -s /var/www/html/wapt/waptagent/waptdeploy.exe waptdeploy.exe
Launch the postconf.sh
/opt/wapt/waptserver/scripts/postconf.sh
Stop WAPT related services on the WAPT Server.
systemctl stop nginx && systemctl stop waptserver && systemctl stop waptserver-uwsgi && systemctl stop wapttasks
Verify the Database
su - postgres
psql -l
Restore the database (adapt the name of your file). The first command deletes the WAPT database (if it exists). Make sure that your dump file is correct before deleting!
Warning
Check the encoding before creating the wapt database, if the dumped file is in en_US, your new base has to be en_US.
cd /tmp
sudo -u postgres psql -c "drop database wapt"
sudo -u postgres psql -c "create database wapt with owner=wapt encoding='utf-8'"
sudo -u postgres psql < /tmp/backup_wapt.sql
Apply ownership rights to the restored folders.
chown -R wapt:www-data /var/www/wapt/
chown -R wapt:www-data /var/www/wapt-host/
chown -R wapt:www-data /var/www/waptwua/
chown -R wapt:www-data /var/www/wads/
chown -R wapt /opt/wapt/conf/
chown -R wapt /opt/wapt/waptserver/ssl/
chown -R wapt:nginx /var/www/html/wapt/
chown -R wapt:nginx /var/www/html/wapt-host/
chown -R wapt:nginx /var/www/html/waptwua/
chown -R wapt:nginx /var/www/html/wads/
chown -R wapt /opt/wapt/conf/
chown -R wapt /opt/wapt/waptserver/ssl/
Run a Scanpackages on your repositories.
wapt-scanpackages /var/www/wapt/
wapt-scanpackages /var/www/html/wapt/
Lastly relaunch the post.conf
/opt/wapt/waptserver/scripts/postconf.sh
The restoration process is now complete
5.2. Windows¶
Stop WAPT related services on the WAPT Server.
net stop WAPTServer
net stop WAPTService
net stop WAPTTftpServer
Restore the following directories.
C:\wapt\waptserver\repository\wapt
C:\wapt\waptserver\repository\wapt-host
C:\wapt\waptserver\repository\waptwua
C:\wapt\waptserver\repository\wads
C:\wapt\conf
C:\wapt\waptserver\nginx\ssl
Apply full rights to the folder
C:\wapt\waptserver\repositoryfor the “Network Service” group.Restore the database (adapt the name of your file). The first command deletes the WAPT database (if it exists). Make sure that your dump file is correct before deleting!
Warning
Check the encoding before creating the wapt database, if the dumped file is in en_US, your new base has to be en_US.
"C:\wapt\waptserver\pgsql-15\bin\psql.exe" -U postgres -c "drop database wapt;"
"C:\wapt\waptserver\pgsql-15\bin\psql.exe" -U postgres -c "create database wapt with owner=wapt encoding='utf-8';"
"C:\wapt\waptserver\pgsql-15\bin\psql.exe" -f c:\backup_wapt.sql -U postgres
Scan package repositories.
wapt-scanpackages "C:\wapt\waptserver\repository\wapt"
Restart WAPT related services on the WAPT Server.
net start WAPTServer
net start WAPTService
net start WAPTTftpServer