jshridha / docker-blueiris

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

Can no longer update! #62

Open stefan-west1 opened 2 years ago

stefan-west1 commented 2 years ago

Hi all, I've been using the gpu branch for a while now as it seemed the most stable. Not had any issues updating until recently. The only way I could get the update to work was pressing update, blueiris closed and immediately re opened, I'd have to manually close it from the top right corner, and then the updater would restart it again and it'd be all updated and work perfect. However recently, this method has stopped working. Even if I keep the original exe file and put it back, the program no longer opens. I've tried restarting the docker image, but blueiris no longer opens. The only fix I've found is to restore from a full backup I luckily made. However this backup is quite out of date, so I no longer have access to things like deepstack etc. Any way of successfully updating this?

stefan-west1 commented 2 years ago

Quick update on this. Turns out my method works up until version 5.5.0.15. If you try to update to any version after this using this method then it doesn't work and you have to restore.

CalebFenton commented 2 years ago

The problem as I saw it was the updater closes blueiris and supervisord immediately restarts it. The results are unpredictable but in general some files will fail to be updated because they're open and in use. This was causing my install to crash randomly, probably because of a dll version mismatch. My solution is to modify supervisord to not restart blueiris when it closes normally:

[program:blueiris]
command=bash "/root/blueiris.sh"
autorestart=unexpected
exitcodes=0

After this change, when blueiris updates, you'll see this line in your logs:

INFO exited: blueiris (exit status 0; expected)

The updater will restart blueiris when it's done updating and any time blueiris crashes it should have a non-zero exit code (fingers crossed) and will get restarted. Side note: I've seen blueiris just pop up a message box saying its crashed without actually exiting so it might be necessary to add healthchecks and restart blueiris if they fail.

BlueManRising commented 2 years ago

@CalebFenton how did you change the supervisord file and reload into docker? i tried to just gitpull this repo and recreate with my dockerhub account, but i keep getting errors and not able to do it. is there a repo or way to do it inside the program, or file somewhere? sorry newer to this whole docker thing...

BlueManRising commented 2 years ago

I actually figured out a clever work-around, when starting the docker for the first time, read the "read-me" and that will open a txt editor, you can find the file in there and make the edit... lol -- Disregard, found out if you chmod and change it, the docker just freezes and all changes revert back when you restart, have to change the file before you load the docker, i don't know where unraid saves these, so im back to square 1

CalebFenton commented 2 years ago

As a quick hack, you can just mount a local copy of supervisord.conf to /etc/supervisor/conf.d/supervisord.conf. This would allow you to make any changes you want and just restart / recreate the container.

I build the images myself. My fork is here: https://github.com/CalebFenton/docker-blueiris I build it myself so I can make sure everything is up-to-date and make a lot of other changes like including wine / blueiris logs (check my supervisord.conf to see how), updating the vnc, updating ui3 web library, minimizing the size of the docker layers, etc. My changes were so drastic that I didn't offer a PR.

Clever idea using notepad to open the file and make changes. You could probably even navigate to c:\windows, right click explorer.exe and run it :D. I'm surprised that didn't work because the changes should persist until you destroy the container. Maybe unraid does that a lot?

BlueManRising commented 2 years ago

@CalebFenton one more question, u have a dockerhub of this? Ic ur git hub, I tried to clone it, but it fails in dockerhub... I did get branch 3 to work in dockerhub, but now it's not loading blue Iris, so either keep messing with that or dump it and use urs

stefan-west1 commented 2 years ago

@CalebFenton You'll have to bear with me as I know absolutely nothing about docker containers but here goes. I managed to update the supervisord.conf file by sshing into the container, installing nano and changing it that way. That seemed to work great. If i manually close down blueiris, it doesn't auto restart. If I install any update to 5.5.0.15, it installs and waits for the updater to restart it. However still if I try to install anything beyond that, it shows as installing, says "restarting application" dissapears and then does nothing. Restarting the container also just leaves me looking at a blank screen

CalebFenton commented 2 years ago

@BlueManRising What fails in dockerhub? How does it fail? How does something fail in dockerhub -- I thought it was just a place that hosts images? What is branch 3? I only use master branch. All you need to do is modify supervisor.d either by baking it into the container or mounting your version and using this repo / image / dockerhub / whatever. The easiest thing to do is use this repo the way you've been using it, but add a mount in the docker-compose for your version of supervisord.conf which has the added lines to not restart on expected exits. I explain below.

@stefan-west1 The problem with that is containers are ephemeral -- meaning any changes you make will get blown away when you take it down. If you want it to last, either bake the change into the image (modify the Dockerfile and build yourself) or mount it from your host machine (modify docker-compose.yml).

You can find out where supervisord.conf is supposed to go by opening bash within the running container: docker-compose exec blueiris bash (if it's not running, you use run instead of exec) and doing a find / | grep supervisord or you could look at where the Dockerfile puts it: COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf

So right next to your docker-compose.yml create a copy of the original supervisord.conf file and make this change todocker-compose.yml:

    volumes:
      - ./supervisord.conf:/etc/supervisor/conf.d/supervisord.conf # add this line

Now modify supervisord.conf to your heart's content. For example, it may not be that it's valid to assume every 0 exit code is an update. Maybe weird stuff happens when it auto upgrades, maybe it exits with 0 under certain crash conditions. It's good practice to only exit 0 when there's no error, but the universe does not enforce this. You may be able to just add a startup delay which is more dumb but perhaps more rugged. Not sure if supervisord allows this though.

After you made your changes, just restart docker-compose down && docker-compose up -d and the container will use that config file. This will allow you to make rapid changes and test them just by restarting the container.

CalebFenton commented 2 years ago

Oh yeah and an easier way to run stuff is right click in the clips left bar and goto "open containing folder". I have no idea how to close the navigation window other than restarting but it's a good way to navigate around and open stuff.

BlueManRising commented 2 years ago

@CalebFenton Thanks man appreciate the insight, ill take a look this weekend.

stefan-west1 commented 2 years ago

@CalebFenton Can't believe I didn't think of doing that with docker-compose, to be honest. That has worked, in that the change to supervisord-normal.conf is permanent, however, I'm still not able to update. Trying to update past 5.5.0.15 still leaves me with a blank screen. I haven't tried with the latest branch, as I'm using the GPU branch as it seems to work better for other issues