Question - how to host multiple libraries with PS for Node on same machine?

Hi all, looking for help.

I would like to host multiple libraries on the same Windows host, using Photostructure for Node.

What I don’t understand is how to solve the following:

  • PS for Node likes using %APPDATA%\PhotoStructure. I assume this won’t work for multiple instances on the same machine. Can I tell each Node instance to use a different path?

  • I’m a noob with Node, and I haven’t been able to get the --pidfile parameter to work on Windows. Any tips on the syntax for this? Or is there a better way to run it headless?

Any help muchly appreciated,

Thanks

To run multiple libraries, you need to specify several things:

  1. where your library is (PS_LIBRARY_DIR)
  2. what http and rpc ports you want it to listen on (PS_HTTP_PORT and PS_RPC_PORT)
  3. what paths you want it to scan for that library (PS_SCAN_PATHS)

You’ll need to set all these environment variables to values unique to each library. I’d personally set up shell scripts or .bat files to do this, so for library A, something like this script:

#!/bin/sh
export PS_LIBRARY_DIR=D:/photostructure-a

# Make sure the ports are unique between libraries!
export PS_HTTP_PORT=8080
export PS_RPC_PORT=8081

# This can be encoded either as a standard PATH
# (using `;` to separate paths on windows or `:` on other OSes), 
# or JSON-encoded:
export PS_SCAN_PATHS="C:/contents/for/a;C:/more/contents/for/a"

# And then launch. You may want to run with `--verbose` to aid in debugging:
C:/photostructure-for-servers/start.sh

Get that working, then copy it and change all 4 exports (make sure the ports are unique for each library!). If you activate a plus license for one library, that license will automatically be applied to the others as well.

Thanks heaps, I’ll give all that a go (but as a Windows batch or PowerShell script).

My question remains I think - how does this solve the use of %APPDATA%\PhotoStructure, or is it fine that multiple instances use the same folder?

As an example, the settings.toml file in %APPDATA%\PhotoStructure has one media library path listed, which I don’t want the other instance scanning - is it okay that this file exists if the environment variables are overridden in the unique instance by a start.sh-like script?

Yes: environment variables, when set, replace whatever is stored in settings.toml files.

1 Like

Sweet, I’ve just tried it and works a treat. Thanks for the help!