cyberia 2.8.885
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 +15 -0
- package/.env.development +45 -0
- package/.env.production +50 -0
- package/.env.test +45 -0
- package/.github/workflows/engine-cyberia.cd.yml +31 -0
- package/.github/workflows/engine-cyberia.ci.yml +60 -0
- package/.github/workflows/ghpkg.ci.yml +87 -0
- package/.github/workflows/npmpkg.ci.yml +72 -0
- package/.github/workflows/publish.ci.yml +84 -0
- package/.github/workflows/publish.cyberia.ci.yml +84 -0
- package/.github/workflows/pwa-microservices-template-page.cd.yml +72 -0
- package/.github/workflows/pwa-microservices-template-test.ci.yml +33 -0
- package/.github/workflows/release.cd.yml +37 -0
- package/.nycrc +9 -0
- package/.prettierignore +13 -0
- package/.prettierrc +9 -0
- package/.vscode/extensions.json +51 -0
- package/.vscode/settings.json +87 -0
- package/AUTHORS.md +21 -0
- package/CHANGELOG.md +205 -0
- package/Dockerfile +28 -0
- package/LICENSE +21 -0
- package/README.md +85 -0
- package/bin/build.js +209 -0
- package/bin/cron.js +47 -0
- package/bin/cyberia.js +145 -0
- package/bin/db.js +199 -0
- package/bin/deploy.js +1293 -0
- package/bin/file.js +197 -0
- package/bin/hwt.js +49 -0
- package/bin/index.js +145 -0
- package/bin/ssl.js +63 -0
- package/bin/util.js +80 -0
- package/bin/vs.js +74 -0
- package/cli.md +714 -0
- package/conf.js +204 -0
- package/deployment.yaml +138 -0
- package/jsconfig.json +7 -0
- package/jsdoc.json +32 -0
- package/manifests/deployment/adminer/deployment.yaml +32 -0
- package/manifests/deployment/adminer/kustomization.yaml +7 -0
- package/manifests/deployment/adminer/service.yaml +13 -0
- package/manifests/deployment/dd-default-development/deployment.yaml +167 -0
- package/manifests/deployment/dd-default-development/proxy.yaml +46 -0
- package/manifests/deployment/dd-test-development/deployment.yaml +174 -0
- package/manifests/deployment/dd-test-development/proxy.yaml +51 -0
- package/manifests/deployment/fastapi/backend-deployment.yml +120 -0
- package/manifests/deployment/fastapi/backend-service.yml +19 -0
- package/manifests/deployment/fastapi/frontend-deployment.yml +54 -0
- package/manifests/deployment/fastapi/frontend-service.yml +15 -0
- package/manifests/deployment/fastapi/initial_data.sh +56 -0
- package/manifests/deployment/kafka/deployment.yaml +69 -0
- package/manifests/deployment/mongo-express/deployment.yaml +60 -0
- package/manifests/deployment/phpmyadmin/deployment.yaml +54 -0
- package/manifests/deployment/spark/spark-pi-py.yaml +21 -0
- package/manifests/deployment/tensorflow/tf-gpu-test.yaml +65 -0
- package/manifests/envoy-service-nodeport.yaml +23 -0
- package/manifests/grafana/deployment.yaml +57 -0
- package/manifests/grafana/kustomization.yaml +7 -0
- package/manifests/grafana/pvc.yaml +12 -0
- package/manifests/grafana/service.yaml +14 -0
- package/manifests/kind-config-dev.yaml +12 -0
- package/manifests/kind-config.yaml +12 -0
- package/manifests/kubeadm-calico-config.yaml +119 -0
- package/manifests/kubelet-config.yaml +65 -0
- package/manifests/letsencrypt-prod.yaml +15 -0
- package/manifests/lxd/lxd-admin-profile.yaml +17 -0
- package/manifests/lxd/lxd-preseed.yaml +30 -0
- package/manifests/lxd/underpost-setup.sh +163 -0
- package/manifests/mariadb/config.yaml +10 -0
- package/manifests/mariadb/kustomization.yaml +9 -0
- package/manifests/mariadb/pv.yaml +12 -0
- package/manifests/mariadb/pvc.yaml +10 -0
- package/manifests/mariadb/secret.yaml +8 -0
- package/manifests/mariadb/service.yaml +10 -0
- package/manifests/mariadb/statefulset.yaml +56 -0
- package/manifests/mariadb/storage-class.yaml +10 -0
- package/manifests/mongodb/backup-access.yaml +16 -0
- package/manifests/mongodb/backup-cronjob.yaml +42 -0
- package/manifests/mongodb/backup-pv-pvc.yaml +22 -0
- package/manifests/mongodb/configmap.yaml +26 -0
- package/manifests/mongodb/headless-service.yaml +10 -0
- package/manifests/mongodb/kustomization.yaml +11 -0
- package/manifests/mongodb/pv-pvc.yaml +23 -0
- package/manifests/mongodb/statefulset.yaml +126 -0
- package/manifests/mongodb/storage-class.yaml +9 -0
- package/manifests/mongodb-4.4/kustomization.yaml +7 -0
- package/manifests/mongodb-4.4/pv-pvc.yaml +23 -0
- package/manifests/mongodb-4.4/service-deployment.yaml +63 -0
- package/manifests/mysql/kustomization.yaml +7 -0
- package/manifests/mysql/pv-pvc.yaml +27 -0
- package/manifests/mysql/statefulset.yaml +55 -0
- package/manifests/postgresql/configmap.yaml +9 -0
- package/manifests/postgresql/kustomization.yaml +10 -0
- package/manifests/postgresql/pv.yaml +15 -0
- package/manifests/postgresql/pvc.yaml +13 -0
- package/manifests/postgresql/service.yaml +10 -0
- package/manifests/postgresql/statefulset.yaml +37 -0
- package/manifests/prometheus/deployment.yaml +82 -0
- package/manifests/valkey/kustomization.yaml +7 -0
- package/manifests/valkey/service.yaml +11 -0
- package/manifests/valkey/statefulset.yaml +38 -0
- package/nodemon.json +6 -0
- package/package.json +118 -0
- package/proxy.yaml +35 -0
- package/scripts/device-scan.sh +43 -0
- package/scripts/gpu-diag.sh +19 -0
- package/scripts/maas-setup.sh +120 -0
- package/scripts/nat-iptables.sh +26 -0
- package/scripts/nvim.sh +91 -0
- package/scripts/snap-clean.sh +26 -0
- package/scripts/ssh-cluster-info.sh +14 -0
- package/scripts/ssl.sh +164 -0
- package/src/api/blockchain/blockchain.controller.js +51 -0
- package/src/api/blockchain/blockchain.model.js +90 -0
- package/src/api/blockchain/blockchain.router.js +21 -0
- package/src/api/blockchain/blockchain.service.js +24 -0
- package/src/api/core/core.controller.js +69 -0
- package/src/api/core/core.model.js +11 -0
- package/src/api/core/core.router.js +24 -0
- package/src/api/core/core.service.js +35 -0
- package/src/api/crypto/crypto.controller.js +51 -0
- package/src/api/crypto/crypto.model.js +23 -0
- package/src/api/crypto/crypto.router.js +20 -0
- package/src/api/crypto/crypto.service.js +64 -0
- package/src/api/default/default.controller.js +74 -0
- package/src/api/default/default.model.js +20 -0
- package/src/api/default/default.router.js +27 -0
- package/src/api/default/default.service.js +40 -0
- package/src/api/document/document.controller.js +66 -0
- package/src/api/document/document.model.js +51 -0
- package/src/api/document/document.router.js +24 -0
- package/src/api/document/document.service.js +133 -0
- package/src/api/file/file.controller.js +67 -0
- package/src/api/file/file.model.js +19 -0
- package/src/api/file/file.router.js +22 -0
- package/src/api/file/file.service.js +100 -0
- package/src/api/instance/instance.controller.js +69 -0
- package/src/api/instance/instance.model.js +40 -0
- package/src/api/instance/instance.router.js +34 -0
- package/src/api/instance/instance.service.js +70 -0
- package/src/api/ipfs/ipfs.controller.js +51 -0
- package/src/api/ipfs/ipfs.model.js +17 -0
- package/src/api/ipfs/ipfs.router.js +20 -0
- package/src/api/ipfs/ipfs.service.js +25 -0
- package/src/api/object-layer/README.md +85 -0
- package/src/api/object-layer/object-layer.controller.js +69 -0
- package/src/api/object-layer/object-layer.model.js +181 -0
- package/src/api/object-layer/object-layer.router.js +29 -0
- package/src/api/object-layer/object-layer.service.js +49 -0
- package/src/api/test/test.controller.js +59 -0
- package/src/api/test/test.model.js +14 -0
- package/src/api/test/test.router.js +21 -0
- package/src/api/test/test.service.js +35 -0
- package/src/api/user/postman_collection.json +216 -0
- package/src/api/user/user.build.js +16 -0
- package/src/api/user/user.controller.js +35 -0
- package/src/api/user/user.model.js +100 -0
- package/src/api/user/user.router.js +400 -0
- package/src/api/user/user.service.js +500 -0
- package/src/api.js +23 -0
- package/src/cli/baremetal.js +1310 -0
- package/src/cli/cloud-init.js +548 -0
- package/src/cli/cluster.js +834 -0
- package/src/cli/cron.js +95 -0
- package/src/cli/db.js +414 -0
- package/src/cli/deploy.js +661 -0
- package/src/cli/env.js +101 -0
- package/src/cli/fs.js +256 -0
- package/src/cli/image.js +156 -0
- package/src/cli/index.js +436 -0
- package/src/cli/lxd.js +402 -0
- package/src/cli/monitor.js +260 -0
- package/src/cli/repository.js +274 -0
- package/src/cli/run.js +728 -0
- package/src/cli/script.js +85 -0
- package/src/cli/secrets.js +71 -0
- package/src/cli/ssh.js +46 -0
- package/src/cli/test.js +159 -0
- package/src/client/Cyberia.index.js +50 -0
- package/src/client/CyberiaAdmin.index.js +34 -0
- package/src/client/CyberiaPortal.index.js +36 -0
- package/src/client/Default.index.js +84 -0
- package/src/client/components/core/404.js +20 -0
- package/src/client/components/core/500.js +20 -0
- package/src/client/components/core/Account.js +326 -0
- package/src/client/components/core/AgGrid.js +191 -0
- package/src/client/components/core/Alert.js +77 -0
- package/src/client/components/core/Auth.js +342 -0
- package/src/client/components/core/Badge.js +32 -0
- package/src/client/components/core/Blockchain.js +41 -0
- package/src/client/components/core/Blog.js +9 -0
- package/src/client/components/core/BtnIcon.js +111 -0
- package/src/client/components/core/CalendarCore.js +464 -0
- package/src/client/components/core/Chat.js +64 -0
- package/src/client/components/core/ColorPalette.js +5267 -0
- package/src/client/components/core/CommonJs.js +1010 -0
- package/src/client/components/core/Content.js +196 -0
- package/src/client/components/core/Css.js +1099 -0
- package/src/client/components/core/CssCore.js +882 -0
- package/src/client/components/core/D3Chart.js +44 -0
- package/src/client/components/core/Docs.js +376 -0
- package/src/client/components/core/DropDown.js +223 -0
- package/src/client/components/core/EventsUI.js +133 -0
- package/src/client/components/core/FileExplorer.js +707 -0
- package/src/client/components/core/FullScreen.js +36 -0
- package/src/client/components/core/Input.js +383 -0
- package/src/client/components/core/JoyStick.js +80 -0
- package/src/client/components/core/Keyboard.js +73 -0
- package/src/client/components/core/LoadingAnimation.js +159 -0
- package/src/client/components/core/LogIn.js +190 -0
- package/src/client/components/core/LogOut.js +63 -0
- package/src/client/components/core/Logger.js +29 -0
- package/src/client/components/core/Modal.js +2494 -0
- package/src/client/components/core/NotificationManager.js +84 -0
- package/src/client/components/core/ObjectLayerEngine.js +1229 -0
- package/src/client/components/core/ObjectLayerEngineModal.js +443 -0
- package/src/client/components/core/Pagination.js +207 -0
- package/src/client/components/core/Panel.js +772 -0
- package/src/client/components/core/PanelForm.js +627 -0
- package/src/client/components/core/Polyhedron.js +162 -0
- package/src/client/components/core/Recover.js +207 -0
- package/src/client/components/core/Responsive.js +82 -0
- package/src/client/components/core/RichText.js +43 -0
- package/src/client/components/core/Router.js +317 -0
- package/src/client/components/core/Scroll.js +76 -0
- package/src/client/components/core/SignUp.js +125 -0
- package/src/client/components/core/SocketIo.js +74 -0
- package/src/client/components/core/Stream.js +113 -0
- package/src/client/components/core/ToggleSwitch.js +101 -0
- package/src/client/components/core/ToolTip.js +90 -0
- package/src/client/components/core/Translate.js +522 -0
- package/src/client/components/core/Validator.js +115 -0
- package/src/client/components/core/VanillaJs.js +423 -0
- package/src/client/components/core/Wallet.js +106 -0
- package/src/client/components/core/WebComponent.js +44 -0
- package/src/client/components/core/Webhook.js +25 -0
- package/src/client/components/core/Worker.js +371 -0
- package/src/client/components/core/windowGetDimensions.js +269 -0
- package/src/client/components/cyberia/BagCyberia.js +1253 -0
- package/src/client/components/cyberia/BiomeCyberia.js +130 -0
- package/src/client/components/cyberia/CharacterCyberia.js +321 -0
- package/src/client/components/cyberia/CommonCyberia.js +1834 -0
- package/src/client/components/cyberia/CssCyberia.js +816 -0
- package/src/client/components/cyberia/ElementPreviewCyberia.js +183 -0
- package/src/client/components/cyberia/ElementsCyberia.js +146 -0
- package/src/client/components/cyberia/InteractionPanelCyberia.js +1043 -0
- package/src/client/components/cyberia/JoyStickCyberia.js +53 -0
- package/src/client/components/cyberia/LogInCyberia.js +68 -0
- package/src/client/components/cyberia/LogOutCyberia.js +24 -0
- package/src/client/components/cyberia/MainUserCyberia.js +424 -0
- package/src/client/components/cyberia/MapCyberia.js +160 -0
- package/src/client/components/cyberia/MatrixCyberia.js +147 -0
- package/src/client/components/cyberia/MenuCyberia.js +575 -0
- package/src/client/components/cyberia/PixiCyberia.js +1639 -0
- package/src/client/components/cyberia/PointAndClickMovementCyberia.js +146 -0
- package/src/client/components/cyberia/QuestCyberia.js +1420 -0
- package/src/client/components/cyberia/RoutesCyberia.js +47 -0
- package/src/client/components/cyberia/SettingsCyberia.js +16 -0
- package/src/client/components/cyberia/SignUpCyberia.js +14 -0
- package/src/client/components/cyberia/SkillCyberia.js +124 -0
- package/src/client/components/cyberia/SocketIoCyberia.js +211 -0
- package/src/client/components/cyberia/TileCyberia.js +685 -0
- package/src/client/components/cyberia/TranslateCyberia.js +96 -0
- package/src/client/components/cyberia/UniverseCyberia.js +14 -0
- package/src/client/components/cyberia/WebhookCyberia.js +13 -0
- package/src/client/components/cyberia/WikiCyberia.js +144 -0
- package/src/client/components/cyberia/WorldCyberia.js +680 -0
- package/src/client/components/cyberia-admin/BiomeCyberiaAdmin.js +978 -0
- package/src/client/components/cyberia-admin/CommonCyberiaAdmin.js +29 -0
- package/src/client/components/cyberia-admin/CssCyberiaAdmin.js +15 -0
- package/src/client/components/cyberia-admin/ElementsCyberiaAdmin.js +38 -0
- package/src/client/components/cyberia-admin/InstanceEngineCyberiaAdmin.js +180 -0
- package/src/client/components/cyberia-admin/LogInCyberiaAdmin.js +34 -0
- package/src/client/components/cyberia-admin/LogOutCyberiaAdmin.js +24 -0
- package/src/client/components/cyberia-admin/MenuCyberiaAdmin.js +660 -0
- package/src/client/components/cyberia-admin/RoutesCyberiaAdmin.js +57 -0
- package/src/client/components/cyberia-admin/ServerCyberiaAdmin.js +129 -0
- package/src/client/components/cyberia-admin/SettingsCyberiaAdmin.js +16 -0
- package/src/client/components/cyberia-admin/SignUpCyberiaAdmin.js +11 -0
- package/src/client/components/cyberia-admin/SocketIoCyberiaAdmin.js +53 -0
- package/src/client/components/cyberia-admin/TranslateCyberiaAdmin.js +7 -0
- package/src/client/components/cyberia-biome/CityCyberiaBiome.js +209 -0
- package/src/client/components/cyberia-biome/CityInteriorCyberiaBiome.js +253 -0
- package/src/client/components/cyberia-biome/ColorChaosCyberiaBiome.js +26 -0
- package/src/client/components/cyberia-biome/ForestCyberiaBiome.js +191 -0
- package/src/client/components/cyberia-biome/GridBaseCyberiaBiome.js +364 -0
- package/src/client/components/cyberia-biome/SeedCityCyberiaBiome.js +347 -0
- package/src/client/components/cyberia-biome/ShopCyberiaBiome.js +12 -0
- package/src/client/components/cyberia-biome/SpaceCyberiaBiome.js +58 -0
- package/src/client/components/cyberia-portal/CommonCyberiaPortal.js +29 -0
- package/src/client/components/cyberia-portal/CssCyberiaPortal.js +132 -0
- package/src/client/components/cyberia-portal/ElementsCyberiaPortal.js +38 -0
- package/src/client/components/cyberia-portal/LogInCyberiaPortal.js +18 -0
- package/src/client/components/cyberia-portal/LogOutCyberiaPortal.js +12 -0
- package/src/client/components/cyberia-portal/MenuCyberiaPortal.js +487 -0
- package/src/client/components/cyberia-portal/RoutesCyberiaPortal.js +45 -0
- package/src/client/components/cyberia-portal/ServerCyberiaPortal.js +136 -0
- package/src/client/components/cyberia-portal/SettingsCyberiaPortal.js +16 -0
- package/src/client/components/cyberia-portal/SignUpCyberiaPortal.js +11 -0
- package/src/client/components/cyberia-portal/SocketIoCyberiaPortal.js +52 -0
- package/src/client/components/cyberia-portal/TranslateCyberiaPortal.js +12 -0
- package/src/client/components/default/CommonDefault.js +29 -0
- package/src/client/components/default/CssDefault.js +27 -0
- package/src/client/components/default/ElementsDefault.js +38 -0
- package/src/client/components/default/LogInDefault.js +14 -0
- package/src/client/components/default/LogOutDefault.js +10 -0
- package/src/client/components/default/MenuDefault.js +743 -0
- package/src/client/components/default/RoutesDefault.js +48 -0
- package/src/client/components/default/SettingsDefault.js +16 -0
- package/src/client/components/default/SignUpDefault.js +9 -0
- package/src/client/components/default/SocketIoDefault.js +54 -0
- package/src/client/components/default/TranslateDefault.js +7 -0
- 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-precomposed.png +0 -0
- package/src/client/public/default/apple-touch-icon-114x114.png +0 -0
- package/src/client/public/default/apple-touch-icon-120x120-precomposed.png +0 -0
- package/src/client/public/default/apple-touch-icon-120x120.png +0 -0
- package/src/client/public/default/apple-touch-icon-144x144-precomposed.png +0 -0
- package/src/client/public/default/apple-touch-icon-144x144.png +0 -0
- package/src/client/public/default/apple-touch-icon-152x152-precomposed.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-precomposed.png +0 -0
- package/src/client/public/default/apple-touch-icon-180x180.png +0 -0
- package/src/client/public/default/apple-touch-icon-57x57-precomposed.png +0 -0
- package/src/client/public/default/apple-touch-icon-57x57.png +0 -0
- package/src/client/public/default/apple-touch-icon-60x60-precomposed.png +0 -0
- package/src/client/public/default/apple-touch-icon-60x60.png +0 -0
- package/src/client/public/default/apple-touch-icon-72x72-precomposed.png +0 -0
- package/src/client/public/default/apple-touch-icon-72x72.png +0 -0
- package/src/client/public/default/apple-touch-icon-76x76-precomposed.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/dark.jpg +0 -0
- package/src/client/public/default/assets/background/dark.svg +557 -0
- package/src/client/public/default/assets/background/white.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/default/assets/logo/base-icon.png +0 -0
- package/src/client/public/default/assets/logo/underpost.gif +0 -0
- package/src/client/public/default/assets/mailer/api-user-check.png +0 -0
- package/src/client/public/default/assets/mailer/api-user-default-avatar.png +0 -0
- package/src/client/public/default/assets/mailer/api-user-invalid-token.png +0 -0
- package/src/client/public/default/assets/mailer/api-user-recover.png +0 -0
- package/src/client/public/default/browserconfig.xml +12 -0
- 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 +69 -0
- 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/plantuml/client-conf.svg +1 -0
- package/src/client/public/default/plantuml/client-schema.svg +1 -0
- package/src/client/public/default/plantuml/cron-conf.svg +1 -0
- package/src/client/public/default/plantuml/cron-schema.svg +1 -0
- package/src/client/public/default/plantuml/server-conf.svg +1 -0
- package/src/client/public/default/plantuml/server-schema.svg +1 -0
- package/src/client/public/default/plantuml/ssr-conf.svg +1 -0
- package/src/client/public/default/plantuml/ssr-schema.svg +1 -0
- package/src/client/public/default/safari-pinned-tab.svg +24 -0
- package/src/client/public/default/site.webmanifest +69 -0
- package/src/client/public/default/sitemap +148 -0
- package/src/client/public/default/yandex-browser-50x50.png +0 -0
- package/src/client/public/default/yandex-browser-manifest.json +9 -0
- package/src/client/public/doc/favicon.ico +0 -0
- package/src/client/public/doc/sitemap +148 -0
- package/src/client/public/test/favicon.ico +0 -0
- package/src/client/public/test/sitemap +148 -0
- package/src/client/services/blockchain/blockchain.service.js +73 -0
- package/src/client/services/core/core.service.js +165 -0
- package/src/client/services/crypto/crypto.service.js +73 -0
- package/src/client/services/default/default.management.js +450 -0
- package/src/client/services/default/default.service.js +98 -0
- package/src/client/services/document/document.service.js +97 -0
- package/src/client/services/file/file.service.js +72 -0
- package/src/client/services/instance/instance.management.js +78 -0
- package/src/client/services/instance/instance.service.js +97 -0
- package/src/client/services/ipfs/ipfs.service.js +73 -0
- package/src/client/services/object-layer/object-layer.service.js +93 -0
- package/src/client/services/test/test.service.js +73 -0
- package/src/client/services/user/user.management.js +56 -0
- package/src/client/services/user/user.service.js +108 -0
- package/src/client/ssr/Render.js +237 -0
- package/src/client/ssr/body/404.js +73 -0
- package/src/client/ssr/body/500.js +72 -0
- package/src/client/ssr/body/CacheControl.js +114 -0
- package/src/client/ssr/body/CyberiaDefaultSplashScreen.js +90 -0
- package/src/client/ssr/body/CyberiaSplashScreenLore.js +424 -0
- package/src/client/ssr/body/DefaultSplashScreen.js +90 -0
- package/src/client/ssr/email/DefaultRecoverEmail.js +21 -0
- package/src/client/ssr/email/DefaultVerifyEmail.js +17 -0
- package/src/client/ssr/head/Css.js +241 -0
- package/src/client/ssr/head/CyberiaAdminScripts.js +6 -0
- package/src/client/ssr/head/CyberiaPortalScripts.js +6 -0
- package/src/client/ssr/head/CyberiaScripts.js +6 -0
- package/src/client/ssr/head/DefaultScripts.js +6 -0
- package/src/client/ssr/head/Microdata.js +11 -0
- package/src/client/ssr/head/Production.js +1 -0
- package/src/client/ssr/head/Pwa.js +146 -0
- package/src/client/ssr/head/Seo.js +15 -0
- package/src/client/ssr/mailer/DefaultRecoverEmail.js +21 -0
- package/src/client/ssr/mailer/DefaultVerifyEmail.js +17 -0
- package/src/client/ssr/offline/Maintenance.js +63 -0
- package/src/client/ssr/offline/NoNetworkConnection.js +67 -0
- package/src/client/ssr/pages/404.js +12 -0
- package/src/client/ssr/pages/500.js +12 -0
- package/src/client/ssr/pages/Test.js +198 -0
- package/src/client/ssr/pages/maintenance.js +14 -0
- package/src/client/ssr/pages/offline.js +21 -0
- package/src/client/sw/default.sw.js +108 -0
- package/src/client/sw/template.sw.js +84 -0
- package/src/client.build.js +22 -0
- package/src/client.dev.js +24 -0
- package/src/db/DataBaseProvider.js +98 -0
- package/src/db/mariadb/MariaDB.js +66 -0
- package/src/db/mongo/MongooseDB.js +70 -0
- package/src/index.js +198 -0
- package/src/mailer/EmailRender.js +116 -0
- package/src/mailer/MailerProvider.js +213 -0
- package/src/monitor.js +24 -0
- package/src/proxy.js +22 -0
- package/src/runtime/express/Express.js +256 -0
- package/src/runtime/lampp/Dockerfile +50 -0
- package/src/runtime/lampp/Lampp.js +343 -0
- package/src/server/auth.js +689 -0
- package/src/server/backup.js +96 -0
- package/src/server/client-build-docs.js +205 -0
- package/src/server/client-build-live.js +109 -0
- package/src/server/client-build.js +690 -0
- package/src/server/client-dev-server.js +87 -0
- package/src/server/client-formatted.js +87 -0
- package/src/server/client-icons.js +108 -0
- package/src/server/conf.js +1071 -0
- package/src/server/crypto.js +210 -0
- package/src/server/dns.js +276 -0
- package/src/server/downloader.js +74 -0
- package/src/server/json-schema.js +77 -0
- package/src/server/logger.js +197 -0
- package/src/server/network.js +72 -0
- package/src/server/object-layer.js +294 -0
- package/src/server/peer.js +69 -0
- package/src/server/process.js +171 -0
- package/src/server/proxy.js +110 -0
- package/src/server/runtime.js +170 -0
- package/src/server/ssr.js +127 -0
- package/src/server/start.js +161 -0
- package/src/server/tls.js +251 -0
- package/src/server/valkey.js +293 -0
- package/src/server.js +25 -0
- package/src/ws/IoInterface.js +139 -0
- package/src/ws/IoServer.js +88 -0
- package/src/ws/core/channels/core.ws.chat.js +23 -0
- package/src/ws/core/channels/core.ws.mailer.js +35 -0
- package/src/ws/core/channels/core.ws.stream.js +31 -0
- package/src/ws/core/core.ws.connection.js +62 -0
- package/src/ws/core/core.ws.emit.js +53 -0
- package/src/ws/core/core.ws.server.js +76 -0
- package/src/ws/core/management/core.ws.chat.js +8 -0
- package/src/ws/core/management/core.ws.mailer.js +16 -0
- package/src/ws/core/management/core.ws.stream.js +8 -0
- package/src/ws/cyberia/channels/cyberia.ws.bot.js +56 -0
- package/src/ws/cyberia/channels/cyberia.ws.skill.js +51 -0
- package/src/ws/cyberia/channels/cyberia.ws.user.js +437 -0
- package/src/ws/cyberia/cyberia.ws.connection.js +36 -0
- package/src/ws/cyberia/cyberia.ws.emit.js +14 -0
- package/src/ws/cyberia/cyberia.ws.server.js +67 -0
- package/src/ws/cyberia/management/cyberia.ws.bot.js +669 -0
- package/src/ws/cyberia/management/cyberia.ws.skill.js +441 -0
- package/src/ws/cyberia/management/cyberia.ws.user.js +188 -0
- package/src/ws/default/channels/default.ws.main.js +16 -0
- package/src/ws/default/default.ws.connection.js +22 -0
- package/src/ws/default/default.ws.emit.js +14 -0
- package/src/ws/default/default.ws.server.js +20 -0
- package/src/ws/default/management/default.ws.main.js +8 -0
- package/test/api.test.js +53 -0
- package/test/crypto.test.js +117 -0
|
@@ -0,0 +1,661 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deploy module for managing the deployment of applications and services.
|
|
3
|
+
* @module src/cli/deploy.js
|
|
4
|
+
* @namespace UnderpostDeploy
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import {
|
|
8
|
+
buildKindPorts,
|
|
9
|
+
buildPortProxyRouter,
|
|
10
|
+
buildProxyRouter,
|
|
11
|
+
Config,
|
|
12
|
+
deployRangePortFactory,
|
|
13
|
+
getDataDeploy,
|
|
14
|
+
loadReplicas,
|
|
15
|
+
pathPortAssignmentFactory,
|
|
16
|
+
} from '../server/conf.js';
|
|
17
|
+
import { loggerFactory } from '../server/logger.js';
|
|
18
|
+
import { shellExec } from '../server/process.js';
|
|
19
|
+
import fs from 'fs-extra';
|
|
20
|
+
import dotenv from 'dotenv';
|
|
21
|
+
import UnderpostRootEnv from './env.js';
|
|
22
|
+
import UnderpostCluster from './cluster.js';
|
|
23
|
+
|
|
24
|
+
const logger = loggerFactory(import.meta);
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* @class UnderpostDeploy
|
|
28
|
+
* @description Manages the deployment of applications and services.
|
|
29
|
+
* This class provides a set of static methods to handle the deployment process,
|
|
30
|
+
* including resource allocation, configuration management, and Kubernetes deployment.
|
|
31
|
+
* @memberof UnderpostDeploy
|
|
32
|
+
*/
|
|
33
|
+
class UnderpostDeploy {
|
|
34
|
+
static NETWORK = {};
|
|
35
|
+
static API = {
|
|
36
|
+
/**
|
|
37
|
+
* Synchronizes deployment configurations for a list of deployments.
|
|
38
|
+
* @param {string} deployList - List of deployment IDs to synchronize.
|
|
39
|
+
* @param {object} options - Options for the synchronization process.
|
|
40
|
+
* @param {string} options.versions - Comma-separated list of versions to deploy.
|
|
41
|
+
* @param {string} options.replicas - Number of replicas for each deployment.
|
|
42
|
+
* @param {string} options.node - Node name for resource allocation.
|
|
43
|
+
* @returns {object} - Deployment data for the specified deployments.
|
|
44
|
+
* @memberof UnderpostDeploy
|
|
45
|
+
*/
|
|
46
|
+
sync(deployList, { versions, replicas, node }) {
|
|
47
|
+
const deployGroupId = 'dd.router';
|
|
48
|
+
fs.writeFileSync(`./engine-private/deploy/${deployGroupId}`, deployList, 'utf8');
|
|
49
|
+
const totalPods = deployList.split(',').length * versions.split(',').length * parseInt(replicas);
|
|
50
|
+
const limitFactor = 0.8;
|
|
51
|
+
const reserveFactor = 0.05;
|
|
52
|
+
const resources = UnderpostCluster.API.getResourcesCapacity(node);
|
|
53
|
+
const memory = parseInt(resources.memory.value / totalPods);
|
|
54
|
+
const cpu = parseInt(resources.cpu.value / totalPods);
|
|
55
|
+
UnderpostRootEnv.API.set(
|
|
56
|
+
'resources.requests.memory',
|
|
57
|
+
`${parseInt(memory * reserveFactor)}${resources.memory.unit}`,
|
|
58
|
+
);
|
|
59
|
+
UnderpostRootEnv.API.set('resources.requests.cpu', `${parseInt(cpu * reserveFactor)}${resources.cpu.unit}`);
|
|
60
|
+
UnderpostRootEnv.API.set('resources.limits.memory', `${parseInt(memory * limitFactor)}${resources.memory.unit}`);
|
|
61
|
+
UnderpostRootEnv.API.set('resources.limits.cpu', `${parseInt(cpu * limitFactor)}${resources.cpu.unit}`);
|
|
62
|
+
UnderpostRootEnv.API.set('total-pods', totalPods);
|
|
63
|
+
return getDataDeploy({
|
|
64
|
+
buildSingleReplica: true,
|
|
65
|
+
deployGroupId,
|
|
66
|
+
});
|
|
67
|
+
},
|
|
68
|
+
/**
|
|
69
|
+
* Creates a router configuration for a list of deployments.
|
|
70
|
+
* @param {string} deployList - List of deployment IDs to include in the router.
|
|
71
|
+
* @param {string} env - Environment for which the router is being created.
|
|
72
|
+
* @returns {object} - Router configuration for the specified deployments.
|
|
73
|
+
* @memberof UnderpostDeploy
|
|
74
|
+
*/
|
|
75
|
+
async routerFactory(deployList, env) {
|
|
76
|
+
const initEnvPath = `./engine-private/conf/${deployList.split(',')[0]}/.env.${env}`;
|
|
77
|
+
const initEnvObj = dotenv.parse(fs.readFileSync(initEnvPath, 'utf8'));
|
|
78
|
+
process.env.PORT = initEnvObj.PORT;
|
|
79
|
+
process.env.NODE_ENV = env;
|
|
80
|
+
await Config.build('proxy', deployList);
|
|
81
|
+
return buildPortProxyRouter(env === 'development' ? 80 : 443, buildProxyRouter());
|
|
82
|
+
},
|
|
83
|
+
/**
|
|
84
|
+
* Creates a YAML service configuration for a deployment.
|
|
85
|
+
* @param {string} deployId - Deployment ID for which the service is being created.
|
|
86
|
+
* @param {string} env - Environment for which the service is being created.
|
|
87
|
+
* @param {number} port - Port number for the service.
|
|
88
|
+
* @param {Array<string>} deploymentVersions - List of deployment versions.
|
|
89
|
+
* @returns {string} - YAML service configuration for the specified deployment.
|
|
90
|
+
* @memberof UnderpostDeploy
|
|
91
|
+
*/
|
|
92
|
+
deploymentYamlServiceFactory({ deployId, env, port, deploymentVersions }) {
|
|
93
|
+
return deploymentVersions
|
|
94
|
+
.map(
|
|
95
|
+
(version, i) => ` - name: ${deployId}-${env}-${version}-service
|
|
96
|
+
port: ${port}
|
|
97
|
+
weight: ${i === 0 ? 100 : 0}
|
|
98
|
+
`,
|
|
99
|
+
)
|
|
100
|
+
.join('');
|
|
101
|
+
},
|
|
102
|
+
/**
|
|
103
|
+
* Creates a YAML deployment configuration for a deployment.
|
|
104
|
+
* @param {string} deployId - Deployment ID for which the deployment is being created.
|
|
105
|
+
* @param {string} env - Environment for which the deployment is being created.
|
|
106
|
+
* @param {string} suffix - Suffix for the deployment.
|
|
107
|
+
* @param {object} resources - Resource configuration for the deployment.
|
|
108
|
+
* @param {number} replicas - Number of replicas for the deployment.
|
|
109
|
+
* @param {string} image - Docker image for the deployment.
|
|
110
|
+
* @returns {string} - YAML deployment configuration for the specified deployment.
|
|
111
|
+
* @memberof UnderpostDeploy
|
|
112
|
+
*/
|
|
113
|
+
deploymentYamlPartsFactory({ deployId, env, suffix, resources, replicas, image }) {
|
|
114
|
+
const packageJson = JSON.parse(fs.readFileSync('./package.json', 'utf8'));
|
|
115
|
+
return `apiVersion: apps/v1
|
|
116
|
+
kind: Deployment
|
|
117
|
+
metadata:
|
|
118
|
+
name: ${deployId}-${env}-${suffix}
|
|
119
|
+
labels:
|
|
120
|
+
app: ${deployId}-${env}-${suffix}
|
|
121
|
+
spec:
|
|
122
|
+
replicas: ${replicas}
|
|
123
|
+
selector:
|
|
124
|
+
matchLabels:
|
|
125
|
+
app: ${deployId}-${env}-${suffix}
|
|
126
|
+
template:
|
|
127
|
+
metadata:
|
|
128
|
+
labels:
|
|
129
|
+
app: ${deployId}-${env}-${suffix}
|
|
130
|
+
spec:
|
|
131
|
+
containers:
|
|
132
|
+
- name: ${deployId}-${env}-${suffix}
|
|
133
|
+
image: ${image ?? `localhost/rockylinux9-underpost:v${packageJson.version}`}
|
|
134
|
+
# resources:
|
|
135
|
+
# requests:
|
|
136
|
+
# memory: "${resources.requests.memory}"
|
|
137
|
+
# cpu: "${resources.requests.cpu}"
|
|
138
|
+
# limits:
|
|
139
|
+
# memory: "${resources.limits.memory}"
|
|
140
|
+
# cpu: "${resources.limits.cpu}"
|
|
141
|
+
command:
|
|
142
|
+
- /bin/sh
|
|
143
|
+
- -c
|
|
144
|
+
- >
|
|
145
|
+
npm install -g npm@11.2.0 &&
|
|
146
|
+
npm install -g underpost &&
|
|
147
|
+
underpost secret underpost --create-from-file /etc/config/.env.${env} &&
|
|
148
|
+
underpost start --build --run ${deployId} ${env}
|
|
149
|
+
volumeMounts:
|
|
150
|
+
- name: config-volume
|
|
151
|
+
mountPath: /etc/config
|
|
152
|
+
volumes:
|
|
153
|
+
- name: config-volume
|
|
154
|
+
configMap:
|
|
155
|
+
name: underpost-config
|
|
156
|
+
---
|
|
157
|
+
apiVersion: v1
|
|
158
|
+
kind: Service
|
|
159
|
+
metadata:
|
|
160
|
+
name: ${deployId}-${env}-${suffix}-service
|
|
161
|
+
spec:
|
|
162
|
+
selector:
|
|
163
|
+
app: ${deployId}-${env}-${suffix}
|
|
164
|
+
ports:
|
|
165
|
+
{{ports}} type: LoadBalancer`;
|
|
166
|
+
},
|
|
167
|
+
/**
|
|
168
|
+
* Builds a manifest for a list of deployments.
|
|
169
|
+
* @param {string} deployList - List of deployment IDs to include in the manifest.
|
|
170
|
+
* @param {string} env - Environment for which the manifest is being built.
|
|
171
|
+
* @param {object} options - Options for the manifest build process.
|
|
172
|
+
* @param {string} options.replicas - Number of replicas for each deployment.
|
|
173
|
+
* @param {string} options.image - Docker image for the deployment.
|
|
174
|
+
* @returns {Promise<void>} - Promise that resolves when the manifest is built.
|
|
175
|
+
* @memberof UnderpostDeploy
|
|
176
|
+
*/
|
|
177
|
+
async buildManifest(deployList, env, options) {
|
|
178
|
+
const resources = UnderpostDeploy.API.resourcesFactory();
|
|
179
|
+
const replicas = options.replicas;
|
|
180
|
+
const image = options.image;
|
|
181
|
+
|
|
182
|
+
for (const _deployId of deployList.split(',')) {
|
|
183
|
+
const deployId = _deployId.trim();
|
|
184
|
+
if (!deployId) continue;
|
|
185
|
+
const confServer = loadReplicas(
|
|
186
|
+
JSON.parse(fs.readFileSync(`./engine-private/conf/${deployId}/conf.server.json`, 'utf8')),
|
|
187
|
+
);
|
|
188
|
+
const router = await UnderpostDeploy.API.routerFactory(deployId, env);
|
|
189
|
+
const pathPortAssignmentData = pathPortAssignmentFactory(router, confServer);
|
|
190
|
+
const { fromPort, toPort } = deployRangePortFactory(router);
|
|
191
|
+
const deploymentVersions = options.versions.split(',');
|
|
192
|
+
fs.mkdirSync(`./engine-private/conf/${deployId}/build/${env}`, { recursive: true });
|
|
193
|
+
if (env === 'development') fs.mkdirSync(`./manifests/deployment/${deployId}-${env}`, { recursive: true });
|
|
194
|
+
|
|
195
|
+
logger.info('port range', { deployId, fromPort, toPort });
|
|
196
|
+
|
|
197
|
+
let deploymentYamlParts = '';
|
|
198
|
+
for (const deploymentVersion of deploymentVersions) {
|
|
199
|
+
deploymentYamlParts += `---
|
|
200
|
+
${UnderpostDeploy.API.deploymentYamlPartsFactory({
|
|
201
|
+
deployId,
|
|
202
|
+
env,
|
|
203
|
+
suffix: deploymentVersion,
|
|
204
|
+
resources,
|
|
205
|
+
replicas,
|
|
206
|
+
image,
|
|
207
|
+
}).replace('{{ports}}', buildKindPorts(fromPort, toPort))}
|
|
208
|
+
`;
|
|
209
|
+
}
|
|
210
|
+
fs.writeFileSync(`./engine-private/conf/${deployId}/build/${env}/deployment.yaml`, deploymentYamlParts, 'utf8');
|
|
211
|
+
|
|
212
|
+
let proxyYaml = '';
|
|
213
|
+
let secretYaml = '';
|
|
214
|
+
|
|
215
|
+
for (const host of Object.keys(confServer)) {
|
|
216
|
+
if (env === 'production') secretYaml += UnderpostDeploy.API.buildCertManagerCertificate({ host });
|
|
217
|
+
|
|
218
|
+
const pathPortAssignment = pathPortAssignmentData[host];
|
|
219
|
+
// logger.info('', { host, pathPortAssignment });
|
|
220
|
+
proxyYaml += `
|
|
221
|
+
---
|
|
222
|
+
apiVersion: projectcontour.io/v1
|
|
223
|
+
kind: HTTPProxy
|
|
224
|
+
metadata:
|
|
225
|
+
name: ${host}
|
|
226
|
+
spec:
|
|
227
|
+
virtualhost:
|
|
228
|
+
fqdn: ${host}${
|
|
229
|
+
env === 'development'
|
|
230
|
+
? ''
|
|
231
|
+
: `
|
|
232
|
+
tls:
|
|
233
|
+
secretName: ${host}`
|
|
234
|
+
}
|
|
235
|
+
routes:`;
|
|
236
|
+
for (const conditionObj of pathPortAssignment) {
|
|
237
|
+
const { path, port } = conditionObj;
|
|
238
|
+
proxyYaml += `
|
|
239
|
+
- conditions:
|
|
240
|
+
- prefix: ${path}
|
|
241
|
+
enableWebsockets: true
|
|
242
|
+
services:
|
|
243
|
+
${UnderpostDeploy.API.deploymentYamlServiceFactory({
|
|
244
|
+
deployId,
|
|
245
|
+
env,
|
|
246
|
+
port,
|
|
247
|
+
deploymentVersions:
|
|
248
|
+
options.traffic && typeof options.traffic === 'string' ? options.traffic.split(',') : ['blue'],
|
|
249
|
+
})}`;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
const yamlPath = `./engine-private/conf/${deployId}/build/${env}/proxy.yaml`;
|
|
253
|
+
fs.writeFileSync(yamlPath, proxyYaml, 'utf8');
|
|
254
|
+
if (env === 'production') {
|
|
255
|
+
const yamlPath = `./engine-private/conf/${deployId}/build/${env}/secret.yaml`;
|
|
256
|
+
fs.writeFileSync(yamlPath, secretYaml, 'utf8');
|
|
257
|
+
} else {
|
|
258
|
+
const deploymentsFiles = ['Dockerfile', 'proxy.yaml', 'deployment.yaml'];
|
|
259
|
+
for (const file of deploymentsFiles) {
|
|
260
|
+
if (fs.existsSync(`./engine-private/conf/${deployId}/build/${env}/${file}`)) {
|
|
261
|
+
fs.copyFileSync(
|
|
262
|
+
`./engine-private/conf/${deployId}/build/${env}/${file}`,
|
|
263
|
+
`./manifests/deployment/${deployId}-${env}/${file}`,
|
|
264
|
+
);
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
},
|
|
270
|
+
/**
|
|
271
|
+
* Builds a Certificate resource for a host using cert-manager.
|
|
272
|
+
* @param {string} host - Hostname for which the certificate is being built.
|
|
273
|
+
* @returns {string} - Certificate resource YAML for the specified host.
|
|
274
|
+
* @memberof UnderpostDeploy
|
|
275
|
+
*/
|
|
276
|
+
buildCertManagerCertificate({ host }) {
|
|
277
|
+
return `
|
|
278
|
+
---
|
|
279
|
+
apiVersion: cert-manager.io/v1
|
|
280
|
+
kind: Certificate
|
|
281
|
+
metadata:
|
|
282
|
+
name: ${host}
|
|
283
|
+
spec:
|
|
284
|
+
commonName: ${host}
|
|
285
|
+
dnsNames:
|
|
286
|
+
- ${host}
|
|
287
|
+
issuerRef:
|
|
288
|
+
name: letsencrypt-prod
|
|
289
|
+
kind: ClusterIssuer
|
|
290
|
+
secretName: ${host}`;
|
|
291
|
+
},
|
|
292
|
+
/**
|
|
293
|
+
* Retrieves the current traffic status for a deployment.
|
|
294
|
+
* @param {string} deployId - Deployment ID for which the traffic status is being retrieved.
|
|
295
|
+
* @returns {string|null} - Current traffic status ('blue' or 'green') or null if not found.
|
|
296
|
+
* @memberof UnderpostDeploy
|
|
297
|
+
*/
|
|
298
|
+
getCurrentTraffic(deployId) {
|
|
299
|
+
// kubectl get deploy,sts,svc,configmap,secret -n default -o yaml --export > default.yaml
|
|
300
|
+
const hostTest = Object.keys(
|
|
301
|
+
JSON.parse(fs.readFileSync(`./engine-private/conf/${deployId}/conf.server.json`, 'utf8')),
|
|
302
|
+
)[0];
|
|
303
|
+
const info = shellExec(`sudo kubectl get HTTPProxy/${hostTest} -o yaml`, { silent: true, stdout: true });
|
|
304
|
+
return info.match('blue') ? 'blue' : info.match('green') ? 'green' : null;
|
|
305
|
+
},
|
|
306
|
+
|
|
307
|
+
/**
|
|
308
|
+
* Callback function for handling deployment options.
|
|
309
|
+
* @param {string} deployList - List of deployment IDs to include in the manifest.
|
|
310
|
+
* @param {string} env - Environment for which the manifest is being built.
|
|
311
|
+
* @param {object} options - Options for the manifest build process.
|
|
312
|
+
* @param {string} options.remove - Whether to remove the deployment.
|
|
313
|
+
* @param {string} options.infoRouter - Whether to display router information.
|
|
314
|
+
* @param {string} options.sync - Whether to synchronize the deployment.
|
|
315
|
+
* @param {string} options.buildManifest - Whether to build the manifest.
|
|
316
|
+
* @param {string} options.infoUtil - Whether to display utility information.
|
|
317
|
+
* @param {string} options.expose - Whether to expose the deployment.
|
|
318
|
+
* @param {string} options.cert - Whether to create a certificate.
|
|
319
|
+
* @param {string} options.certHosts - List of hosts for which certificates are being created.
|
|
320
|
+
* @param {string} options.versions - Comma-separated list of versions to deploy.
|
|
321
|
+
* @param {string} options.image - Docker image for the deployment.
|
|
322
|
+
* @param {string} options.traffic - Current traffic status for the deployment.
|
|
323
|
+
* @param {string} options.replicas - Number of replicas for the deployment.
|
|
324
|
+
* @param {string} options.node - Node name for resource allocation.
|
|
325
|
+
* @param {string} options.restoreHosts - Whether to restore hosts.
|
|
326
|
+
* @param {string} options.disableUpdateDeployment - Whether to disable updating the deployment.
|
|
327
|
+
* @param {string} options.infoTraffic - Whether to display traffic information.
|
|
328
|
+
* @param {string} options.etcHosts - Whether to update /etc/hosts.
|
|
329
|
+
* @returns {Promise<void>} - Promise that resolves when the callback is complete.
|
|
330
|
+
* @memberof UnderpostDeploy
|
|
331
|
+
*/
|
|
332
|
+
async callback(
|
|
333
|
+
deployList = '',
|
|
334
|
+
env = 'development',
|
|
335
|
+
options = {
|
|
336
|
+
remove: false,
|
|
337
|
+
infoRouter: false,
|
|
338
|
+
sync: false,
|
|
339
|
+
buildManifest: false,
|
|
340
|
+
infoUtil: false,
|
|
341
|
+
expose: false,
|
|
342
|
+
cert: false,
|
|
343
|
+
certHosts: '',
|
|
344
|
+
versions: '',
|
|
345
|
+
image: '',
|
|
346
|
+
traffic: '',
|
|
347
|
+
replicas: '',
|
|
348
|
+
node: '',
|
|
349
|
+
restoreHosts: false,
|
|
350
|
+
disableUpdateDeployment: false,
|
|
351
|
+
infoTraffic: false,
|
|
352
|
+
etcHosts: false,
|
|
353
|
+
},
|
|
354
|
+
) {
|
|
355
|
+
if (options.infoUtil === true)
|
|
356
|
+
return logger.info(`
|
|
357
|
+
kubectl rollout restart deployment/deployment-name
|
|
358
|
+
kubectl rollout undo deployment/deployment-name
|
|
359
|
+
kubectl scale statefulsets <stateful-set-name> --replicas=<new-replicas>
|
|
360
|
+
kubectl get pods -w
|
|
361
|
+
kubectl patch statefulset valkey-service --type='json' -p='[{"op": "replace", "path": "/spec/template/spec/containers/0/image", "value":"valkey/valkey:latest"}]'
|
|
362
|
+
kubectl patch statefulset valkey-service -p '{"spec":{"template":{"spec":{"containers":[{"name":"valkey-service","imagePullPolicy":"Never"}]}}}}'
|
|
363
|
+
kubectl logs -f <pod-name>
|
|
364
|
+
kubectl describe pod <pod-name>
|
|
365
|
+
kubectl exec -it <pod-name> -- bash
|
|
366
|
+
kubectl exec -it <pod-name> -- sh
|
|
367
|
+
docker exec -it kind-control-plane bash
|
|
368
|
+
curl -4 -v google.com
|
|
369
|
+
kubectl taint nodes <node-name> node-role.kubernetes.io/control-plane:NoSchedule-
|
|
370
|
+
kubectl run test-pod --image=busybox:latest --restart=Never -- /bin/sh -c "while true; do sleep 30; done;"
|
|
371
|
+
kubectl run test-pod --image=alpine/curl:latest --restart=Never -- sh -c "sleep infinity"
|
|
372
|
+
kubectl get ippools -o yaml
|
|
373
|
+
kubectl get node <node-name> -o jsonpath='{.spec.podCIDR}'
|
|
374
|
+
kubectl patch ippool default-ipv4-ippool --type='json' -p='[{"op": "replace", "path": "/spec/cidr", "value": "10.244.0.0/16"}]'
|
|
375
|
+
kubectl patch ippool default-ipv4-ippool --type='json' -p='[{"op": "replace", "path": "/spec/cidr", "value": "192.168.0.0/24"}]'
|
|
376
|
+
sudo podman run --rm localhost/<image-name>:<image-version> <command>
|
|
377
|
+
kubectl get configmap kubelet-config -n kube-system -o yaml > kubelet-config.yaml
|
|
378
|
+
kubectl -n kube-system rollout restart daemonset kube-proxy
|
|
379
|
+
kubectl get EndpointSlice -o wide --all-namespaces -w
|
|
380
|
+
kubectl apply -k manifests/deployment/adminer/.
|
|
381
|
+
kubectl wait --for=condition=Ready pod/busybox1
|
|
382
|
+
kubectl wait --for=jsonpath='{.status.phase}'=Running pod/busybox1
|
|
383
|
+
kubectl wait --for='jsonpath={.status.conditions[?(@.type=="Ready")].status}=True' pod/busybox1
|
|
384
|
+
kubectl wait --for=delete pod/busybox1 --timeout=60s
|
|
385
|
+
|
|
386
|
+
kubectl run --rm -it test-dns --image=busybox:latest --restart=Never -- /bin/sh -c "
|
|
387
|
+
nslookup kubernetes.default.svc.cluster.local;
|
|
388
|
+
nslookup mongodb-service.default.svc.cluster.local;
|
|
389
|
+
nslookup valkey-service.default.svc.cluster.local;
|
|
390
|
+
nc -vz mongodb-service 27017;
|
|
391
|
+
nc -vz valkey-service 6379;
|
|
392
|
+
echo exit code: \\\$?
|
|
393
|
+
"
|
|
394
|
+
|
|
395
|
+
kubectl apply -f - <<EOF
|
|
396
|
+
apiVersion: apps/v1
|
|
397
|
+
kind: StatefulSet
|
|
398
|
+
metadata:
|
|
399
|
+
name: ...
|
|
400
|
+
EOF
|
|
401
|
+
|
|
402
|
+
https://org.ngc.nvidia.com/setup/api-keys
|
|
403
|
+
docker login nvcr.io
|
|
404
|
+
Username: $oauthtoken
|
|
405
|
+
Password: <Your Key>
|
|
406
|
+
`);
|
|
407
|
+
if (!deployList && options.certHosts) {
|
|
408
|
+
for (const host of options.certHosts.split(',')) {
|
|
409
|
+
shellExec(`sudo kubectl apply -f - <<EOF
|
|
410
|
+
${UnderpostDeploy.API.buildCertManagerCertificate({ host })}
|
|
411
|
+
EOF`);
|
|
412
|
+
}
|
|
413
|
+
return;
|
|
414
|
+
} else if (!deployList) deployList = 'dd-default';
|
|
415
|
+
if (deployList === 'dd' && fs.existsSync(`./engine-private/deploy/dd.router`))
|
|
416
|
+
deployList = fs.readFileSync(`./engine-private/deploy/dd.router`, 'utf8');
|
|
417
|
+
if (options.infoTraffic === true) {
|
|
418
|
+
for (const _deployId of deployList.split(',')) {
|
|
419
|
+
const deployId = _deployId.trim();
|
|
420
|
+
logger.info('', {
|
|
421
|
+
deployId,
|
|
422
|
+
env,
|
|
423
|
+
traffic: UnderpostDeploy.API.getCurrentTraffic(deployId),
|
|
424
|
+
router: await UnderpostDeploy.API.routerFactory(deployId, env),
|
|
425
|
+
pods: await UnderpostDeploy.API.get(deployId),
|
|
426
|
+
});
|
|
427
|
+
}
|
|
428
|
+
return;
|
|
429
|
+
}
|
|
430
|
+
if (!(options.versions && typeof options.versions === 'string')) options.versions = 'blue,green';
|
|
431
|
+
if (!options.replicas) options.replicas = 1;
|
|
432
|
+
if (options.sync) UnderpostDeploy.API.sync(deployList, options);
|
|
433
|
+
if (options.buildManifest === true) await UnderpostDeploy.API.buildManifest(deployList, env, options);
|
|
434
|
+
if (options.infoRouter === true || options.buildManifest === true) {
|
|
435
|
+
logger.info('router', await UnderpostDeploy.API.routerFactory(deployList, env));
|
|
436
|
+
return;
|
|
437
|
+
}
|
|
438
|
+
UnderpostDeploy.API.configMap(env);
|
|
439
|
+
let renderHosts = '';
|
|
440
|
+
let etcHosts = [];
|
|
441
|
+
if (options.restoreHosts === true) {
|
|
442
|
+
const factoryResult = UnderpostDeploy.API.etcHostFactory(etcHosts);
|
|
443
|
+
renderHosts = factoryResult.renderHosts;
|
|
444
|
+
logger.info(renderHosts);
|
|
445
|
+
return;
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
for (const _deployId of deployList.split(',')) {
|
|
449
|
+
const deployId = _deployId.trim();
|
|
450
|
+
if (!deployId) continue;
|
|
451
|
+
if (options.expose === true) {
|
|
452
|
+
const svc = UnderpostDeploy.API.get(deployId, 'svc')[0];
|
|
453
|
+
const port = parseInt(svc[`PORT(S)`].split('/TCP')[0]);
|
|
454
|
+
logger.info(deployId, {
|
|
455
|
+
svc,
|
|
456
|
+
port,
|
|
457
|
+
});
|
|
458
|
+
shellExec(`sudo kubectl port-forward -n default svc/${svc.NAME} ${port}:${port}`, { async: true });
|
|
459
|
+
continue;
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
if (!options.disableUpdateDeployment)
|
|
463
|
+
for (const version of options.versions.split(',')) {
|
|
464
|
+
shellExec(`sudo kubectl delete svc ${deployId}-${env}-${version}-service`);
|
|
465
|
+
shellExec(`sudo kubectl delete deployment ${deployId}-${env}-${version}`);
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
const confServer = JSON.parse(fs.readFileSync(`./engine-private/conf/${deployId}/conf.server.json`, 'utf8'));
|
|
469
|
+
for (const host of Object.keys(confServer)) {
|
|
470
|
+
shellExec(`sudo kubectl delete HTTPProxy ${host}`);
|
|
471
|
+
if (UnderpostDeploy.API.isValidTLSContext({ host, env, options }))
|
|
472
|
+
shellExec(`sudo kubectl delete Certificate ${host}`);
|
|
473
|
+
if (!options.remove === true && env === 'development') etcHosts.push(host);
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
const manifestsPath =
|
|
477
|
+
env === 'production'
|
|
478
|
+
? `engine-private/conf/${deployId}/build/production`
|
|
479
|
+
: `manifests/deployment/${deployId}-${env}`;
|
|
480
|
+
|
|
481
|
+
if (!options.remove === true) {
|
|
482
|
+
if (!options.disableUpdateDeployment) shellExec(`sudo kubectl apply -f ./${manifestsPath}/deployment.yaml`);
|
|
483
|
+
shellExec(`sudo kubectl apply -f ./${manifestsPath}/proxy.yaml`);
|
|
484
|
+
|
|
485
|
+
if (UnderpostDeploy.API.isValidTLSContext({ host: Object.keys(confServer)[0], env, options }))
|
|
486
|
+
shellExec(`sudo kubectl apply -f ./${manifestsPath}/secret.yaml`);
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
if (options.etcHosts === true) {
|
|
490
|
+
const factoryResult = UnderpostDeploy.API.etcHostFactory(etcHosts);
|
|
491
|
+
renderHosts = factoryResult.renderHosts;
|
|
492
|
+
}
|
|
493
|
+
if (renderHosts)
|
|
494
|
+
logger.info(
|
|
495
|
+
`
|
|
496
|
+
` + renderHosts,
|
|
497
|
+
);
|
|
498
|
+
},
|
|
499
|
+
/**
|
|
500
|
+
* Retrieves information about a deployment.
|
|
501
|
+
* @param {string} deployId - Deployment ID for which information is being retrieved.
|
|
502
|
+
* @param {string} kindType - Type of Kubernetes resource to retrieve information for (e.g. 'pods').
|
|
503
|
+
* @returns {Array<object>} - Array of objects containing information about the deployment.
|
|
504
|
+
* @memberof UnderpostDeploy
|
|
505
|
+
*/
|
|
506
|
+
get(deployId, kindType = 'pods') {
|
|
507
|
+
const raw = shellExec(`sudo kubectl get ${kindType} --all-namespaces -o wide`, {
|
|
508
|
+
stdout: true,
|
|
509
|
+
disableLog: true,
|
|
510
|
+
silent: true,
|
|
511
|
+
});
|
|
512
|
+
|
|
513
|
+
const heads = raw
|
|
514
|
+
.split(`\n`)[0]
|
|
515
|
+
.split(' ')
|
|
516
|
+
.filter((_r) => _r.trim());
|
|
517
|
+
|
|
518
|
+
const pods = raw
|
|
519
|
+
.split(`\n`)
|
|
520
|
+
.filter((r) => (deployId ? r.match(deployId) : r.trim() && !r.match('NAME')))
|
|
521
|
+
.map((r) => r.split(' ').filter((_r) => _r.trim()));
|
|
522
|
+
|
|
523
|
+
const result = [];
|
|
524
|
+
|
|
525
|
+
for (const row of pods) {
|
|
526
|
+
const pod = {};
|
|
527
|
+
let index = -1;
|
|
528
|
+
for (const head of heads) {
|
|
529
|
+
index++;
|
|
530
|
+
pod[head] = row[index];
|
|
531
|
+
}
|
|
532
|
+
result.push(pod);
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
return result;
|
|
536
|
+
},
|
|
537
|
+
/**
|
|
538
|
+
* Retrieves the resources factory for a deployment.
|
|
539
|
+
* @returns {object} - Object containing the resources factory for the deployment.
|
|
540
|
+
* @memberof UnderpostDeploy
|
|
541
|
+
*/
|
|
542
|
+
resourcesFactory() {
|
|
543
|
+
return {
|
|
544
|
+
requests: {
|
|
545
|
+
memory: UnderpostRootEnv.API.get('resources.requests.memory'),
|
|
546
|
+
cpu: UnderpostRootEnv.API.get('resources.requests.cpu'),
|
|
547
|
+
},
|
|
548
|
+
limits: {
|
|
549
|
+
memory: UnderpostRootEnv.API.get('resources.limits.memory'),
|
|
550
|
+
cpu: UnderpostRootEnv.API.get('resources.limits.cpu'),
|
|
551
|
+
},
|
|
552
|
+
totalPods: UnderpostRootEnv.API.get('total-pods'),
|
|
553
|
+
};
|
|
554
|
+
},
|
|
555
|
+
/**
|
|
556
|
+
* Checks if a container file exists in a pod.
|
|
557
|
+
* @param {object} options - Options for the check.
|
|
558
|
+
* @param {string} options.podName - Name of the pod to check.
|
|
559
|
+
* @param {string} options.path - Path to the container file to check.
|
|
560
|
+
* @returns {boolean} - True if the container file exists, false otherwise.
|
|
561
|
+
* @memberof UnderpostDeploy
|
|
562
|
+
*/
|
|
563
|
+
existsContainerFile({ podName, path }) {
|
|
564
|
+
return JSON.parse(
|
|
565
|
+
shellExec(`kubectl exec ${podName} -- test -f ${path} && echo "true" || echo "false"`, {
|
|
566
|
+
stdout: true,
|
|
567
|
+
disableLog: true,
|
|
568
|
+
silent: true,
|
|
569
|
+
}).trim(),
|
|
570
|
+
);
|
|
571
|
+
},
|
|
572
|
+
/**
|
|
573
|
+
* Checks the status of a deployment.
|
|
574
|
+
* @param {string} deployId - Deployment ID for which the status is being checked.
|
|
575
|
+
* @param {string} env - Environment for which the status is being checked.
|
|
576
|
+
* @param {string} traffic - Current traffic status for the deployment.
|
|
577
|
+
* @param {Array<string>} ignoresNames - List of pod names to ignore.
|
|
578
|
+
* @returns {object} - Object containing the status of the deployment.
|
|
579
|
+
* @memberof UnderpostDeploy
|
|
580
|
+
*/
|
|
581
|
+
checkDeploymentReadyStatus(deployId, env, traffic, ignoresNames = []) {
|
|
582
|
+
const cmd = `underpost config get container-status`;
|
|
583
|
+
const pods = UnderpostDeploy.API.get(`${deployId}-${env}-${traffic}`);
|
|
584
|
+
const readyPods = [];
|
|
585
|
+
const notReadyPods = [];
|
|
586
|
+
for (const pod of pods) {
|
|
587
|
+
const { NAME } = pod;
|
|
588
|
+
if (ignoresNames && ignoresNames.find((t) => NAME.trim().toLowerCase().match(t.trim().toLowerCase()))) continue;
|
|
589
|
+
if (
|
|
590
|
+
shellExec(`sudo kubectl exec -i ${NAME} -- sh -c "${cmd}"`, { stdout: true }).match(
|
|
591
|
+
`${deployId}-${env}-running-deployment`,
|
|
592
|
+
)
|
|
593
|
+
) {
|
|
594
|
+
readyPods.push(pod);
|
|
595
|
+
} else {
|
|
596
|
+
notReadyPods.push(pod);
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
return {
|
|
600
|
+
ready: pods.length > 0 && notReadyPods.length === 0,
|
|
601
|
+
notReadyPods,
|
|
602
|
+
readyPods,
|
|
603
|
+
};
|
|
604
|
+
},
|
|
605
|
+
/**
|
|
606
|
+
* Creates a configmap for a deployment.
|
|
607
|
+
* @param {string} env - Environment for which the configmap is being created.
|
|
608
|
+
* @memberof UnderpostDeploy
|
|
609
|
+
*/
|
|
610
|
+
configMap(env) {
|
|
611
|
+
shellExec(`kubectl delete configmap underpost-config`);
|
|
612
|
+
shellExec(
|
|
613
|
+
`kubectl create configmap underpost-config --from-file=/home/dd/engine/engine-private/conf/dd-cron/.env.${env}`,
|
|
614
|
+
);
|
|
615
|
+
},
|
|
616
|
+
/**
|
|
617
|
+
* Switches the traffic for a deployment.
|
|
618
|
+
* @param {string} deployId - Deployment ID for which the traffic is being switched.
|
|
619
|
+
* @param {string} env - Environment for which the traffic is being switched.
|
|
620
|
+
* @param {string} targetTraffic - Target traffic status for the deployment.
|
|
621
|
+
* @param {number} replicas - Number of replicas for the deployment.
|
|
622
|
+
* @memberof UnderpostDeploy
|
|
623
|
+
*/
|
|
624
|
+
switchTraffic(deployId, env, targetTraffic, replicas = 1) {
|
|
625
|
+
UnderpostRootEnv.API.set(`${deployId}-${env}-traffic`, targetTraffic);
|
|
626
|
+
shellExec(
|
|
627
|
+
`node bin deploy --info-router --build-manifest --traffic ${targetTraffic} --replicas ${replicas} ${deployId} ${env}`,
|
|
628
|
+
);
|
|
629
|
+
shellExec(`sudo kubectl apply -f ./engine-private/conf/${deployId}/build/${env}/proxy.yaml`);
|
|
630
|
+
},
|
|
631
|
+
/**
|
|
632
|
+
* Creates a hosts file for a deployment.
|
|
633
|
+
* @param {Array<string>} hosts - List of hosts to be added to the hosts file.
|
|
634
|
+
* @memberof UnderpostDeploy
|
|
635
|
+
*/
|
|
636
|
+
etcHostFactory(hosts = []) {
|
|
637
|
+
const renderHosts = `127.0.0.1 ${hosts.join(
|
|
638
|
+
' ',
|
|
639
|
+
)} localhost localhost.localdomain localhost4 localhost4.localdomain4
|
|
640
|
+
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6`;
|
|
641
|
+
|
|
642
|
+
fs.writeFileSync(`/etc/hosts`, renderHosts, 'utf8');
|
|
643
|
+
return { renderHosts };
|
|
644
|
+
},
|
|
645
|
+
/**
|
|
646
|
+
* Checks if a TLS context is valid.
|
|
647
|
+
* @param {object} options - Options for the check.
|
|
648
|
+
* @param {string} options.host - Host for which the TLS context is being checked.
|
|
649
|
+
* @param {string} options.env - Environment for which the TLS context is being checked.
|
|
650
|
+
* @param {object} options.options - Options for the TLS context check.
|
|
651
|
+
* @returns {boolean} - True if the TLS context is valid, false otherwise.
|
|
652
|
+
* @memberof UnderpostDeploy
|
|
653
|
+
*/
|
|
654
|
+
isValidTLSContext: ({ host, env, options }) =>
|
|
655
|
+
env === 'production' &&
|
|
656
|
+
options.cert === true &&
|
|
657
|
+
(!options.certHosts || options.certHosts.split(',').includes(host)),
|
|
658
|
+
};
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
export default UnderpostDeploy;
|