Omeka S can keep a site's files somewhere other than its files/ folder: in cloud storage such as Amazon S3 or Backblaze B2, through a module that replaces Omeka's file store (Omeka\File\Store in config/local.config.php). Backup works with any such store. It backs up the site's files from the store, restores them into it, and keeps archives there too, so the site needs no lasting folder of its own on the server.
A file store can only store a file, delete one, and give a file's web address. It cannot list what it holds or read a file back, so Backup reads files back from their addresses.
Backing up the files
On a site whose files are in cloud storage, Include files downloads every file Omeka's records point at, six at a time:
- each media file's original (
original/<storage id>.<extension>); - its thumbnails, for each thumbnail type (
large/,medium/,square/,<storage id>.jpg); - each asset (
asset/<storage id>.<extension>).
They go into the archive's files/ folder under the same paths, so the archive looks the same as one made from a files/ folder.
- A file the store does not have (it answers not found, or forbidden, as many public buckets do for a missing file) is left out. The archive's
metadata.jsonlists it underfiles_missing, the log names it, and the restore preview warns about it. - A file that fails for another reason is tried three times. After that the backup fails, rather than leaving the file out without saying so.
- A store that has none of the files fails the backup. This usually means the store does not serve its files at the addresses it gives for them.
Files that modules keep in the store under other paths are not found, because the store cannot be listed.
Where archives are kept
With Backup storage path left blank under Admin > Backup > Settings, archives are kept in the site's file store, under backups/:
- Each archive is made in a private folder in the server's temporary directory (
omeka-backup-<16 characters>, one per database). The folder is readable only by the web server user. - Once the archive is complete and checked, it is stored in the file store as
backups/<32 random characters>/<filename>, and removed from the server. - The Backups page says Archives are kept in the site's file store.
The same goes for archives brought in from elsewhere: uploads and downloads from a link arrive in the private folder, are checked, then stored.
Enter a directory under Backup storage path to keep archives on the server instead, whatever the file store. Archives already in the list stay where they are, so both kinds can be listed at once.
Keep archives private
A cloud store serves what it holds at a public address, as it does for the site's images. What keeps an archive private there is that its address cannot be guessed: each one is stored under a folder of 32 random characters, even an uploaded archive with a plain name such as site-backup.zip. Downloads and download links pass through the site, so the archive's address in the store is never shown. Delete archives you no longer need.
Downloading, links and restores
- Download and download links send the archive through the site, which reads it from the store and passes byte ranges on, so a dropped download continues where it stopped. If the store cannot be read, Download says so on the Backups page, and a download link answers with a server error (HTTP 502), which the other site's From a link tries again.
- Restore copies the archive from the store to the private folder first, checks its SHA-256 checksum, then restores as usual and removes the copy. The restore preview does not copy it: what the archive holds was recorded when it was stored.
- Restoring files stores each file in the archive's
files/folder in the site's file store, replacing files of the same name. An archive made from afiles/folder restores into cloud storage, and one made from cloud storage restores into afiles/folder. - Delete removes the archive from the store.
What does not apply
- Adding archives by FTP. There is no folder on the server to copy an archive into, so Archives in the backup directory does not appear and
importrefuses. Use a link or an upload, or set a backup directory first. See Adding Archives by FTP. - backup.log is written in the private folder, so it does not last if the server's temporary directory is cleared.
- File missing is not shown for archives in the store, as the store cannot be asked whether a file is there. An archive deleted from the store by hand fails to download or restore with HTTP 404. After a database restore from another site, the list can hold that site's archives, which are not in this site's store.