How to install PhotoPrism in Jail?

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
although I did create the jail from the WUI
So did you then manually install git, ca_root_nss, wget, npm, and sudo in the jail?
 

adrianwi

Guru
Joined
Oct 15, 2013
Messages
1,231
No - I've destroyed and am starting again, paying more attention to the first line :grin:

Same problem though after following the instructions more carefully.

Time for bed though now...
 
Last edited:

ByteNick

Explorer
Joined
Jan 24, 2015
Messages
98
This looks interesting, but I'm struggling to create the jail with this error when trying to make install

Code:
Invalid C++ compiler path. C++ cannot be found.
Please specify which C++ compiler should be used as the host C++ compiler. [Default is ]: 


Any ideas what I might have done wrong?

Thanks
+1, same here, even though all pkgs have been installed...
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,703
You will get that if you take my instructions too literally.

Look at the defaults rather than using Y (like is needed a few times in the pkgs install). A bunch of them default to N (so press enter instead).

If you deviate from defaults you will get that compiler error.
 

adrianwi

Guru
Joined
Oct 15, 2013
Messages
1,231
I'm good at taking instructions too literally :grin:

So the gotcha's are after the make config-recursive && make install command. You need to accept all of the blue screens, selecting OK, but when you get back to the text, and need to enter the paths for Python, the next questions have defaults of N and answering Y will give you the C++ error.

I'd also mounted some folders, and the /var/photoprism/assets folder I'd mounted to my photo library folder and made this read-only as I didn't want Photoprism touching any of my master images. It didn't like this, although it must have been at the end of the installation as when I ran it again with a writable folder it completed in just a few minutes.

I still need to work out which folder/mount is for which, and how I get it to use my library folder, without changing all of the permissions and causing problems elsewhere.

It's running though and looks pretty neat, so thanks!
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,703
I still need to work out which folder/mount is for which, and how I get it to use my library folder, without changing all of the permissions and causing problems elsewhere.
/var/photoprism/assets is for the database it builds for its own use (should be an apps/data mount)
/var/photoprism/storage is where photos will live, so mount your stuff here.

To get your photos in there, they should probably go in a directory called /var/photoprism/storage/originals.

You can then go to the library tab in photoprism and tell it to do a full scan.

You can also go to setings and set it to read-only mode if you want that.

For permissions, you will probably need to take a rather similar approach than you would use for other media... the same account with the same UID, etc should exist on the host and in all jails you're using... then you'll need to set permissions for that user to the photoprism executables under /usr/local/photoprism and change the service to use that user with sysrc.
 

adrianwi

Guru
Joined
Oct 15, 2013
Messages
1,231
I've worked around the mount points and permissions and after a long scan have almost 50,000 images in PhotoPrism.

The first point is that it's highlighted how disorganised my photo library backup is, although I already knew that. The library in Apple Aperture is slightly better, although I really needed to move away from that about 5 years ago! It doesn't have any of the photos or videos from my iPhone which are backed up elsewhere.

My biggest issue is the resources it's taking, and now it's settled down it appears to be using about 10GB RAM. It looks promising, although I'm not sure it would replace Aperture, and I suspect my efforts are best placed fixing that than trying to make this work.

Thanks for the guide though, which works really well, if you don't follow it too literally :cool:
 
Last edited:

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,504
I'm just playing around with PhotoPrism's built-in WebDAV functionality--it's pretty cool. I can mount it as a shared drive on my Mac, and just copy in whatever photos I want. PhotoPrism will then recognize them and import them. Pretty slick.
 

kioftes

Cadet
Joined
Feb 3, 2021
Messages
1
First of all thank you very much for your efforts! Sadly compile fails with the following error:

Code:
ld: error: duplicate symbol: deflateInit2_
>>> defined at deflate.c
>>>            deflate.pic.o:(deflateInit2_) in archive bazel-out/host/bin/external/zlib/libzlib.pic.a
>>> defined at deflate.c
>>>            deflate.pic.o:(.text.deflateInit2_+0x0) in archive bazel-out/host/bin/external/zlib_archive/libzlib.pic.a


I also don't know where to add the suggested --verbose_failures flag to get more info.

All defaults have been accepted, would be grateful for any hints!
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,703
All defaults have been accepted, would be grateful for any hints!
Since the project is still new, it's probably a temporary case of being unable to build.

Try again in a few days.
 

s00hr7

Dabbler
Joined
Feb 12, 2021
Messages
11
Thank you sretalla for this awesome guide! I was able to install photoprism following it, which would probably have taken me forever without it.

One question: I'd like to keep the size of the jail as small as possible. Do you know if all the packages installed with "pkg install `make all-depends-list | cut -d / -f 4,5`" are required to run photoprism, or are they only required for the build? So I am wondering if I can just remove them without breaking the installation.
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,703
You can always snapshot the jail and try it out more or less for free. If it breaks, just roll back the snap.
 

ByteNick

Explorer
Joined
Jan 24, 2015
Messages
98
Tried to reinstall, and I get this:

Code:
ld: error: too many errors emitted, stopping now (use -error-limit=0 to see all errors)
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Target //tensorflow:libtensorflow.so failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 411.568s, Critical Path: 91.19s
INFO: 2580 processes: 2580 local.
FAILED: Build did NOT complete successfully
*** Error code 1

