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:
- Call
{txture-URL}/api/v11/maintenance-mode/enable
with aPUT
request. This call will schedule the activation of maintenance mode. Please note that an API Token with administrative privileges is required for this task. - (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 anid
field with the user-ID. The next step is to query for the maintenance mode with aGET
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. - 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. - 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
- 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 aPUT
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.
- Stop Txture (maintenance mode is not sufficient here)
- Clear the
txture_home
directory and replace all contents with the backup. - 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}}
- Restart - Txture will then be at the state of the backup time.