jshridha / docker-blueiris

Blueiris in a docker using wine!
Apache License 2.0
105 stars 53 forks source link

UI3 does not work #13

Closed calvinbui closed 4 years ago

calvinbui commented 4 years ago

I've been trying to get UI3 which comes with Blue Iris 5 working. Blue Iris should be loading UI3 by default at it's webserver but I am by a 404 for the login.htm page. Under the www/ folder, indeed that file does not exist.

I noticed in the main directory (Program Files/Blue Iris 5) that there is a ui3.zip. Unzipping this to www/ (unzip ui3.zip -d www/ does get the page to load but errors to occur.

Installing UI3's latest release from it's GitHub repository also causes the same issue as unzipping.

An unexpected error has occurred in Blue Iris Login (v 20 / 5.0.6.9). If you wish to report the error, please SCREENSHOT the browser now.

ReferenceError: $ is not defined
at http://censored_hostname/login.htm?page=%2F [149:3]
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:70.0) Gecko/20100101 Firefox/70.0

Checking the browser console, the error appears to be at login.htm Loading failed for the <script> with source “http://192.168.3.2:81/applet/loginScripts.js?v=20-5.0.6.9”. When performing a wget or curl to this endpoint, I can see errors. This leads me to believe there is something up with the webserver.

I have to been able to reproduce this across multiple machines running this docker image. There was one time it worked, but I didn't do anything differently.

calvinbui commented 4 years ago

It appears the Blue Iris webserver, Wine or the docker container is not sending the complete JS files when requested. They're getting cut-off / incomplete when downloaded which is what causes these problems.

I've noticed this problem with:

dseven commented 4 years ago

For UI3 to work, the port number used by the browser must be the same number that the server is using inside the container - e.g, if you use -p 8081:81 it will not work, but if you use -p 81:81, it should work. If you need to use a port other than 81, you'll have to configure BI (Settings -> Web Server) to use that port and map it (e.g. -p 8081:8081) in docker

dseven commented 4 years ago

Not sure what's with the thumbs-down? This worked for me shrug. I did unzip ui3.zip first, as you suggested... that may or may not be necessary.

I assume (haven't done the digging) that the server port number is embedded in some javascript code that gets sent to the browser, and that's why it needs to be the same port number "outside" the container.

calvinbui commented 4 years ago

The issue isn't the port forwarding as a response is given to the browser from Blue Iris.

dseven commented 4 years ago

Responding has nothing to do with it. The issue (I believe) is that URLs are embedded in content that gets sent to the browser, and those URLs contain the port that the http server is listening on. That is the port that's used inside the container. If you're mapping a different port outside the container, the browser will not be able to reach it. The browser will get some of the content, but you will not get ALL of it. That's why it seems to partially work.

You can choose to accept this, or not, but using the same port number outside as inside worked for me. Not going to argue about it any further.

Good luck!

calvinbui commented 4 years ago

I'm networking using macvlan so all ports are exposed. It's not the problem. Sometimes the login page does eventually load with a lot of refreshes but it's a 1 in 30 chance.

FuzzyMistborn commented 4 years ago

Similar issue here. Solution was to install on another machine and copy the www directory from ProgramData/BlueIris5 to the data directory for docker. https://www.reddit.com/r/BlueIris/comments/9gdow0/blue_iris_in_linux_with_docker_container_working/e67r0ai?utm_source=share&utm_medium=web2x

calvinbui commented 4 years ago

Updating to 5.2.9.12 seems to have resolved the issue for me

OscarVanL commented 4 years ago

HI @calvinbui , I've had the same issue and while @FuzzyMistborn 's fix did work, I'd much rather update my Blue Iris.

You mentioned you could update to 5.2.9.12, I'd like to do this as I'm on 4.8.6.3.

When I click Check for update in Blue Iris, it says "Trouble connecting. Please check your Internet connection and try again.". What did you do to circumvent this?

(FYI, I'm currently using the demo Blue Iris version as I want to check that everything works properly before I migrate my license from my old Windows Blue Iris server. Could this be contributing to the problem?)

TonyBrobston commented 4 years ago

I'm having the same problem.

When I look inside prefix32/drive_c/Program\ Files/Blue\ Iris\ 5/www/ there is no login.htm. When I uncheck "Use UI3 for non-IE browsers", then xlogin.htm loads up just fine. Also xlogin.htm does exist in prefix32/drive_c/Program\ Files/Blue\ Iris\ 5/www/.

So it feels like this really is an issue of missing files.

version: '3'

services:
  blue-iris:
    image: jshridha/blueiris
    restart: unless-stopped
    ports:
    - 8080:8080
    - 5900:5900
    - 81:81

image

TonyBrobston commented 4 years ago

After a rm -rf www/* and a unzip ui3.zip -d www/, I was able to turn the web server off, then back on, and now I'm able to login and get to ui3.html. Also at some point in the process I updated to 5.3.2.0.

TonyBrobston commented 4 years ago

Unfortunately whenever I restart my docker container, when supervisord https://github.com/jshridha/docker-blueiris/blob/3b796feeb8e7bd6663bdfded5b20a81a7df62c22/Dockerfile#L52 is kicked off, the www directory gets set back 🤦 .

TonyBrobston commented 4 years ago

@calvinbui @dseven @FuzzyMistborn @OscarVanL I added another "program" to supervisord.conf.

This kicks off a bash script that, once Blue Iris is up and healthy on port 8080, deletes all the contents of www and then unzips ui3.zip into www. This is an unfortunate workaround; I couldn't figure out why part of www is missing.

I'm hoping to get this merged, if I'm not able to I will probably publish my own docker image of my fork.

https://github.com/TonyBrobston/docker-blueiris/blob/f57ca08d6da61847c49ac2af91549682bc9c042b/supervisord.conf#L24-L26

https://github.com/TonyBrobston/docker-blueiris/blob/f57ca08d6da61847c49ac2af91549682bc9c042b/fixui3.sh#L6-L11

calvinbui commented 3 years ago

Previously only local access was working and remote access was still having issues for me

This meant something was wrong with my reverse proxy, Traefik v2. I placed an NGINX proxy inbetween Blueiris and Traefik and this solved the remote access issues for me.

palmersu commented 3 years ago

@calvinbui @dseven @FuzzyMistborn @OscarVanL I added another "program" to supervisord.conf.

This kicks off a bash script that, once Blue Iris is up and healthy on port 8080, deletes all the contents of www and then unzips ui3.zip into www. This is an unfortunate workaround; I couldn't figure out why part of www is missing.

I'm hoping to get this merged, if I'm not able to I will probably publish my own docker image of my fork.

https://github.com/TonyBrobston/docker-blueiris/blob/f57ca08d6da61847c49ac2af91549682bc9c042b/supervisord.conf#L24-L26

https://github.com/TonyBrobston/docker-blueiris/blob/f57ca08d6da61847c49ac2af91549682bc9c042b/fixui3.sh#L6-L11

I am having this issue - was wondering if anyone had a docker image of a fork that had this fix?