From 3a988b8fdcf3339e599d2c14d4faf94d46b297e7 Mon Sep 17 00:00:00 2001 From: Amir Raminfar Date: Thu, 25 Jul 2024 08:01:33 -0700 Subject: [PATCH] feat: updates agents to be more resilient by reconnecting. also adds big performance issues in swarm mode with little updates to the UI. (#3145) --- .vscode/settings.json | 2 +- Makefile | 4 +- assets/components.d.ts | 5 + assets/components/HostList.vue | 37 ++-- assets/components/HostMenu.vue | 3 +- assets/components/common/HostIcon.vue | 10 ++ assets/main.css | 1 + assets/stores/config.ts | 4 +- assets/stores/container.ts | 9 +- assets/stores/hosts.ts | 34 ++-- examples/docker.swarm.yml | 2 +- go.mod | 2 +- go.sum | 16 -- internal/agent/client.go | 13 +- internal/agent/client_test.go | 3 +- internal/agent/pb/types.pb.go | 39 +++- internal/agent/server.go | 36 ++-- internal/docker/client.go | 4 + internal/docker/host.go | 24 +-- internal/docker/stats_collector.go | 4 +- internal/support/cli/clients.go | 23 +-- internal/support/docker/multi_host_service.go | 141 +++------------ .../docker/retriable_client_manager.go | 149 +++++++++++++++ .../support/docker/swarm_client_manager.go | 170 ++++++++++++++++++ internal/web/events.go | 19 +- internal/web/events_test.go | 7 +- internal/web/routes_test.go | 4 +- main.go | 34 +++- protos/types.proto | 2 + 29 files changed, 560 insertions(+), 241 deletions(-) create mode 100644 assets/components/common/HostIcon.vue create mode 100644 internal/support/docker/retriable_client_manager.go create mode 100644 internal/support/docker/swarm_client_manager.go diff --git a/.vscode/settings.json b/.vscode/settings.json index bac65365..fcee7c4e 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,7 +1,7 @@ { "i18n-ally.localesPaths": ["locales"], "i18n-ally.keystyle": "nested", - "cSpell.words": ["healthcheck", "orderedmap", "stdcopy", "Warnf"], + "cSpell.words": ["healthcheck", "orderedmap", "Retriable", "stdcopy", "Warnf"], "editor.formatOnSave": true, "i18n-ally.extract.autoDetect": true } diff --git a/Makefile b/Makefile index 5d73e563..4fbd89b4 100644 --- a/Makefile +++ b/Makefile @@ -55,5 +55,5 @@ $(GEN_DIR)/%.pb.go: $(PROTO_DIR)/%.proto .PHONY: push push: docker - @docker tag amir20/dozzle:latest amir20/dozzle:agent - @docker push amir20/dozzle:agent + @docker tag amir20/dozzle:latest amir20/dozzle:local-test + @docker push amir20/dozzle:local-test diff --git a/assets/components.d.ts b/assets/components.d.ts index f577a6a5..be09a019 100644 --- a/assets/components.d.ts +++ b/assets/components.d.ts @@ -40,6 +40,7 @@ declare module 'vue' { FieldList: typeof import('./components/LogViewer/FieldList.vue')['default'] FuzzySearchModal: typeof import('./components/FuzzySearchModal.vue')['default'] GroupedLog: typeof import('./components/GroupedViewer/GroupedLog.vue')['default'] + HostIcon: typeof import('./components/common/HostIcon.vue')['default'] HostList: typeof import('./components/HostList.vue')['default'] HostMenu: typeof import('./components/HostMenu.vue')['default'] 'Ic:sharpKeyboardReturn': typeof import('~icons/ic/sharp-keyboard-return')['default'] @@ -63,9 +64,12 @@ declare module 'vue' { 'Mdi:chevronRight': typeof import('~icons/mdi/chevron-right')['default'] 'Mdi:close': typeof import('~icons/mdi/close')['default'] 'Mdi:cog': typeof import('~icons/mdi/cog')['default'] + 'Mdi:docker': typeof import('~icons/mdi/docker')['default'] 'Mdi:hamburgerMenu': typeof import('~icons/mdi/hamburger-menu')['default'] + 'Mdi:hexagonMultiple': typeof import('~icons/mdi/hexagon-multiple')['default'] 'Mdi:keyboardEsc': typeof import('~icons/mdi/keyboard-esc')['default'] 'Mdi:magnify': typeof import('~icons/mdi/magnify')['default'] + 'Mdi:satelliteVariant': typeof import('~icons/mdi/satellite-variant')['default'] MobileMenu: typeof import('./components/common/MobileMenu.vue')['default'] MultiContainerLog: typeof import('./components/MultiContainerViewer/MultiContainerLog.vue')['default'] MultiContainerStat: typeof import('./components/LogViewer/MultiContainerStat.vue')['default'] @@ -80,6 +84,7 @@ declare module 'vue' { 'Ph:computerTower': typeof import('~icons/ph/computer-tower')['default'] 'Ph:controlBold': typeof import('~icons/ph/control-bold')['default'] 'Ph:cpu': typeof import('~icons/ph/cpu')['default'] + 'Ph:globeSimple': typeof import('~icons/ph/globe-simple')['default'] 'Ph:memory': typeof import('~icons/ph/memory')['default'] 'Ph:stack': typeof import('~icons/ph/stack')['default'] 'Ph:stackSimple': typeof import('~icons/ph/stack-simple')['default'] diff --git a/assets/components/HostList.vue b/assets/components/HostList.vue index 01a5f598..f6616b19 100644 --- a/assets/components/HostList.vue +++ b/assets/components/HostList.vue @@ -2,20 +2,37 @@