Photoprism network configuration

burakkusensei

Dabbler
Joined
Dec 3, 2018
Messages
16
I've just installed Photoprism in a jail, but when I start it I can't access the WebUI and the network status returns "cannot connect to 0.0.0.0:2342". I'm guessing I've made some dumb mistake with the network configuration, but I'm not sure where to go to fix it. I'd be very grateful if someone more knowledgeable than me could give me a hand.
 

lachdanan

Dabbler
Joined
Sep 15, 2020
Messages
19
Are you able to provide any additional network information? Like whether you are using a VPN, reverse proxy. Whether 2342 is forwarded on your router to anywhere. Do you believe you have left or set the port to 2342 and where you have done so. Is the attempt to access it being done locally and on either the same switch or router? What do we have for firewalls between the two machines?

you could also run this from within the Jail's CLI to see if Photoprism is even up on that port

# curl -v http://localhost:2324
(you might need to install curl first)
# pkg install curl

You could also try doing Window's invoke web request from powershell (I assume you are trying to reach the GUI from a windows machine)
# Invoke-WebRequest http://<local IP to reach Photoprism>:2324
example = Invoke-WebRequest http://192.168.0.18:2324

Sorry I don't have any answers, but those are questions you should ask yourself. If you provide these kinds of details, one of us may be able to help.
 

burakkusensei

Dabbler
Joined
Dec 3, 2018
Messages
16
Thanks for the reply -- I'm a bit out of my depth here. I'm not connecting through a VPN, although I am running Adguard Home in a TrueNAS jail. But I've tried taking that out of the equation and the result is still the same. I'm not aware of having done anything else with port 2324.

I'm getting the "cannot connect to 0.0.0.0:2324" message with # photoprism status, so photoprism itself is failing to connect. I'm also getting an error message on start in photoprism's logs:

level=error msg=“html/template: no files named in call to ParseFiles”

With curl I get:

Trying 127.0.0.1:2324…
connect to 127.0.0.1 port 2324 failed: Connection refused
Trying [::1]:2324…
connect to ::1 port 2324 failed: Connection refused
Failed to connect to localhost port 2324 after 0 ms: Couldn’t connect to server

With Invoke-WebRequest I get

Invoke-WebRequest : Unable to connect to the remote server
At line:1 char:1
+ Invoke-WebRequest http://192.168.0.15:2324
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebExc
eption
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand
 

lachdanan

Dabbler
Joined
Sep 15, 2020
Messages
19
Especially since the curl isn't working from the jail it's hosted on I have a more generalized question. Do you know whether you are using Truenas Core or Truenas Scale? One way to check is to open up your dashboard it is in really small print though so decently easy to not notice. If you are on Truenas Core, would you be willing to share what guide you used to install Photoprism to a jail?
1673279191477.png
 

burakkusensei

Dabbler
Joined
Dec 3, 2018
Messages
16
Thanks for getting back to me again.
I'm on TrueNAS Core. And I basically winged it with the installation, starting from reading on the Photoprism website that there was a FreeBSD port of it but being unable to just install the package as per their instructions. After looking at the photoprism port for FreeBSD instructions on github, I wound up basically doing the following:

* creating a basic jail with DHCP and IPv6 autoconfigure
* creating a photoprism user
* fetching the current pre-built binary for photoprism
* fetching the current pre-built binary for libtensorflow1
* installing ffmpeg, libheif, p5-Image-ExifTool
* adding
sysrc photoprism_enable="YES"
sysrc photoprism_assetspath="/var/photoprism/assets"
sysrc photoprism_storagepath="/var/photoprism/storage"
to rc.conf
* running # 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
and setting a password

Then I started Photoprism but it couldn't create the assets and storage directories, so I created a photoprism directory and gave photoprism read/write permissions for it and tried again. Then it created the directories and started; but that's where I ran into the "cannot connect to 0.0.0.0:2342" problem.
 

lachdanan

