Code Monkey home page Code Monkey logo

Comments (10)

amir20 avatar amir20 commented on June 2, 2024 2

I think the current solution is good and doesn't need to be changed. Because sometimes I only care about the logs of other connected Hosts

Based on this, it sounds like I should NOT wait for all to connect. So perhaps trying to reconnect when UI updates is the best option.

I hope the REMOTE_HOST can always fix on the left host list and show the connection status of the host. (It can change in time when the host disconnect after some time)

I feel like this wouldn't be a great experience. If the connection can be fixed, then it should just be fixed. No reason to bother with UI icons.

There is a lot of async code happening here so I have to be careful. I'll see what I can do in the future.

from dozzle.

amir20 avatar amir20 commented on June 2, 2024

This sounds like a bug that should be fixed. And I agree it can be improved. I don't use REMOTE_HOST a lot personally which is why I never noticed it.

I am wondering if Dozzle should auto reconnect automatically or try only when the UI is refreshed. I think both are great options with different tradeoffs.

While reading the code, I did notice that if the events API throws an exception then I log

log.Fatalf("error while listening to docker events: %v. Exiting...", err)

So question, when remote connection exits, do you see this error? The part I don't understand is that this is a fatal log which should cause Dozzle to restart. That was my original goal to not reconnect and instead just exit the program so it would reconnect.

It sounds like you are not getting that error which might mean something else is happening.

If you don't see that error, do you know what is causing the host to disconnect?

from dozzle.

amir20 avatar amir20 commented on June 2, 2024

I just tested it locally and I do see error while listening to docker events: unexpected EOF. Exiting... so let me know what error, if any, you see...

from dozzle.

amir20 avatar amir20 commented on June 2, 2024

Are you using --restart unless-stopped?

from dozzle.

azhezzzz avatar azhezzzz commented on June 2, 2024

image

i can see these but not found Exiting...

here is my config

version: "3"
services:
  dozzle_test:
    container_name: dozzle_test
    restart: always
    image: amir20/dozzle:latest
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    extra_hosts:
      - 'host.docker.internal:host-gateway'
    ports:
      - 9999:8080
    environment:
      - DOZZLE_REMOTE_HOST=tcp://host.docker.internal:2377|TEST_HOST

  dockerproxy:
    container_name: dockerproxy
    image: tecnativa/docker-socket-proxy
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    ports:
      - 2377:2375
    environment:
      - CONTAINERS=1

from dozzle.

azhezzzz avatar azhezzzz commented on June 2, 2024

In my actual situation, my REMOTE_HOST will lose connection for a while before reconnecting (sometimes caused by machine restart), maybe a few minutes or more.
So sometimes restarting Dozzle still cannot connect to REMOTE_HOST immediately.
I think it would be good to have both automatic and manual ways
Dozzle auto reconnect automatically at backend every minute (or a suitable time interval)
and try to reconnect when the UI is refreshed(or provide a connect button)

from dozzle.

amir20 avatar amir20 commented on June 2, 2024

I think I have an idea what's happening. This is a guess though:

  1. Dozzle gets started with 2 connections successfully, but at some point the remote connection fails
  2. Dozzle restarts, so the remote connection is still not working and it only connects to 1 connection
  3. Since one connection still exists, Dozzle is up and running and you don't see the remote connection. This also matches the errors you showed me.

This only happens if you have restart: always.

So I have a solution in mind but it might not be the best.

Right now, Dozzle doesn't fail if at least one connection succeeds. If I was to fail and not start Dozzle if any of the remote connections fails, then it would retry until all of them are working.

What do you think about this solution? When I think about it, it might make more sense to fail because one should know if one of the connections doesn't work. It also happens to work out well with restart: always because Docker will automatically restart Dozzle until all connections works. That way I don't have to retry. The bad part to this solution would be if any connections fails the Dozzle wouldn't be useful at all.

The other solution would be reconnect when the UI is triggered. This adds a lot of complexity though because now I have to asynchronously check if all clients are valid and potentially introducing a lot of race conditions.

I think it's a rare for Docker hosts to restart so perhaps restarting Dozzle and having it reconnect would be the easiest. In fact, a one line change.

from dozzle.

azhezzzz avatar azhezzzz commented on June 2, 2024

Yes, I think your guess is right. In fact, I always keep at least one connection that is localhost and it's always work fine.

Dozzle doesn't fail if at least one connection succeeds

I think the current solution is good and doesn't need to be changed. Because sometimes I only care about the logs of other connected Hosts.

I agree with restart the Dozzle container to reconnect to Remote Host.
In fact, that's what I did. restart the dozzle container in the UI by setting DOZZLE_ENABLE_ACTIONS

I deploy multiple dozzle container and they have their own REMOTE_HOST, and when a remote host lose connection I often forget if it's in the REMOTE_HOST or not

I hope the REMOTE_HOST can always fix on the left host list and show the connection status of the host. (It can change in time when the host disconnect after some time)

And I can know which host lost connection and try to reconnect it.

from dozzle.

amir20 avatar amir20 commented on June 2, 2024

I spent some time on this. It turns out to be very complicated. When the client is connected, the UI loads assuming it has everything it needs and flushes all data to UI. But when the client is disconnected, the UI will load without any data because it loads asynchronously. But then the client my fail, which is not handled correctly. If the client succeeds then its get even more complicated because the data needs to be streamed to the UI.

I am not sure if I have a good solution for this. I may have to rethink a lot here.

from dozzle.

amir20 avatar amir20 commented on June 2, 2024

@azhezzzz can you try amir20/dozzle:pr-2876 I think I have a fix. I tried to keep it simple. The only caveat is that all hosts do need to connect initially. After that, if a host fails, Dozzle will not exit, instead retry on every UI refresh.

from dozzle.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.