Skip to main content

Backup

Txture saves most of its data and internal configuration within the txture_home directory. In addition to backing up this directory, one has to back up the PostgreSQL database. Txture must be at least put into maintenance mode to ensure that no corrupt files will be backed up. Alternatively, it is of course also possible to shut down Txture and restart it after the backup process.

Maintenance mode can be activated via the REST API in the following way:

  1. Call {txture-URL}/api/v11/maintenance-mode/enable with a PUT request. This call will schedule the activation of maintenance mode. Please note that an API Token with administrative privileges is required for this task.
  2. (Optional, but recommended) Depending on the usage of your Txture instance, it might take a while before the maintenance is actually activated. It is hence recommended to wait with the backup until the maintenance mode is active. This can be done by querying your user-ID from the server with a GET call to {txture-URL}/api/v11/whoami. The resulting JSON contains an id field with the user-ID. The next step is to query for the maintenance mode with a GET call to {txture-URL}/api/v11/maintenance-mode. The resulting JSON contains a list with the name .enabledByActorDatabaseIds. Ideally this polling call is repeated until the first entry in this list equals the user-ID. In most usage scenarios this will be the first call.
  3. Proceed with backing up your txture_home directory with a tool of your choice. Compression (such as gzip oder LZMA) is recommended as it typically achieves compression rates of up to 90%! However, no restriction as to the tools used for backing up the directory is given. This allows for using your usual backup tools.
  4. Back up the PostgreSQL database using pg_dump. This could look similar to the following command if you are running PostgreSQL as a container in docker: docker exec -t {{postgres_container_name}} pg_dump --clean --if-exists -U {{txture_postgres_user}} {{txture_postgres_db_name}} | gzip > /path/to/database_dump.gz
  5. Upon completion of the backup, proceed to deactivate the maintenance mode similar to the first step. Call {txture-URL}/api/v11/maintenance-mode/disable with a PUT request.

Our public Github repository contains an example as to how to integrate this with your usual backup strategy.

Restoring

Similar to the backup process, the process of restoring a backup is rather straight forward.

  1. Stop Txture (maintenance mode is not sufficient here)
  2. Clear the txture_home directory and replace all contents with the backup.
  3. Empty your PostgreSQL database (for example by deleting and recreating the container volume) and repopulate it from the backup: gzip -cd /path/to/database_dump.gz | docker exec -i postgres15 psql -U {{txture_postgres_user}} {{txture_postgres_db_name}}
  4. Restart - Txture will then be at the state of the backup time.