Unifi Protect Backup

Unifi Protect Backup is a python based tool for backing up UniFi Protect event clips as they occur.

Not yet tested storage Based on TrueNAS app v1.3.9 (Unifi Protect Backup 0.14.3)
  1. 1
    Copy the script below
  2. 2
    In HexOS, open Apps, find Unifi Protect Backup and choose Custom Install
  3. 3
    Paste, then press Install — full guide with screenshots
unifi-protect-backup.json
Download
1{
12  "version": 5,
23  "script": {
4    "version": "0.1.0",
5    "changeLog": "Auto-generated draft from TrueNAS unifi-protect-backup 1.3.9"
6  },
37  "installation_questions": [
8    {
9      "question": "Username",
10      "type": "text",
11      "key": "username",
12      "required": true
13    },
14    {
15      "question": "Password",
16      "type": "password",
17      "key": "password",
18      "required": true
19    },
20    {
21      "question": "Address",
22      "type": "text",
23      "key": "address",
24      "required": true
25    }
26  ],
27  "requirements": {
428    "locations": ["ApplicationsPerformance"],
529    "specifications": ["2CORE"],
630    "permissions": ["READ_WRITE_LOCATIONS"]
31  },
732  "ensure_directories_exists": [
33    {"path": "$LOCATION(ApplicationsPerformance)"},
34    {"path": "$LOCATION(ApplicationsPerformance)/unifi-protect-backup"},
35    {
36      "path": "$LOCATION(ApplicationsPerformance)/unifi-protect-backup/config",
37      "snapshot": {"id": "config"}
38    },
39    {
40      "path": "$LOCATION(ApplicationsPerformance)/unifi-protect-backup/data",
41      "snapshot": {"id": "data"}
42    }
43  ],
44  "app_values": {
45    "unifi_protect_backup": {
846      "username": "$QUESTION(username)",
947      "password": "$QUESTION(password)",
1048      "address": "$QUESTION(address)"
49    },
50    "storage": {
1151      "config": "$HOST_PATH($LOCATION(ApplicationsPerformance)/unifi-protect-backup/config)",
1252      "data": "$HOST_PATH($LOCATION(ApplicationsPerformance)/unifi-protect-backup/data)"
53    },
1354    "resources": {"limits": {"cpus": 2, "memory": "$MEMORY(10%, 4096)"}}
55  }
56}

What this script does

Hover or tap a box to see the lines it explains.

  1. Script format

    Tells HexOS this is a version 5 install script, so it knows how to read the rest.

    Line 2

  2. Script revision

    This copy of the script is revision 0.1.0. Latest change: “Auto-generated draft from TrueNAS unifi-protect-backup 1.3.9”.

    Lines 3–6

  3. Questions you'll be asked

    Before installing, HexOS will ask you for: Username, Password and Address. Your answers are slotted into the settings further down wherever you see $QUESTION(...).

    Lines 7–26

  4. Storage locations it needs

    The app uses these HexOS storage locations: App storage (fast). If one isn't set up yet, HexOS will ask you to pick a place for it.

    Line 28

  5. Minimum hardware

    Recommended minimum: 2 CPU cores.

    Line 29

  6. Permission to use your folders

    Allows the app to read and write files inside the storage locations listed above — and nowhere else.

    Line 30

  7. Folders created on install

    Creates the folders the app needs before it starts: App storage (fast) › unifi-protect-backup, App storage (fast) › unifi-protect-backup › config and App storage (fast) › unifi-protect-backup › data. Folders marked “snapshot” are included in HexOS snapshots, so you can roll them back.

    Lines 32–43

  8. Your answer: username

    Filled in with what you typed for “username” when you installed.

    Line 46

  9. Your answer: password

    Filled in with what you typed for “password” when you installed.

    Line 47

  10. Your answer: address

    Filled in with what you typed for “address” when you installed.

    Line 48

  11. Where the app's settings is saved

    Where the app's settings is saved on your server: App storage (fast) › unifi-protect-backup › config.

    Line 51

  12. Where the app's main data is saved

    Where the app's main data is saved on your server: App storage (fast) › unifi-protect-backup › data.

    Line 52

  13. Resource limits

    Caps how much of your server the app can use: 2 CPU cores and 10% of your server's memory, but never more than 4 GB. This keeps one busy app from slowing everything else down.

    Line 54