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

It doesn’t look like I can edit my original post anymore. In any case, here’s my updated instructions with DSM 7.2 for creating a user and getting PUID / GUID. Many thanks to Step 2: Setting up a restricted Docker user and obtaining IDs and Synology: Find UID (userID) and GID (groupID) in 5 Seconds – Marius Hosting for the excellent help!

First, create a new user for photostructure so you can easily change what it can/cannot do in the future. Here’s what I use:

  • Click Control Panel → User & Group → Create, and follow the wizard. Screens I haven’t shown, I left at defaults.
  • The “Edit” button lets you change anything later, so don’t worry too much about what you pick in the wizard.
  • You could give PhotoStructure read-only access to your photos if you don’t care about using it to update photo metadata, including rotation and such. Maybe set it up read-only for now, then change to read/write later. Read/write access is required for the docker folder, so PhotoStructure can save thumbnails and make its database.

Second get the new user’s PUID/GUID. We can get this from the control panel, too!

  • Go to Control Panel → Task Scheduler → Create → Triggered Task → User-defined script.
  • De-select “Enabled”, then in the “Task Settings” tab enter the script id dockerphotostructure (or id yourDockerUsername if you picked a different username than me for your PhotoStructure Docker container).
  • Select your task and click “Run” to run it once now (de-selecting “Enabled” means it doesn’t run a schedule. But we can still manually trigger it.)
  • Select your task again, then click Action → View Result. Your PUID is after uid= and your GUID is after gid. In my case, they’re 1033 and 100, respectively.
  • Advanced users can instead use command for user in $(awk -F':' '$3>999 && $3<9999 {print $1}' /etc/passwd); do id $user; done to get the IDs of all (non-system) users. I’ve started using this instead so I can have one script to run for anytime I add/change users, without having to change the task script and type exactly which username I’m looking for each time.

Via Synology DSM 7.2

:construction::construction::construction:
This procedure is a work-in-progress using the latest pre-alpha, details may change with stable release; and anyway, details are hopefully eventually officially updated in PhotoStructure | PhotoStructure for Docker
:construction::construction::construction:

  1. Create a new user for photostructure and find the new user’s PUID and GUID (see previous comments).
  2. Click Main MenuContainer Manager
  3. Click the Image tab
  4. Click ActionImportAdd From URL
  5. Enter https://hub.docker.com/r/photostructure/server and import
  6. Select tag latest
  7. Wait for the image to download (it’s about 500 MB, it may take a minute). You’ll see a system notification when it’s done.
  8. Click Run
  9. You can select resource limitation, but give PhotoStructure at least 2GB. Do not select high CPU priority.
  10. You may want to select Enable auto-start
  11. Click Next.
  12. Configure port settings as you’d like. You can just map port 1787 directly.
  13. Configure volume settings by reading about required and optional volumes and adding entries for
  • /ps/library (must be read/write)
  • /pictures and/or any other existing directories you want to import into your library
  1. Depending on your Synology setup, you may wish to configure additional volumes for
  • /ps/tmp
  • /ps/logs
  • /ps/config
  1. Configure Environment by adding PUID and GUID
  2. Do not select Execute container using high privilege
  3. Configure network settings by selecting bridge.
  4. Click Next, select Run this container after the wizard is finished, then click Done
    and wait for it to start successfully.
  5. Switch to the Container tab, click your new container, then click Details. Then you can:
  • Manually start the new container at any time by clicking Start in top-right
  • If it doesn’t start successfully, switch to the Log tab
  • Email/Discord/etc us if you need help!

Extra credit: while container is running, from Details you can click ActionOpen terminal. Then you can type --status (and hit return) to have PhotoStructure run health checks. (You can also run --pause, --resume, and --exit).

To update, assuming you are using the latest branch then just click the Update available link in Container Manger in the Image tab. For more details see Synology: How to Update Containers in Container Manager – Marius Hosting

1 Like