Dabbler
Joined
Sep 15, 2020
Messages
19
Unfortunately, I fear I'm reaching the end of my useful advice on this. Like you, it's decently easy to find freebsd instructions then really easy to find issues with photoprism on freebsd. I found one Truenas forum that was very interesting on attempts to install (linked below). On page 6 a gt2416 claims to have gotten it installed and working in a jail. His instructions seem similar to yours but they don't match and it may be worth a look.

I fear the 'correct' answer though is back on page 1 of the forum (linked below) where the OP is told they will be happier going the Docker route (requires a VM on core). I don't know how much you have running on core, but I believe you may be happier moving to scale or creating a VM and using docker. (this coming from a fellow heathen that is avoiding the move to scale myself).

If you are like me, and feel you can't move over (yet), and want to give it more effort without resorting to a Linux VM or scale, this is the advice I can give. What I know for sure is if the jail or VM that an application is running on is unable to curl the IP+port that is supposed to be your reachable reachable GUI, the application isn't truly up and working. Once that is reachable, you can try and reach it from another VM/machine in your local environment and that will start testing actual routing of traffic to that IP and port.

If I were you, and I wanted to give this more effort as a jail before resorting to a VM or going scale, I would read this forum post start to end. Then I would likely create a new jail and try the steps on page 6 unless something else convinces you to try something else.

 

burakkusensei

Dabbler
Joined
Dec 3, 2018
Messages
16
Thanks for the advice -- I really appreciate it. I'll have another try with those instructions, and if that doesn't work I'll start considering alternatives.
 

burakkusensei

Dabbler
Joined
Dec 3, 2018
Messages
16
Just a follow-up on this. I tried the suggested instructions and got the same result, but then it occurred to me to create an empty jail and check port 2324 without photoprism. The connection was still refused, so this issue doesn't seem to be related to photoprism anyway. I need to figure out what's messing up that port.
 

lachdanan

Dabbler
Joined
Sep 15, 2020
Messages
19
Just a follow-up on this. I tried the suggested instructions and got the same result, but then it occurred to me to create an empty jail and check port 2324 without photoprism. The connection was still refused, so this issue doesn't seem to be related to photoprism anyway. I need to figure out what's messing up that port.
In the brand new jail when you # curl 127.0.0.1:2324 it is saying 'connection refused' instead of 'failed to connect'?

I used 22 as an example since turning ssh on is so simple
 

Attachments

  • failed to connect.JPG
    failed to connect.JPG
    70.8 KB · Views: 221

lachdanan

Dabbler
Joined
Sep 15, 2020
Messages
19
It is saying "connect to 127.0.0.1 port 2324 failed: Connection refused."
Ok, what that will mean is that there is something (some kind of application like your Photoprism) that is using that port within that jail that, when seeing curl's attempt to say hi, is slamming the door on curl's face.

What is the output of this?
# sockstat -4 -l
we are mostly curious in any output from it that has 2324 in the 'local address' column and what the 'user' and 'command' is for it.
 

burakkusensei

Dabbler
Joined
Dec 3, 2018
Messages
16
Thanks for sticking with this -- I really appreciate all the help. In the jail, the only thing that comes up is photoprism itself. It's listed as using port 2324, but with a PID of 21987, while the log lists it as 21986...
 

lachdanan

Dabbler
Joined
Sep 15, 2020
Messages
19
Hmm now I'm a little bit confused.

"it occurred to me to create an empty jail and check port 2324 without photoprism. The connection was still refused, so this issue doesn't seem to be related to photoprism anyway. I need to figure out what's messing up that port."

-That is what the #sockstat -4 -l from above is meant to help with. That jail you created that when running # curl 127.0.0.1:2324 is saying 'connection refused' but that doesn't have photoprism installed.

Interesting catch with the logs not lining up with the PID of the application. Out of curiosity, when you took a step back and retried following what that forum mentioned in my post#6 above, did you try it from a new, fresh Jail or did you try salvaging your install attempt on your previous Jail?

I would advise with each attempt, if you get to the point you feel you need to follow new instructions, to delete the Jail and make a new one (or have a snapshot you revert back to). Even if you find a guide that will work, if you are mixing things with a previous guide it is unlikely to be successful.
 

burakkusensei

