Note: the following post is for the as-yet-unreleased next version of PhotoStructure, v2.1
As I’ve been testing the new v2.1 alpha build on docker, every time I spin up a new container, I think “gosh, can’t this be made simpler?” I think it can.
What we’ve got up to now
PhotoStructure’s docker setup currently requires at least 4 bind mounts:
- The library directory,
/ps/library
- The scratch directory,
/ps/tmp
- The system configuration directory,
/ps/config
- The log directory,
/ps/logs
There are a couple constraints on these directories:
- The library directory needs to have a bunch of free disk space
- The scratch disk must be on a local disk, and cannot be a disk using a “union” or
mergefs
filesystem.
More details about these volumes are in the docker setup page.
What we’ll have with v2.1
PhotoStructure v2.1 will require a /ps/library
bind-mounted volume. Everything else is optional.
If you’ve got a big local disk that you want everything to live in, just bind-mount that one directory, and you’re done. Like this:
docker run \
--stop-timeout 120 \
-v "$HOME"/PhotoStructure:/ps/library \
photostructure/server:stable
Implementation details
Here’s how v2.1 figures out directories when running in Docker; the first directory that exists, wins.
For your library directory, PhotoStructure still defaults to /ps/library
(but can be changed from the default by setting PS_LIBRARY_DIR
).
For your scratch directory, if /ps/tmp
is a read/writable directory, return that. Otherwise, if /ps/cache
is a read/writable directory, return that. Otherwise, return /ps/library/.photostructure/cache-$UID
.
For your system settings: if /ps/config
is a read/writable directory, return that. Otherwise, return /ps/library/.photostructure/docker-config
.
For your log files: if /ps/logs
is a read/writable directory, return that. Otherwise, return /ps/library/.photostructure/logs
.
PhotoStructure still needs a local disk!
PhotoStructure still needs to have a cache dir that supports memory mapping, so if you want to store your library on mergefs
or a union filesystem, you can bind-mount that volume to /ps/library
, but you also need to provide a standard, local (fast!) filesystem bind-mounted to /ps/tmp
.
Read more about why on this forum post.
Does this work for you?
So, docker users: Does this make sense? Will you use this?
Feedback is welcome: it’s easy to change stuff now, before I have to support backward compatibility…
Edits
20220129: prior version referenced the default directory as /ps/default
, but to keep things simple, I’ve renamed it /ps/library
. The thinking is that you have to have a library directory, but everything else is an implementation detail.
20220130: I’ve shoved the scratch, logs, and config directory to live under /ps/library/.photostructure
to minimize the number of directories I’m writing into.