Hide navigation sidebar
Hide table of contents sidebar
Skip to content
Quickstart Official documentation Setuphelpers Changelog FAQ
Back to top
View this page
Toggle table of contents sidebar

# 5. Restoring the WAPT Server

In case of a complete crash, restart a standard WAPT Server installation on your WAPT Server. 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.

## 5.1. Linux

- 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.

    /var/www/wapt/
    /var/www/wapt-host/
    /var/www/waptwua/
    /var/www/wads/
    /opt/wapt/conf/
    /opt/wapt/waptserver/ssl/
    /var/www/*.json

    /var/www/html/wapt/
    /var/www/html/wapt-host/
    /var/www/html/waptwua/
    /var/www/html/wads/
    /opt/wapt/conf/
    /opt/wapt/waptserver/ssl/
    /var/www/html/*.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

    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

- 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/

Important

If you change waptserver Debian for Redhat or vice versa. Don’t forget to check somethings :

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

    vi /opt/wapt/conf/waptserver.ini

    wapt_folder = /var/www/html/wapt
    waptwua_folder= /var/www/html/waptwua

Adapt path for the `nginx` configuration.

    vi /etc/nginx/sites-available/wapt.conf

    Root paths must point to "/var/www/"

    vi /etc/nginx/conf.d/wapt.conf

    Root paths must point to "/var/www/html/"

Recreating symbolic links.

    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

    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

- Run a Scanpackages on your repositories.

    wapt-scanpackages /var/www/wapt/

    wapt-scanpackages /var/www/html/wapt/

- Restart WAPT related services on the WAPT Server.

    systemctl start wapttasks
    systemctl start waptserver
    systemctl start nginx

- Launch the postconf.sh

    /opt/wapt/waptserver/scripts/postconf.sh

## 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\repository` for 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-14\bin\psql.exe" -U postgres -c "drop database wapt;"
    "C:\wapt\waptserver\pgsql-14\bin\psql.exe" -U postgres -c "create database wapt with owner=wapt encoding='utf-8';"
    "C:\wapt\waptserver\pgsql-14\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