How to install PhotoPrism in Jail?

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,466
maybe caddy is not respecting this ?
No, I wouldn't expect Caddy to respect the Apache-format .htaccess file. Looks like I'll need to figure out how to translate Apache-style rewrite directives into the Caddyfile.

What's puzzling me is that it doesn't even seem to be interpreting PHP at all. I set up a separate jail, installed Caddy and php74, and that much works fine. But this one is just serving empty pages. More digging required, I guess.
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,740
This Lychee thingy looks really intriguing. Thanks everyone for pointing me to it. Not going to do it with caddy as the application web server, though - probably.

OTOH I am planning to replace my SSL reverse proxy based on Apache and dehydrated with caddy in the next days ...
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,466
Not going to do it with caddy as the application web server, though - probably.
A config file of a dozen or so lines is pretty attractive--though not quite so much if you need to translate Apache or Nginx syntax into Caddyfile-speak.
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,466

gt2416

Patron
Joined
Feb 4, 2018
Messages
262
Jeez you work fast. Nice!
Looking at the script I can't tell what you did to fix the caddy problem, what was it?
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,466
Looking at the script I can't tell what you did to fix the caddy problem, what was it?
One little asterisk, that's all it was. As far as the redirects/rewrites, I haven't done anything as yet--I've been able to log in, upload and browse photos, and change settings. There are probably other things that need to be tested, so let me know how it works.
 

kiriak

Contributor
Joined
Mar 2, 2020
Messages
122
Man you are awesome !!!
I'm a noob and I tried a few times to setup Lychee in Docker (in another test machine) without success.
Your script was really a plug and play.

A photo gallery app was the only thing that was keeping me from migrating from Synology to FreeNAS.
Also this is the first photo gallery app for FreeNAS ( or TrueNAS ).

We really appreciate it and I would happily donate or pay for this.

Thanks again!!
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,466
A config file of a dozen or so lines
Actually, ignoring whitespace, 10 lines. Here it is:
Code:
:80 {
        encode gzip

        log {
                output file /var/log/lychee_access.log
                format single_field common_log
        }

        root * /usr/local/www/Lychee/public
        file_server

        php_fastcgi 127.0.0.1:9000

}
 

Gibbo

Cadet
Joined
Jan 10, 2021
Messages
4
Howdy,
If you are still interested in setting it up in a jail, I have just finished configuring photoprism on my home server:

Create Jail
Make yourself a jail based on "12.2-RELEASE-p2" and assign a mount point your appropriate pool/dataset

Setup user
Username: photoprism
UID: 805
Assign this user full permissions on your jails mount point

Launch a shell on your created jail

Install Prerequisites
pkg install git wget npm nano

Install photoprisim
cd ~ git clone https://github.com/huo-ju/photoprism-freebsd-port cd photoprism-freebsd-port make config-recursive && make install

Configure photoprism
nano /etc/rc.conf
# Enable photoprism
photoprism_enable="YES"
photoprism_assetspath="/mnt/photoprism/assets"
photoprism_storagepath="/mnt/photoprism/storage"

