Repository navigation
feat(panel-host): обновление Docker Engine из окна компонентов сервера панели - #126
Merged
Merged
Conversation
…s dialog The Docker row of Panel host components only showed a shell command, because upgrading Docker restarts the daemon and with it the panel that would run the upgrade. The row now has an "Upgrade to <version>" button. The panel writes the upgrade script to /etc/dokploy/host-updates, which the host shares with the panel container, and starts it through a one-off privileged container that enters the host's namespaces and calls systemd-run. The script then runs as the host unit dokploy-docker-engine-upgrade, outside Docker, so the daemon restart does not stop it. The script reuses the remote-server Docker steps: it pre-downloads the pinned packages, saves the installed ones for rollback, installs, and waits up to five minutes for Traefik, the panel (healthy), Postgres (pg_isready) and Redis (PONG). If they do not come back, it reinstalls the saved packages. A skipped upgrade (no apt, no pinned candidate, a Docker apt source for another release) fails the run with nothing changed. The script writes its log and a JSON status next to itself. The dialog polls that status every two seconds, keeps polling while the panel is down, and shows the log and the result when the panel is back. A run that stops writing for 30 minutes is reported as interrupted. A running upgrade blocks a second one, the Traefik and Redis update and the panel update. The new procedures are settings.hostDockerUpgrade (read) and settings.upgradeHostDocker (dangerous, not in the OpenAPI document). Hosts without systemd get a clear refusal and keep the manual command, which stays visible under the button. The Docker test fakes move to __test__/server/docker-script-fakes.ts so the new host script tests run the generated bash the same way as the remote-server tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Первый реальный запуск на сервере (Ubuntu 24.04 в OrbStack) откатил Docker 29.9.2: за отведённое время сервисы не признали готовыми. Ожидание считало попытки, а не секунды. Одна попытка с проверками swarm, панели, Postgres и Redis на нагруженном сервере шла около двух секунд, поэтому «300 секунд» растянулись на 9 минут. По журналу при этом нельзя было понять, какая проверка не проходила. Теперь docker_wait_ready ждёт до срока по date +%s. Раз в 30 секунд он пишет в журнал, чего ждёт: версию Docker, Traefik, задачу swarm, здоровье панели, Postgres или Redis. При истечении срока та же причина попадает в текст ошибки. Это касается и обновления Docker на удалённых серверах. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Что меняется для администратора
В карточке Remote Servers → Panel host (this server) → Components у строки Docker появилась кнопка Upgrade to <версия>. Раньше там была только команда, которую нужно было запускать на сервере по SSH.
При обновлении Docker перезапускается его демон, а вместе с ним все контейнеры сервера: сайты и сама панель недоступны минуту-две. Окно подтверждения прямо об этом предупреждает. Окно Components можно не закрывать: пока панель перезапускается, оно ждёт, а потом показывает журнал и итог. Ручная команда (
DOCKER_ENGINE_UPGRADE=1 bash install-agenthits.sh update) осталась под кнопкой, в блоке «Or run it on the host yourself».Как это устроено
/etc/dokploy/host-updates/(эта папка общая у сервера и контейнера панели). Затем одноразовый привилегированный контейнер входит в пространства имён сервера (nsenter --target=1) и запускает скрипт черезsystemd-runкак службу сервераdokploy-docker-engine-upgrade. Эта служба работает вне Docker и переживает его перезапуск.pg_isready) и Redis (PONG).docker-engine-upgrade.logи JSON-статус рядом с собой. Окно опрашивает их каждые 2 секунды черезsettings.hostDockerUpgrade. Если запуск 30 минут ничего не пишет, он показывается как прерванный.settings.hostDockerUpgrade(чтение);settings.upgradeHostDocker(dangerous; в OpenAPI не попадает, как иupdateHostStack).docs/server-maintenance.mdописаны кнопка, откат и где лежит журнал.Проверки
bun x tsc --noEmitвapps/dokployиpackages/server.host-docker-upgrade.test.tsпрогоняет сгенерированный скрипт в bash с поддельнымиdockerиapt-get. Покрыты успех, откат при нездоровой панели, панель без проверки здоровья и отсутствие нужной версии в apt. Тесты роутера покрывают запуск, отказы, блокировку и запрет обновлений панели и Traefik/Redis во время обновления Docker. Весь набор проходит, кромеvector-validate: ему нужен локальный Docker, и без этого изменения он падает так же.Учтите: обновление Docker перезапускает все контейнеры сервера. Демон даёт каждому 10 секунд после SIGTERM, затем останавливает принудительно. Базы данных приложений при этом могут подниматься через восстановление после сбоя, поэтому кнопку стоит нажимать, когда на сервере не идут выкладки.
🤖 Generated with Claude Code