@underpostnet/cyberia 3.2.90 → 3.3.73
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/.dockerignore +1 -0
- package/.env.example +16 -0
- package/.github/workflows/coverall.cyberia.ci.yml +107 -0
- package/.github/workflows/cyberia-client.cd.yml +6 -18
- package/.github/workflows/cyberia-server.cd.yml +6 -18
- package/.github/workflows/docker-image.cyberia-client.ci.yml +8 -5
- package/.github/workflows/docker-image.cyberia-client.dev.ci.yml +8 -3
- package/.github/workflows/docker-image.cyberia-server.ci.yml +8 -5
- package/.github/workflows/docker-image.cyberia-server.dev.ci.yml +8 -5
- package/.github/workflows/docker-image.engine-cyberia.ci.yml +15 -1
- package/.github/workflows/docker-image.engine-cyberia.dev.ci.yml +15 -1
- package/.github/workflows/engine-cyberia.cd.yml +6 -78
- package/.github/workflows/engine-cyberia.ci.yml +4 -5
- package/.github/workflows/ghpkg.ci.yml +42 -21
- package/.github/workflows/hardhat.ci.yml +12 -11
- package/.github/workflows/npmpkg.ci.yml +17 -15
- package/.github/workflows/pwa-microservices-template-page.cd.yml +1 -16
- package/.github/workflows/pwa-microservices-template-test.ci.yml +2 -2
- package/.github/workflows/release.cd.yml +2 -9
- package/.prettierignore +1 -0
- package/AGENTS.md +47 -0
- package/CHANGELOG.md +581 -2417
- package/CLI-HELP.md +416 -127
- package/Dockerfile +25 -9
- package/Dockerfile.dev +25 -9
- package/Dockerfile.test +4 -4
- package/README.md +21 -1
- package/bin/build.js +70 -43
- package/bin/build.template.js +8 -3
- package/bin/cyberia.js +372 -135
- package/bin/deploy.js +18 -104
- package/bin/index.js +372 -135
- package/compose.env +16 -0
- package/conf.js +93 -4
- package/deploy/cyberia-client/deploy.sh +47 -0
- package/deploy/cyberia-client/package.sh +18 -0
- package/deploy/cyberia-client/state.sh +14 -0
- package/deploy/cyberia-server/deploy.sh +47 -0
- package/deploy/cyberia-server/package.sh +18 -0
- package/deploy/cyberia-server/state.sh +14 -0
- package/deploy/dd-cyberia/deploy.sh +22 -0
- package/deploy/dd-cyberia/init.sh +55 -0
- package/deploy/dd-cyberia/package.sh +17 -0
- package/deploy/dd-cyberia/state.sh +14 -0
- package/deploy/dd-cyberia/sync-deploy.sh +116 -0
- package/deploy/lib/github-actions-logging.sh +594 -0
- package/deploy/lib/host.sh +185 -0
- package/deploy/lib/state.sh +62 -0
- package/deploy/pwa-microservices-template/deploy.sh +45 -0
- package/deploy/release/deploy.sh +32 -0
- package/deployment.yaml +7 -2
- package/docker-compose.yml +31 -37
- package/examples/static-page/README.md +19 -19
- package/examples/static-page/ssr-components/CustomPage.js +2 -2
- package/hardhat/hardhat.config.js +1 -6
- package/hardhat/package-lock.json +104 -43
- package/hardhat/package.json +3 -3
- package/manifests/alertmanager/deployment.yaml +81 -0
- package/manifests/blackbox-exporter/deployment.yaml +75 -0
- package/manifests/cronjobs/dd-cron/dd-cron-backup.yaml +36 -7
- package/manifests/cronjobs/dd-cron/dd-cron-vultr.yaml +77 -0
- package/manifests/deployment/dd-cyberia-development/deployment.yaml +7 -2
- package/manifests/deployment/dd-default-development/deployment.yaml +2 -2
- package/manifests/grafana/deployment.yaml +26 -7
- package/manifests/grafana/kustomization.yaml +1 -0
- package/manifests/grafana/service.yaml +6 -1
- package/manifests/mariadb/pv.yaml +1 -0
- package/manifests/mongodb/statefulset.yaml +9 -2
- package/manifests/mysql/pv-pvc.yaml +14 -1
- package/manifests/postgresql/pv.yaml +12 -1
- package/manifests/postgresql/pvc.yaml +1 -0
- package/manifests/prometheus/deployment.yaml +18 -22
- package/package.json +83 -10
- package/scripts/audit-selinux.sh +64 -0
- package/scripts/event-monitor.sh +56 -0
- package/scripts/gpu-diag.sh +0 -0
- package/scripts/ip-info.sh +0 -0
- package/scripts/k3s-node-setup.sh +30 -14
- package/scripts/kubeadm-node-setup.sh +40 -31
- package/scripts/lxd-vm-setup.sh +0 -0
- package/scripts/maas-nat-firewalld.sh +0 -0
- package/scripts/maas-setup.sh +8 -8
- package/scripts/nat-iptables.sh +2 -0
- package/scripts/rhel-grpc-setup.sh +0 -0
- package/scripts/rocky-kickstart.sh +25 -9
- package/scripts/selinux-normalize.sh +907 -0
- package/scripts/shutdown-machine.sh +843 -0
- package/scripts/test-monitor.sh +3 -3
- package/src/api/atlas-sprite-sheet/atlas-sprite-sheet.controller.js +1 -1
- package/src/api/atlas-sprite-sheet/atlas-sprite-sheet.router.js +2 -2
- package/src/api/atlas-sprite-sheet/atlas-sprite-sheet.service.js +2 -2
- package/src/api/core/core.controller.js +1 -1
- package/src/api/core/core.router.js +2 -2
- package/src/api/core/core.service.js +2 -2
- package/src/api/crypto/crypto.controller.js +1 -1
- package/src/api/crypto/crypto.service.js +1 -1
- package/src/api/cyberia-action/cyberia-action.controller.js +1 -1
- package/src/api/cyberia-action/cyberia-action.router.js +1 -1
- package/src/api/cyberia-action/cyberia-action.service.js +2 -2
- package/src/api/cyberia-client-hints/cyberia-client-hints.controller.js +1 -1
- package/src/api/cyberia-client-hints/cyberia-client-hints.router.js +1 -1
- package/src/api/cyberia-client-hints/cyberia-client-hints.service.js +2 -2
- package/src/api/cyberia-dialogue/cyberia-dialogue.controller.js +1 -1
- package/src/api/cyberia-dialogue/cyberia-dialogue.router.js +1 -1
- package/src/api/cyberia-dialogue/cyberia-dialogue.service.js +2 -2
- package/src/api/cyberia-entity/cyberia-entity.controller.js +1 -1
- package/src/api/cyberia-entity/cyberia-entity.router.js +1 -1
- package/src/api/cyberia-entity/cyberia-entity.service.js +2 -2
- package/src/api/cyberia-entity-type-default/cyberia-entity-type-default.controller.js +1 -1
- package/src/api/cyberia-entity-type-default/cyberia-entity-type-default.router.js +1 -1
- package/src/api/cyberia-entity-type-default/cyberia-entity-type-default.service.js +2 -2
- package/src/api/cyberia-instance/cyberia-fallback-capture.js +466 -0
- package/src/api/cyberia-instance/cyberia-fallback-default-items.js +63 -0
- package/src/api/cyberia-instance/cyberia-fallback-world.js +16 -1
- package/src/api/cyberia-instance/cyberia-instance-map.service.js +1 -1
- package/src/api/cyberia-instance/cyberia-instance.controller.js +4 -1
- package/src/api/cyberia-instance/cyberia-instance.router.js +15 -2
- package/src/api/cyberia-instance/cyberia-instance.service.js +45 -2
- package/src/api/cyberia-instance-conf/cyberia-instance-conf.controller.js +1 -1
- package/src/api/cyberia-instance-conf/cyberia-instance-conf.model.js +1 -0
- package/src/api/cyberia-instance-conf/cyberia-instance-conf.router.js +1 -1
- package/src/api/cyberia-instance-conf/cyberia-instance-conf.service.js +2 -2
- package/src/api/cyberia-map/cyberia-map.controller.js +1 -1
- package/src/api/cyberia-map/cyberia-map.router.js +1 -1
- package/src/api/cyberia-map/cyberia-map.service.js +2 -2
- package/src/api/cyberia-quest/cyberia-quest.controller.js +1 -1
- package/src/api/cyberia-quest/cyberia-quest.router.js +1 -1
- package/src/api/cyberia-quest/cyberia-quest.service.js +2 -2
- package/src/api/cyberia-quest-progress/cyberia-quest-progress.controller.js +1 -1
- package/src/api/cyberia-quest-progress/cyberia-quest-progress.router.js +1 -1
- package/src/api/cyberia-quest-progress/cyberia-quest-progress.service.js +2 -2
- package/src/api/cyberia-saga/cyberia-saga.controller.js +1 -1
- package/src/api/cyberia-saga/cyberia-saga.router.js +1 -1
- package/src/api/cyberia-saga/cyberia-saga.service.js +2 -2
- package/src/api/cyberia-server-defaults/cyberia-server-defaults.js +16 -29
- package/src/api/cyberia-skill/cyberia-skill.controller.js +1 -1
- package/src/api/cyberia-skill/cyberia-skill.router.js +1 -1
- package/src/api/cyberia-skill/cyberia-skill.service.js +2 -2
- package/src/api/default/default.controller.js +1 -1
- package/src/api/default/default.router.js +1 -1
- package/src/api/default/default.service.js +2 -2
- package/src/api/document/document.controller.js +1 -1
- package/src/api/document/document.router.js +1 -1
- package/src/api/document/document.service.js +2 -2
- package/src/api/file/file.controller.js +1 -1
- package/src/api/file/file.router.js +1 -1
- package/src/api/file/file.service.js +2 -2
- package/src/api/instance/instance.controller.js +1 -1
- package/src/api/instance/instance.router.js +1 -1
- package/src/api/instance/instance.service.js +2 -2
- package/src/api/ipfs/ipfs.controller.js +1 -1
- package/src/api/ipfs/ipfs.router.js +2 -2
- package/src/api/ipfs/ipfs.service.js +2 -2
- package/src/api/object-layer/object-layer.controller.js +1 -1
- package/src/api/object-layer/object-layer.model.js +204 -3
- package/src/api/object-layer/object-layer.router.js +2 -2
- package/src/api/object-layer/object-layer.service.js +4 -17
- package/src/api/object-layer-render-frames/object-layer-render-frames.controller.js +1 -1
- package/src/api/object-layer-render-frames/object-layer-render-frames.router.js +1 -1
- package/src/api/object-layer-render-frames/object-layer-render-frames.service.js +2 -2
- package/src/api/test/test.controller.js +1 -1
- package/src/api/test/test.service.js +1 -1
- package/src/api/user/guest.service.js +3 -3
- package/src/api/user/user.controller.js +1 -1
- package/src/api/user/user.router.js +2 -2
- package/src/api/user/user.service.js +4 -4
- package/src/api.js +5 -9
- package/src/cli/app.js +391 -0
- package/src/cli/baremetal.js +30 -36
- package/src/cli/client.js +306 -0
- package/src/cli/cloud-init.js +3 -3
- package/src/cli/cluster.js +242 -135
- package/src/cli/db.js +126 -67
- package/src/cli/deploy.js +158 -60
- package/src/cli/docker-compose.js +5 -5
- package/src/cli/domains.js +184 -0
- package/src/cli/dotenv-store.js +143 -0
- package/src/cli/event.js +2281 -0
- package/src/cli/fs.js +3 -3
- package/src/cli/host.js +672 -0
- package/src/cli/image.js +4 -7
- package/src/cli/index.js +426 -134
- package/src/cli/ipfs.js +34 -30
- package/src/cli/kickstart.js +1 -1
- package/src/cli/kubectl.js +218 -41
- package/src/cli/lxd.js +3 -3
- package/src/cli/monitor.js +1359 -26
- package/src/cli/package.js +90 -0
- package/src/cli/release.js +73 -34
- package/src/cli/repository.js +564 -367
- package/src/cli/run.js +362 -654
- package/src/cli/secrets.js +2158 -964
- package/src/cli/ssh.js +651 -331
- package/src/cli/state.js +394 -0
- package/src/cli/static.js +2 -2
- package/src/cli/system.js +26 -13
- package/src/cli/test.js +199 -125
- package/src/cli/vultr.js +623 -0
- package/src/cli/wireguard.js +2930 -0
- package/src/client/components/core/CalendarCore.js +53 -96
- package/src/client/components/core/Docs.js +258 -211
- package/src/client/components/core/FileExplorer.js +0 -21
- package/src/client/components/core/PanelForm.js +4 -4
- package/src/client/components/core/Repository.js +56 -0
- package/src/client/components/core/Translate.js +7 -0
- package/src/client/components/core/{FullScreen.js → ViewModeController.js} +42 -39
- package/src/client/components/core/Wallet.js +0 -11
- package/src/client/components/core/Worker.js +7 -1
- package/src/client/components/cryptokoyn/SettingsCryptokoyn.js +2 -2
- package/src/client/components/cyberia/FallbackWorldEngineCyberia.js +368 -0
- package/src/client/components/cyberia-portal/AppShellCyberiaPortal.js +35 -1
- package/src/client/components/cyberia-portal/RouterCyberiaPortal.js +4 -0
- package/src/client/components/cyberia-portal/SettingsCyberiaPortal.js +2 -2
- package/src/client/components/cyberia-portal/TranslateCyberiaPortal.js +4 -0
- package/src/client/components/default/AppShellDefault.js +1 -1
- package/src/client/components/default/SettingsDefault.js +2 -2
- package/src/client/components/itemledger/SettingsItemledger.js +2 -2
- package/src/client/components/underpost/AppShellUnderpost.js +3 -2
- package/src/client/components/underpost/SettingsUnderpost.js +2 -2
- package/src/client/public/cyberia-docs/ARCHITECTURE.md +17 -3
- package/src/client/public/cyberia-docs/CYBERIA-CLI.md +32 -5
- package/src/client/public/cyberia-docs/CYBERIA-SERVER.md +1 -1
- package/src/client/public/cyberia-docs/CYBERIA.md +21 -1
- package/src/client/public/cyberia-docs/HARDHAT-MODULE.md +23 -6
- package/src/client/public/cyberia-docs/ROADMAP.md +1 -1
- package/src/client/public/cyberia-docs/WHITE-PAPER.md +1 -1
- package/src/client/public/default/android-chrome-144x144.png +0 -0
- package/src/client/public/default/android-chrome-192x192.png +0 -0
- package/src/client/public/default/android-chrome-256x256.png +0 -0
- package/src/client/public/default/android-chrome-36x36.png +0 -0
- package/src/client/public/default/android-chrome-384x384.png +0 -0
- package/src/client/public/default/android-chrome-48x48.png +0 -0
- package/src/client/public/default/android-chrome-512x512.png +0 -0
- package/src/client/public/default/android-chrome-72x72.png +0 -0
- package/src/client/public/default/android-chrome-96x96.png +0 -0
- package/src/client/public/default/apple-touch-icon-1024x1024.png +0 -0
- package/src/client/public/default/apple-touch-icon-114x114.png +0 -0
- package/src/client/public/default/apple-touch-icon-120x120.png +0 -0
- package/src/client/public/default/apple-touch-icon-144x144.png +0 -0
- package/src/client/public/default/apple-touch-icon-152x152.png +0 -0
- package/src/client/public/default/apple-touch-icon-167x167.png +0 -0
- package/src/client/public/default/apple-touch-icon-180x180.png +0 -0
- package/src/client/public/default/apple-touch-icon-57x57.png +0 -0
- package/src/client/public/default/apple-touch-icon-60x60.png +0 -0
- package/src/client/public/default/apple-touch-icon-72x72.png +0 -0
- package/src/client/public/default/apple-touch-icon-76x76.png +0 -0
- package/src/client/public/default/apple-touch-icon-precomposed.png +0 -0
- package/src/client/public/default/apple-touch-icon.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-1125x2436.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-1136x640.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-1170x2532.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-1179x2556.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-1242x2208.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-1242x2688.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-1284x2778.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-1290x2796.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-1334x750.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-1488x2266.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-1536x2048.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-1620x2160.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-1640x2160.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-1668x2224.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-1668x2388.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-1792x828.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-2048x1536.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-2048x2732.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-2160x1620.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-2160x1640.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-2208x1242.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-2224x1668.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-2266x1488.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-2388x1668.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-2436x1125.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-2532x1170.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-2556x1179.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-2688x1242.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-2732x2048.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-2778x1284.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-2796x1290.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-640x1136.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-750x1334.png +0 -0
- package/src/client/public/default/apple-touch-startup-image-828x1792.png +0 -0
- package/src/client/public/default/assets/background/white.jpg +0 -0
- package/src/client/public/default/browserconfig.xml +1 -1
- package/src/client/public/default/favicon-16x16.png +0 -0
- package/src/client/public/default/favicon-32x32.png +0 -0
- package/src/client/public/default/favicon-48x48.png +0 -0
- package/src/client/public/default/favicon.ico +0 -0
- package/src/client/public/default/manifest.webmanifest +5 -5
- package/src/client/public/default/mstile-144x144.png +0 -0
- package/src/client/public/default/mstile-150x150.png +0 -0
- package/src/client/public/default/mstile-310x150.png +0 -0
- package/src/client/public/default/mstile-310x310.png +0 -0
- package/src/client/public/default/mstile-70x70.png +0 -0
- package/src/client/public/default/yandex-browser-50x50.png +0 -0
- package/src/client/public/default/yandex-browser-manifest.json +1 -1
- package/src/client/services/cyberia-instance/cyberia-instance.service.js +40 -0
- package/src/client/services/object-layer/object-layer.management.js +4 -4
- package/src/client/ssr/RootDocument.js +1 -1
- package/src/client/ssr/body/404.js +1 -1
- package/src/client/ssr/body/500.js +1 -1
- package/src/client/ssr/body/CacheControl.js +1 -1
- package/src/client/ssr/body/CyberiaDefaultSplashScreen.js +1 -1
- package/src/client/ssr/body/DefaultSplashScreen.js +1 -1
- package/src/client/ssr/body/SwaggerDarkMode.js +1 -1
- package/src/client/ssr/body/UnderpostDefaultSplashScreen.js +1 -1
- package/src/client/ssr/head/CryptokoynScripts.js +1 -1
- package/src/client/ssr/head/Css.js +1 -1
- package/src/client/ssr/head/CyberiaPortalScripts.js +1 -1
- package/src/client/ssr/head/DefaultScripts.js +1 -1
- package/src/client/ssr/head/ItemledgerScripts.js +1 -1
- package/src/client/ssr/head/Microdata.js +1 -1
- package/src/client/ssr/head/Production.js +1 -1
- package/src/client/ssr/head/Pwa.js +1 -1
- package/src/client/ssr/head/PwaItemledger.js +1 -1
- package/src/client/ssr/head/Seo.js +1 -1
- package/src/client/ssr/head/UnderpostScripts.js +1 -1
- package/src/client/ssr/mailer/DefaultRecoverEmail.js +1 -1
- package/src/client/ssr/mailer/DefaultVerifyEmail.js +1 -1
- package/src/client/ssr/views/Cyberia404.js +7 -5
- package/src/client/ssr/views/CyberiaServerMetrics.js +1 -1
- package/src/client/ssr/views/Maintenance.js +1 -1
- package/src/client/ssr/views/NoNetworkConnection.js +1 -1
- package/src/client/ssr/views/Test.js +1 -1
- package/src/client/sw/core.sw.js +20 -14
- package/src/client-builder/client-build-docs.js +61 -46
- package/src/client-builder/client-build-live.js +2 -2
- package/src/client-builder/client-build.js +58 -44
- package/src/client-builder/client-dev-server.js +3 -3
- package/src/client-builder/client-icons.js +2 -2
- package/src/client-builder/ssr.js +3 -3
- package/src/client.build.js +3 -6
- package/src/client.dev.js +3 -6
- package/src/db/DataBaseProvider.js +186 -3
- package/src/db/mariadb/MariaDB.js +3 -2
- package/src/db/mongo/MongoBootstrap.js +273 -101
- package/src/db/mongo/MongooseDB.js +11 -8
- package/src/{server/valkey.js → db/valkey/Valkey.js} +5 -4
- package/src/grpc/cyberia/grpc-server.js +1 -1
- package/src/index.js +103 -23
- package/src/mailer/EmailRender.js +2 -2
- package/src/mailer/MailerInterceptor.js +87 -0
- package/src/mailer/MailerProvider.js +50 -6
- package/src/projects/cyberia/atlas-sprite-sheet-generator.js +1 -1
- package/src/projects/cyberia/besu-genesis-generator.js +3 -3
- package/src/projects/cyberia/catalog-cyberia.js +54 -6
- package/src/projects/cyberia/gemini-client.js +1 -1
- package/src/projects/cyberia/generate-saga.js +15 -24
- package/src/projects/cyberia/hot-reload-trigger.js +1 -1
- package/src/projects/cyberia/instance-data.js +22 -3
- package/src/projects/cyberia/ipfs-client.js +4 -4
- package/src/projects/cyberia/map-preview-generator.js +1 -1
- package/src/projects/cyberia/object-layer.js +12 -22
- package/src/projects/cyberia/semantic-layer-generator.js +1 -1
- package/src/projects/underpost/catalog-underpost.js +13 -2
- package/src/proxy.js +4 -7
- package/src/runtime/cyberia-client/Dockerfile +9 -4
- package/src/runtime/cyberia-client/Dockerfile.dev +8 -2
- package/src/runtime/cyberia-server/Dockerfile +9 -4
- package/src/runtime/cyberia-server/Dockerfile.dev +8 -2
- package/src/runtime/engine-cyberia/Dockerfile +25 -9
- package/src/runtime/engine-cyberia/Dockerfile.dev +25 -9
- package/src/runtime/engine-cyberia/Dockerfile.test +4 -4
- package/src/runtime/engine-cyberia/compose.env +16 -0
- package/src/runtime/engine-cyberia/docker-compose.yml +31 -37
- package/src/runtime/express/Express.js +32 -27
- package/src/runtime/lampp/Lampp.js +22 -70
- package/src/runtime/nginx/Nginx.js +1 -1
- package/src/runtime/wp/Wp.js +16 -48
- package/src/server/{catalog.js → build/catalog.js} +15 -5
- package/src/server/build/coverage.js +117 -0
- package/src/server/build/execution.js +402 -0
- package/src/server/build/package.js +465 -0
- package/src/server/build/testing.js +528 -0
- package/src/server/{dns.js → network/dns.js} +241 -14
- package/src/server/network/forward-proxy.js +541 -0
- package/src/server/{middlewares.js → network/middlewares.js} +59 -4
- package/src/server/network/node-capability.js +98 -0
- package/src/server/{peer.js → network/peer.js} +3 -3
- package/src/server/{proxy.js → network/proxy.js} +7 -13
- package/src/server/network/router.js +356 -0
- package/src/server/{tls.js → network/tls.js} +2 -2
- package/src/server/network/underpost-compression.js +186 -0
- package/src/server/{underpost-gateway.js → network/underpost-gateway.js} +26 -16
- package/src/server/{underpost-ingress.js → network/underpost-ingress.js} +19 -3
- package/src/server/{cri.js → ops/cri.js} +2 -2
- package/src/server/ops/cron.js +949 -0
- package/src/server/ops/event-notification.js +284 -0
- package/src/server/{logger.js → ops/logger.js} +108 -23
- package/src/server/ops/monitoring.js +1724 -0
- package/src/server/ops/systemd.js +259 -0
- package/src/server/{conf.js → runtime/conf.js} +521 -520
- package/src/server/runtime/config-scope.js +215 -0
- package/src/server/runtime/environment.js +149 -0
- package/src/server/{process.js → runtime/process.js} +153 -13
- package/src/server/{runtime-status.js → runtime/runtime-status.js} +155 -16
- package/src/server/{runtime.js → runtime/runtime.js} +12 -8
- package/src/server/{start.js → runtime/start.js} +128 -39
- package/src/server/{auth.js → security/auth.js} +7 -8
- package/src/server/security/container-storage.js +382 -0
- package/src/server/{crypto.js → security/crypto.js} +1 -1
- package/src/server/security/selinux.js +185 -0
- package/src/server/{backup.js → storage/backup.js} +17 -8
- package/src/server/{data-query.js → storage/data-query.js} +1 -1
- package/src/server/{downloader.js → storage/downloader.js} +2 -2
- package/src/server/storage/repository.js +68 -0
- package/src/server.js +4 -7
- package/src/ws/IoInterface.js +1 -1
- package/src/ws/IoServer.js +1 -1
- package/src/ws/core/core.ws.connection.js +1 -1
- package/src/ws/core/core.ws.emit.js +1 -1
- package/src/ws/core/core.ws.server.js +1 -1
- package/src/ws/default/default.ws.connection.js +1 -1
- package/src/ws/default/default.ws.emit.js +1 -1
- package/src/ws/default/default.ws.server.js +1 -1
- package/test/e2e/event-e2e-public-ingress-down.js +45 -0
- package/test/e2e/event-e2e-wireguard-server-down.js +38 -0
- package/test/e2e/event-e2e-wireguard-spoke-down.js +40 -0
- package/test/{api.test.js → integration/app/api.test.js} +33 -14
- package/test/integration/app/cyberia/cyberia-cli-plain-reads.test.js +30 -0
- package/test/{cyberia-instance-conf-defaults.test.js → integration/app/cyberia/cyberia-instance-conf-defaults.test.js} +2 -1
- package/test/integration/app/cyberia/cyberia-load.test.js +467 -0
- package/test/integration/app/cyberia/fallback-world-capture.test.js +253 -0
- package/test/integration/app/cyberia/object-layer-item-id.test.js +327 -0
- package/test/{shape-generator.test.js → integration/app/cyberia/shape-generator.test.js} +1 -1
- package/test/integration/infra/1-security/config-scope.test.js +305 -0
- package/test/integration/infra/1-security/container-storage.test.js +356 -0
- package/test/integration/infra/1-security/in-pod-cli-surface.test.js +86 -0
- package/test/integration/infra/1-security/secret-onboarding.test.js +930 -0
- package/test/integration/infra/1-security/selinux.test.js +69 -0
- package/test/{sops-secret-store.test.js → integration/infra/1-security/sops-secret-store.test.js} +415 -61
- package/test/integration/infra/1-security/systemd-service.test.js +70 -0
- package/test/integration/infra/1-security/underpost-config-secret.test.js +367 -0
- package/test/integration/infra/2-network/dns-firewall.test.js +566 -0
- package/test/integration/infra/2-network/node-capability.test.js +182 -0
- package/test/integration/infra/2-network/wireguard-cli.test.js +1163 -0
- package/test/integration/infra/2-network/wireguard-edge.test.js +1731 -0
- package/test/{cluster-instances.test.js → integration/infra/3-cluster/cluster-instances.test.js} +11 -15
- package/test/{deploy-node-placement.test.js → integration/infra/3-cluster/deploy-node-placement.test.js} +3 -3
- package/test/integration/infra/3-cluster/docker-compose-stack.test.js +313 -0
- package/test/integration/infra/4-ingress/deploy-routes.test.js +379 -0
- package/test/integration/infra/4-ingress/gateway-static-assets.test.js +453 -0
- package/test/{instance-traffic-plan.test.js → integration/infra/4-ingress/instance-traffic-plan.test.js} +10 -6
- package/test/{underpost-gateway.test.js → integration/infra/4-ingress/underpost-gateway.test.js} +47 -6
- package/test/{underpost-ingress.test.js → integration/infra/4-ingress/underpost-ingress.test.js} +56 -4
- package/test/integration/infra/5-observability/cron-jobs.test.js +652 -0
- package/test/{deploy-monitor.test.js → integration/infra/5-observability/deploy-monitor.test.js} +29 -31
- package/test/integration/infra/5-observability/event-notification.test.js +197 -0
- package/test/integration/infra/5-observability/event-remediation.test.js +502 -0
- package/test/integration/infra/5-observability/event-targets.test.js +1174 -0
- package/test/integration/infra/5-observability/monitoring-stack.test.js +902 -0
- package/test/support/shell-harness.js +73 -0
- package/test/unit/build-template.test.js +97 -0
- package/test/unit/build-workflow-offline.test.js +132 -0
- package/test/unit/catalog.test.js +71 -0
- package/test/unit/client-build-docs.test.js +334 -0
- package/test/unit/conf-loading.test.js +303 -0
- package/test/unit/conf-resolution.test.js +979 -0
- package/test/unit/coverage-artifact.test.js +130 -0
- package/test/{crypto.test.js → unit/crypto.test.js} +1 -1
- package/test/unit/deploy-env-resolution.test.js +38 -0
- package/test/unit/deploy-log-table.test.js +447 -0
- package/test/unit/execution-profiles.test.js +219 -0
- package/test/unit/fleet-sync-source.test.js +149 -0
- package/test/unit/logger-redaction.test.js +112 -0
- package/test/unit/package.test.js +403 -0
- package/test/unit/prepare-host.test.js +299 -0
- package/test/unit/process-environment.test.js +18 -0
- package/test/unit/propagation-message.test.js +78 -0
- package/test/unit/redeploy-plan.test.js +24 -0
- package/test/unit/release-bump.test.js +474 -0
- package/test/unit/ssh-output-redaction.test.js +28 -0
- package/test/unit/start-options.test.js +46 -0
- package/test/unit/test-tiers.test.js +193 -0
- package/vitest.config.js +58 -0
- package/.nycrc +0 -9
- package/manifests/cronjobs/dd-cron/dd-cron-dns.yaml +0 -48
- package/manifests/mongodb/pv-pvc.yaml +0 -59
- package/scripts/link-local-underpost-cli.sh +0 -6
- package/src/api/user/user.build.js +0 -16
- package/src/cli/env.js +0 -177
- package/src/client/components/core/Blockchain.js +0 -41
- package/src/client/components/core/Blog.js +0 -9
- package/src/client/components/core/KeyboardAvoidance.js +0 -145
- package/src/client/public/default/assets/background/dark.jpg +0 -0
- package/src/client/public/default/assets/background/white0-min.jpg +0 -0
- package/src/client/public/default/assets/background/white0.jpg +0 -0
- package/src/client/public/doc/favicon.ico +0 -0
- package/src/client/public/doc/sitemap +0 -148
- package/src/server/cron.js +0 -476
|
@@ -0,0 +1,379 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
import { expect } from 'chai';
|
|
4
|
+
import fs from 'fs-extra';
|
|
5
|
+
import {
|
|
6
|
+
DEPLOY_ROUTES_PATH,
|
|
7
|
+
buildKindPorts,
|
|
8
|
+
buildPortProxyRouter,
|
|
9
|
+
buildProxyRouter,
|
|
10
|
+
deployRangePortFactory,
|
|
11
|
+
deployRoutesExists,
|
|
12
|
+
parseDeployRoutes,
|
|
13
|
+
pathPortAssignmentFactory,
|
|
14
|
+
readDeployRoutes,
|
|
15
|
+
registerDeployRoute,
|
|
16
|
+
resolveDeployList,
|
|
17
|
+
} from '../../../../src/server/network/router.js';
|
|
18
|
+
import { Config } from '../../../../src/server/runtime/conf.js';
|
|
19
|
+
|
|
20
|
+
describe('DEPLOY_ROUTES_PATH', () => {
|
|
21
|
+
it('names the route table by what it holds — a list of routes', () => {
|
|
22
|
+
expect(DEPLOY_ROUTES_PATH).to.equal('./engine-private/deploy/dd.routes');
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
describe('parseDeployRoutes', () => {
|
|
27
|
+
it('reads the comma separated table', () => {
|
|
28
|
+
expect(parseDeployRoutes('dd-core,dd-cyberia,dd-test')).to.deep.equal(['dd-core', 'dd-cyberia', 'dd-test']);
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
it('tolerates the whitespace and trailing newline a hand-edited table carries', () => {
|
|
32
|
+
expect(parseDeployRoutes(' dd-core , dd-cyberia ,\n')).to.deep.equal(['dd-core', 'dd-cyberia']);
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it('drops empty entries rather than yielding a deploy id of ""', () => {
|
|
36
|
+
// A trailing comma used to produce an empty id, which every `dd` fan-out
|
|
37
|
+
// then resolved to `./engine-private/conf//conf.server.json`.
|
|
38
|
+
expect(parseDeployRoutes('dd-core,,dd-test,')).to.deep.equal(['dd-core', 'dd-test']);
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
it('treats a missing or empty table as no routes at all', () => {
|
|
42
|
+
expect(parseDeployRoutes('')).to.deep.equal([]);
|
|
43
|
+
expect(parseDeployRoutes()).to.deep.equal([]);
|
|
44
|
+
expect(parseDeployRoutes(null)).to.deep.equal([]);
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
it('preserves declaration order, which is the order deploys are rolled out in', () => {
|
|
48
|
+
expect(parseDeployRoutes('dd-lampp,dd-cyberia,dd-core')).to.deep.equal(['dd-lampp', 'dd-cyberia', 'dd-core']);
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
// The route table is a real file in the private repository this checkout may or
|
|
53
|
+
// may not carry, so every case here stubs the filesystem rather than writing to
|
|
54
|
+
// the path an engine actually deploys from.
|
|
55
|
+
describe('deploy route table', () => {
|
|
56
|
+
const stubRouteTable = (contents) => {
|
|
57
|
+
const written = { path: '', contents: '' };
|
|
58
|
+
vi.spyOn(fs, 'existsSync').mockImplementation((filePath) => contents !== null && filePath === DEPLOY_ROUTES_PATH);
|
|
59
|
+
vi.spyOn(fs, 'readFileSync').mockImplementation(() => contents);
|
|
60
|
+
vi.spyOn(fs, 'outputFileSync').mockImplementation((filePath, value) => {
|
|
61
|
+
written.path = `${filePath}`;
|
|
62
|
+
written.contents = `${value}`;
|
|
63
|
+
});
|
|
64
|
+
return written;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
afterEach(() => vi.restoreAllMocks());
|
|
68
|
+
|
|
69
|
+
it('reports the table present only when the file is there', () => {
|
|
70
|
+
stubRouteTable('dd-core');
|
|
71
|
+
expect(deployRoutesExists()).to.equal(true);
|
|
72
|
+
vi.restoreAllMocks();
|
|
73
|
+
stubRouteTable(null);
|
|
74
|
+
expect(deployRoutesExists()).to.equal(false);
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
it('reads the routed deploy ids', () => {
|
|
78
|
+
stubRouteTable('dd-core, dd-cyberia\n');
|
|
79
|
+
expect(readDeployRoutes()).to.deep.equal(['dd-core', 'dd-cyberia']);
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
it('reads no routes at all without a table', () => {
|
|
83
|
+
stubRouteTable(null);
|
|
84
|
+
expect(readDeployRoutes()).to.deep.equal([]);
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
it('appends a new deploy id to the table', () => {
|
|
88
|
+
const written = stubRouteTable('dd-core');
|
|
89
|
+
expect(registerDeployRoute('dd-cyberia')).to.deep.equal(['dd-core', 'dd-cyberia']);
|
|
90
|
+
expect(written.path).to.equal(DEPLOY_ROUTES_PATH);
|
|
91
|
+
expect(written.contents).to.equal('dd-core,dd-cyberia');
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
it('creates the table when the engine has none', () => {
|
|
95
|
+
const written = stubRouteTable(null);
|
|
96
|
+
expect(registerDeployRoute('dd-core')).to.deep.equal(['dd-core']);
|
|
97
|
+
expect(written.contents).to.equal('dd-core');
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
it('leaves an already routed deploy alone rather than building it twice', () => {
|
|
101
|
+
const written = stubRouteTable('dd-core,dd-cyberia');
|
|
102
|
+
expect(registerDeployRoute(' dd-cyberia ')).to.deep.equal(['dd-core', 'dd-cyberia']);
|
|
103
|
+
expect(written.path).to.equal('');
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
it('writes nothing for an empty deploy id', () => {
|
|
107
|
+
const written = stubRouteTable('dd-core');
|
|
108
|
+
expect(registerDeployRoute(' ')).to.deep.equal(['dd-core']);
|
|
109
|
+
expect(registerDeployRoute()).to.deep.equal(['dd-core']);
|
|
110
|
+
expect(written.path).to.equal('');
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
it('fans the dd meta id out to the whole table', () => {
|
|
114
|
+
stubRouteTable('dd-core,dd-cyberia');
|
|
115
|
+
expect(resolveDeployList('dd')).to.deep.equal(['dd-core', 'dd-cyberia']);
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
it('falls back to the default deploy when no table is checked out', () => {
|
|
119
|
+
stubRouteTable(null);
|
|
120
|
+
expect(resolveDeployList('dd')).to.deep.equal(['dd-default']);
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
it('parses any other selector as a literal list', () => {
|
|
124
|
+
stubRouteTable('dd-core');
|
|
125
|
+
expect(resolveDeployList('dd-a,dd-b')).to.deep.equal(['dd-a', 'dd-b']);
|
|
126
|
+
});
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
describe('proxy router construction', () => {
|
|
130
|
+
const CONF_SERVER = {
|
|
131
|
+
'app.fixture.test': {
|
|
132
|
+
'/': { proxy: [80, 443], client: 'App', peer: true },
|
|
133
|
+
'/admin': { proxy: [443], client: 'Admin', redirect: 'https://admin.fixture.test' },
|
|
134
|
+
},
|
|
135
|
+
'single.fixture.test': {
|
|
136
|
+
'/': { proxy: [80], singleReplica: true },
|
|
137
|
+
},
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
let previousServer;
|
|
141
|
+
let previousPort;
|
|
142
|
+
|
|
143
|
+
beforeEach(() => {
|
|
144
|
+
previousServer = Config.default.server;
|
|
145
|
+
previousPort = process.env.PORT;
|
|
146
|
+
Config.default.server = JSON.parse(JSON.stringify(CONF_SERVER));
|
|
147
|
+
process.env.PORT = '3000';
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
afterEach(() => {
|
|
151
|
+
Config.default.server = previousServer;
|
|
152
|
+
if (previousPort === undefined) delete process.env.PORT;
|
|
153
|
+
else process.env.PORT = previousPort;
|
|
154
|
+
vi.restoreAllMocks();
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
it('assigns one ascending port per served path and keys it by proxy port', () => {
|
|
158
|
+
const proxyRouter = buildProxyRouter();
|
|
159
|
+
expect(Object.keys(proxyRouter).sort()).to.deep.equal(['443', '80']);
|
|
160
|
+
expect(proxyRouter[80]['app.fixture.test/'].target).to.equal('http://localhost:3001');
|
|
161
|
+
expect(proxyRouter[443]['app.fixture.test/'].target).to.equal('http://localhost:3001');
|
|
162
|
+
expect(proxyRouter[443]['app.fixture.test/admin'].target).to.equal('http://localhost:3003');
|
|
163
|
+
expect(proxyRouter[443]['app.fixture.test/admin'].redirect).to.equal('https://admin.fixture.test');
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
it('gives a peer-enabled path its own port on the next slot', () => {
|
|
167
|
+
const proxyRouter = buildProxyRouter();
|
|
168
|
+
expect(proxyRouter[80]['app.fixture.test/peer'].target).to.equal('http://localhost:3002');
|
|
169
|
+
expect(proxyRouter[80]['app.fixture.test/peer'].path).to.equal('/peer');
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
it('nests the peer path under a non-root path', () => {
|
|
173
|
+
Config.default.server = { 'app.fixture.test': { '/admin': { proxy: [443], peer: true } } };
|
|
174
|
+
const proxyRouter = buildProxyRouter();
|
|
175
|
+
expect(Object.keys(proxyRouter[443])).to.include('app.fixture.test/admin/peer');
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
it('leaves a single replica out of the proxy router entirely', () => {
|
|
179
|
+
const proxyRouter = buildProxyRouter();
|
|
180
|
+
expect(Object.keys(proxyRouter[80])).not.to.include('single.fixture.test/');
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
it('collapses every proxy port to the dev proxy port under a proxy invocation', () => {
|
|
184
|
+
const previousArgv = process.argv;
|
|
185
|
+
process.argv = [...previousArgv.slice(0, 2), 'proxy'];
|
|
186
|
+
try {
|
|
187
|
+
expect(Object.keys(buildProxyRouter())).to.deep.equal(['80']);
|
|
188
|
+
} finally {
|
|
189
|
+
process.argv = previousArgv;
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
describe('port proxy router', () => {
|
|
195
|
+
const HOSTS = {
|
|
196
|
+
'app.fixture.test/': {
|
|
197
|
+
host: 'app.fixture.test',
|
|
198
|
+
path: '/',
|
|
199
|
+
target: 'http://localhost:3001',
|
|
200
|
+
proxy: [80, 443],
|
|
201
|
+
},
|
|
202
|
+
'app.fixture.test/admin': {
|
|
203
|
+
host: 'app.fixture.test',
|
|
204
|
+
path: '/admin',
|
|
205
|
+
target: 'http://localhost:3002',
|
|
206
|
+
proxy: [443],
|
|
207
|
+
},
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
afterEach(() => vi.restoreAllMocks());
|
|
211
|
+
|
|
212
|
+
it('drops the port from the absolute host on the standard edge ports', () => {
|
|
213
|
+
const router = buildPortProxyRouter({ port: 443, hosts: HOSTS });
|
|
214
|
+
expect(router).to.deep.equal({
|
|
215
|
+
'app.fixture.test': 'http://localhost:3001',
|
|
216
|
+
'app.fixture.test/admin': 'http://localhost:3002',
|
|
217
|
+
});
|
|
218
|
+
});
|
|
219
|
+
|
|
220
|
+
it('carries the port on a non standard edge port', () => {
|
|
221
|
+
const router = buildPortProxyRouter({ port: 4000, hosts: { 'a/': HOSTS['app.fixture.test/'] } });
|
|
222
|
+
expect(router).to.deep.equal({ 'app.fixture.test:4000': 'http://localhost:3001' });
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
it('reads the hosts off the proxy router when none are passed', () => {
|
|
226
|
+
const router = buildPortProxyRouter({
|
|
227
|
+
port: 80,
|
|
228
|
+
proxyRouter: { 80: { 'app.fixture.test/': HOSTS['app.fixture.test/'] } },
|
|
229
|
+
});
|
|
230
|
+
expect(router).to.deep.equal({ 'app.fixture.test': 'http://localhost:3001' });
|
|
231
|
+
});
|
|
232
|
+
|
|
233
|
+
it('returns an empty router when the port serves nothing', () => {
|
|
234
|
+
expect(buildPortProxyRouter({ port: 8080, proxyRouter: {} })).to.deep.equal({});
|
|
235
|
+
});
|
|
236
|
+
|
|
237
|
+
it('keeps a host whose conf omits the port outside production', () => {
|
|
238
|
+
const previous = process.env.NODE_ENV;
|
|
239
|
+
process.env.NODE_ENV = 'development';
|
|
240
|
+
try {
|
|
241
|
+
const router = buildPortProxyRouter({ port: 8080, hosts: { 'a/': HOSTS['app.fixture.test/'] } });
|
|
242
|
+
expect(router).to.deep.equal({ 'app.fixture.test:8080': 'http://localhost:3001' });
|
|
243
|
+
} finally {
|
|
244
|
+
process.env.NODE_ENV = previous;
|
|
245
|
+
}
|
|
246
|
+
});
|
|
247
|
+
|
|
248
|
+
it('omits a host whose conf omits the port in production', () => {
|
|
249
|
+
const previous = process.env.NODE_ENV;
|
|
250
|
+
process.env.NODE_ENV = 'production';
|
|
251
|
+
try {
|
|
252
|
+
expect(buildPortProxyRouter({ port: 8080, hosts: { 'a/': HOSTS['app.fixture.test/'] } })).to.deep.equal({});
|
|
253
|
+
} finally {
|
|
254
|
+
process.env.NODE_ENV = previous;
|
|
255
|
+
}
|
|
256
|
+
});
|
|
257
|
+
|
|
258
|
+
it('warns and keeps the last target when two hosts resolve to one absolute host', () => {
|
|
259
|
+
const router = buildPortProxyRouter({
|
|
260
|
+
port: 443,
|
|
261
|
+
hosts: {
|
|
262
|
+
first: { ...HOSTS['app.fixture.test/'], target: 'http://localhost:3001' },
|
|
263
|
+
second: { ...HOSTS['app.fixture.test/'], target: 'http://localhost:3009' },
|
|
264
|
+
},
|
|
265
|
+
});
|
|
266
|
+
expect(router).to.deep.equal({ 'app.fixture.test': 'http://localhost:3009' });
|
|
267
|
+
});
|
|
268
|
+
|
|
269
|
+
it('rewrites the target to the app dev port under a dev proxy context', () => {
|
|
270
|
+
const previous = process.env.DEV_PROXY_PORT_OFFSET;
|
|
271
|
+
process.env.DEV_PROXY_PORT_OFFSET = '1000';
|
|
272
|
+
try {
|
|
273
|
+
const router = buildPortProxyRouter({ port: 443, hosts: HOSTS, devProxyContext: true });
|
|
274
|
+
expect(router['app.fixture.test']).to.equal('http://localhost:2001');
|
|
275
|
+
} finally {
|
|
276
|
+
if (previous === undefined) delete process.env.DEV_PROXY_PORT_OFFSET;
|
|
277
|
+
else process.env.DEV_PROXY_PORT_OFFSET = previous;
|
|
278
|
+
}
|
|
279
|
+
});
|
|
280
|
+
|
|
281
|
+
it('orders the router by absolute host length so the longest path matches first', () => {
|
|
282
|
+
const router = buildPortProxyRouter({ port: 443, hosts: HOSTS, orderByPathLength: true });
|
|
283
|
+
expect(Object.keys(router)).to.deep.equal(['app.fixture.test/admin', 'app.fixture.test']);
|
|
284
|
+
});
|
|
285
|
+
|
|
286
|
+
it('splits the dev API host into its api and socket routes and points the bare host at the origin', () => {
|
|
287
|
+
const previousEnv = process.env.NODE_ENV;
|
|
288
|
+
const previousApi = process.env.BASE_API;
|
|
289
|
+
const previousOffset = process.env.DEV_PROXY_PORT_OFFSET;
|
|
290
|
+
const previousArgv = process.argv;
|
|
291
|
+
process.env.NODE_ENV = 'development';
|
|
292
|
+
process.env.BASE_API = 'api';
|
|
293
|
+
process.env.DEV_PROXY_PORT_OFFSET = '0';
|
|
294
|
+
process.argv = [...previousArgv.slice(0, 2), 'proxy', 'dd-fixture', 'local'];
|
|
295
|
+
const devApiConf = {
|
|
296
|
+
'app.fixture.test': {
|
|
297
|
+
'/': { origins: ['http://localhost:5173'] },
|
|
298
|
+
'/peer': { origins: [] },
|
|
299
|
+
},
|
|
300
|
+
};
|
|
301
|
+
vi.spyOn(fs, 'existsSync').mockImplementation((filePath) => `${filePath}`.endsWith('local-dev-api.json'));
|
|
302
|
+
vi.spyOn(fs, 'readFileSync').mockImplementation(() => JSON.stringify(devApiConf));
|
|
303
|
+
try {
|
|
304
|
+
const router = buildPortProxyRouter({ port: 443, hosts: HOSTS, devProxyContext: true });
|
|
305
|
+
expect(router['app.fixture.test/api']).to.equal('http://localhost:3001');
|
|
306
|
+
expect(router['app.fixture.test/socket.io']).to.equal('http://localhost:3001');
|
|
307
|
+
expect(router['app.fixture.test']).to.equal('http://localhost:5173');
|
|
308
|
+
} finally {
|
|
309
|
+
process.env.NODE_ENV = previousEnv;
|
|
310
|
+
if (previousApi === undefined) delete process.env.BASE_API;
|
|
311
|
+
else process.env.BASE_API = previousApi;
|
|
312
|
+
if (previousOffset === undefined) delete process.env.DEV_PROXY_PORT_OFFSET;
|
|
313
|
+
else process.env.DEV_PROXY_PORT_OFFSET = previousOffset;
|
|
314
|
+
process.argv = previousArgv;
|
|
315
|
+
}
|
|
316
|
+
});
|
|
317
|
+
});
|
|
318
|
+
|
|
319
|
+
describe('deploy port range', () => {
|
|
320
|
+
it('reports every assigned port and the range that spans them', () => {
|
|
321
|
+
expect(
|
|
322
|
+
deployRangePortFactory({
|
|
323
|
+
'a.test': 'http://localhost:3001',
|
|
324
|
+
'b.test': 'http://localhost:3005',
|
|
325
|
+
'c.test': 'http://localhost:3003',
|
|
326
|
+
}),
|
|
327
|
+
).to.deep.equal({ ports: [3001, 3005, 3003], fromPort: 3001, toPort: 3005 });
|
|
328
|
+
});
|
|
329
|
+
|
|
330
|
+
it('renders one TCP and one UDP entry per port in the kind service', () => {
|
|
331
|
+
const yaml = buildKindPorts(3001, 3002);
|
|
332
|
+
expect(yaml).to.include("- name: 'tcp-3001'");
|
|
333
|
+
expect(yaml).to.include("- name: 'udp-3002'");
|
|
334
|
+
expect(yaml.match(/protocol: TCP/g).length).to.equal(2);
|
|
335
|
+
});
|
|
336
|
+
});
|
|
337
|
+
|
|
338
|
+
describe('path port assignment', () => {
|
|
339
|
+
const CONF_SERVER = {
|
|
340
|
+
'app.fixture.test': {
|
|
341
|
+
'/': { peer: true },
|
|
342
|
+
'/admin': {},
|
|
343
|
+
'/unrouted': {},
|
|
344
|
+
},
|
|
345
|
+
};
|
|
346
|
+
const ROUTER = {
|
|
347
|
+
'app.fixture.test': 'http://localhost:3001',
|
|
348
|
+
'app.fixture.test/admin': 'http://localhost:3003',
|
|
349
|
+
};
|
|
350
|
+
|
|
351
|
+
afterEach(() => vi.restoreAllMocks());
|
|
352
|
+
|
|
353
|
+
it('maps each routed path to the port its runtime bound', async () => {
|
|
354
|
+
vi.spyOn(fs, 'existsSync').mockReturnValue(false);
|
|
355
|
+
expect(await pathPortAssignmentFactory('dd-fixture', ROUTER, CONF_SERVER)).to.deep.equal({
|
|
356
|
+
'app.fixture.test': [
|
|
357
|
+
{ port: 3001, path: '/' },
|
|
358
|
+
{ port: 3002, path: '/peer' },
|
|
359
|
+
{ port: 3003, path: '/admin' },
|
|
360
|
+
],
|
|
361
|
+
});
|
|
362
|
+
});
|
|
363
|
+
|
|
364
|
+
it('appends the paths served by every single replica of the deploy', async () => {
|
|
365
|
+
vi.spyOn(fs, 'existsSync').mockImplementation((filePath) => `${filePath}`.includes('./engine-private/replica'));
|
|
366
|
+
vi.spyOn(fs, 'readdir').mockResolvedValue(['dd-fixture-blue', 'dd-other-green']);
|
|
367
|
+
vi.spyOn(fs, 'readFileSync').mockReturnValue(
|
|
368
|
+
JSON.stringify({ 'app.fixture.test': { '/admin': { peer: true }, '/unrouted': {} } }),
|
|
369
|
+
);
|
|
370
|
+
const assignment = await pathPortAssignmentFactory('dd-fixture', ROUTER, CONF_SERVER);
|
|
371
|
+
expect(assignment['app.fixture.test']).to.deep.equal([
|
|
372
|
+
{ port: 3001, path: '/' },
|
|
373
|
+
{ port: 3002, path: '/peer' },
|
|
374
|
+
{ port: 3003, path: '/admin' },
|
|
375
|
+
{ port: 3003, path: '/admin' },
|
|
376
|
+
{ port: 3004, path: '/admin/peer' },
|
|
377
|
+
]);
|
|
378
|
+
});
|
|
379
|
+
});
|