Copy files from var to mnt
cp -vR /var/photoprism/* /mnt/photoprism/

Start photoprism
service photoprism start
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,466
Thanks for finding this, Gibbo, and for writing it up--PhotoPrism looked like a nice app, so it's good to see that someone's ported it to FreeBSD.

nano /etc/rc.conf
I think it's usually preferred to use sysrc rather than directly editing rc.conf--so you'd say instead sysrc photoprism_enable=YES. Not sure how significant of a difference it is, though.

cp -vR /var/photoprism/* /mnt/photoprism/
I'm guessing that /mnt/photoprism represents the mount point--it might be easier to just mount it to /var/photoprism. That would also, I'd guess, remove the need for the second and third additions to rc.conf.
 

kiriak

Contributor
Joined
Mar 2, 2020
Messages
122
@ Gibbo
Thanks very much for sharing this !!


I got stuck at
make config-recursive && make install

and got this message

make: "/usr/share/mk/bsd.port.mk" line 32: Cannot open /usr/ports/Mk/bsd.port.mk
make: Fatal errors encountered -- cannot continue
make: stopped in /root/photoprism-freebsd-port

Maybe it is a permissions error?


Anyway,
I have already Lychee running on my test machine (an old PC).
It was super easy even for a noob like me with danb35 's script ( @ danb35 many thanks again !!)
I'd like to try Photoprism also as it has many more features.

Thanks guys!!
Migration from Synology to FreeNAS (on a proper small server) is now very very close.
 

Gibbo

Cadet
Joined
Jan 10, 2021
Messages
4
Thanks for finding this, Gibbo, and for writing it up--PhotoPrism looked like a nice app, so it's good to see that someone's ported it to FreeBSD.
No worries at all :cool:

I think it's usually preferred to use sysrc rather than directly editing rc.conf--so you'd say instead sysrc photoprism_enable=YES. Not sure how significant of a difference it is, though.
Probably not very, but it does prevent you screwing up the file with a bad hand edit.
(It also simplifies the instructions)

I'm guessing that /mnt/photoprism represents the mount point--it might be easier to just mount it to /var/photoprism. That would also, I'd guess, remove the need for the second and third additions to rc.conf.
Good catch! It will also allow the package to be updated smoother.
 

Gibbo

Cadet
Joined
Jan 10, 2021
Messages
4
@ Gibbo
Thanks very much for sharing this !!
My pleasure. Forum threads that end in "Don't worry guys, I fixed it." without instructions are just the worst.

I got stuck at
make config-recursive && make install

and got this message
...
Oops. I totally missed out a step :confused: (That's what I get for posting in excitement at 2am).
Updated/amended instructions below:


Create Jail
Make yourself a jail based on "12.2-RELEASE-p2"
Mount the appropriate pool/dataset to /var/photoprism on the jail

Setup user
Username: photoprism
UID: 805
Add this user with full permissions on your jails mount point

Launch a shell on your created jail

Install Prerequisites
pkg install git wget npm portsnap fetch extract

Install photoprism
cd ~ git clone https://github.com/huo-ju/photoprism-freebsd-port cd photoprism-freebsd-port make config-recursive && make install

Configure photoprism
sysrc photoprism_enable="YES" sysrc photoprism_assetspath="/var/photoprism/assets" sysrc photoprism_storagepath="/var/photoprism/storage"

Start photoprism
service photoprism start
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,466
make config-recursive && make install
Good heavens, but that's a lot of dependencies to compile--mine ran at least three hours before it errored out. I wonder if that could be reduced by installing some dependencies from binary packages.
 

Gibbo

Cadet
Joined
Jan 10, 2021
Messages
4
Good heavens, but that's a lot of dependencies to compile--mine ran at least three hours before it errored out. I wonder if that could be reduced by installing some dependencies from binary packages.

Sure can.
I just like optimising compiling for my particular CPU :wink:
(especially slow/big things like tensorflow)

Taking the output of make all-depends-list, cleaning it up, and putting ten to a line (for readability):

pkg install ffmpeg nasm gmake gettext-runtime libiconv indexinfo perl5.32 texi2html gettext-tools libtextstyle pkg install frei0r cmake py-sphinx py-setuptools python37 pkgconf kyua atf lutok lua52 pkg install libedit sqlite3 libffi dejagnu expect autoconf m4 texinfo help2man p5-Locale-gettext pkg install p5-Locale-libintl p5-Text-Unidecode p5-Unicode-EastAsianWidth autoconf-wrapper automake tcl86 readline py-sphinxcontrib-applehelp py-sphinxcontrib-devhelp py-sphinxcontrib-jsmath pkg install py-sphinxcontrib-htmlhelp py-sphinxcontrib-serializinghtml py-sphinxcontrib-qthelp py-Jinja2 py-markupsafe py-babel py-pytz py-pygments py-docutils py-snowballstemmer pkg install py-pystemmer cython py-alabaster py-imagesize py-requests py-certifi py-chardet py-pytest-runner py-setuptools_scm py-toml pkg install py-pytest py-atomicwrites py-attrs py-coverage py-hypothesis py-sortedcontainers py-pympler py-six py-zope.interface py-pluggy pkg install py-importlib-metadata py-zipp py-typing-extensions py-py py-wcwidth py-more-itertools py-pytest-xdist py-execnet py-apipkg py-pytest-forked pkg install py-filelock py-nose py-pip py-pypa-docs-theme py-python-docs-theme py-cryptography py-cffi py-pycparser py-cryptography-vectors py-iso8601 pkg install py-pretend py-csv23 py-freezegun py-dateutil py-sqlite3 py-mock py-invoke py-semantic-version py-django22 py-sqlparse pkg install py-tblib py-twine py-colorama py-keyring py-entrypoints py-keyrings.alt py-pycrypto gmp py-fs py-SecretStorage pkg install py-dbus dbus-glib dbus minixmlto docbook-xsl xmlcatmgr docbook docbook-sgml iso8879 docbook-xml pkg install xmlcharent sdocbook-xml libxslt libgcrypt libgpg-error libxml2 html2text libICE xorgproto xorg-macros pkg install xtrans libSM libX11 libxcb xcb-proto libpthread-stubs libXau libXdmcp expat2 bash pkg install bison glib20 meson ninja pcre pydbus-common py-pkginfo py-readme-renderer py-bleach py-webencodings pkg install py-packaging py-pyparsing py-requests-toolbelt py-sphinx_rtd_theme py-rfc3986 py-tqdm py-wheel py-pytest-rerunfailures py-pytest-timeout py-pexpect pkg install py-ptyprocess py-yaml py-scripttest py-tox py-virtualenv py-towncrier py-click py-incremental py-pytest-mock py-werkzeug pkg install py-openssl py-flaky py-genty ca_root_nss mercurial git curl libnghttp2 libtool zstd pkg install liblz4 coreutils p5-Error rubygem-asciidoctor ruby27 libyaml libunwind ruby-gems xmlto getopt pkg install libpaper w3m boehm-gc libatomic_ops libltdl cvsps p5-CGI p5-HTML-Parser p5-HTML-Tagset p5-HTTP-Message pkg install p5-Clone p5-B-COW p5-Encode-Locale p5-HTTP-Date p5-TimeDate p5-IO-HTML p5-LWP-MediaTypes p5-Test-Fatal p5-Try-Tiny p5-Capture-Tiny pkg install p5-Inline p5-Parse-RecDescent p5-Test-Warn p5-Sub-Uplevel p5-Inline-Files p5-URI p5-Test-Needs p5-Test-Deep p5-Test-NoWarnings p5-Authen-SASL pkg install p5-Digest-HMAC p5-GSSAPI p5-IO-Socket-SSL p5-Net-SSLeay p5-Test-Exception p5-Mozilla-CA p5-IO-Socket-INET6 p5-Socket6 p5-Term-ReadKey p5-subversion pkg install subversion gnupg libassuan libksba npth gnutls nettle libtasn1 libunistring libidn2 pkg install p11-kit bash-completion tcllib gtk-doc itstool py-libxml2 highlight boost-libs boost-jam icu pkg install trousers tpm-emulator pinentry pinentry-tty apr1 gdbm db5 utf8proc serf scons pkg install py-idna py-urllib3 py-pysocks py-trustme py-pytest-cov py-service_identity py-pyasn1-modules py-pyasn1 py-pytest-freezegun py-tornado pkg install py-html5lib py-typed-ast jsoncpp libuv rhash libarchive cairo pixman libXext libXrender pkg install freetype2 png fontconfig gperf mesa-libs wayland-protocols wayland libepoll-shim py-mako py-beaker pkg install llvm10 py-recommonmark py-CommonMark py-future binutils mpfr swig libXdamage libXfixes libxshmfence pkg install libXxf86vm libXrandr libdrm libpciaccess pciids v4l_compat evdev-proto aom vmaf libass pkg install harfbuzz gobject-introspection graphite2 py-fonttools3 py-lxml py-fs2 py-appdirs py-brotli py-zopfli py-unicodedata2 pkg install fribidi dav1d lame opencv-core protobuf googletest eigen3 suitesparse gcc9 mpc pkg install isl metis tbb doxygen graphviz ghostscript9-agpl-base jbig2dec libidn tiff jbigkit pkg install jpeg-turbo cups avahi-app intltool p5-XML-Parser libdaemon libevent gnome_subr openjpeg lcms2 pkg install poppler-data groff psutils gsfonts uchardet libXaw libXmu libXt libXpm webp pkg install giflib gd pango libXft xorg-fonts-truetype font-bh-ttf mkfontscale libfontenc bdftopcf font-misc-meltho pkg install font-misc-ethiopic encodings font-util dejavu tex-formats tex-basic-engines tex-web2c openjpeg15 zziplib gsed pkg install zip tex-kpathsea tex-ptexenc texlive-texmf texlive-base texlive-tlmgr t1lib teckit harfbuzz-icu poppler pkg install nspr nss libpotrace p5-File-HomeDir p5-File-Which p5-YAML-Tiny xpdfopen tex-dvipsk openblas superlu pkg install blas lapack adol-c fftw3 opus libtheora libogg libvorbis libv4l argp-standalone pkg install libudev-devd libva libvdpau libvpx libx264 opencl x265 xvid go python3 pkg install bazel029 unzip openjdk8 libXi libXtst libinotify alsa-lib javavmwrapper java-zoneinfo

You may also want to add in:
pkg install p5-Image-ExifTool darktable
(to do extended exif information and raw conversion)

then do:
cd ~/photoprism-freebsd-port make config-recursive && make install
 

Tigersharke

BOfH in User's clothing
Administrator
Moderator
Joined
May 18, 2016
Messages
890
In lieu of all the typing or cut & paste, one can use the following for the massive list of dependencies as one step:
pkg install `make all-depends-list | cut -d / -f 4,5`
Be aware that the list takes a few minutes to create before it is used by pkg, so it will sit there seeming to have stalled.
 

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,466
pkg install `make all-depends-list | cut -d / -f 4,5`
...which results in 436 dependencies to install--but a much cleaner way of doing it. Thanks. I guess the next level of refinement would be to determine which packages you really might want to configure (ffmpeg would likely be one), and only install the other ones from packages (I see that llvm10 is called for, and I know it takes roughly forever to build).

Interestingly, even after installing all of them, make config-recursive still has me configure all of them, though it doesn't look like it's building them. Still, it's maxing out the CPUs:
1610362511760.png

Unfortunately, after about 10-15 minutes, it fails:
Code:
ld: error: duplicate symbol: deflateParams
>>> defined at deflate.c
>>>            deflate.pic.o:(deflateParams) in archive bazel-out/host/bin/external/zlib/libzlib.pic.a
>>> defined at deflate.c
>>>            deflate.pic.o:(.text.deflateParams+0x0) in archive bazel-out/host/bin/external/zlib_archive/libzlib.pic.a

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: 327.221s, Critical Path: 126.48s
INFO: 2483 processes: 2483 local.
FAILED: Build did NOT complete successfully
*** Error code 1

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

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,702

danb35

Hall of Famer
Joined
Aug 16, 2011
Messages
15,466

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,740
Top