Restoring from backup

If you have lost your configuration files, you will need to restore them before you will be able to restore databases. To restore your configuration files from backup, you can find a recent configuration backup under the /srv/vaisala/radarsw/backup directory to restore and then run the following command:

bd=/srv/vaisala/radarsw/backup/configuration
(cd / && tar xzf ${bd}/radarsw-configuration-2019-10-12T07-54-50.tar.gz)
  1. Log in to the server as root.
  2. Stop the Monit service:
    systemctl stop monit.service
  3. Stop the IRIS Focus web application:
    systemctl stop vaisala-radarsw-webapp.service
  4. Stop all services which might access the database.
    kubectl delete -f /etc/vaisala/focus/k8s/vaisala-focus.yaml
  5. (Optional) Run the backup script:

    /usr/vaisala/radarsw/backup/bin/do-backups

    Database backups for the wx and vsp databases will be in /srv/vaisala/radarsw/backup/database. Move a copy to a remote host if reinstalling or otherwise reimaging the machine.
  6. Drop the current database with the rsw-db-tool utility:
    rsw-db-tool drop-db
  7. Drop the current database with the rsw-vsp-db-tool utility:
    rsw-vsp-db-tool drop-db
  8. Drop the current keycloak database using the rsw-api-auth-tool:
    rsw-api-auth-tool delete-db --no-prompt
  9. Recreate an empty wx database:
    rsw-db-tool create-db
  10. Create an empty keycloak database:
    rsw-api-auth-tool create-db
  11. Recreate an empty vsp database:
    rsw-vsp-db-tool create-db
  12. Copy your database backup files back to the Focus server and restore the database contents by reading the file contents into the standard output stream and inserting them in the IRIS Focus databases:
    ext=2019-10-12T07-54-50.gz
    pre=radarsw-database
    gzip -dc ${pre}-vsp-${ext} | psql -d vsp_v1 -U vsp_user -h localhost
    gzip -dc ${pre}-wx-${ext} | psql -d wxdb2 -U wxuser -h localhost
    gzip -dc ${pre}-keycloak-${ext} | psql -d keycloak -U keycloak -h localhost
  13. Restart services which might use database.
    kubectl apply -f /etc/vaisala/focus/k8s/vaisala-focus.yaml
  14. Start the IRIS Focus web application:
    systemctl start vaisala-radarsw-webapp.service
  15. Start the Monit service:
    systemctl start monit.service