underpost 2.8.841 → 2.8.844
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/.env.development +1 -0
- package/.env.production +1 -0
- package/.env.test +1 -0
- package/.github/workflows/{ghpkg.yml → ghpkg.ci.yml} +1 -1
- package/.github/workflows/{npmpkg.yml → npmpkg.ci.yml} +1 -1
- package/.github/workflows/{publish.yml → publish.ci.yml} +1 -1
- package/.github/workflows/{pwa-microservices-template.page.yml → pwa-microservices-template-page.cd.yml} +1 -1
- package/.github/workflows/{pwa-microservices-template.test.yml → pwa-microservices-template-test.ci.yml} +1 -1
- package/.vscode/settings.json +0 -1
- package/README.md +16 -2
- package/bin/build.js +8 -4
- package/bin/deploy.js +10 -81
- package/bin/file.js +15 -8
- package/cli.md +48 -43
- package/docker-compose.yml +1 -1
- package/manifests/deployment/dd-template-development/deployment.yaml +2 -2
- package/manifests/maas/gpu-diag.sh +1 -1
- package/package.json +4 -5
- package/src/api/user/user.router.js +24 -1
- package/src/cli/cluster.js +19 -10
- package/src/cli/deploy.js +19 -0
- package/src/cli/index.js +9 -1
- package/src/cli/monitor.js +8 -12
- package/src/cli/run.js +80 -0
- package/src/client/components/core/CssCore.js +0 -4
- package/src/client/components/core/Docs.js +1 -47
- package/src/client/components/core/EventsUI.js +92 -5
- package/src/client/components/core/Modal.js +431 -87
- package/src/client/components/core/NotificationManager.js +2 -2
- package/src/client/components/core/Panel.js +2 -2
- package/src/client/components/core/PanelForm.js +2 -0
- package/src/client/components/core/Recover.js +1 -1
- package/src/index.js +1 -1
- package/src/monitor.js +24 -0
- package/src/server/client-build.js +0 -20
- package/src/server/valkey.js +102 -41
package/src/cli/index.js
CHANGED
|
@@ -86,7 +86,13 @@ program
|
|
|
86
86
|
.argument('<deploy-id>', `The deployment configuration ID. Use 'clean' to restore default environment settings.`)
|
|
87
87
|
.argument('[env]', 'Optional: The environment to set (e.g., "production", "development"). Defaults to "production".')
|
|
88
88
|
.description('Sets environment variables and configurations related to a specific deployment ID.')
|
|
89
|
-
.action(
|
|
89
|
+
.action((...args) => {
|
|
90
|
+
if (args[0] === 'current') {
|
|
91
|
+
console.log(process.env.DEPLOY_ID);
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
loadConf(...args);
|
|
95
|
+
});
|
|
90
96
|
|
|
91
97
|
// 'config' command: Manage Underpost configurations
|
|
92
98
|
program
|
|
@@ -112,6 +118,7 @@ program
|
|
|
112
118
|
.option('--mariadb', 'Initializes the cluster with a MariaDB statefulset.')
|
|
113
119
|
.option('--mysql', 'Initializes the cluster with a MySQL statefulset.')
|
|
114
120
|
.option('--mongodb', 'Initializes the cluster with a MongoDB statefulset.')
|
|
121
|
+
.option('--mongo-db-host <host>', 'Set custom mongo db host')
|
|
115
122
|
.option('--postgresql', 'Initializes the cluster with a PostgreSQL statefulset.')
|
|
116
123
|
.option('--mongodb4', 'Initializes the cluster with a MongoDB 4.4 service.')
|
|
117
124
|
.option('--valkey', 'Initializes the cluster with a Valkey service.')
|
|
@@ -326,6 +333,7 @@ program
|
|
|
326
333
|
.option('--pod-name <pod-name>', 'Optional: Specifies the pod name for test execution.')
|
|
327
334
|
.option('--volume-host-path <volume-host-path>', 'Optional: Specifies the volume host path for test execution.')
|
|
328
335
|
.option('--volume-mount-path <volume-mount-path>', 'Optional: Specifies the volume mount path for test execution.')
|
|
336
|
+
.option('--volume-type <volume-type>', 'Optional: Specifies the volume type for test execution.')
|
|
329
337
|
.option('--image-name <image-name>', 'Optional: Specifies the image name for test execution.')
|
|
330
338
|
.option('--container-name <container-name>', 'Optional: Specifies the container name for test execution.')
|
|
331
339
|
.option('--namespace <namespace>', 'Optional: Specifies the namespace for test execution.')
|
package/src/cli/monitor.js
CHANGED
|
@@ -173,19 +173,15 @@ class UnderpostMonitor {
|
|
|
173
173
|
monitorTrafficName = undefined;
|
|
174
174
|
monitorPodName = undefined;
|
|
175
175
|
}
|
|
176
|
-
const cmd = `underpost config get container-status`;
|
|
177
176
|
const checkDeploymentReadyStatus = () => {
|
|
178
|
-
const
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
monitorPodName = NAME;
|
|
187
|
-
monitorTrafficName = `${traffic}`;
|
|
188
|
-
}
|
|
177
|
+
const { ready, notReadyPods, readyPods } = UnderpostDeploy.API.checkDeploymentReadyStatus(
|
|
178
|
+
deployId,
|
|
179
|
+
env,
|
|
180
|
+
traffic,
|
|
181
|
+
);
|
|
182
|
+
if (ready) {
|
|
183
|
+
monitorPodName = readyPods[0].NAME;
|
|
184
|
+
monitorTrafficName = `${traffic}`;
|
|
189
185
|
}
|
|
190
186
|
};
|
|
191
187
|
if (!monitorPodName) {
|
package/src/cli/run.js
CHANGED
|
@@ -65,6 +65,27 @@ class UnderpostRun {
|
|
|
65
65
|
shellExec(`kubectl delete pod tf-gpu-test-pod`);
|
|
66
66
|
shellExec(`kubectl apply -f ${underpostRoot}/manifests/deployment/tensorflow/tf-gpu-test.yaml`);
|
|
67
67
|
},
|
|
68
|
+
'dev-cluster': (path, options = UnderpostRun.DEFAULT_OPTION) => {
|
|
69
|
+
const baseCommand = options.dev ? 'node bin' : 'underpost';
|
|
70
|
+
shellExec(`${baseCommand} cluster${options.dev ? ' --dev' : ''} --reset`);
|
|
71
|
+
shellExec(`${baseCommand} cluster${options.dev ? ' --dev' : ''}`);
|
|
72
|
+
shellExec(
|
|
73
|
+
`${baseCommand} cluster${options.dev ? ' --dev' : ''} --mongodb --mongo-db-host ${'127.0.0.1'} --pull-image`,
|
|
74
|
+
);
|
|
75
|
+
shellExec(`${baseCommand} cluster${options.dev ? ' --dev' : ''} --valkey --pull-image`);
|
|
76
|
+
shellExec(`${baseCommand} deploy --expose mongo`, { async: true });
|
|
77
|
+
shellExec(`${baseCommand} deploy --expose valkey`, { async: true });
|
|
78
|
+
},
|
|
79
|
+
'cyberia-ide': (path, options = UnderpostRun.DEFAULT_OPTION) => {
|
|
80
|
+
const baseCommand = options.dev ? 'node bin' : 'underpost';
|
|
81
|
+
shellExec(`${baseCommand} run ide /home/dd/cyberia-server`);
|
|
82
|
+
shellExec(`${baseCommand} run ide /home/dd/cyberia-client`);
|
|
83
|
+
},
|
|
84
|
+
'engine-ide': (path, options = UnderpostRun.DEFAULT_OPTION) => {
|
|
85
|
+
const baseCommand = options.dev ? 'node bin' : 'underpost';
|
|
86
|
+
shellExec(`${baseCommand} run ide /home/dd/engine`);
|
|
87
|
+
shellExec(`${baseCommand} run ide /home/dd/engine/engine-private`);
|
|
88
|
+
},
|
|
68
89
|
ide: (path, options = UnderpostRun.DEFAULT_OPTION) => {
|
|
69
90
|
const { underpostRoot } = options;
|
|
70
91
|
shellExec(`node ${underpostRoot}/bin/vs ${path}`);
|
|
@@ -142,6 +163,65 @@ class UnderpostRun {
|
|
|
142
163
|
};
|
|
143
164
|
_monitor();
|
|
144
165
|
},
|
|
166
|
+
'db-client': async (path, options = UnderpostRun.DEFAULT_OPTION) => {
|
|
167
|
+
const { underpostRoot } = options;
|
|
168
|
+
shellExec(`kubectl apply -k ${underpostRoot}/manifests/deployment/adminer/.`);
|
|
169
|
+
},
|
|
170
|
+
cluster: async (path, options = UnderpostRun.DEFAULT_OPTION) => {
|
|
171
|
+
const deployList = fs.readFileSync(`./engine-private/deploy/dd.router`, 'utf8').split(',');
|
|
172
|
+
const env = 'production';
|
|
173
|
+
shellCd(`/home/dd/engine`);
|
|
174
|
+
shellExec(`underpost cluster --reset`);
|
|
175
|
+
await timer(5000);
|
|
176
|
+
shellExec(`underpost cluster --kubeadm`);
|
|
177
|
+
await timer(5000);
|
|
178
|
+
shellExec(`underpost dockerfile-pull-base-images --path /home/dd/engine/src/runtime/lampp --kubeadm-load`);
|
|
179
|
+
await timer(5000);
|
|
180
|
+
shellExec(`underpost cluster --kubeadm --pull-image --mongodb`);
|
|
181
|
+
await timer(5000);
|
|
182
|
+
shellExec(`underpost cluster --kubeadm --pull-image --mariadb`);
|
|
183
|
+
await timer(5000);
|
|
184
|
+
for (const deployId of deployList) {
|
|
185
|
+
shellExec(`underpost db ${deployId} --import --git`);
|
|
186
|
+
}
|
|
187
|
+
await timer(5000);
|
|
188
|
+
shellExec(`underpost cluster --kubeadm --pull-image --valkey`);
|
|
189
|
+
await timer(5000);
|
|
190
|
+
shellExec(`underpost cluster --kubeadm --contour`);
|
|
191
|
+
await timer(5000);
|
|
192
|
+
shellExec(`underpost cluster --kubeadm --cert-manager`);
|
|
193
|
+
for (const deployId of deployList) {
|
|
194
|
+
shellExec(`underpost deploy ${deployId} ${env} --kubeadm --cert`);
|
|
195
|
+
}
|
|
196
|
+
},
|
|
197
|
+
deploy: async (path, options = UnderpostRun.DEFAULT_OPTION) => {
|
|
198
|
+
const deployId = path;
|
|
199
|
+
const currentTraffic = UnderpostDeploy.API.getCurrentTraffic(deployId);
|
|
200
|
+
const targetTraffic = currentTraffic === 'blue' ? 'green' : 'blue';
|
|
201
|
+
const env = 'production';
|
|
202
|
+
shellExec(`sudo kubectl rollout restart deployment/${deployId}-${env}-${targetTraffic}`);
|
|
203
|
+
|
|
204
|
+
let secondsElapsed = 0;
|
|
205
|
+
logger.info('Deployment init', { deployId, env, targetTraffic });
|
|
206
|
+
|
|
207
|
+
while (!UnderpostDeploy.API.checkDeploymentReadyStatus(deployId, env, targetTraffic).ready) {
|
|
208
|
+
await timer(1000);
|
|
209
|
+
secondsElapsed++;
|
|
210
|
+
logger.info(`Deployment in progress, seconds elapsed: ${secondsElapsed}`);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
logger.info(`Deployment ready, seconds elapsed: ${secondsElapsed}`);
|
|
214
|
+
|
|
215
|
+
UnderpostRootEnv.API.set(`${deployId}-${env}-traffic`, targetTraffic);
|
|
216
|
+
|
|
217
|
+
shellExec(
|
|
218
|
+
`node bin deploy --info-router --build-manifest --traffic ${targetTraffic} --replicas ${
|
|
219
|
+
options.replicas ? options.replicas : 1
|
|
220
|
+
} ${deployId} ${env}`,
|
|
221
|
+
);
|
|
222
|
+
shellExec(`sudo kubectl apply -f ./engine-private/conf/${deployId}/build/${env}/proxy.yaml`);
|
|
223
|
+
shellExec(`sudo kubectl rollout restart deployment/${deployId}-${env}-${currentTraffic}`);
|
|
224
|
+
},
|
|
145
225
|
'tf-vae-test': async (path, options = UnderpostRun.DEFAULT_OPTION) => {
|
|
146
226
|
const { underpostRoot } = options;
|
|
147
227
|
const podName = 'tf-vae-test';
|
|
@@ -11,8 +11,6 @@ import Sortable from 'sortablejs';
|
|
|
11
11
|
|
|
12
12
|
// https://mintlify.com/docs/quickstart
|
|
13
13
|
|
|
14
|
-
const umlTypes = ['server', 'cron', 'client', 'ssr'];
|
|
15
|
-
|
|
16
14
|
const Docs = {
|
|
17
15
|
RenderModal: async function (type, modalOptions) {
|
|
18
16
|
const docData = this.Data.find((d) => d.type === type);
|
|
@@ -118,37 +116,7 @@ const Docs = {
|
|
|
118
116
|
)}`;
|
|
119
117
|
},
|
|
120
118
|
},
|
|
121
|
-
]
|
|
122
|
-
umlTypes.map((umlType) => {
|
|
123
|
-
const umlId = `uml-${umlType}`;
|
|
124
|
-
return {
|
|
125
|
-
type: umlId,
|
|
126
|
-
icon: html`<i class="fas fa-sitemap"></i>`,
|
|
127
|
-
text: Translate.Render(`${umlType} config uml`),
|
|
128
|
-
url: function () {
|
|
129
|
-
return `/docs/?cid=${umlId}`;
|
|
130
|
-
},
|
|
131
|
-
renderHtml: function () {
|
|
132
|
-
return html` <div class="in section-mp">
|
|
133
|
-
<div class="in sub-title-modal"><i class="fas fa-project-diagram"></i> Schema</div>
|
|
134
|
-
</div>
|
|
135
|
-
<div class="in section-mp">
|
|
136
|
-
<a href="${getProxyPath()}docs/plantuml/${umlType}-schema.svg" target="_blank"
|
|
137
|
-
><img class="in plantuml-svg" src="${getProxyPath()}docs/plantuml/${umlType}-schema.svg"
|
|
138
|
-
/></a>
|
|
139
|
-
</div>
|
|
140
|
-
<div class="in section-mp">
|
|
141
|
-
<div class="in sub-title-modal"><i class="fas fa-project-diagram"></i> Instance example</div>
|
|
142
|
-
</div>
|
|
143
|
-
<div class="in section-mp">
|
|
144
|
-
<a href="${getProxyPath()}docs/plantuml/${umlType}-conf.svg" target="_blank"
|
|
145
|
-
><img class="in plantuml-svg" src="${getProxyPath()}docs/plantuml/${umlType}-conf.svg"
|
|
146
|
-
/></a>
|
|
147
|
-
</div>`;
|
|
148
|
-
},
|
|
149
|
-
};
|
|
150
|
-
}),
|
|
151
|
-
),
|
|
119
|
+
],
|
|
152
120
|
Tokens: {},
|
|
153
121
|
Init: async function (options) {
|
|
154
122
|
const { idModal } = options;
|
|
@@ -158,10 +126,6 @@ const Docs = {
|
|
|
158
126
|
s(`.btn-docs-src`).classList.remove('main-btn-menu-active');
|
|
159
127
|
s(`.btn-docs-api`).classList.remove('main-btn-menu-active');
|
|
160
128
|
s(`.btn-docs-coverage`).classList.remove('main-btn-menu-active');
|
|
161
|
-
for (const umlType of umlTypes) {
|
|
162
|
-
const umlId = `uml-${umlType}`;
|
|
163
|
-
s(`.btn-docs-${umlId}`).classList.remove('main-btn-menu-active');
|
|
164
|
-
}
|
|
165
129
|
};
|
|
166
130
|
s(`.btn-docs-src`).onclick = async () => {
|
|
167
131
|
setQueryPath({ path: 'docs', queryPath: 'src' });
|
|
@@ -195,16 +159,6 @@ const Docs = {
|
|
|
195
159
|
location.href = docData.url();
|
|
196
160
|
};
|
|
197
161
|
|
|
198
|
-
for (const umlType of umlTypes) {
|
|
199
|
-
const umlId = `uml-${umlType}`;
|
|
200
|
-
s(`.btn-docs-${umlId}`).onclick = async () => {
|
|
201
|
-
cleanActive();
|
|
202
|
-
s(`.btn-docs-${umlId}`).classList.add('main-btn-menu-active');
|
|
203
|
-
setQueryPath({ path: 'docs', queryPath: umlId });
|
|
204
|
-
await this.RenderModal(umlId, { ...options.modalOptions, handleType: 'bar' });
|
|
205
|
-
};
|
|
206
|
-
}
|
|
207
|
-
|
|
208
162
|
listenQueryPathInstance({
|
|
209
163
|
id: options.idModal,
|
|
210
164
|
routeId: 'docs',
|
|
@@ -2,7 +2,7 @@ import { LoadingAnimation } from '../core/LoadingAnimation.js';
|
|
|
2
2
|
import { loggerFactory } from '../core/Logger.js';
|
|
3
3
|
import { cssEffect } from './Css.js';
|
|
4
4
|
import { NotificationManager } from './NotificationManager.js';
|
|
5
|
-
import { s } from './VanillaJs.js';
|
|
5
|
+
import { s, isActiveElement } from './VanillaJs.js';
|
|
6
6
|
|
|
7
7
|
const logger = loggerFactory(import.meta);
|
|
8
8
|
|
|
@@ -13,10 +13,37 @@ const EventsUI = {
|
|
|
13
13
|
let complete = true;
|
|
14
14
|
s(id)[type] = async function (e) {
|
|
15
15
|
if (options.clickEffect) cssEffect(id, e);
|
|
16
|
+
const noGate = !!options.noGate;
|
|
17
|
+
const noLoading = !!options.noLoading;
|
|
18
|
+
const playLoading = async () => {
|
|
19
|
+
if (!noLoading) {
|
|
20
|
+
await LoadingAnimation.spinner.play(loadingContainer ? loadingContainer : id);
|
|
21
|
+
if (options.context !== 'modal') await LoadingAnimation.bar.play(id);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
const stopLoading = async () => {
|
|
25
|
+
if (!noLoading) {
|
|
26
|
+
if (options.context !== 'modal') LoadingAnimation.bar.stop(id);
|
|
27
|
+
await LoadingAnimation.spinner.stop(loadingContainer ? loadingContainer : id);
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
if (noGate) {
|
|
31
|
+
try {
|
|
32
|
+
await playLoading();
|
|
33
|
+
await logic(e);
|
|
34
|
+
} catch (error) {
|
|
35
|
+
logger.error(error);
|
|
36
|
+
NotificationManager.Push({
|
|
37
|
+
status: 'error',
|
|
38
|
+
html: error?.message ? error.message : error ? error : 'Event error',
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
await stopLoading();
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
16
44
|
if (complete) {
|
|
17
45
|
complete = false;
|
|
18
|
-
await
|
|
19
|
-
if (options.context !== 'modal') await LoadingAnimation.bar.play(id);
|
|
46
|
+
await playLoading();
|
|
20
47
|
try {
|
|
21
48
|
await logic(e);
|
|
22
49
|
} catch (error) {
|
|
@@ -26,8 +53,7 @@ const EventsUI = {
|
|
|
26
53
|
html: error?.message ? error.message : error ? error : 'Event error',
|
|
27
54
|
});
|
|
28
55
|
}
|
|
29
|
-
|
|
30
|
-
await LoadingAnimation.spinner.stop(loadingContainer ? loadingContainer : id);
|
|
56
|
+
await stopLoading();
|
|
31
57
|
complete = true;
|
|
32
58
|
return;
|
|
33
59
|
}
|
|
@@ -41,6 +67,67 @@ const EventsUI = {
|
|
|
41
67
|
onChange: async function (id = '', logic = async function (e) {}, options = { loadingContainer: '' }) {
|
|
42
68
|
return await this.on(id, logic, 'onchange', options);
|
|
43
69
|
},
|
|
70
|
+
// Shared hover/focus controller extracted from Modal
|
|
71
|
+
HoverFocusController: function ({ inputSelector, panelSelector, activeElementId, onDismiss } = {}) {
|
|
72
|
+
let hoverPanel = false;
|
|
73
|
+
let hoverInput = false;
|
|
74
|
+
const isActive = () => (activeElementId ? isActiveElement(activeElementId) : false);
|
|
75
|
+
const shouldStay = () => isActive() || hoverPanel || hoverInput;
|
|
76
|
+
const bind = () => {
|
|
77
|
+
if (inputSelector && s(inputSelector)) {
|
|
78
|
+
s(inputSelector).onmouseover = () => {
|
|
79
|
+
hoverInput = true;
|
|
80
|
+
};
|
|
81
|
+
s(inputSelector).onmouseout = () => {
|
|
82
|
+
hoverInput = false;
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
if (panelSelector && s(panelSelector)) {
|
|
86
|
+
s(panelSelector).onmouseover = () => {
|
|
87
|
+
hoverPanel = true;
|
|
88
|
+
};
|
|
89
|
+
s(panelSelector).onmouseout = () => {
|
|
90
|
+
hoverPanel = false;
|
|
91
|
+
if (activeElementId && s(`.${activeElementId}`) && s(`.${activeElementId}`).focus)
|
|
92
|
+
s(`.${activeElementId}`).focus();
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
const checkDismiss = () => {
|
|
97
|
+
if (!shouldStay()) onDismiss && onDismiss();
|
|
98
|
+
};
|
|
99
|
+
return { bind, shouldStay, checkDismiss };
|
|
100
|
+
},
|
|
101
|
+
// Generic click-outside binding to dismiss a panel/modal
|
|
102
|
+
// Options:
|
|
103
|
+
// - shouldStay: function -> boolean
|
|
104
|
+
// - onDismiss: function
|
|
105
|
+
// - anchors: array of selectors to treat as inside clicks (e.g., input button, panel container)
|
|
106
|
+
// - graceMs: number of ms after binding to ignore clicks (avoid closing on the same click that opened)
|
|
107
|
+
bindDismissOnDocumentClick: function ({ shouldStay, onDismiss, anchors = [], graceMs = 200 } = {}) {
|
|
108
|
+
if (typeof document === 'undefined') return () => {};
|
|
109
|
+
const bindAt = Date.now();
|
|
110
|
+
const isInsideAnchors = (target) => {
|
|
111
|
+
if (!target) return false;
|
|
112
|
+
for (const sel of anchors) {
|
|
113
|
+
const el = sel && typeof sel === 'string' ? s(sel) : null;
|
|
114
|
+
if (el && (el === target || el.contains(target))) return true;
|
|
115
|
+
}
|
|
116
|
+
return false;
|
|
117
|
+
};
|
|
118
|
+
const handler = (e) => {
|
|
119
|
+
// Ignore very quick clicks right after binding
|
|
120
|
+
if (Date.now() - bindAt < graceMs) return;
|
|
121
|
+
// If click is within anchors, ignore
|
|
122
|
+
if (isInsideAnchors(e?.target)) return;
|
|
123
|
+
// Defer to allow hover flags to update first
|
|
124
|
+
setTimeout(() => {
|
|
125
|
+
if (!shouldStay || !shouldStay()) onDismiss && onDismiss();
|
|
126
|
+
});
|
|
127
|
+
};
|
|
128
|
+
document.addEventListener('click', handler, true);
|
|
129
|
+
return () => document.removeEventListener('click', handler, true);
|
|
130
|
+
},
|
|
44
131
|
};
|
|
45
132
|
|
|
46
133
|
export { EventsUI };
|