Skip to content

Admin Maintenance

dbeasley1 edited this page Jan 21, 2022 · 4 revisions

Home | Installation Guide | User Guide | Admin Guide | User Tests


Updating Docker images and XNAT Container

If your version of DASHER does not container the script ./Linux/update_images.sh, download it from here and place in the Linux directory:

https://github.com/KCL-BMEIS/DASHER/blob/master/Linux/update_images.sh

The script can be edited to select different Docker base images. It will update the Docker images used for Nginx and Postgresql and update software running in the XNAT container and set it to update nightly. Warning, this will restart DASHER.

cd Linux
sudo ./update_iamges.sh

You may have issues updating to the latest version of Nginx if you have SSL certificates installed. You may have to edit the file ./nginx/xnat.conf to conform to the latest version and rerun the script.

Reinstalling DASHER

If you need to reinstall DASHER, follow the Linux instructions or Windows Instructions for updating DASHER.

Installing new Plugins in an existing DASHER

If a new XNAT plugin is made available, you can install this on an existing DASHER. You should place the new plugin in one or both plugin folders:

[install_path]/plugins1
[install_path]/plugins2

The plugins in folder plugins1 are those for the first, or non-anonymised XNAT instance, and those plugins in folder plugins2 are for the pseudonymised XNAT instance.

You will then need to restart tomcat as follows:

Restarting tomcat

IMPORTANT: DASHER is a server and stopping the server must be done elegantly - ensure no data is being imported/processed when shutting down

To restart the tomcat service within the containers, run the following script

On Windows run:

[install_dir]\DASHER\Windows\restart_tomcat.bat

On Linux run:

sudo [install_dir]\DASHER\Linux\restart_tomcat.sh

After the script is complete, allow time for all processes to properly restart in the containers.

Additional scripts:

Scripts are located under either ./DASHER/Linux or ./DASHER/Windows.

If you need to restart Docker use:

   sudo ./restart.sh (linux) or restart.bat (Windows)

IMPORTANT: DASHER is a server and stopping the server must be done elegantly - ensure no data is being imported/processed when shutting down

When restarting Docker or DASHER, the containers need rebuilding. This takes a considerable amount of time (>30minutes) before Tomcat fully restarts and you can log into XNAT.

WARNING: On Windows, there is the small possibility of the sql database file is corrupted during the shutdown. In the [shared_storage]/postgres-data[1/2] folders are located the sql database backup files. Locate and delete the newest xnat.sql.gz files from each folder. The previous xnat.sql.gz will then be used to restore the database. Restart DASHER.

If you wish to restart DASHER and delete the existing servers and all the data, or if you have previously attempted a failed install, then try:

   sudo ./restart_and_clean.sh (linux) or restart_and_clean.bat (Windows)

If there is a problem during creating new docker images and containers, old containers and images can be removed:

   sudo ./clean_docker.sh  (linux) or clean_docker.bat (Windows)

To stop and update the Docker service:

  sudo docker stack rm secure-dicom-uploader (Linux)
  docker stack rm secure-dicom-uploader (Windows)

To access the containers via the command line:

Linux:
      Non-anonymised XNAT:  sudo ./update_xnat_projects.sh bash 1
      Pseudonymised XNAT:   sudo ./update_xnat_projects.sh bash 2

Windows:
      Non-anonymised XNAT:  update_xnat_projects.bat bash 1
      Pseudonymised XNAT:   update_xnat_projects.bat bash 2

Backup and Restore

You can save DASHER - the containers and shared storage. This is useful for backing up. It creates a folder ./backup which contains saved containers stored as .tar files. and also a compressed copy of the storage_path.

In order to work with Linux, the postgresql folder cannot be mounted - before starting you must edit some files:

docker-compose-template:
         line 27, 71 - remove #WIN#, so /pg_backup will be mounted:
              ./volume/postgres-data1:/pg_backup
              ./volume/postgres-data2:/pg_backup
         delete lines 95,50:
              LINX- ./volume/postgres-data1:/var/lib/postgresql/data
              LINX- ./volume/postgres-data2:/var/lib/postgresql/data
./xnat/templates/cronjoobs.txt:
         delete #WIN# - this way, the postgresql will backup to the new mounted folder

Linux 
      To save/backup DASHER: sudo ./save_and_restore.sh save
      To restore DASHER from the backup directory: save_and_restore.sh restore

Windows
      To save/backup DASHER: sudo ./save_and_restore.bat save
      To restore DASHER from the backup directory: save_and_restore.bat restore

Maintenance:

A script inside the tomcat docker container regularly cleans the container of old log files etc. However space should be monitored.

    docker stats

Will give the current health of the service.

Recovering Space:

If the server is running low on space, old dicom files can be deleted via XNAT.

WARNING: if the data has not been synched to a remote repository, the data will be lost for good.

On a Session page, go to Process Session, and select the ‘delete_dicom_files’. You must be logged on as the XNAT admin user. It gives you the option to delete the dicom files of that session or all the dicom files on the server.

If you wish to continuously delete old dicom files (>30days) edit the [storage]/scripts1/clean_logs.sh file, uncommenting out the line to delete dicom files older than 30 days. This will not immediately delete the files, but the maintenance script will clear these – it runs as a cronjob once per day.

The docker-compose.yaml file contains the resources allocated to each container. If more resources are required, change the memory/cpus allocated to each container then save the file and restart the service:

    Docker stack rm secure-dicom-uploader
    Docker stack deploy –c docker-compose.yml secure-dicom-uploader

The service should continue as before.

You may wish to add some scripts to a container. For the tomcat/xnat container, a shared folder ‘scripts’ allows files to be dropped into the container. Else use the command docker cp. Type docker cp –help for more info.

Logging

DASHER keeps a log of various processing steps to aid troubleshooting and tracking of general processing. The log files are stored here for the non-anonymised and pseudonymised XNAT instances respectively:

[storage_path]/scripts1/logs/
[storage_path]/scripts2/logs/

The non-anonymised XNAT instance holds the following log files:

image

The pseudonymised XNAT instance holds the following log files:

image

Developer Notes

  • /data/xnat/setup-xnat.sh is triggered when the tomcat(xnat) containers are started. This script starts tomcat, cron and uses curl to create the users and projects and configure XNAT. It loops at the end to prevent the container stopping.
  • /data/xnat/xnat.cfg – copied into the container when the image is built.
  • /data/xnat/scripts – this is mounted and contains scripts that can be added later. It also contains setting files (protocol.txt, permitted_roi_labels.txt, anon scripts)
Clone this wiki locally