ysk-server-core 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -6
- package/dist/db/database.d.ts +1 -1
- package/dist/db/database.js +1 -1
- package/dist/db/document-store.d.ts +6 -2
- package/dist/db/document-store.d.ts.map +1 -1
- package/dist/db/document-store.js +5 -5
- package/dist/db/document-store.js.map +1 -1
- package/dist/db/store.d.ts +31 -2
- package/dist/db/store.d.ts.map +1 -1
- package/dist/db/store.js +286 -40
- package/dist/db/store.js.map +1 -1
- package/dist/email/autodiscover.d.ts +3 -0
- package/dist/email/autodiscover.d.ts.map +1 -1
- package/dist/email/autodiscover.js +57 -17
- package/dist/email/autodiscover.js.map +1 -1
- package/dist/email/dns-records.d.ts.map +1 -1
- package/dist/email/dns-records.js +3 -1
- package/dist/email/dns-records.js.map +1 -1
- package/dist/email/live-checks.d.ts.map +1 -1
- package/dist/email/live-checks.js +13 -4
- package/dist/email/live-checks.js.map +1 -1
- package/dist/email/mail-queue.d.ts +13 -4
- package/dist/email/mail-queue.d.ts.map +1 -1
- package/dist/email/mail-queue.js +69 -14
- package/dist/email/mail-queue.js.map +1 -1
- package/dist/email/mail-tls-apply.d.ts.map +1 -1
- package/dist/email/mail-tls-apply.js +22 -0
- package/dist/email/mail-tls-apply.js.map +1 -1
- package/dist/files/index.d.ts +1 -0
- package/dist/files/index.d.ts.map +1 -1
- package/dist/files/index.js +1 -0
- package/dist/files/index.js.map +1 -1
- package/dist/files/manager.d.ts +25 -6
- package/dist/files/manager.d.ts.map +1 -1
- package/dist/files/manager.js +166 -33
- package/dist/files/manager.js.map +1 -1
- package/dist/files/name-conflict.d.ts +9 -0
- package/dist/files/name-conflict.d.ts.map +1 -0
- package/dist/files/name-conflict.js +36 -0
- package/dist/files/name-conflict.js.map +1 -0
- package/dist/files/shares.d.ts.map +1 -1
- package/dist/files/shares.js +17 -1
- package/dist/files/shares.js.map +1 -1
- package/dist/host/executor.d.ts +3 -0
- package/dist/host/executor.d.ts.map +1 -1
- package/dist/host/executor.js +169 -7
- package/dist/host/executor.js.map +1 -1
- package/dist/host-browse/browser-engine.d.ts.map +1 -1
- package/dist/host-browse/browser-engine.js +2 -1
- package/dist/host-browse/browser-engine.js.map +1 -1
- package/dist/host-browse/chrome-as-user.d.ts.map +1 -1
- package/dist/host-browse/chrome-as-user.js +2 -1
- package/dist/host-browse/chrome-as-user.js.map +1 -1
- package/dist/host-browse/chrome-path.d.ts +13 -0
- package/dist/host-browse/chrome-path.d.ts.map +1 -0
- package/dist/host-browse/chrome-path.js +76 -0
- package/dist/host-browse/chrome-path.js.map +1 -0
- package/dist/host-browse/chrome-probe.d.ts.map +1 -1
- package/dist/host-browse/chrome-probe.js +3 -2
- package/dist/host-browse/chrome-probe.js.map +1 -1
- package/dist/host-browse/index.d.ts +1 -0
- package/dist/host-browse/index.d.ts.map +1 -1
- package/dist/host-browse/index.js +1 -0
- package/dist/host-browse/index.js.map +1 -1
- package/dist/host-browse/ssrf.d.ts.map +1 -1
- package/dist/host-browse/ssrf.js +2 -2
- package/dist/host-browse/ssrf.js.map +1 -1
- package/dist/host-browse/types.d.ts.map +1 -1
- package/dist/host-browse/types.js +4 -3
- package/dist/host-browse/types.js.map +1 -1
- package/dist/hosting/apache/render-site.d.ts.map +1 -1
- package/dist/hosting/apache/render-site.js +2 -1
- package/dist/hosting/apache/render-site.js.map +1 -1
- package/dist/hosting/apache/sync.d.ts +2 -0
- package/dist/hosting/apache/sync.d.ts.map +1 -1
- package/dist/hosting/apache/sync.js +25 -0
- package/dist/hosting/apache/sync.js.map +1 -1
- package/dist/hosting/app-templates.js +1 -1
- package/dist/hosting/app-templates.js.map +1 -1
- package/dist/hosting/backup-cron.d.ts +19 -0
- package/dist/hosting/backup-cron.d.ts.map +1 -1
- package/dist/hosting/backup-cron.js +200 -35
- package/dist/hosting/backup-cron.js.map +1 -1
- package/dist/hosting/backup-remote.d.ts +17 -0
- package/dist/hosting/backup-remote.d.ts.map +1 -1
- package/dist/hosting/backup-remote.js +341 -55
- package/dist/hosting/backup-remote.js.map +1 -1
- package/dist/hosting/bt-tracker/index.d.ts +3 -0
- package/dist/hosting/bt-tracker/index.d.ts.map +1 -1
- package/dist/hosting/bt-tracker/index.js +3 -0
- package/dist/hosting/bt-tracker/index.js.map +1 -1
- package/dist/hosting/bt-tracker/library-ops.d.ts +86 -0
- package/dist/hosting/bt-tracker/library-ops.d.ts.map +1 -0
- package/dist/hosting/bt-tracker/library-ops.js +481 -0
- package/dist/hosting/bt-tracker/library-ops.js.map +1 -0
- package/dist/hosting/bt-tracker/library.d.ts +12 -0
- package/dist/hosting/bt-tracker/library.d.ts.map +1 -0
- package/dist/hosting/bt-tracker/library.js +109 -0
- package/dist/hosting/bt-tracker/library.js.map +1 -0
- package/dist/hosting/bt-tracker/restore-library.d.ts +16 -0
- package/dist/hosting/bt-tracker/restore-library.d.ts.map +1 -0
- package/dist/hosting/bt-tracker/restore-library.js +67 -0
- package/dist/hosting/bt-tracker/restore-library.js.map +1 -0
- package/dist/hosting/bt-tracker/restore-shares.d.ts.map +1 -1
- package/dist/hosting/bt-tracker/restore-shares.js +8 -0
- package/dist/hosting/bt-tracker/restore-shares.js.map +1 -1
- package/dist/hosting/bt-tracker/seeder.d.ts +55 -16
- package/dist/hosting/bt-tracker/seeder.d.ts.map +1 -1
- package/dist/hosting/bt-tracker/seeder.js +103 -3
- package/dist/hosting/bt-tracker/seeder.js.map +1 -1
- package/dist/hosting/bt-tracker/service.d.ts.map +1 -1
- package/dist/hosting/bt-tracker/service.js +28 -4
- package/dist/hosting/bt-tracker/service.js.map +1 -1
- package/dist/hosting/bt-tracker/settings.d.ts +14 -1
- package/dist/hosting/bt-tracker/settings.d.ts.map +1 -1
- package/dist/hosting/bt-tracker/settings.js +102 -3
- package/dist/hosting/bt-tracker/settings.js.map +1 -1
- package/dist/hosting/cdn/fan-out.d.ts.map +1 -1
- package/dist/hosting/cdn/fan-out.js +56 -31
- package/dist/hosting/cdn/fan-out.js.map +1 -1
- package/dist/hosting/cdn/from-project.d.ts +6 -0
- package/dist/hosting/cdn/from-project.d.ts.map +1 -1
- package/dist/hosting/cdn/from-project.js +55 -1
- package/dist/hosting/cdn/from-project.js.map +1 -1
- package/dist/hosting/cdn/http-probe-error.d.ts +7 -0
- package/dist/hosting/cdn/http-probe-error.d.ts.map +1 -0
- package/dist/hosting/cdn/http-probe-error.js +44 -0
- package/dist/hosting/cdn/http-probe-error.js.map +1 -0
- package/dist/hosting/cdn/nodes.d.ts +8 -0
- package/dist/hosting/cdn/nodes.d.ts.map +1 -1
- package/dist/hosting/cdn/nodes.js +69 -1
- package/dist/hosting/cdn/nodes.js.map +1 -1
- package/dist/hosting/cdn/ssl.d.ts.map +1 -1
- package/dist/hosting/cdn/ssl.js +3 -25
- package/dist/hosting/cdn/ssl.js.map +1 -1
- package/dist/hosting/db-cluster/apply-local.d.ts +1 -1
- package/dist/hosting/db-cluster/apply-local.js +7 -7
- package/dist/hosting/db-cluster/apply-local.js.map +1 -1
- package/dist/hosting/db-cluster/probe.js +1 -1
- package/dist/hosting/db-cluster/probe.js.map +1 -1
- package/dist/hosting/db-cluster/push-peer.d.ts +3 -0
- package/dist/hosting/db-cluster/push-peer.d.ts.map +1 -1
- package/dist/hosting/db-cluster/push-peer.js +41 -21
- package/dist/hosting/db-cluster/push-peer.js.map +1 -1
- package/dist/hosting/db-cluster/store.d.ts +1 -0
- package/dist/hosting/db-cluster/store.d.ts.map +1 -1
- package/dist/hosting/db-cluster/store.js +11 -0
- package/dist/hosting/db-cluster/store.js.map +1 -1
- package/dist/hosting/db-cluster/types.d.ts +1 -1
- package/dist/hosting/db-cluster/types.d.ts.map +1 -1
- package/dist/hosting/db-service-config.d.ts +1 -0
- package/dist/hosting/db-service-config.d.ts.map +1 -1
- package/dist/hosting/db-service-config.js +11 -1
- package/dist/hosting/db-service-config.js.map +1 -1
- package/dist/hosting/defense/automation.js +1 -1
- package/dist/hosting/defense/automation.js.map +1 -1
- package/dist/hosting/defense/defense-service.d.ts.map +1 -1
- package/dist/hosting/defense/defense-service.js +62 -39
- package/dist/hosting/defense/defense-service.js.map +1 -1
- package/dist/hosting/defense/geoip/index.d.ts.map +1 -1
- package/dist/hosting/defense/geoip/index.js +9 -7
- package/dist/hosting/defense/geoip/index.js.map +1 -1
- package/dist/hosting/defense/presets.js +2 -2
- package/dist/hosting/defense/presets.js.map +1 -1
- package/dist/hosting/defense/signals.d.ts +5 -0
- package/dist/hosting/defense/signals.d.ts.map +1 -1
- package/dist/hosting/defense/signals.js +26 -10
- package/dist/hosting/defense/signals.js.map +1 -1
- package/dist/hosting/defense/types.d.ts +2 -0
- package/dist/hosting/defense/types.d.ts.map +1 -1
- package/dist/hosting/dns-health.d.ts.map +1 -1
- package/dist/hosting/dns-health.js +26 -20
- package/dist/hosting/dns-health.js.map +1 -1
- package/dist/hosting/dns-zone.d.ts +18 -0
- package/dist/hosting/dns-zone.d.ts.map +1 -1
- package/dist/hosting/dns-zone.js +59 -0
- package/dist/hosting/dns-zone.js.map +1 -1
- package/dist/hosting/docker/argv.d.ts +10 -0
- package/dist/hosting/docker/argv.d.ts.map +1 -0
- package/dist/hosting/docker/argv.js +274 -0
- package/dist/hosting/docker/argv.js.map +1 -0
- package/dist/hosting/docker/daemon.d.ts +27 -0
- package/dist/hosting/docker/daemon.d.ts.map +1 -0
- package/dist/hosting/docker/daemon.js +125 -0
- package/dist/hosting/docker/daemon.js.map +1 -0
- package/dist/hosting/docker/honesty.d.ts +27 -0
- package/dist/hosting/docker/honesty.d.ts.map +1 -0
- package/dist/hosting/docker/honesty.js +50 -0
- package/dist/hosting/docker/honesty.js.map +1 -0
- package/dist/hosting/docker/index.d.ts +6 -0
- package/dist/hosting/docker/index.d.ts.map +1 -0
- package/dist/hosting/docker/index.js +6 -0
- package/dist/hosting/docker/index.js.map +1 -0
- package/dist/hosting/docker/manager.d.ts +131 -0
- package/dist/hosting/docker/manager.d.ts.map +1 -0
- package/dist/hosting/docker/manager.js +681 -0
- package/dist/hosting/docker/manager.js.map +1 -0
- package/dist/hosting/docker/parse.d.ts +21 -0
- package/dist/hosting/docker/parse.d.ts.map +1 -0
- package/dist/hosting/docker/parse.js +185 -0
- package/dist/hosting/docker/parse.js.map +1 -0
- package/dist/hosting/extras.d.ts.map +1 -1
- package/dist/hosting/extras.js +7 -1
- package/dist/hosting/extras.js.map +1 -1
- package/dist/hosting/fail2ban-ops.d.ts +2 -0
- package/dist/hosting/fail2ban-ops.d.ts.map +1 -1
- package/dist/hosting/fail2ban-ops.js +11 -9
- package/dist/hosting/fail2ban-ops.js.map +1 -1
- package/dist/hosting/firewall-ops.d.ts +4 -0
- package/dist/hosting/firewall-ops.d.ts.map +1 -1
- package/dist/hosting/firewall-ops.js +43 -2
- package/dist/hosting/firewall-ops.js.map +1 -1
- package/dist/hosting/ftps-service.d.ts +14 -0
- package/dist/hosting/ftps-service.d.ts.map +1 -1
- package/dist/hosting/ftps-service.js +78 -11
- package/dist/hosting/ftps-service.js.map +1 -1
- package/dist/hosting/git-auth.d.ts +77 -0
- package/dist/hosting/git-auth.d.ts.map +1 -0
- package/dist/hosting/git-auth.js +314 -0
- package/dist/hosting/git-auth.js.map +1 -0
- package/dist/hosting/git-control.d.ts +110 -0
- package/dist/hosting/git-control.d.ts.map +1 -0
- package/dist/hosting/git-control.js +333 -0
- package/dist/hosting/git-control.js.map +1 -0
- package/dist/hosting/git-deploy.d.ts +2 -0
- package/dist/hosting/git-deploy.d.ts.map +1 -1
- package/dist/hosting/git-deploy.js +50 -7
- package/dist/hosting/git-deploy.js.map +1 -1
- package/dist/hosting/git-errors.d.ts +7 -0
- package/dist/hosting/git-errors.d.ts.map +1 -0
- package/dist/hosting/git-errors.js +45 -0
- package/dist/hosting/git-errors.js.map +1 -0
- package/dist/hosting/git-hook.d.ts +33 -0
- package/dist/hosting/git-hook.d.ts.map +1 -0
- package/dist/hosting/git-hook.js +174 -0
- package/dist/hosting/git-hook.js.map +1 -0
- package/dist/hosting/global-search.d.ts.map +1 -1
- package/dist/hosting/global-search.js +22 -4
- package/dist/hosting/global-search.js.map +1 -1
- package/dist/hosting/host-migrate/bootstrap-target.d.ts +1 -1
- package/dist/hosting/host-migrate/bootstrap-target.js +6 -6
- package/dist/hosting/host-migrate/bootstrap-target.js.map +1 -1
- package/dist/hosting/host-migrate/index.d.ts +1 -0
- package/dist/hosting/host-migrate/index.d.ts.map +1 -1
- package/dist/hosting/host-migrate/index.js +1 -0
- package/dist/hosting/host-migrate/index.js.map +1 -1
- package/dist/hosting/host-migrate/inventory.d.ts.map +1 -1
- package/dist/hosting/host-migrate/inventory.js +13 -0
- package/dist/hosting/host-migrate/inventory.js.map +1 -1
- package/dist/hosting/host-migrate/orphan-homes.d.ts +19 -0
- package/dist/hosting/host-migrate/orphan-homes.d.ts.map +1 -0
- package/dist/hosting/host-migrate/orphan-homes.js +46 -0
- package/dist/hosting/host-migrate/orphan-homes.js.map +1 -0
- package/dist/hosting/host-migrate/temp-key.d.ts.map +1 -1
- package/dist/hosting/host-migrate/temp-key.js +7 -1
- package/dist/hosting/host-migrate/temp-key.js.map +1 -1
- package/dist/hosting/index.d.ts +9 -0
- package/dist/hosting/index.d.ts.map +1 -1
- package/dist/hosting/index.js +9 -0
- package/dist/hosting/index.js.map +1 -1
- package/dist/hosting/leftover-apply.d.ts +18 -0
- package/dist/hosting/leftover-apply.d.ts.map +1 -0
- package/dist/hosting/leftover-apply.js +90 -0
- package/dist/hosting/leftover-apply.js.map +1 -0
- package/dist/hosting/leftover-probe.d.ts +38 -0
- package/dist/hosting/leftover-probe.d.ts.map +1 -0
- package/dist/hosting/leftover-probe.js +162 -0
- package/dist/hosting/leftover-probe.js.map +1 -0
- package/dist/hosting/log-center/catalog.d.ts.map +1 -1
- package/dist/hosting/log-center/catalog.js +9 -0
- package/dist/hosting/log-center/catalog.js.map +1 -1
- package/dist/hosting/log-center/journal.d.ts.map +1 -1
- package/dist/hosting/log-center/journal.js +3 -0
- package/dist/hosting/log-center/journal.js.map +1 -1
- package/dist/hosting/managed-resources.d.ts.map +1 -1
- package/dist/hosting/managed-resources.js +18 -2
- package/dist/hosting/managed-resources.js.map +1 -1
- package/dist/hosting/nginx-sites-list.d.ts.map +1 -1
- package/dist/hosting/nginx-sites-list.js +39 -3
- package/dist/hosting/nginx-sites-list.js.map +1 -1
- package/dist/hosting/nginx-ssl.d.ts +4 -0
- package/dist/hosting/nginx-ssl.d.ts.map +1 -1
- package/dist/hosting/nginx-ssl.js +52 -7
- package/dist/hosting/nginx-ssl.js.map +1 -1
- package/dist/hosting/nginx-sync.d.ts +33 -0
- package/dist/hosting/nginx-sync.d.ts.map +1 -1
- package/dist/hosting/nginx-sync.js +258 -11
- package/dist/hosting/nginx-sync.js.map +1 -1
- package/dist/hosting/ops-log.d.ts +23 -0
- package/dist/hosting/ops-log.d.ts.map +1 -0
- package/dist/hosting/ops-log.js +15 -0
- package/dist/hosting/ops-log.js.map +1 -0
- package/dist/hosting/panel-tls.d.ts +9 -0
- package/dist/hosting/panel-tls.d.ts.map +1 -1
- package/dist/hosting/panel-tls.js +50 -2
- package/dist/hosting/panel-tls.js.map +1 -1
- package/dist/hosting/pm2-apply.d.ts.map +1 -1
- package/dist/hosting/pm2-apply.js +9 -2
- package/dist/hosting/pm2-apply.js.map +1 -1
- package/dist/hosting/postgres-provision.d.ts.map +1 -1
- package/dist/hosting/postgres-provision.js +43 -19
- package/dist/hosting/postgres-provision.js.map +1 -1
- package/dist/hosting/production-readiness.d.ts.map +1 -1
- package/dist/hosting/production-readiness.js +67 -10
- package/dist/hosting/production-readiness.js.map +1 -1
- package/dist/hosting/project-create-extras.d.ts +37 -0
- package/dist/hosting/project-create-extras.d.ts.map +1 -0
- package/dist/hosting/project-create-extras.js +47 -0
- package/dist/hosting/project-create-extras.js.map +1 -0
- package/dist/hosting/project-isolation-status.d.ts.map +1 -1
- package/dist/hosting/project-isolation-status.js +10 -2
- package/dist/hosting/project-isolation-status.js.map +1 -1
- package/dist/hosting/project-ops.d.ts +67 -0
- package/dist/hosting/project-ops.d.ts.map +1 -1
- package/dist/hosting/project-ops.js +377 -7
- package/dist/hosting/project-ops.js.map +1 -1
- package/dist/hosting/project-service.d.ts +3 -0
- package/dist/hosting/project-service.d.ts.map +1 -1
- package/dist/hosting/project-service.js +9 -0
- package/dist/hosting/project-service.js.map +1 -1
- package/dist/hosting/public-files.d.ts +4 -0
- package/dist/hosting/public-files.d.ts.map +1 -1
- package/dist/hosting/public-files.js +46 -7
- package/dist/hosting/public-files.js.map +1 -1
- package/dist/hosting/rebuild.d.ts.map +1 -1
- package/dist/hosting/rebuild.js +10 -2
- package/dist/hosting/rebuild.js.map +1 -1
- package/dist/hosting/runtime-probe.d.ts +7 -0
- package/dist/hosting/runtime-probe.d.ts.map +1 -1
- package/dist/hosting/runtime-probe.js +74 -7
- package/dist/hosting/runtime-probe.js.map +1 -1
- package/dist/hosting/runtime.d.ts.map +1 -1
- package/dist/hosting/runtime.js +5 -3
- package/dist/hosting/runtime.js.map +1 -1
- package/dist/hosting/service-catalog/redis.d.ts.map +1 -1
- package/dist/hosting/service-catalog/redis.js +2 -1
- package/dist/hosting/service-catalog/redis.js.map +1 -1
- package/dist/hosting/service-console.d.ts.map +1 -1
- package/dist/hosting/service-console.js +2 -1
- package/dist/hosting/service-console.js.map +1 -1
- package/dist/hosting/service-matrix.d.ts +1 -1
- package/dist/hosting/service-matrix.d.ts.map +1 -1
- package/dist/hosting/service-matrix.js +24 -1
- package/dist/hosting/service-matrix.js.map +1 -1
- package/dist/hosting/sftp-keys.d.ts.map +1 -1
- package/dist/hosting/sftp-keys.js +2 -1
- package/dist/hosting/sftp-keys.js.map +1 -1
- package/dist/hosting/software-catalog.d.ts +2 -2
- package/dist/hosting/software-catalog.d.ts.map +1 -1
- package/dist/hosting/software-catalog.js +12 -2
- package/dist/hosting/software-catalog.js.map +1 -1
- package/dist/hosting/software-probe/HostSoftwareProbe.d.ts.map +1 -1
- package/dist/hosting/software-probe/HostSoftwareProbe.js +4 -0
- package/dist/hosting/software-probe/HostSoftwareProbe.js.map +1 -1
- package/dist/hosting/software-probe/registry.d.ts.map +1 -1
- package/dist/hosting/software-probe/registry.js +13 -0
- package/dist/hosting/software-probe/registry.js.map +1 -1
- package/dist/hosting/software-uninstall.d.ts.map +1 -1
- package/dist/hosting/software-uninstall.js +22 -0
- package/dist/hosting/software-uninstall.js.map +1 -1
- package/dist/hosting/sql-engine-switch/migrate.d.ts.map +1 -1
- package/dist/hosting/sql-engine-switch/migrate.js +62 -5
- package/dist/hosting/sql-engine-switch/migrate.js.map +1 -1
- package/dist/hosting/sql-engine-switch/preview.d.ts +9 -0
- package/dist/hosting/sql-engine-switch/preview.d.ts.map +1 -1
- package/dist/hosting/sql-engine-switch/preview.js +48 -0
- package/dist/hosting/sql-engine-switch/preview.js.map +1 -1
- package/dist/hosting/ssl-certs.js +1 -1
- package/dist/hosting/ssl-certs.js.map +1 -1
- package/dist/hosting/stack/definitions.js +1 -1
- package/dist/hosting/stack/definitions.js.map +1 -1
- package/dist/hosting/system-apply.d.ts.map +1 -1
- package/dist/hosting/system-apply.js +16 -6
- package/dist/hosting/system-apply.js.map +1 -1
- package/dist/hosting/temp-db-user.d.ts +10 -0
- package/dist/hosting/temp-db-user.d.ts.map +1 -1
- package/dist/hosting/temp-db-user.js +31 -0
- package/dist/hosting/temp-db-user.js.map +1 -1
- package/dist/hosting/validators/adapters/ada.d.ts +16 -0
- package/dist/hosting/validators/adapters/ada.d.ts.map +1 -0
- package/dist/hosting/validators/adapters/ada.js +72 -0
- package/dist/hosting/validators/adapters/ada.js.map +1 -0
- package/dist/hosting/validators/adapters/avax.d.ts +17 -0
- package/dist/hosting/validators/adapters/avax.d.ts.map +1 -0
- package/dist/hosting/validators/adapters/avax.js +67 -0
- package/dist/hosting/validators/adapters/avax.js.map +1 -0
- package/dist/hosting/validators/adapters/base.d.ts +61 -0
- package/dist/hosting/validators/adapters/base.d.ts.map +1 -0
- package/dist/hosting/validators/adapters/base.js +4 -0
- package/dist/hosting/validators/adapters/base.js.map +1 -0
- package/dist/hosting/validators/adapters/eth-clients.d.ts +16 -0
- package/dist/hosting/validators/adapters/eth-clients.d.ts.map +1 -0
- package/dist/hosting/validators/adapters/eth-clients.js +247 -0
- package/dist/hosting/validators/adapters/eth-clients.js.map +1 -0
- package/dist/hosting/validators/adapters/eth.d.ts +18 -0
- package/dist/hosting/validators/adapters/eth.d.ts.map +1 -0
- package/dist/hosting/validators/adapters/eth.js +102 -0
- package/dist/hosting/validators/adapters/eth.js.map +1 -0
- package/dist/hosting/validators/adapters/index.d.ts +5 -0
- package/dist/hosting/validators/adapters/index.d.ts.map +1 -0
- package/dist/hosting/validators/adapters/index.js +39 -0
- package/dist/hosting/validators/adapters/index.js.map +1 -0
- package/dist/hosting/validators/adapters/near.d.ts +15 -0
- package/dist/hosting/validators/adapters/near.d.ts.map +1 -0
- package/dist/hosting/validators/adapters/near.js +72 -0
- package/dist/hosting/validators/adapters/near.js.map +1 -0
- package/dist/hosting/validators/adapters/phase2.d.ts +33 -0
- package/dist/hosting/validators/adapters/phase2.d.ts.map +1 -0
- package/dist/hosting/validators/adapters/phase2.js +294 -0
- package/dist/hosting/validators/adapters/phase2.js.map +1 -0
- package/dist/hosting/validators/compose-runner.d.ts +80 -0
- package/dist/hosting/validators/compose-runner.d.ts.map +1 -0
- package/dist/hosting/validators/compose-runner.js +158 -0
- package/dist/hosting/validators/compose-runner.js.map +1 -0
- package/dist/hosting/validators/disk.d.ts +20 -0
- package/dist/hosting/validators/disk.d.ts.map +1 -0
- package/dist/hosting/validators/disk.js +106 -0
- package/dist/hosting/validators/disk.js.map +1 -0
- package/dist/hosting/validators/extras.d.ts +77 -0
- package/dist/hosting/validators/extras.d.ts.map +1 -0
- package/dist/hosting/validators/extras.js +370 -0
- package/dist/hosting/validators/extras.js.map +1 -0
- package/dist/hosting/validators/health.d.ts +21 -0
- package/dist/hosting/validators/health.d.ts.map +1 -0
- package/dist/hosting/validators/health.js +65 -0
- package/dist/hosting/validators/health.js.map +1 -0
- package/dist/hosting/validators/honesty.d.ts +33 -0
- package/dist/hosting/validators/honesty.d.ts.map +1 -0
- package/dist/hosting/validators/honesty.js +54 -0
- package/dist/hosting/validators/honesty.js.map +1 -0
- package/dist/hosting/validators/index.d.ts +24 -0
- package/dist/hosting/validators/index.d.ts.map +1 -0
- package/dist/hosting/validators/index.js +24 -0
- package/dist/hosting/validators/index.js.map +1 -0
- package/dist/hosting/validators/manager.d.ts +77 -0
- package/dist/hosting/validators/manager.d.ts.map +1 -0
- package/dist/hosting/validators/manager.js +447 -0
- package/dist/hosting/validators/manager.js.map +1 -0
- package/dist/hosting/validators/mithril.d.ts +30 -0
- package/dist/hosting/validators/mithril.d.ts.map +1 -0
- package/dist/hosting/validators/mithril.js +146 -0
- package/dist/hosting/validators/mithril.js.map +1 -0
- package/dist/hosting/validators/native-prune.d.ts +12 -0
- package/dist/hosting/validators/native-prune.d.ts.map +1 -0
- package/dist/hosting/validators/native-prune.js +40 -0
- package/dist/hosting/validators/native-prune.js.map +1 -0
- package/dist/hosting/validators/ports.d.ts +7 -0
- package/dist/hosting/validators/ports.d.ts.map +1 -0
- package/dist/hosting/validators/ports.js +75 -0
- package/dist/hosting/validators/ports.js.map +1 -0
- package/dist/hosting/validators/registry.d.ts +22 -0
- package/dist/hosting/validators/registry.d.ts.map +1 -0
- package/dist/hosting/validators/registry.js +311 -0
- package/dist/hosting/validators/registry.js.map +1 -0
- package/dist/hosting/validators/releases.d.ts +30 -0
- package/dist/hosting/validators/releases.d.ts.map +1 -0
- package/dist/hosting/validators/releases.js +149 -0
- package/dist/hosting/validators/releases.js.map +1 -0
- package/dist/hosting/validators/settings.d.ts +4 -0
- package/dist/hosting/validators/settings.d.ts.map +1 -0
- package/dist/hosting/validators/settings.js +28 -0
- package/dist/hosting/validators/settings.js.map +1 -0
- package/dist/hosting/validators/snapshots.d.ts +40 -0
- package/dist/hosting/validators/snapshots.d.ts.map +1 -0
- package/dist/hosting/validators/snapshots.js +221 -0
- package/dist/hosting/validators/snapshots.js.map +1 -0
- package/dist/hosting/validators/store.d.ts +29 -0
- package/dist/hosting/validators/store.d.ts.map +1 -0
- package/dist/hosting/validators/store.js +186 -0
- package/dist/hosting/validators/store.js.map +1 -0
- package/dist/hosting/validators/upgrade.d.ts +35 -0
- package/dist/hosting/validators/upgrade.d.ts.map +1 -0
- package/dist/hosting/validators/upgrade.js +251 -0
- package/dist/hosting/validators/upgrade.js.map +1 -0
- package/dist/hosting/validators/versions.d.ts +9 -0
- package/dist/hosting/validators/versions.d.ts.map +1 -0
- package/dist/hosting/validators/versions.js +20 -0
- package/dist/hosting/validators/versions.js.map +1 -0
- package/dist/hosting/version-discovery.d.ts.map +1 -1
- package/dist/hosting/version-discovery.js +15 -6
- package/dist/hosting/version-discovery.js.map +1 -1
- package/dist/hosting/vnc/client-profiles.d.ts.map +1 -1
- package/dist/hosting/vnc/client-profiles.js +12 -6
- package/dist/hosting/vnc/client-profiles.js.map +1 -1
- package/dist/hosting/vnc/passwd.d.ts.map +1 -1
- package/dist/hosting/vnc/passwd.js +14 -3
- package/dist/hosting/vnc/passwd.js.map +1 -1
- package/dist/hosting/vnc/server-session.d.ts.map +1 -1
- package/dist/hosting/vnc/server-session.js +5 -0
- package/dist/hosting/vnc/server-session.js.map +1 -1
- package/dist/hosting/vnc/service.d.ts +1 -0
- package/dist/hosting/vnc/service.d.ts.map +1 -1
- package/dist/hosting/vnc/service.js +48 -9
- package/dist/hosting/vnc/service.js.map +1 -1
- package/dist/hosting/vnc/types.d.ts +5 -0
- package/dist/hosting/vnc/types.d.ts.map +1 -1
- package/dist/hosting/vnc/types.js +22 -0
- package/dist/hosting/vnc/types.js.map +1 -1
- package/dist/hosting/vpn/client-conf-protect.d.ts +5 -0
- package/dist/hosting/vpn/client-conf-protect.d.ts.map +1 -1
- package/dist/hosting/vpn/client-conf-protect.js +15 -0
- package/dist/hosting/vpn/client-conf-protect.js.map +1 -1
- package/dist/hosting/vpn/openvpn-ops.d.ts.map +1 -1
- package/dist/hosting/vpn/openvpn-ops.js +13 -3
- package/dist/hosting/vpn/openvpn-ops.js.map +1 -1
- package/dist/hosting/vpn/outline-ops.d.ts.map +1 -1
- package/dist/hosting/vpn/outline-ops.js +7 -3
- package/dist/hosting/vpn/outline-ops.js.map +1 -1
- package/dist/hosting/vpn/ports.d.ts +3 -0
- package/dist/hosting/vpn/ports.d.ts.map +1 -1
- package/dist/hosting/vpn/ports.js +8 -0
- package/dist/hosting/vpn/ports.js.map +1 -1
- package/dist/hosting/vpn/service.d.ts +11 -0
- package/dist/hosting/vpn/service.d.ts.map +1 -1
- package/dist/hosting/vpn/service.js +102 -27
- package/dist/hosting/vpn/service.js.map +1 -1
- package/dist/hosting/web-stats.d.ts.map +1 -1
- package/dist/hosting/web-stats.js +0 -1
- package/dist/hosting/web-stats.js.map +1 -1
- package/dist/hosting/wizard.d.ts.map +1 -1
- package/dist/hosting/wizard.js +53 -63
- package/dist/hosting/wizard.js.map +1 -1
- package/dist/llm/http-transport.d.ts.map +1 -1
- package/dist/llm/http-transport.js +11 -3
- package/dist/llm/http-transport.js.map +1 -1
- package/dist/monitoring/notifications.d.ts.map +1 -1
- package/dist/monitoring/notifications.js +86 -0
- package/dist/monitoring/notifications.js.map +1 -1
- package/dist/monitoring/process-snapshot.d.ts +2 -0
- package/dist/monitoring/process-snapshot.d.ts.map +1 -1
- package/dist/monitoring/process-snapshot.js +14 -2
- package/dist/monitoring/process-snapshot.js.map +1 -1
- package/dist/net/ssrf.d.ts +6 -0
- package/dist/net/ssrf.d.ts.map +1 -1
- package/dist/net/ssrf.js +80 -15
- package/dist/net/ssrf.js.map +1 -1
- package/dist/repositories/project-repo.d.ts +1 -1
- package/dist/repositories/project-repo.d.ts.map +1 -1
- package/dist/repositories/project-repo.js +12 -0
- package/dist/repositories/project-repo.js.map +1 -1
- package/dist/repositories/settings-repo.d.ts.map +1 -1
- package/dist/repositories/settings-repo.js +6 -1
- package/dist/repositories/settings-repo.js.map +1 -1
- package/dist/security/mfa/rate-limit.d.ts +11 -0
- package/dist/security/mfa/rate-limit.d.ts.map +1 -1
- package/dist/security/mfa/rate-limit.js +18 -0
- package/dist/security/mfa/rate-limit.js.map +1 -1
- package/dist/security/mfa/webauthn.d.ts +5 -0
- package/dist/security/mfa/webauthn.d.ts.map +1 -1
- package/dist/security/mfa/webauthn.js +13 -4
- package/dist/security/mfa/webauthn.js.map +1 -1
- package/dist/security/ssh-identity/install.d.ts.map +1 -1
- package/dist/security/ssh-identity/install.js +12 -0
- package/dist/security/ssh-identity/install.js.map +1 -1
- package/dist/security/ssh-identity/ops.d.ts +16 -0
- package/dist/security/ssh-identity/ops.d.ts.map +1 -1
- package/dist/security/ssh-identity/ops.js +73 -3
- package/dist/security/ssh-identity/ops.js.map +1 -1
- package/dist/services/auth.d.ts +9 -0
- package/dist/services/auth.d.ts.map +1 -1
- package/dist/services/auth.js +27 -9
- package/dist/services/auth.js.map +1 -1
- package/dist/services/protection-probe.d.ts.map +1 -1
- package/dist/services/protection-probe.js +7 -5
- package/dist/services/protection-probe.js.map +1 -1
- package/dist/services/scheduler.d.ts +5 -0
- package/dist/services/scheduler.d.ts.map +1 -1
- package/dist/services/scheduler.js +11 -0
- package/dist/services/scheduler.js.map +1 -1
- package/dist/services/users-admin.d.ts +1 -0
- package/dist/services/users-admin.d.ts.map +1 -1
- package/dist/services/users-admin.js +42 -4
- package/dist/services/users-admin.js.map +1 -1
- package/dist/update/index.d.ts +2 -0
- package/dist/update/index.d.ts.map +1 -1
- package/dist/update/index.js +2 -0
- package/dist/update/index.js.map +1 -1
- package/dist/update/inventory.d.ts +2 -0
- package/dist/update/inventory.d.ts.map +1 -1
- package/dist/update/inventory.js +13 -5
- package/dist/update/inventory.js.map +1 -1
- package/dist/update/self-update-apply.d.ts +51 -0
- package/dist/update/self-update-apply.d.ts.map +1 -1
- package/dist/update/self-update-apply.js +246 -63
- package/dist/update/self-update-apply.js.map +1 -1
- package/dist/update/self-update-overlay.d.ts +49 -0
- package/dist/update/self-update-overlay.d.ts.map +1 -0
- package/dist/update/self-update-overlay.js +343 -0
- package/dist/update/self-update-overlay.js.map +1 -0
- package/dist/update/update-hub.d.ts +45 -0
- package/dist/update/update-hub.d.ts.map +1 -0
- package/dist/update/update-hub.js +217 -0
- package/dist/update/update-hub.js.map +1 -0
- package/package.json +2 -4
|
@@ -0,0 +1,681 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Docker engine manager — inventory + honesty-gated mutations via HostExecutor.
|
|
3
|
+
*/
|
|
4
|
+
import { existsSync, readdirSync } from 'node:fs';
|
|
5
|
+
import { join } from 'node:path';
|
|
6
|
+
import { isSafeDockerImageRef, isSafeDockerName, isSafeVolumeDest, isDockerPruneScope, isDockerRestartPolicy, tl, validatorIdFromComposeProject, } from 'ysk-server-shared';
|
|
7
|
+
import { runOpts } from '../ops-log.js';
|
|
8
|
+
import { classifyDockerArgv } from './argv.js';
|
|
9
|
+
import { applyDaemonPatch, readDaemonSettings, writeDaemonSettings, } from './daemon.js';
|
|
10
|
+
import { appliedDockerOp, blockedDockerOp, failedDockerOp, writtenDockerOp, } from './honesty.js';
|
|
11
|
+
import { parseComposeLs, parseContainers, parseDockerInfo, parseImages, parseNetworks, parseSystemDf, parseVolumes, } from './parse.js';
|
|
12
|
+
import { composeFilePath, composeProjectName } from '../validators/compose-runner.js';
|
|
13
|
+
import { listValidatorInstances } from '../validators/store.js';
|
|
14
|
+
async function docker(host, argv, opts) {
|
|
15
|
+
const cls = classifyDockerArgv(['docker', ...argv]);
|
|
16
|
+
if (cls === 'blocked') {
|
|
17
|
+
return { exitCode: 2, stdout: '', stderr: 'blocked docker argv', argv: ['docker', ...argv] };
|
|
18
|
+
}
|
|
19
|
+
try {
|
|
20
|
+
const r = await host.runCommand(['docker', ...argv], {
|
|
21
|
+
...runOpts({
|
|
22
|
+
execute: opts?.dryRun === true ? false : true,
|
|
23
|
+
timeoutMs: opts?.timeoutMs ?? 30_000,
|
|
24
|
+
onLog: opts?.onLog,
|
|
25
|
+
signal: opts?.signal,
|
|
26
|
+
}),
|
|
27
|
+
dryRun: opts?.dryRun,
|
|
28
|
+
});
|
|
29
|
+
return { exitCode: r.exitCode, stdout: r.stdout, stderr: r.stderr, argv: ['docker', ...argv] };
|
|
30
|
+
}
|
|
31
|
+
catch (e) {
|
|
32
|
+
return {
|
|
33
|
+
exitCode: 1,
|
|
34
|
+
stdout: '',
|
|
35
|
+
stderr: e instanceof Error ? e.message : 'docker command failed',
|
|
36
|
+
argv: ['docker', ...argv],
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
export async function probeDockerEngine(host) {
|
|
41
|
+
const notes = [];
|
|
42
|
+
let version = null;
|
|
43
|
+
let composeVersion = null;
|
|
44
|
+
let installed = false;
|
|
45
|
+
let daemonActive = false;
|
|
46
|
+
let composeAvailable = false;
|
|
47
|
+
try {
|
|
48
|
+
const ver = await docker(host, ['version', '--format', '{{.Client.Version}}'], { timeoutMs: 4_000 });
|
|
49
|
+
if (ver.exitCode === 0 && ver.stdout.trim()) {
|
|
50
|
+
installed = true;
|
|
51
|
+
version = ver.stdout.trim().split('\n')[0] ?? null;
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
notes.push(ver.stderr.trim() || tl('docker.errors.notInstalled'));
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
catch (e) {
|
|
58
|
+
notes.push(e instanceof Error ? e.message : tl('docker.errors.notInstalled'));
|
|
59
|
+
}
|
|
60
|
+
if (installed) {
|
|
61
|
+
try {
|
|
62
|
+
const info = await docker(host, ['info', '--format', '{{.ServerVersion}}'], { timeoutMs: 8_000 });
|
|
63
|
+
daemonActive = info.exitCode === 0 && Boolean(info.stdout.trim());
|
|
64
|
+
if (!daemonActive)
|
|
65
|
+
notes.push(tl('docker.errors.daemonDown'));
|
|
66
|
+
}
|
|
67
|
+
catch {
|
|
68
|
+
notes.push(tl('docker.errors.daemonDown'));
|
|
69
|
+
}
|
|
70
|
+
try {
|
|
71
|
+
const cv = await docker(host, ['compose', 'version'], { timeoutMs: 8_000 });
|
|
72
|
+
composeAvailable = cv.exitCode === 0;
|
|
73
|
+
composeVersion = composeAvailable ? cv.stdout.trim().split('\n')[0] ?? null : null;
|
|
74
|
+
if (!composeAvailable)
|
|
75
|
+
notes.push(tl('docker.errors.needCompose'));
|
|
76
|
+
}
|
|
77
|
+
catch {
|
|
78
|
+
notes.push(tl('docker.errors.needCompose'));
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return { installed, daemonActive, composeAvailable, version, composeVersion, notes };
|
|
82
|
+
}
|
|
83
|
+
function scanValidatorCompose(dataDir) {
|
|
84
|
+
const root = join(dataDir, 'validators');
|
|
85
|
+
if (!existsSync(root))
|
|
86
|
+
return [];
|
|
87
|
+
const out = [];
|
|
88
|
+
for (const inst of listValidatorInstances(dataDir)) {
|
|
89
|
+
const file = composeFilePath(join(root, inst.id));
|
|
90
|
+
out.push({
|
|
91
|
+
name: composeProjectName(inst.id),
|
|
92
|
+
status: existsSync(file) ? 'configured' : 'missing',
|
|
93
|
+
configFiles: existsSync(file) ? file : '',
|
|
94
|
+
yskManaged: true,
|
|
95
|
+
validatorId: inst.id,
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
try {
|
|
99
|
+
for (const name of readdirSync(root)) {
|
|
100
|
+
const file = composeFilePath(join(root, name));
|
|
101
|
+
if (!existsSync(file))
|
|
102
|
+
continue;
|
|
103
|
+
if (out.some((p) => p.validatorId === name))
|
|
104
|
+
continue;
|
|
105
|
+
out.push({
|
|
106
|
+
name: composeProjectName(name),
|
|
107
|
+
status: 'configured',
|
|
108
|
+
configFiles: file,
|
|
109
|
+
yskManaged: true,
|
|
110
|
+
validatorId: name,
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
catch {
|
|
115
|
+
/* ignore */
|
|
116
|
+
}
|
|
117
|
+
return out;
|
|
118
|
+
}
|
|
119
|
+
export async function dockerEngineStatus(input) {
|
|
120
|
+
const probe = await probeDockerEngine(input.host);
|
|
121
|
+
const validatorProjects = listValidatorInstances(input.dataDir).length;
|
|
122
|
+
const empty = {
|
|
123
|
+
...probe,
|
|
124
|
+
dataRoot: null,
|
|
125
|
+
rootless: false,
|
|
126
|
+
cgroupDriver: null,
|
|
127
|
+
counts: { containers: 0, running: 0, images: 0, volumes: 0, networks: 0 },
|
|
128
|
+
disk: { dataRoot: null, usedBytes: null, availBytes: null, usePct: null },
|
|
129
|
+
validatorProjects,
|
|
130
|
+
};
|
|
131
|
+
if (!probe.installed || !probe.daemonActive)
|
|
132
|
+
return empty;
|
|
133
|
+
try {
|
|
134
|
+
const infoRaw = await docker(input.host, ['info', '--format', '{{json .}}'], { timeoutMs: 12_000 });
|
|
135
|
+
const info = parseDockerInfo(infoRaw.stdout);
|
|
136
|
+
const vols = await listDockerVolumes({ host: input.host });
|
|
137
|
+
const nets = await listDockerNetworks({ host: input.host });
|
|
138
|
+
let disk = { dataRoot: info.dataRoot, usedBytes: null, availBytes: null, usePct: null };
|
|
139
|
+
if (info.dataRoot) {
|
|
140
|
+
try {
|
|
141
|
+
const { parseDfBytes, pickMountForPath } = await import('../validators/disk.js');
|
|
142
|
+
const df = await input.host.runCommand(['df', '-B1', '-T', info.dataRoot], { timeoutMs: 8_000 });
|
|
143
|
+
const mount = pickMountForPath(parseDfBytes(df.stdout), info.dataRoot);
|
|
144
|
+
if (mount) {
|
|
145
|
+
disk = {
|
|
146
|
+
dataRoot: info.dataRoot,
|
|
147
|
+
usedBytes: mount.usedBytes,
|
|
148
|
+
availBytes: mount.availBytes,
|
|
149
|
+
usePct: mount.usePct,
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
catch {
|
|
154
|
+
/* leave nulls */
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
return {
|
|
158
|
+
...probe,
|
|
159
|
+
version: info.version ?? probe.version,
|
|
160
|
+
dataRoot: info.dataRoot,
|
|
161
|
+
rootless: info.rootless,
|
|
162
|
+
cgroupDriver: info.cgroupDriver,
|
|
163
|
+
counts: {
|
|
164
|
+
containers: info.containers,
|
|
165
|
+
running: info.running,
|
|
166
|
+
images: info.images,
|
|
167
|
+
volumes: vols.length,
|
|
168
|
+
networks: nets.length,
|
|
169
|
+
},
|
|
170
|
+
disk,
|
|
171
|
+
validatorProjects,
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
catch (e) {
|
|
175
|
+
return {
|
|
176
|
+
...empty,
|
|
177
|
+
notes: [...probe.notes, e instanceof Error ? e.message : 'docker info failed'],
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
export async function listDockerContainers(input) {
|
|
182
|
+
const argv = ['ps', '--format', '{{json .}}'];
|
|
183
|
+
if (input.all !== false)
|
|
184
|
+
argv.splice(1, 0, '-a');
|
|
185
|
+
const r = await docker(input.host, argv);
|
|
186
|
+
if (r.exitCode !== 0)
|
|
187
|
+
return [];
|
|
188
|
+
return parseContainers(r.stdout);
|
|
189
|
+
}
|
|
190
|
+
export async function listDockerImages(host) {
|
|
191
|
+
const r = await docker(host, ['images', '--format', '{{json .}}']);
|
|
192
|
+
return r.exitCode === 0 ? parseImages(r.stdout) : [];
|
|
193
|
+
}
|
|
194
|
+
export async function listDockerVolumes(input) {
|
|
195
|
+
const r = await docker(input.host, ['volume', 'ls', '--format', '{{json .}}']);
|
|
196
|
+
return r.exitCode === 0 ? parseVolumes(r.stdout) : [];
|
|
197
|
+
}
|
|
198
|
+
export async function listDockerNetworks(input) {
|
|
199
|
+
const r = await docker(input.host, ['network', 'ls', '--format', '{{json .}}']);
|
|
200
|
+
return r.exitCode === 0 ? parseNetworks(r.stdout) : [];
|
|
201
|
+
}
|
|
202
|
+
export async function listDockerComposeProjects(input) {
|
|
203
|
+
const fromDisk = scanValidatorCompose(input.dataDir);
|
|
204
|
+
const r = await docker(input.host, ['compose', 'ls', '--format', 'json']);
|
|
205
|
+
const live = r.exitCode === 0 ? parseComposeLs(r.stdout) : [];
|
|
206
|
+
const byName = new Map();
|
|
207
|
+
for (const p of fromDisk)
|
|
208
|
+
byName.set(p.name, p);
|
|
209
|
+
for (const p of live) {
|
|
210
|
+
const prev = byName.get(p.name);
|
|
211
|
+
byName.set(p.name, {
|
|
212
|
+
...p,
|
|
213
|
+
yskManaged: p.yskManaged || Boolean(prev?.yskManaged),
|
|
214
|
+
validatorId: p.validatorId ?? prev?.validatorId ?? validatorIdFromComposeProject(p.name),
|
|
215
|
+
configFiles: p.configFiles || prev?.configFiles || '',
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
return [...byName.values()].sort((a, b) => a.name.localeCompare(b.name));
|
|
219
|
+
}
|
|
220
|
+
export async function dockerContainerLogs(input) {
|
|
221
|
+
const id = String(input.id ?? '').trim();
|
|
222
|
+
if (!isSafeDockerName(id) && !/^[a-f0-9]{6,64}$/i.test(id)) {
|
|
223
|
+
return { lines: [], notes: [tl('docker.errors.badName')] };
|
|
224
|
+
}
|
|
225
|
+
const tail = Math.min(500, Math.max(20, input.tail ?? 200));
|
|
226
|
+
const r = await docker(input.host, ['logs', '--tail', String(tail), id], { timeoutMs: 20_000 });
|
|
227
|
+
const text = `${r.stdout}\n${r.stderr}`.trim();
|
|
228
|
+
return {
|
|
229
|
+
lines: text ? text.split('\n') : [],
|
|
230
|
+
notes: r.exitCode === 0 ? [] : [r.stderr.trim() || tl('docker.errors.logsFailed')],
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
export function inferExecBin(image) {
|
|
234
|
+
const s = String(image ?? '').toLowerCase();
|
|
235
|
+
if (s.includes('client-go') || /\/geth(?::|$)/.test(s) || s.includes('ethereum/client-go'))
|
|
236
|
+
return 'geth';
|
|
237
|
+
if (s.includes('reth'))
|
|
238
|
+
return 'reth';
|
|
239
|
+
if (s.includes('nethermind'))
|
|
240
|
+
return 'nethermind';
|
|
241
|
+
if (s.includes('lighthouse'))
|
|
242
|
+
return 'lighthouse';
|
|
243
|
+
if (s.includes('prysm'))
|
|
244
|
+
return 'beacon-chain';
|
|
245
|
+
if (s.includes('teku'))
|
|
246
|
+
return 'teku';
|
|
247
|
+
if (s.includes('nimbus'))
|
|
248
|
+
return 'nimbus_beacon_node';
|
|
249
|
+
if (s.includes('avalanche'))
|
|
250
|
+
return 'avalanchego';
|
|
251
|
+
if (s.includes('near'))
|
|
252
|
+
return 'neard';
|
|
253
|
+
if (s.includes('cardano'))
|
|
254
|
+
return 'cardano-node';
|
|
255
|
+
if (s.includes('bitcoin'))
|
|
256
|
+
return 'bitcoin-cli';
|
|
257
|
+
if (s.includes('gaia') || s.includes('cosmos'))
|
|
258
|
+
return 'gaiad';
|
|
259
|
+
if (s.includes('sui'))
|
|
260
|
+
return 'sui';
|
|
261
|
+
if (s.includes('aptos'))
|
|
262
|
+
return 'aptos';
|
|
263
|
+
if (s.includes('agave') || s.includes('solana'))
|
|
264
|
+
return 'solana';
|
|
265
|
+
if (s.includes('polkadot'))
|
|
266
|
+
return 'polkadot';
|
|
267
|
+
if (s.includes('alpine') || s.includes('busybox'))
|
|
268
|
+
return 'busybox';
|
|
269
|
+
return null;
|
|
270
|
+
}
|
|
271
|
+
export function buildDockerExecArgv(input) {
|
|
272
|
+
const id = String(input.id ?? '').trim();
|
|
273
|
+
if (!isSafeDockerName(id) && !/^[a-f0-9]{6,64}$/i.test(id)) {
|
|
274
|
+
return { ok: false, notes: [tl('docker.errors.badName')] };
|
|
275
|
+
}
|
|
276
|
+
const bin = (input.bin?.trim() || inferExecBin(input.image ?? '') || '').trim();
|
|
277
|
+
if (!bin)
|
|
278
|
+
return { ok: false, notes: [tl('docker.errors.badExec')] };
|
|
279
|
+
const tail = input.preset === 'hostname'
|
|
280
|
+
? bin === 'busybox'
|
|
281
|
+
? ['busybox', 'hostname']
|
|
282
|
+
: ['hostname']
|
|
283
|
+
: input.preset === 'help'
|
|
284
|
+
? [bin, '--help']
|
|
285
|
+
: bin === 'geth'
|
|
286
|
+
? ['geth', 'version']
|
|
287
|
+
: [bin, '--version'];
|
|
288
|
+
const argv = ['exec', id, ...tail];
|
|
289
|
+
if (classifyDockerArgv(['docker', ...argv]) === 'blocked') {
|
|
290
|
+
return { ok: false, notes: [tl('docker.errors.badExec')] };
|
|
291
|
+
}
|
|
292
|
+
return { ok: true, argv };
|
|
293
|
+
}
|
|
294
|
+
export async function dockerExec(input) {
|
|
295
|
+
const probe = await probeDockerEngine(input.host);
|
|
296
|
+
const missing = needDocker(probe);
|
|
297
|
+
if (missing)
|
|
298
|
+
return missing;
|
|
299
|
+
let image = '';
|
|
300
|
+
const ins = await inspectDocker({ host: input.host, id: input.id });
|
|
301
|
+
if (ins.ok && ins.raw && typeof ins.raw === 'object') {
|
|
302
|
+
const arr = Array.isArray(ins.raw) ? ins.raw : [ins.raw];
|
|
303
|
+
const cfg = arr[0];
|
|
304
|
+
image = String(cfg?.Config?.Image ?? cfg?.Image ?? '');
|
|
305
|
+
}
|
|
306
|
+
const built = buildDockerExecArgv({
|
|
307
|
+
id: input.id,
|
|
308
|
+
preset: input.preset ?? 'version',
|
|
309
|
+
bin: input.bin,
|
|
310
|
+
image,
|
|
311
|
+
});
|
|
312
|
+
if (!built.ok)
|
|
313
|
+
return blockedDockerOp({ reason: 'validation', notes: built.notes });
|
|
314
|
+
if (!input.execute || !input.host.executeEnabled()) {
|
|
315
|
+
return writtenDockerOp({ notes: [tl('docker.notes.dryMutate'), built.argv.join(' ')] });
|
|
316
|
+
}
|
|
317
|
+
const r = await docker(input.host, built.argv, {
|
|
318
|
+
timeoutMs: 30_000,
|
|
319
|
+
onLog: input.onLog,
|
|
320
|
+
signal: input.signal,
|
|
321
|
+
});
|
|
322
|
+
if (r.exitCode !== 0) {
|
|
323
|
+
return failedDockerOp({ notes: [r.stderr.trim() || tl('docker.errors.mutateFailed'), r.stdout.trim()] });
|
|
324
|
+
}
|
|
325
|
+
return appliedDockerOp({
|
|
326
|
+
notes: [tl('docker.notes.exec'), r.stdout.trim() || r.stderr.trim()].filter(Boolean),
|
|
327
|
+
});
|
|
328
|
+
}
|
|
329
|
+
export async function inspectDocker(input) {
|
|
330
|
+
const id = String(input.id ?? '').trim();
|
|
331
|
+
if (!id)
|
|
332
|
+
return { ok: false, raw: null, notes: [tl('docker.errors.badName')] };
|
|
333
|
+
const r = await docker(input.host, ['inspect', id]);
|
|
334
|
+
if (r.exitCode !== 0)
|
|
335
|
+
return { ok: false, raw: null, notes: [r.stderr.trim() || 'inspect failed'] };
|
|
336
|
+
try {
|
|
337
|
+
return { ok: true, raw: JSON.parse(r.stdout), notes: [] };
|
|
338
|
+
}
|
|
339
|
+
catch {
|
|
340
|
+
return { ok: true, raw: r.stdout, notes: [] };
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
export async function dockerSystemDf(host) {
|
|
344
|
+
const r = await docker(host, ['system', 'df']);
|
|
345
|
+
return parseSystemDf(r.stdout);
|
|
346
|
+
}
|
|
347
|
+
function needDocker(probe) {
|
|
348
|
+
if (!probe.installed) {
|
|
349
|
+
return blockedDockerOp({ reason: 'missing_binary', notes: [tl('docker.errors.notInstalled'), ...probe.notes] });
|
|
350
|
+
}
|
|
351
|
+
if (!probe.daemonActive) {
|
|
352
|
+
return blockedDockerOp({ reason: 'other', notes: [tl('docker.errors.daemonDown'), ...probe.notes] });
|
|
353
|
+
}
|
|
354
|
+
return null;
|
|
355
|
+
}
|
|
356
|
+
export async function dockerContainerAction(input) {
|
|
357
|
+
const id = String(input.id ?? '').trim();
|
|
358
|
+
if (!id)
|
|
359
|
+
return blockedDockerOp({ reason: 'validation', notes: [tl('docker.errors.badName')] });
|
|
360
|
+
const probe = await probeDockerEngine(input.host);
|
|
361
|
+
const missing = needDocker(probe);
|
|
362
|
+
if (missing)
|
|
363
|
+
return missing;
|
|
364
|
+
const argv = input.action === 'remove' ? ['rm', '-f', id] : [input.action, id];
|
|
365
|
+
if (!input.execute || !input.host.executeEnabled()) {
|
|
366
|
+
return writtenDockerOp({ notes: [tl('docker.notes.dryMutate'), argv.join(' ')] });
|
|
367
|
+
}
|
|
368
|
+
const r = await docker(input.host, argv, { timeoutMs: 60_000 });
|
|
369
|
+
if (r.exitCode !== 0) {
|
|
370
|
+
return failedDockerOp({ notes: [r.stderr.trim() || tl('docker.errors.mutateFailed')] });
|
|
371
|
+
}
|
|
372
|
+
return appliedDockerOp({ notes: [tl(`docker.notes.${input.action}`)] });
|
|
373
|
+
}
|
|
374
|
+
export function buildDockerRunArgv(req) {
|
|
375
|
+
if (!isSafeDockerImageRef(req.image)) {
|
|
376
|
+
return { ok: false, notes: [tl('docker.errors.badImage')] };
|
|
377
|
+
}
|
|
378
|
+
if (req.name && !isSafeDockerName(req.name)) {
|
|
379
|
+
return { ok: false, notes: [tl('docker.errors.badName')] };
|
|
380
|
+
}
|
|
381
|
+
const restart = req.restart ?? 'unless-stopped';
|
|
382
|
+
if (!isDockerRestartPolicy(restart)) {
|
|
383
|
+
return { ok: false, notes: [tl('docker.errors.badRestart')] };
|
|
384
|
+
}
|
|
385
|
+
const network = (req.network ?? 'bridge').trim() || 'bridge';
|
|
386
|
+
if (network === 'host' || !/^[a-zA-Z0-9][a-zA-Z0-9_.-]{0,64}$/.test(network)) {
|
|
387
|
+
return { ok: false, notes: [tl('docker.errors.badNetwork')] };
|
|
388
|
+
}
|
|
389
|
+
const argv = ['run', '-d', '--restart', restart, '--network', network];
|
|
390
|
+
if (req.name)
|
|
391
|
+
argv.push('--name', req.name);
|
|
392
|
+
argv.push('--label', 'com.ysk-server.managed=true', '--label', 'com.ysk-server.feature=docker-run');
|
|
393
|
+
for (const p of req.ports ?? []) {
|
|
394
|
+
const host = Number(p.host);
|
|
395
|
+
const cont = Number(p.container);
|
|
396
|
+
if (!Number.isInteger(host) || host < 1 || host > 65535) {
|
|
397
|
+
return { ok: false, notes: [tl('docker.errors.badPort')] };
|
|
398
|
+
}
|
|
399
|
+
if (!Number.isInteger(cont) || cont < 1 || cont > 65535) {
|
|
400
|
+
return { ok: false, notes: [tl('docker.errors.badPort')] };
|
|
401
|
+
}
|
|
402
|
+
const bind = (p.bind ?? '127.0.0.1').trim() || '127.0.0.1';
|
|
403
|
+
if (bind !== '127.0.0.1' && bind !== '0.0.0.0') {
|
|
404
|
+
return { ok: false, notes: [tl('docker.errors.badPort')] };
|
|
405
|
+
}
|
|
406
|
+
const proto = p.proto === 'udp' ? '/udp' : '';
|
|
407
|
+
argv.push('-p', `${bind}:${host}:${cont}${proto}`);
|
|
408
|
+
}
|
|
409
|
+
for (const [k, v] of Object.entries(req.env ?? {})) {
|
|
410
|
+
if (!/^[A-Za-z_][A-Za-z0-9_]*$/.test(k)) {
|
|
411
|
+
return { ok: false, notes: [tl('docker.errors.badEnv')] };
|
|
412
|
+
}
|
|
413
|
+
if (String(v).includes('\n')) {
|
|
414
|
+
return { ok: false, notes: [tl('docker.errors.badEnv')] };
|
|
415
|
+
}
|
|
416
|
+
argv.push('-e', `${k}=${v}`);
|
|
417
|
+
}
|
|
418
|
+
for (const vol of req.volumes ?? []) {
|
|
419
|
+
if (!isSafeDockerName(vol.name) || !isSafeVolumeDest(vol.dest)) {
|
|
420
|
+
return { ok: false, notes: [tl('docker.errors.badVolume')] };
|
|
421
|
+
}
|
|
422
|
+
argv.push('-v', `${vol.name}:${vol.dest}`);
|
|
423
|
+
}
|
|
424
|
+
argv.push(req.image);
|
|
425
|
+
return { ok: true, argv };
|
|
426
|
+
}
|
|
427
|
+
export async function dockerRun(input) {
|
|
428
|
+
const built = buildDockerRunArgv(input.req);
|
|
429
|
+
if (!built.ok)
|
|
430
|
+
return blockedDockerOp({ reason: 'validation', notes: built.notes });
|
|
431
|
+
const probe = await probeDockerEngine(input.host);
|
|
432
|
+
const missing = needDocker(probe);
|
|
433
|
+
if (missing)
|
|
434
|
+
return missing;
|
|
435
|
+
if (!input.execute || !input.host.executeEnabled()) {
|
|
436
|
+
return writtenDockerOp({ notes: [tl('docker.notes.dryMutate'), built.argv.join(' ')] });
|
|
437
|
+
}
|
|
438
|
+
const r = await docker(input.host, built.argv, { timeoutMs: 180_000 });
|
|
439
|
+
if (r.exitCode !== 0)
|
|
440
|
+
return failedDockerOp({ notes: [r.stderr.trim() || tl('docker.errors.mutateFailed')] });
|
|
441
|
+
return appliedDockerOp({ notes: [tl('docker.notes.ran'), r.stdout.trim()].filter(Boolean) });
|
|
442
|
+
}
|
|
443
|
+
export async function dockerPull(input) {
|
|
444
|
+
if (!isSafeDockerImageRef(input.image)) {
|
|
445
|
+
return blockedDockerOp({ reason: 'validation', notes: [tl('docker.errors.badImage')] });
|
|
446
|
+
}
|
|
447
|
+
const probe = await probeDockerEngine(input.host);
|
|
448
|
+
const missing = needDocker(probe);
|
|
449
|
+
if (missing)
|
|
450
|
+
return missing;
|
|
451
|
+
if (!input.execute || !input.host.executeEnabled()) {
|
|
452
|
+
return writtenDockerOp({ notes: [tl('docker.notes.dryMutate'), `docker pull ${input.image}`] });
|
|
453
|
+
}
|
|
454
|
+
const r = await docker(input.host, ['pull', input.image], {
|
|
455
|
+
timeoutMs: 600_000,
|
|
456
|
+
onLog: input.onLog,
|
|
457
|
+
signal: input.signal,
|
|
458
|
+
});
|
|
459
|
+
if (r.exitCode !== 0)
|
|
460
|
+
return failedDockerOp({ notes: [r.stderr.trim() || tl('docker.errors.mutateFailed')] });
|
|
461
|
+
return appliedDockerOp({ notes: [tl('docker.notes.pulled')] });
|
|
462
|
+
}
|
|
463
|
+
export async function dockerRemoveImage(input) {
|
|
464
|
+
const id = String(input.id ?? '').trim();
|
|
465
|
+
if (!id)
|
|
466
|
+
return blockedDockerOp({ reason: 'validation', notes: [tl('docker.errors.badImage')] });
|
|
467
|
+
const probe = await probeDockerEngine(input.host);
|
|
468
|
+
const missing = needDocker(probe);
|
|
469
|
+
if (missing)
|
|
470
|
+
return missing;
|
|
471
|
+
if (!input.execute || !input.host.executeEnabled()) {
|
|
472
|
+
return writtenDockerOp({ notes: [tl('docker.notes.dryMutate'), `docker rmi ${id}`] });
|
|
473
|
+
}
|
|
474
|
+
const r = await docker(input.host, ['rmi', id], { timeoutMs: 120_000 });
|
|
475
|
+
if (r.exitCode !== 0)
|
|
476
|
+
return failedDockerOp({ notes: [r.stderr.trim() || tl('docker.errors.mutateFailed')] });
|
|
477
|
+
return appliedDockerOp({ notes: [tl('docker.notes.imageRemoved')] });
|
|
478
|
+
}
|
|
479
|
+
export async function dockerCreateVolume(input) {
|
|
480
|
+
if (!isSafeDockerName(input.name)) {
|
|
481
|
+
return blockedDockerOp({ reason: 'validation', notes: [tl('docker.errors.badName')] });
|
|
482
|
+
}
|
|
483
|
+
const probe = await probeDockerEngine(input.host);
|
|
484
|
+
const missing = needDocker(probe);
|
|
485
|
+
if (missing)
|
|
486
|
+
return missing;
|
|
487
|
+
if (!input.execute || !input.host.executeEnabled()) {
|
|
488
|
+
return writtenDockerOp({ notes: [tl('docker.notes.dryMutate'), `docker volume create ${input.name}`] });
|
|
489
|
+
}
|
|
490
|
+
const r = await docker(input.host, ['volume', 'create', input.name]);
|
|
491
|
+
if (r.exitCode !== 0)
|
|
492
|
+
return failedDockerOp({ notes: [r.stderr.trim() || tl('docker.errors.mutateFailed')] });
|
|
493
|
+
return appliedDockerOp({ notes: [tl('docker.notes.volumeCreated')] });
|
|
494
|
+
}
|
|
495
|
+
export async function dockerRemoveVolume(input) {
|
|
496
|
+
if (!isSafeDockerName(input.name)) {
|
|
497
|
+
return blockedDockerOp({ reason: 'validation', notes: [tl('docker.errors.badName')] });
|
|
498
|
+
}
|
|
499
|
+
const probe = await probeDockerEngine(input.host);
|
|
500
|
+
const missing = needDocker(probe);
|
|
501
|
+
if (missing)
|
|
502
|
+
return missing;
|
|
503
|
+
if (!input.execute || !input.host.executeEnabled()) {
|
|
504
|
+
return writtenDockerOp({ notes: [tl('docker.notes.dryMutate'), `docker volume rm ${input.name}`] });
|
|
505
|
+
}
|
|
506
|
+
const r = await docker(input.host, ['volume', 'rm', input.name]);
|
|
507
|
+
if (r.exitCode !== 0)
|
|
508
|
+
return failedDockerOp({ notes: [r.stderr.trim() || tl('docker.errors.mutateFailed')] });
|
|
509
|
+
return appliedDockerOp({ notes: [tl('docker.notes.volumeRemoved')] });
|
|
510
|
+
}
|
|
511
|
+
export async function dockerCreateNetwork(input) {
|
|
512
|
+
if (!isSafeDockerName(input.name) || input.name === 'bridge' || input.name === 'host' || input.name === 'none') {
|
|
513
|
+
return blockedDockerOp({ reason: 'validation', notes: [tl('docker.errors.badNetwork')] });
|
|
514
|
+
}
|
|
515
|
+
const probe = await probeDockerEngine(input.host);
|
|
516
|
+
const missing = needDocker(probe);
|
|
517
|
+
if (missing)
|
|
518
|
+
return missing;
|
|
519
|
+
if (!input.execute || !input.host.executeEnabled()) {
|
|
520
|
+
return writtenDockerOp({ notes: [tl('docker.notes.dryMutate'), `docker network create ${input.name}`] });
|
|
521
|
+
}
|
|
522
|
+
const r = await docker(input.host, ['network', 'create', input.name]);
|
|
523
|
+
if (r.exitCode !== 0)
|
|
524
|
+
return failedDockerOp({ notes: [r.stderr.trim() || tl('docker.errors.mutateFailed')] });
|
|
525
|
+
return appliedDockerOp({ notes: [tl('docker.notes.networkCreated')] });
|
|
526
|
+
}
|
|
527
|
+
export async function dockerRemoveNetwork(input) {
|
|
528
|
+
const id = String(input.id ?? '').trim();
|
|
529
|
+
if (!id || id === 'bridge' || id === 'host' || id === 'none' || id === 'docker0') {
|
|
530
|
+
return blockedDockerOp({ reason: 'validation', notes: [tl('docker.errors.protectedNetwork')] });
|
|
531
|
+
}
|
|
532
|
+
const probe = await probeDockerEngine(input.host);
|
|
533
|
+
const missing = needDocker(probe);
|
|
534
|
+
if (missing)
|
|
535
|
+
return missing;
|
|
536
|
+
if (!input.execute || !input.host.executeEnabled()) {
|
|
537
|
+
return writtenDockerOp({ notes: [tl('docker.notes.dryMutate'), `docker network rm ${id}`] });
|
|
538
|
+
}
|
|
539
|
+
const r = await docker(input.host, ['network', 'rm', id]);
|
|
540
|
+
if (r.exitCode !== 0)
|
|
541
|
+
return failedDockerOp({ notes: [r.stderr.trim() || tl('docker.errors.mutateFailed')] });
|
|
542
|
+
return appliedDockerOp({ notes: [tl('docker.notes.networkRemoved')] });
|
|
543
|
+
}
|
|
544
|
+
function composeFileFor(dataDir, project) {
|
|
545
|
+
const fromName = validatorIdFromComposeProject(project);
|
|
546
|
+
if (fromName) {
|
|
547
|
+
const p = composeFilePath(join(dataDir, 'validators', fromName));
|
|
548
|
+
if (existsSync(p))
|
|
549
|
+
return p;
|
|
550
|
+
}
|
|
551
|
+
const direct = composeFilePath(join(dataDir, 'validators', project));
|
|
552
|
+
return existsSync(direct) ? direct : null;
|
|
553
|
+
}
|
|
554
|
+
export async function dockerComposeAction(input) {
|
|
555
|
+
const project = String(input.project ?? '').trim();
|
|
556
|
+
if (!isSafeDockerName(project)) {
|
|
557
|
+
return blockedDockerOp({ reason: 'validation', notes: [tl('docker.errors.badName')] });
|
|
558
|
+
}
|
|
559
|
+
const file = composeFileFor(input.dataDir, project);
|
|
560
|
+
if (!file) {
|
|
561
|
+
return blockedDockerOp({ reason: 'validation', notes: [tl('docker.errors.composeMissing')] });
|
|
562
|
+
}
|
|
563
|
+
const probe = await probeDockerEngine(input.host);
|
|
564
|
+
const missing = needDocker(probe);
|
|
565
|
+
if (missing)
|
|
566
|
+
return missing;
|
|
567
|
+
if (!probe.composeAvailable) {
|
|
568
|
+
return blockedDockerOp({ reason: 'missing_binary', notes: [tl('docker.errors.needCompose')] });
|
|
569
|
+
}
|
|
570
|
+
const argv = input.action === 'up'
|
|
571
|
+
? ['compose', '-f', file, '-p', project, 'up', '-d']
|
|
572
|
+
: input.action === 'down'
|
|
573
|
+
? ['compose', '-f', file, '-p', project, 'down']
|
|
574
|
+
: input.action === 'rm'
|
|
575
|
+
? ['compose', '-f', file, '-p', project, 'down', '--volumes', '--remove-orphans']
|
|
576
|
+
: ['compose', '-f', file, '-p', project, 'restart'];
|
|
577
|
+
if (!input.execute || !input.host.executeEnabled()) {
|
|
578
|
+
return writtenDockerOp({ notes: [tl('docker.notes.dryMutate'), argv.join(' ')] });
|
|
579
|
+
}
|
|
580
|
+
const r = await docker(input.host, argv, {
|
|
581
|
+
timeoutMs: 600_000,
|
|
582
|
+
onLog: input.onLog,
|
|
583
|
+
signal: input.signal,
|
|
584
|
+
});
|
|
585
|
+
if (r.exitCode !== 0)
|
|
586
|
+
return failedDockerOp({ notes: [r.stderr.trim() || tl('docker.errors.mutateFailed')] });
|
|
587
|
+
return appliedDockerOp({ notes: [tl(`docker.notes.compose.${input.action}`)] });
|
|
588
|
+
}
|
|
589
|
+
export async function dockerComposeLogs(input) {
|
|
590
|
+
const file = composeFileFor(input.dataDir, input.project);
|
|
591
|
+
if (!file)
|
|
592
|
+
return { lines: [], notes: [tl('docker.errors.composeMissing')] };
|
|
593
|
+
const tail = Math.min(500, Math.max(20, input.tail ?? 200));
|
|
594
|
+
const r = await docker(input.host, [
|
|
595
|
+
'compose',
|
|
596
|
+
'-f',
|
|
597
|
+
file,
|
|
598
|
+
'-p',
|
|
599
|
+
input.project,
|
|
600
|
+
'logs',
|
|
601
|
+
'--no-color',
|
|
602
|
+
'--tail',
|
|
603
|
+
String(tail),
|
|
604
|
+
]);
|
|
605
|
+
const text = `${r.stdout}\n${r.stderr}`.trim();
|
|
606
|
+
return { lines: text ? text.split('\n') : [], notes: r.exitCode === 0 ? [] : [r.stderr] };
|
|
607
|
+
}
|
|
608
|
+
export async function dockerPrune(input) {
|
|
609
|
+
if (!isDockerPruneScope(input.scope)) {
|
|
610
|
+
return blockedDockerOp({ reason: 'validation', notes: [tl('docker.errors.badPrune')] });
|
|
611
|
+
}
|
|
612
|
+
const scope = input.scope;
|
|
613
|
+
if ((scope === 'volumes' || scope === 'system') && input.confirm !== 'PRUNE') {
|
|
614
|
+
return blockedDockerOp({ reason: 'validation', notes: [tl('docker.errors.needPruneConfirm')] });
|
|
615
|
+
}
|
|
616
|
+
const probe = await probeDockerEngine(input.host);
|
|
617
|
+
const missing = needDocker(probe);
|
|
618
|
+
if (missing)
|
|
619
|
+
return missing;
|
|
620
|
+
const argv = scope === 'containers'
|
|
621
|
+
? ['container', 'prune', '-f']
|
|
622
|
+
: scope === 'images'
|
|
623
|
+
? ['image', 'prune', '-f']
|
|
624
|
+
: scope === 'volumes'
|
|
625
|
+
? ['volume', 'prune', '-f']
|
|
626
|
+
: scope === 'builder'
|
|
627
|
+
? ['builder', 'prune', '-f']
|
|
628
|
+
: ['system', 'prune', '-f'];
|
|
629
|
+
// builder prune is classified blocked at argv — map to image prune --filter dangling
|
|
630
|
+
const safeArgv = scope === 'builder' ? ['image', 'prune', '-f'] : argv;
|
|
631
|
+
if (!input.execute || !input.host.executeEnabled()) {
|
|
632
|
+
const df = await dockerSystemDf(input.host);
|
|
633
|
+
return writtenDockerOp({
|
|
634
|
+
notes: [
|
|
635
|
+
tl('docker.notes.dryPrune'),
|
|
636
|
+
safeArgv.join(' '),
|
|
637
|
+
...df.map((r) => `${r.type} ${r.size} reclaimable ${r.reclaimable}`),
|
|
638
|
+
],
|
|
639
|
+
});
|
|
640
|
+
}
|
|
641
|
+
const r = await docker(input.host, safeArgv, {
|
|
642
|
+
timeoutMs: 300_000,
|
|
643
|
+
onLog: input.onLog,
|
|
644
|
+
signal: input.signal,
|
|
645
|
+
});
|
|
646
|
+
if (r.exitCode !== 0)
|
|
647
|
+
return failedDockerOp({ notes: [r.stderr.trim() || tl('docker.errors.mutateFailed')] });
|
|
648
|
+
return appliedDockerOp({ notes: [tl('docker.notes.pruned'), r.stdout.trim()].filter(Boolean) });
|
|
649
|
+
}
|
|
650
|
+
export async function dockerEngineControl(input) {
|
|
651
|
+
if (!input.execute || !input.host.executeEnabled()) {
|
|
652
|
+
return writtenDockerOp({ notes: [tl('docker.notes.dryEngine'), `systemctl ${input.action} docker`] });
|
|
653
|
+
}
|
|
654
|
+
const r = await input.host.runCommand(['systemctl', input.action, 'docker'], { timeoutMs: 60_000 });
|
|
655
|
+
if (r.exitCode !== 0) {
|
|
656
|
+
return failedDockerOp({ notes: [r.stderr.trim() || tl('docker.errors.engineFailed')] });
|
|
657
|
+
}
|
|
658
|
+
return appliedDockerOp({ notes: [tl(`docker.notes.engine.${input.action}`)] });
|
|
659
|
+
}
|
|
660
|
+
export function getDockerDaemonSettings() {
|
|
661
|
+
return readDaemonSettings();
|
|
662
|
+
}
|
|
663
|
+
export async function patchDockerDaemon(input) {
|
|
664
|
+
const cur = readDaemonSettings();
|
|
665
|
+
const applied = applyDaemonPatch(cur.raw, input.patch);
|
|
666
|
+
if (!applied.ok)
|
|
667
|
+
return blockedDockerOp({ reason: 'validation', notes: applied.notes });
|
|
668
|
+
if (!input.execute || !input.host.executeEnabled()) {
|
|
669
|
+
return writtenDockerOp({ notes: [tl('docker.notes.dryDaemon')] });
|
|
670
|
+
}
|
|
671
|
+
const w = writeDaemonSettings({ next: applied.next, execute: true });
|
|
672
|
+
const restart = await input.host.runCommand(['systemctl', 'restart', 'docker'], { timeoutMs: 90_000 });
|
|
673
|
+
if (restart.exitCode !== 0) {
|
|
674
|
+
return failedDockerOp({
|
|
675
|
+
notes: [tl('docker.errors.engineFailed'), restart.stderr.trim()],
|
|
676
|
+
written: w.written,
|
|
677
|
+
});
|
|
678
|
+
}
|
|
679
|
+
return appliedDockerOp({ notes: [...w.notes, tl('docker.notes.engine.restart')], written: w.written });
|
|
680
|
+
}
|
|
681
|
+
//# sourceMappingURL=manager.js.map
|