Dabbler
Joined
Dec 3, 2018
Messages
16
Sorry, I forgot to say that curl in the empty jail didn't list anything; then later I tried installing photoprism in the empty jail and playing around with it, and I tried it again then. So it was a clean install of photoprism, and I've since tried another clean install and stopping and restarting it, and the PIDs in curl and the logs are always different. But if that's an indication of what's causing the problem, it doesn't explain why the connection is refused in an empty jail (and in the TrueNAS shell as well)...
 

lachdanan

Dabbler
Joined
Sep 15, 2020
Messages
19
Hey, I don't know if you noticed but,
 

burakkusensei

Dabbler
Joined
Dec 3, 2018
Messages
16
Thanks for pointing me to that. It's definitely more sophisticated than what I was doing.
However, even with those instructions, I still wind up with the same problem. There's obviously some issue I have with the port that isn't caused by photoprism -- I just only noticed it with photoprism because it needed that port. I just can't figure out what the problem is.
 

burakkusensei

Dabbler
Joined
Dec 3, 2018
Messages
16
I just rebooted my TrueNAS machine, and maybe the situation has improved ... kind of.
I'm using the installation from the install guide, and photoprism is giving its status as operational, with no errors in the logs, but I still can't access the WebUI. This jail is using NAT, so it should just be at my TrueNAS address with :2324, shouldn't it?
Sockstat is listing photoprism as active on port 2324; # curl -v http://localhost:2324 is giving connection refused; # curl 127.0.0.1:2324 is saying couldn't connect to server.
 

scripsi

Dabbler
Joined
Jan 16, 2023
Messages
15
Hi burakkusensai,

I wrote the install guide that you just used to create your jail. I've just tried my own (tested and known working) PhotoPrism jail with your curl test and got this:

Code:
root@photos:~ # curl -v http://localhost:2324
*   Trying 127.0.0.1:2324...
* connect to 127.0.0.1 port 2324 failed: Connection refused
*   Trying [::1]:2324...
* connect to ::1 port 2324 failed: Connection refused
* Failed to connect to localhost port 2324 after 0 ms: Couldn't connect to server


Nevertheless I can connect to and use PhotoPrism from another computer just fine, so it looks like the test you're using may not work anyway!

The only difference is that I've set my jail up with a different, static IP address using VNET, instead of using NAT from the TrueNAS address. I'll try setting up another PhotoPrism jail on my system using NAT and let you know how it goes...
 

scripsi

Dabbler
Joined
Jan 16, 2023
Messages
15
... OK, I've tested NAT and got it working. I've added an update to my main install guide which shows you how to set up the jail for NAT. If you've already got a jail set up using my install guide, but want to get it working with NAT, then you don't need to start from scratch - just Stop the jail, click Edit, and follow the instructions from that point in my update.

Note that there is a typo in the PhotoPrism port number in this thread! I unwittingly repeated it in my response above (the perils of CTRL-C CTRL-V :rolleyes: ). The correct port number is 2342 and not 2324. When I do the curl test with the correct port number in the PhotoPrism jail I get a proper response:

Code:
root@photos:~ # curl -v http://localhost:2342
*   Trying 127.0.0.1:2342...
* Connected to localhost (127.0.0.1) port 2342 (#0)
> GET / HTTP/1.1
> Host: localhost:2342
> User-Agent: curl/7.87.0
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 307 Temporary Redirect
< Content-Security-Policy: frame-ancestors 'none';
< Content-Type: text/html; charset=utf-8
< Location: /library/login
< X-Frame-Options: DENY
< Date: Fri, 20 Jan 2023 16:13:09 GMT
< Content-Length: 50

> GET / HTTP/1.1
> Host: localhost:2342
> User-Agent: curl/7.87.0
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 307 Temporary Redirect
< Content-Security-Policy: frame-ancestors 'none';
< Content-Type: text/html; charset=utf-8
< Location: /library/login
< X-Frame-Options: DENY
< Date: Fri, 20 Jan 2023 16:13:09 GMT
< Content-Length: 50
<
<a href="/library/login">Temporary Redirect</a>.

* Connection #0 to localhost left intact
 
Top