Stop.
make[1]: stopped in /root/photoprism-freebsd-port
*** Error code 1

Stop.
make: stopped in /root/photoprism-freebsd-port


)-:

The reported error is:

Code:
ERROR: /root/photoprism-freebsd-port/work/photoprism-6b0d94ff42fadccfe88c4d68744b9d3afea36e2f/docker/tensorflow/tensorflow-1.15.2/tensorflow/BUILD:563:1: Linking of rule '//tensorflow:libtensorflow_framework.so.1.15.2' failed (Exit 1)
ld: error: duplicate symbol: adler32


Any idea?
 
Last edited:

ByteNick

Explorer
Joined
Jan 24, 2015
Messages
98
Managed to compile it with the patch described here, but it does not start.
I really don't know where to look and what to do to solve this.
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776

ericm14

Cadet
Joined
Mar 21, 2021
Messages
1
I followed the steps posted in this thread. The service starts well, but the web interface does not respond.
Is there a log somewhere?

I ended up in the exact same position after following all the steps above. Thank you for your reference to the compile patch, that certainly spurred me on. I finally got the web interface up and running today. You just need to update all the storage directory references to use "/var/db/photoprism/" instead of "/var/photoprism". The latest compile and build process changed the output directory.

Code:
# Shutdown the photoprism jail
# Update all your external directory mounts to point to sub-directories under "var/db/photoprism/storage/originals" within the jail
# Start the jail and log into the root console
iocage console photoprism

# Stop the PhotoPrism service
service photoprism stop

# Change the directory references to photoprism within /etc/rc.conf (use vi or install nano) to:
photoprism_assetspath="/var/db/photoprism/assets"
photoprism_storagepath="/var/db/photoprism/storage"

# Now reset all the directories and initial password:
sudo -u photoprism /usr/local/bin/photoprism --assets-path=/var/db/photoprism/assets --storage-path=/var/db/photoprism/storage --originals-path=/var/db/photoprism/storage/originals --import-path=/var/db/photoprism/storage/import passwd

#Start the PhotoPrism service
service photoprism start

You should be good to proceed to http://jail.ip:2342

BTW - This is my first post to this forum so I hope these steps help.

Some background by way of introduction:
I have followed FreeNAS/TrueNAS since 2012 and have benefited greatly from the knowledge learnt through this forum over many years so I'm long overdue to contribute something back!

My first FreeNAS system was a HP Microserver N40L starting on v7.2 prior to the iX Systems purchase of FreeNAS. Last December I migrated/replicated 9TB of data from my old v11 pools over to a second hand (new to me) Supermicro server (sourced from Germany) just in time for TrueNAS Core. I will re-purpose the N40L as a backup NAS in due course.
 

ByteNick

Explorer
Joined
Jan 24, 2015
Messages
98
/var/photoprism/assets is for the database it builds for its own use (should be an apps/data mount)
/var/photoprism/storage is where photos will live, so mount your stuff here.

To get your photos in there, they should probably go in a directory called /var/photoprism/storage/originals.

You can then go to the library tab in photoprism and tell it to do a full scan.

You can also go to setings and set it to read-only mode if you want that.

For permissions, you will probably need to take a rather similar approach than you would use for other media... the same account with the same UID, etc should exist on the host and in all jails you're using... then you'll need to set permissions for that user to the photoprism executables under /usr/local/photoprism and change the service to use that user with sysrc.

I finally made it work with user photoprism.
However, I would like to create and use the user ”media”. Unsuccessful so far. Any idea which files/dirs should have the permissions changes to make it work with this user?
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,703
Unsuccessful so far.
What have you already done?

Created user media in the jail (with matching UID to the media user in your other jails/TrueNAS system)? pw user add media -c media -u 2000 -d /nonexistent -s /usr/bin/nologin -g wheel (2000 is an example UID, replace it to match your needed UID)

Assigned that user to the service ( edit /usr/local/etc/rc.d/photoprism, line that begins like: command_args="-f -T photoprism -p ${pidfile} -u photoprism... change to command_args="-f -T photoprism -p ${pidfile} -u media) ?

Run chown on all of the referenced directories (and the .pid file) before starting the service ? chown -R media:wheel /var/photoprism /usr/local/photoprism /var/run/photoprism.pid
 

ByteNick

Explorer
Joined
Jan 24, 2015
Messages
98
What have you already done?

Created user media in the jail (with matching UID to the media user in your other jails/TrueNAS system)? pw user add media -c media -u 2000 -d /nonexistent -s /usr/bin/nologin -g wheel (2000 is an example UID, replace it to match your needed UID)

Assigned that user to the service ( edit /usr/local/etc/rc.d/photoprism, line that begins like: command_args="-f -T photoprism -p ${pidfile} -u photoprism... change to command_args="-f -T photoprism -p ${pidfile} -u media) ?

Run chown on all of the referenced directories (and the .pid file) before starting the service ? chown -R media:wheel /var/photoprism /usr/local/photoprism /var/run/photoprism.pid
Brilliant! Thank you so much.
My problem was that I did not paid attention to the ../rc.d/photioprism file previously.
Again, thank you so much.
 
Top