Reading guide for system administrators

From ITR Wiki

You are going to run the ITR on your own server? Welcome! This page is your reading guide. It takes you through the wiki in a sensible order, from what the ITR is to installing it, setting it up, keeping it healthy and finding your way when something needs attention. It also brings together the practical facts a system administrator wants to have at hand: where the data lives, how backups work and how updates reach your server.

You do not need to be a developer to follow this guide. For each step it tells you which pages to read and what you will get out of them.

Step 1: get to know the ITR

Start with the ideas behind the ITR. They explain a lot of what you will see later.

  • Introduction – what the ITR is and what you can do with it.
  • Concepts and terminology – organisations, consultants, candidates, sessions, tests, reports and credits. The rest of the wiki uses these words all the time.
  • ITR Design – the design choices, and why the ITR does things the way it does.

The most important idea in one sentence: tests, reports, norms and screen templates are content, not software. Psychologists and other authors build and change them in the ITR itself. Your job as administrator is to keep the platform running; the content takes care of itself.

Step 2: install the ITR

  • Install on linux – the recommended installation, with Docker on Ubuntu. It covers a test setup on your own computer, a production server and HTTPS.
  • Install on windows – the historic installation on Windows with IIS. Only read this if you already have such a server.

Right after the installation, change the password of the Admin user and install at least the open source screen templates. Install on linux tells you how.

Step 3: set up the server

Log in as master user and set up the server and the first organisations.

Step 4: understand how it works

You do not need to know the code, but it helps to know which parts there are and where they keep their data.

  • ITR application architecture – the web client, the two APIs, nginx and PostgreSQL. The section Deployment shows how the Docker containers work together.
  • ITR database model – the master database, the database per organisation, and how the databases create and update themselves.
  • ITR file formats – the files you can download and upload, for example to move tests from one server to another.

Where your data lives

With the Docker installation, everything that matters is kept in folders on the host under /data, so containers can be replaced without losing anything. With an instance number, the folder names end with that number.

Folder What is in it
/data/ITR-data/instance/application.cfg The settings of the server, used by both APIs
/data/ITR-data/instance/log/internal and …/log/external The log files of the internal API and the public API
/data/ITR-data/instance/media Uploaded media files, such as images in tests
/data/ITR-data/instance/translations The translation files, one per language
/data/ITR-data/instance/cache The cache, including the copies of the GitHub repositories; it can be rebuilt
/data/ITR-data/database/data The PostgreSQL databases
/data/ITR-data/database/backup The nightly database backup
/data/ITR-data/nginx/certificates The HTTPS certificate
/data/ITR-webclient, /data/ITR-API, /data/ITR-public-API The code of the web client and the two APIs

Certificates and the firewall

  • Open ports 80 and 443. The ITR is reached through nginx on port 80 (HTTP) and port 443 (HTTPS). Open both in the firewall of the server, and in the firewall of your network or cloud provider if there is one. Make sure your domain name points to the server as well.
  • Let's Encrypt. With the option SSH, prepareITR.sh requests a free certificate from Let's Encrypt for your domain name (see Install on linux). These certificates are only valid for a short time, so the nginx container renews them for you: every Sunday at 0:00 it runs certbot renew, and at 0:10 it copies the certificates and reloads nginx. The result is written to certbot.log in the certificates folder.
  • Keep port 80 open, also when you only use HTTPS. Let's Encrypt checks through port 80 that the domain is really yours, for the first certificate and for every renewal. When port 80 is closed, the renewal fails and the certificate expires after a while.
  • Your own certificate. Place certificate.crt and certificate.key in /data/ITR-data/nginx/certificates (see Install on linux). Renewing it is then up to you, so put the expiry date in your agenda.
  • Several instances on one server. With an instance number the ports become 80 + n and 443 + n. The ITR-Docker repository contains an example HAProxy setup that listens on the normal ports 80 and 443 and sends each domain name to its own instance.

Check the certificate in your browser now and then: a click on the lock in the address bar shows how long it is still valid.

Backups

The PostgreSQL container looks after the databases every night:

  • at 2:00 it saves all databases with pg_dumpall to full-daily-backup.zip in the backup folder;
  • at 3:00 it updates the statistics (vacuumdb);
  • at 4:00 it rebuilds the indexes (reindexdb).

The backup file stays on the same server, and each night replaces the one before. So copy it to another place as well. The ITR-Docker repository has two scripts that help: mountAndBackupSetup.sh prepares a WebDAV storage location, and mountAndBackup.sh copies the database backup, the settings, the logs, the media, the translations and the certificates to it, in a folder per day of the month. That way you always have about a month of backups.

Whatever you choose, make sure your backup contains the database backup and the instance folder, and try a restore now and then.

Keeping the ITR up to date

  • Content: tests, reports, screen templates and translations from the public repositories are installed and updated with Install open source publics in Server settings and tools.
  • Code: the same screen can update the web client and both APIs from GitHub. The ITR is offline for a few minutes while this happens, so choose a quiet moment and make a backup first.
  • Databases: you never have to update a database by hand. After an update, every database brings itself up to the new version the first time it is used. See Creation and updates.

When something needs attention

  • Look at the log first. View log files in Server settings and tools shows the server log live; on the host you find the same files in the log folders above.
  • Restart or clear the cache with the tools in Server settings and tools. A restart interrupts everyone who is working, so pick a quiet moment.
  • Look at the data with Query data sources, without needing database tools.
  • Login questions from users: Login and logout explains passwords, multi factor authentication and what to do when a password is forgotten.

Connecting other systems

Going further

Would you like to adapt the ITR or build your own extensions? Then continue with:

  • ITR development – the repositories, finding your way in the code and writing a plugin.
  • ITR data model – the objects behind tests, sessions, answers and scores.
  • ITR api – the internal and the external API.

One request for anyone who changes the code: existing tests, norms and reports must keep giving exactly the same results. Read ITR Design before you start, and test your changes against existing content.

Where to go next