Synology NAS Tips

Current PhotoStructure Synology docker instructions is for the current stable which doesn’t yet support PUID/GUID, and is for DSM6 rather than DSM7, and doesn’t include info for performance optimization on your particular Synology.

Figured I could share some of my learnings here, with my Synology DS920+ using Docker.

Also see relevant Feature Request: Synology Package Center support.

Create user just for PhotoStructure

Before installing PhotoStructure, go into the Control Panel and create a user specifically for docker use, so you can more easily limit its permissions.

dockerphstr is the user I created. I felt it might be nice to have different permissions for different docker containers, so I make a separate user for each docker container.

I followed permissions setup in Dr. Frankenstein: Step 2: Setting up a restricted Docker user and obtaining IDs. Basically, grant access to your photos and docker shared folders, and block access to all other shared folders and applications. Note he has a single user for all docker containers, which might reduce permissions issues if you have multiple containers reading/writing the same files.

Skip SSH and run any command from Synology GUI / Get user PUID & GUID

Step 2: Setting up a restricted Docker user and obtaining IDs says to use the SSH to get your PUID/GUID which is fine. But if you prefer, you can actually run any command from the Synology GUI and get its output. I originally got this idea from Synology: Find UID (userID) and GID (groupID) in 5 Seconds – Marius Hosting, EXCEPT his tutorial requires you to set up email which is actually not necessary.

Run any command from Synology GUI with these steps:

  1. Control Panel → Task Scheduler → Create → Scheduled Task → User-defined script
  2. In General tab, UNCHECK the “Enabled” box so it doesn’t run automatically
  3. Name it something useful like taskGetUserIds
  4. In Task Settings tab, enter your command in the user-defined script box.
  5. Click OK.
  6. Select the task and click Run.
  7. See output with Action → View Result

Get the ID of a single user with this command:
id dockerphstr

Get the ID of (non-system) users with this command:
for user in $(awk -F':' '$3>999 && $3<9999 {print $1}' /etc/passwd); do id $user; done

image

From the screenshots, my UID/PUID is 1030 and my GID/GUID is 100 (click “View Details” to see full command output).

Faster import/rebuild (and less responsive NAS)

Synology wasn’t using enough CPU resources for my liking. See discussion at Import and resync faster on Docker NAS? for parameters you can play with, and of course more info at PhotoStructure | PhotoStructure's advanced settings. However I haven’t done specific performance testing yet, so do not have a specific recommended setup for Synology DS920+ and others with the same CPU.

Whoa! DSM 7.2 supports Docker Compose from the UI!! And they’ve updated docker-compose to 2.5.1 (currently it’s 1.28.5, which is really old).

SSD Cache Volume (M.2 and 2.5")

The DS923+ with DSM 7.2 allows SSDs (2.5" and M.2) to be created as a volume, which is ideal for use for PhotoStructure’s /ps/tmp
per PhotoStructure for Docker: Docker volume setup

However 7.2 is still in beta and older Synology products like the DS920+ only support using SSDs as a Synology-managed read/write cache. I have not personally tried it yet, but these scripts (and associated Synology subreddit threads) appear to make it easy to unofficially implement. GitHub - 007revad/Synology_HDD_db: Add your HDD, SSD and NVMe drives to your Synology's compatible drive database

Upgrade Docker container

Official options at PhotoStructure: Upgrade on Synology.

Maybe simpler 4-step process at Synology: How to Update Docker Image – Marius Hosting, but I haven’t tested

DSM 7.2 is officially released now, no longer beta