@underpostnet/underpost 2.8.1 → 2.8.31
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/.github/workflows/ghpkg.yml +4 -4
- package/.vscode/extensions.json +8 -71
- package/CHANGELOG.md +55 -3
- package/Dockerfile +22 -36
- package/README.md +0 -27
- package/bin/deploy.js +57 -17
- package/bin/file.js +30 -2
- package/bin/index.js +2 -13
- package/bin/ssl.js +19 -11
- package/bin/vs.js +3 -2
- package/conf.js +9 -0
- package/docker-compose.yml +1 -1
- 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 +55 -0
- package/manifests/test/mongo-express.yaml +60 -0
- package/manifests/test/phpmyadmin.yaml +54 -0
- package/manifests/test/underpost-engine-mongodb-configmap.yaml +26 -0
- package/manifests/test/underpost-engine-pod.yaml +108 -0
- package/manifests/underpost-engine-backup-access.yaml +16 -0
- package/manifests/underpost-engine-backup-pv-pvc.yaml +22 -0
- package/manifests/underpost-engine-headless-service.yaml +10 -0
- package/manifests/underpost-engine-mongodb-backup-cronjob.yaml +40 -0
- package/manifests/underpost-engine-pv-pvc.yaml +23 -0
- package/manifests/underpost-engine-statefulset.yaml +91 -0
- package/manifests/valkey/kustomization.yaml +7 -0
- package/manifests/valkey/underpost-engine-valkey-service.yaml +17 -0
- package/manifests/valkey/underpost-engine-valkey-statefulset.yaml +39 -0
- package/package.json +12 -4
- package/src/api/user/user.model.js +9 -1
- package/src/api/user/user.service.js +1 -1
- package/src/client/components/core/CalendarCore.js +112 -49
- package/src/client/components/core/CommonJs.js +125 -19
- package/src/client/components/core/CssCore.js +6 -0
- package/src/client/components/core/DropDown.js +5 -1
- package/src/client/components/core/Input.js +17 -3
- package/src/client/components/core/Modal.js +5 -0
- package/src/client/components/core/Panel.js +81 -24
- package/src/client/components/core/PanelForm.js +4 -18
- package/src/client/components/core/Translate.js +30 -8
- package/src/db/mongo/MongooseDB.js +13 -1
- package/src/index.js +1 -1
- package/src/server/conf.js +2 -2
- package/src/server/process.js +25 -2
- package/src/server/ssl.js +1 -1
- package/src/server/valkey.js +2 -0
- package/startup.cjs +12 -0
- package/startup.js +0 -11
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getId } from './CommonJs.js';
|
|
1
|
+
import { getId, isValidDate, newInstance } from './CommonJs.js';
|
|
2
2
|
import { LoadingAnimation } from '../core/LoadingAnimation.js';
|
|
3
3
|
import { Validator } from '../core/Validator.js';
|
|
4
4
|
import { Input } from '../core/Input.js';
|
|
@@ -51,8 +51,6 @@ const Panel = {
|
|
|
51
51
|
<i style="font-size: 25px" class="fa-solid fa-cloud"></i>
|
|
52
52
|
</div>`;
|
|
53
53
|
|
|
54
|
-
let editId;
|
|
55
|
-
|
|
56
54
|
const openPanelForm = () => {
|
|
57
55
|
s(`.${idPanel}-form-body`).classList.remove('hide');
|
|
58
56
|
s(`.btn-${idPanel}-add`).classList.add('hide');
|
|
@@ -72,7 +70,7 @@ const Panel = {
|
|
|
72
70
|
};
|
|
73
71
|
|
|
74
72
|
const renderPanel = async (payload) => {
|
|
75
|
-
const obj = payload;
|
|
73
|
+
const obj = newInstance(payload);
|
|
76
74
|
if ('_id' in obj) obj.id = obj._id;
|
|
77
75
|
const { id } = obj;
|
|
78
76
|
|
|
@@ -98,8 +96,8 @@ const Panel = {
|
|
|
98
96
|
});
|
|
99
97
|
EventsUI.onClick(`.${idPanel}-btn-edit-${id}`, async () => {
|
|
100
98
|
logger.warn('edit', obj);
|
|
101
|
-
if (obj._id) editId = obj._id;
|
|
102
|
-
else if (obj.id) editId = obj.id;
|
|
99
|
+
if (obj._id) Panel.Tokens[idPanel].editId = obj._id;
|
|
100
|
+
else if (obj.id) Panel.Tokens[idPanel].editId = obj.id;
|
|
103
101
|
|
|
104
102
|
s(`.btn-${idPanel}-label-edit`).classList.remove('hide');
|
|
105
103
|
s(`.btn-${idPanel}-label-add`).classList.add('hide');
|
|
@@ -171,6 +169,10 @@ const Panel = {
|
|
|
171
169
|
const valueIcon = formObjData?.panel?.icon?.value ? formObjData.panel.icon.value : '';
|
|
172
170
|
const keyIcon = formObjData?.panel?.icon?.key ? formObjData.panel.icon.key : '';
|
|
173
171
|
|
|
172
|
+
if (formObjData && ['datetime-local'].includes(formObjData.inputType) && isValidDate(obj[infoKey])) {
|
|
173
|
+
obj[infoKey] = `${obj[infoKey]}`.replace('T', ' ').replace('.000Z', '');
|
|
174
|
+
}
|
|
175
|
+
|
|
174
176
|
if (formData.find((f) => f.model === infoKey && f.panel && f.panel.type === 'tags')) {
|
|
175
177
|
setTimeout(async () => {
|
|
176
178
|
let tagRender = html``;
|
|
@@ -186,22 +188,50 @@ const Panel = {
|
|
|
186
188
|
});
|
|
187
189
|
return html``;
|
|
188
190
|
}
|
|
191
|
+
{
|
|
192
|
+
const formDataObj = formData.find((f) => f.model === infoKey && f.panel && f.panel.type === 'list');
|
|
193
|
+
if (obj[infoKey] && obj[infoKey].length > 0 && formDataObj)
|
|
194
|
+
return html`<div class="in ${idPanel}-row">
|
|
195
|
+
<span class="${idPanel}-row-key capitalize ${formObjData.label?.disabled ? 'hide' : ''}">
|
|
196
|
+
${keyIcon} ${Translate.Render(infoKey)}:</span
|
|
197
|
+
>
|
|
198
|
+
<span class="${idPanel}-row-value"
|
|
199
|
+
>${valueIcon} ${obj[infoKey].map((k) => Translate.Render(k)).join(', ')}</span
|
|
200
|
+
>
|
|
201
|
+
</div> `;
|
|
202
|
+
}
|
|
189
203
|
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
204
|
+
{
|
|
205
|
+
const formDataObj = formData.find(
|
|
206
|
+
(f) => f.model === infoKey && f.panel && f.panel.type === 'info-row-pin',
|
|
207
|
+
);
|
|
208
|
+
if (obj[infoKey] && formDataObj)
|
|
209
|
+
return html`<div class="in ${idPanel}-row">
|
|
210
|
+
<span class="${idPanel}-row-pin-key capitalize ${formObjData.label?.disabled ? 'hide' : ''}">
|
|
211
|
+
${keyIcon}
|
|
212
|
+
${formDataObj.translateCode
|
|
213
|
+
? Translate.Render(formDataObj.translateCode)
|
|
214
|
+
: Translate.Render(infoKey)}:</span
|
|
215
|
+
>
|
|
216
|
+
<span class="${idPanel}-row-pin-value">${valueIcon} ${obj[infoKey]}</span>
|
|
217
|
+
</div> `;
|
|
218
|
+
}
|
|
197
219
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
220
|
+
{
|
|
221
|
+
const formDataObj = formData.find(
|
|
222
|
+
(f) => f.model === infoKey && f.panel && f.panel.type === 'info-row',
|
|
223
|
+
);
|
|
224
|
+
if (obj[infoKey] && formDataObj)
|
|
225
|
+
return html`<div class="in ${idPanel}-row">
|
|
226
|
+
<span class="${idPanel}-row-key capitalize ${formObjData.label?.disabled ? 'hide' : ''}">
|
|
227
|
+
${keyIcon}
|
|
228
|
+
${formDataObj.translateCode
|
|
229
|
+
? Translate.Render(formDataObj.translateCode)
|
|
230
|
+
: Translate.Render(infoKey)}:</span
|
|
231
|
+
>
|
|
232
|
+
<span class="${idPanel}-row-value"> ${valueIcon} ${obj[infoKey]}</span>
|
|
233
|
+
</div> `;
|
|
234
|
+
}
|
|
205
235
|
|
|
206
236
|
return html``;
|
|
207
237
|
})
|
|
@@ -224,6 +254,30 @@ const Panel = {
|
|
|
224
254
|
for (const modelData of formData) {
|
|
225
255
|
if (modelData.disableRender) continue;
|
|
226
256
|
switch (modelData.inputType) {
|
|
257
|
+
case 'dropdown-checkbox': {
|
|
258
|
+
renderForm += html`<div class="in section-mp">
|
|
259
|
+
${await DropDown.Render({
|
|
260
|
+
id: `${modelData.id}`,
|
|
261
|
+
label: html`${Translate.Render(modelData.model)}`,
|
|
262
|
+
type: 'checkbox',
|
|
263
|
+
value: modelData.dropdown.options[0],
|
|
264
|
+
resetOption: true,
|
|
265
|
+
containerClass: `${idPanel}-dropdown-checkbox`,
|
|
266
|
+
data: modelData.dropdown.options.map((dKey) => {
|
|
267
|
+
return {
|
|
268
|
+
value: dKey,
|
|
269
|
+
data: dKey,
|
|
270
|
+
checked: false,
|
|
271
|
+
display: html`${Translate.Render(dKey)}`,
|
|
272
|
+
onClick: function () {
|
|
273
|
+
logger.info('DropDown onClick', this.checked);
|
|
274
|
+
},
|
|
275
|
+
};
|
|
276
|
+
}),
|
|
277
|
+
})}
|
|
278
|
+
</div>`;
|
|
279
|
+
break;
|
|
280
|
+
}
|
|
227
281
|
case 'dropdown':
|
|
228
282
|
renderForm += html` <div class="in section-mp">
|
|
229
283
|
${await DropDown.Render({
|
|
@@ -418,21 +472,23 @@ const Panel = {
|
|
|
418
472
|
obj.id = `${data.length}`;
|
|
419
473
|
let documents;
|
|
420
474
|
if (options && options.on && options.on.add) {
|
|
421
|
-
const { status, data } = await options.on.add({ data: obj, editId });
|
|
475
|
+
const { status, data } = await options.on.add({ data: obj, editId: Panel.Tokens[idPanel].editId });
|
|
422
476
|
if (status === 'error') return;
|
|
423
477
|
documents = data;
|
|
424
478
|
}
|
|
425
479
|
s(`.btn-${idPanel}-clean`).click();
|
|
426
|
-
if (editId && s(`.${idPanel}-${
|
|
480
|
+
if (Panel.Tokens[idPanel].editId && s(`.${idPanel}-${Panel.Tokens[idPanel].editId}`))
|
|
481
|
+
s(`.${idPanel}-${Panel.Tokens[idPanel].editId}`).remove();
|
|
427
482
|
if (Array.isArray(documents)) {
|
|
428
483
|
htmls(`.${idPanel}-render`, '');
|
|
429
484
|
for (const doc of documents) {
|
|
430
485
|
append(`.${idPanel}-render`, await renderPanel(doc));
|
|
431
486
|
}
|
|
432
|
-
} else htmls(`.${idPanel}-render`, await renderPanel(obj));
|
|
487
|
+
} else htmls(`.${idPanel}-render`, await renderPanel({ ...obj, ...documents }));
|
|
433
488
|
Input.cleanValues(formData);
|
|
434
489
|
s(`.btn-${idPanel}-close`).click();
|
|
435
490
|
s(`.${scrollClassContainer}`).scrollTop = 0;
|
|
491
|
+
if (s(`.${scrollClassContainer}`)) s(`.${scrollClassContainer}`).style.overflow = 'auto';
|
|
436
492
|
});
|
|
437
493
|
s(`.btn-${idPanel}-clean`).onclick = () => {
|
|
438
494
|
Input.cleanValues(formData);
|
|
@@ -458,13 +514,14 @@ const Panel = {
|
|
|
458
514
|
s(`.btn-${idPanel}-add`).onclick = (e) => {
|
|
459
515
|
e.preventDefault();
|
|
460
516
|
// s(`.btn-${idPanel}-clean`).click();
|
|
461
|
-
editId = undefined;
|
|
517
|
+
Panel.Tokens[idPanel].editId = undefined;
|
|
462
518
|
s(`.btn-${idPanel}-label-add`).classList.remove('hide');
|
|
463
519
|
s(`.btn-${idPanel}-label-edit`).classList.add('hide');
|
|
464
520
|
s(`.${scrollClassContainer}`).scrollTop = 0;
|
|
465
521
|
|
|
466
522
|
openPanelForm();
|
|
467
523
|
};
|
|
524
|
+
if (s(`.${scrollClassContainer}`)) s(`.${scrollClassContainer}`).style.overflow = 'auto';
|
|
468
525
|
});
|
|
469
526
|
|
|
470
527
|
if (data.length > 0) for (const obj of data) render += await renderPanel(obj);
|
|
@@ -90,16 +90,7 @@ const PanelForm = {
|
|
|
90
90
|
},
|
|
91
91
|
},
|
|
92
92
|
];
|
|
93
|
-
|
|
94
|
-
html`<span
|
|
95
|
-
style="${renderCssAttr({
|
|
96
|
-
style: {
|
|
97
|
-
'font-size': '14px',
|
|
98
|
-
color: '#888',
|
|
99
|
-
},
|
|
100
|
-
})}"
|
|
101
|
-
>${new Date(date).toLocaleString().replaceAll(',', '')}</span
|
|
102
|
-
>`;
|
|
93
|
+
|
|
103
94
|
const titleIcon = html`<i class="fa-solid fa-quote-left"></i>`;
|
|
104
95
|
const panelRender = async ({ data }) =>
|
|
105
96
|
await Panel.Render({
|
|
@@ -271,7 +262,7 @@ const PanelForm = {
|
|
|
271
262
|
fileId: file ? URL.createObjectURL(file) : undefined,
|
|
272
263
|
_id: documentData._id,
|
|
273
264
|
id: documentData._id,
|
|
274
|
-
createdAt:
|
|
265
|
+
createdAt: documentData.createdAt,
|
|
275
266
|
};
|
|
276
267
|
|
|
277
268
|
if (documentStatus === 'error') status = 'error';
|
|
@@ -376,7 +367,7 @@ const PanelForm = {
|
|
|
376
367
|
PanelForm.Data[idPanel].data.push({
|
|
377
368
|
id: documentObject._id,
|
|
378
369
|
title: documentObject.title,
|
|
379
|
-
createdAt:
|
|
370
|
+
createdAt: documentObject.createdAt,
|
|
380
371
|
tags: documentObject.tags.filter((t) => !prefixTags.includes(t)),
|
|
381
372
|
mdFileId: marked.parse(mdFileId),
|
|
382
373
|
userId: documentObject.userId._id,
|
|
@@ -431,14 +422,9 @@ const PanelForm = {
|
|
|
431
422
|
})),
|
|
432
423
|
});
|
|
433
424
|
|
|
434
|
-
let lastCid;
|
|
435
|
-
let lasUserId;
|
|
436
425
|
this.Data[idPanel].updatePanel = async () => {
|
|
437
426
|
const cid = getQueryParams().cid ? getQueryParams().cid : '';
|
|
438
|
-
if (lastCid === cid && lasUserId === Elements.Data.user.main.model.user._id) return;
|
|
439
427
|
if (options.route === 'home') Modal.homeCid = newInstance(cid);
|
|
440
|
-
lastCid = cid;
|
|
441
|
-
lasUserId = newInstance(Elements.Data.user.main.model.user._id);
|
|
442
428
|
htmls(`.${options.parentIdModal ? 'html-' + options.parentIdModal : 'main-body'}`, await renderSrrPanelData());
|
|
443
429
|
await getPanelData();
|
|
444
430
|
htmls(
|
|
@@ -451,7 +437,7 @@ const PanelForm = {
|
|
|
451
437
|
id: options.parentIdModal ? 'html-' + options.parentIdModal : 'main-body',
|
|
452
438
|
routeId: options.route,
|
|
453
439
|
event: async (path) => {
|
|
454
|
-
await this.Data[idPanel].updatePanel();
|
|
440
|
+
if (!PanelForm.Data[idPanel].sessionIn) await this.Data[idPanel].updatePanel();
|
|
455
441
|
},
|
|
456
442
|
});
|
|
457
443
|
|
|
@@ -16,30 +16,43 @@ const Translate = {
|
|
|
16
16
|
Object.keys(this.Token).map((translateHash) => {
|
|
17
17
|
if (translateHash in this.Token && lang in this.Token[translateHash]) {
|
|
18
18
|
if (!('placeholder' in this.Token[translateHash]) && s(`.${translateHash}`))
|
|
19
|
-
htmls(
|
|
19
|
+
htmls(
|
|
20
|
+
`.${translateHash}`,
|
|
21
|
+
this.Token[translateHash].options?.disableTextFormat
|
|
22
|
+
? this.Token[translateHash][lang]
|
|
23
|
+
: textFormatted(this.Token[translateHash][lang]),
|
|
24
|
+
);
|
|
20
25
|
else if ('placeholder' in this.Token[translateHash] && s(this.Token[translateHash].placeholder))
|
|
21
|
-
s(this.Token[translateHash].placeholder).placeholder =
|
|
26
|
+
s(this.Token[translateHash].placeholder).placeholder = this.Token[translateHash].options?.disableTextFormat
|
|
27
|
+
? this.Token[translateHash][lang]
|
|
28
|
+
: textFormatted(this.Token[translateHash][lang]);
|
|
22
29
|
}
|
|
23
30
|
});
|
|
24
31
|
for (const keyEvent of Object.keys(this.Event)) this.Event[keyEvent]();
|
|
25
32
|
},
|
|
26
|
-
Render: function (keyLang, placeholder) {
|
|
33
|
+
Render: function (keyLang, placeholder, options = { disableTextFormat: false }) {
|
|
27
34
|
if (!(keyLang in this.Data)) {
|
|
28
35
|
// TODO: add translate package or library for this case
|
|
29
36
|
logger.warn('translate key lang does not exist: ', keyLang);
|
|
30
|
-
return textFormatted(keyLang);
|
|
37
|
+
return options.disableTextFormat ? keyLang : textFormatted(keyLang);
|
|
31
38
|
}
|
|
39
|
+
this.Data[keyLang].options = options;
|
|
32
40
|
if (placeholder) this.Data[keyLang].placeholder = placeholder;
|
|
33
41
|
keyLang = this.Data[keyLang];
|
|
34
42
|
const translateHash = getId(this.Token, 'trans');
|
|
35
43
|
this.Token[translateHash] = newInstance(keyLang);
|
|
36
44
|
if ('placeholder' in keyLang) {
|
|
37
|
-
if (s('html').lang in keyLang)
|
|
38
|
-
|
|
45
|
+
if (s('html').lang in keyLang)
|
|
46
|
+
return options.disableTextFormat ? keyLang[s('html').lang] : textFormatted(keyLang[s('html').lang]);
|
|
47
|
+
return options.disableTextFormat ? keyLang['en'] : textFormatted(keyLang['en']);
|
|
39
48
|
}
|
|
40
49
|
if (s('html').lang in keyLang)
|
|
41
|
-
return html`<span class="${translateHash}"
|
|
42
|
-
|
|
50
|
+
return html`<span class="${translateHash}"
|
|
51
|
+
>${options.disableTextFormat ? keyLang[s('html').lang] : textFormatted(keyLang[s('html').lang])}</span
|
|
52
|
+
>`;
|
|
53
|
+
return html`<span class="${translateHash}"
|
|
54
|
+
>${options.disableTextFormat ? keyLang['en'] : textFormatted(keyLang['en'])}</span
|
|
55
|
+
>`;
|
|
43
56
|
},
|
|
44
57
|
renderLang: function (language) {
|
|
45
58
|
localStorage.setItem('lang', language);
|
|
@@ -474,6 +487,15 @@ const TranslateCore = {
|
|
|
474
487
|
Translate.Data['friday'] = { es: 'Viernes', en: 'Friday' };
|
|
475
488
|
Translate.Data['saturday'] = { es: 'Sábado', en: 'Saturday' };
|
|
476
489
|
Translate.Data['sunday'] = { es: 'Domingo', en: 'Sunday' };
|
|
490
|
+
|
|
491
|
+
Translate.Data['description'] = { es: 'Descripción', en: 'Description' };
|
|
492
|
+
Translate.Data['daysOfWeek'] = { es: 'Días de la semana', en: 'Days of the week' };
|
|
493
|
+
Translate.Data['startTime'] = { es: 'Hora de inicio', en: 'Start time' };
|
|
494
|
+
Translate.Data['endTime'] = { es: 'Hora de finalizacion', en: 'End time' };
|
|
495
|
+
Translate.Data['appointment-scheduled'] = {
|
|
496
|
+
en: 'Your appointment has been scheduled',
|
|
497
|
+
es: 'Tu cita ha sido programada',
|
|
498
|
+
};
|
|
477
499
|
},
|
|
478
500
|
};
|
|
479
501
|
|
|
@@ -9,7 +9,12 @@ const MongooseDB = {
|
|
|
9
9
|
connect: async (host, name) => {
|
|
10
10
|
const uri = `${host}/${name}`;
|
|
11
11
|
// logger.info('MongooseDB connect', { host, name, uri });
|
|
12
|
-
return await mongoose
|
|
12
|
+
return await mongoose
|
|
13
|
+
.createConnection(uri, {
|
|
14
|
+
// useNewUrlParser: true,
|
|
15
|
+
// useUnifiedTopology: true,
|
|
16
|
+
})
|
|
17
|
+
.asPromise();
|
|
13
18
|
return new Promise((resolve, reject) =>
|
|
14
19
|
mongoose
|
|
15
20
|
.connect(
|
|
@@ -67,8 +72,15 @@ const MongooseDB = {
|
|
|
67
72
|
shellExec(`sudo rm -r /var/lib/mongodb`);
|
|
68
73
|
// restore lib
|
|
69
74
|
// shellExec(`sudo chown -R mongodb:mongodb /var/lib/mongodb/*`);
|
|
75
|
+
// mongod --repair
|
|
70
76
|
|
|
71
77
|
if (process.argv.includes('legacy')) {
|
|
78
|
+
// TODO:
|
|
79
|
+
if (process.argv.includes('rocky')) {
|
|
80
|
+
// https://github.com/mongodb/mongodb-selinux
|
|
81
|
+
// https://www.mongodb.com/docs/v7.0/tutorial/install-mongodb-enterprise-on-red-hat/
|
|
82
|
+
shellExec(`sudo chown -R mongod:mongod /var/lib/mongo`);
|
|
83
|
+
}
|
|
72
84
|
logger.info('install legacy 4.4');
|
|
73
85
|
shellExec(`wget -qO - https://www.mongodb.org/static/pgp/server-4.4.asc | sudo apt-key add -`);
|
|
74
86
|
|
package/src/index.js
CHANGED
package/src/server/conf.js
CHANGED
|
@@ -9,7 +9,6 @@ import colors from 'colors';
|
|
|
9
9
|
import { loggerFactory } from './logger.js';
|
|
10
10
|
import { shellExec } from './process.js';
|
|
11
11
|
import { DefaultConf } from '../../conf.js';
|
|
12
|
-
import ncp from 'copy-paste';
|
|
13
12
|
import read from 'read';
|
|
14
13
|
import splitFile from 'split-file';
|
|
15
14
|
import axios from 'axios';
|
|
@@ -770,9 +769,10 @@ const deployRun = async (dataDeploy, currentAttempt = 1) => {
|
|
|
770
769
|
} else logger.info(`Deploy process successfully`);
|
|
771
770
|
};
|
|
772
771
|
|
|
773
|
-
const restoreMacroDb = async (deployGroupId = '') => {
|
|
772
|
+
const restoreMacroDb = async (deployGroupId = '', deployId = null) => {
|
|
774
773
|
const dataDeploy = await getDataDeploy({ deployGroupId, buildSingleReplica: false });
|
|
775
774
|
for (const deployGroup of dataDeploy) {
|
|
775
|
+
if (deployId && deployGroup.deployId !== deployId) continue;
|
|
776
776
|
if (!deployGroup.replicaHost) {
|
|
777
777
|
const deployServerConfPath = `./engine-private/conf/${deployGroup.deployId}/conf.server.json`;
|
|
778
778
|
const serverConf = JSON.parse(fs.readFileSync(deployServerConfPath, 'utf8'));
|
package/src/server/process.js
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
import shell from 'shelljs';
|
|
4
4
|
import dotenv from 'dotenv';
|
|
5
5
|
import fs from 'fs-extra';
|
|
6
|
-
|
|
7
6
|
import { loggerFactory } from './logger.js';
|
|
7
|
+
import clipboard from 'clipboardy';
|
|
8
8
|
|
|
9
9
|
dotenv.config();
|
|
10
10
|
|
|
@@ -63,4 +63,27 @@ const shellCd = (cd, options = { disableLog: false }) => {
|
|
|
63
63
|
return shell.cd(cd);
|
|
64
64
|
};
|
|
65
65
|
|
|
66
|
-
|
|
66
|
+
function pbcopy(data) {
|
|
67
|
+
switch (process.platform) {
|
|
68
|
+
case 'linux':
|
|
69
|
+
{
|
|
70
|
+
// sudo dnf install xclip
|
|
71
|
+
// sudo apt update
|
|
72
|
+
// sudo apt install xclip
|
|
73
|
+
// paste: xclip -o
|
|
74
|
+
// copy:
|
|
75
|
+
// shellExec(`echo "${data}" | xclip -sel clip`, { async: true });
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
break;
|
|
79
|
+
|
|
80
|
+
default:
|
|
81
|
+
break;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
clipboard.writeSync(data || '🦄');
|
|
85
|
+
|
|
86
|
+
logger.info(`copied to clipboard:`, clipboard.readSync());
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export { ProcessController, getRootDirectory, shellExec, shellCd, pbcopy };
|
package/src/server/ssl.js
CHANGED
|
@@ -70,7 +70,7 @@ const validateSecureContext = (host) => {
|
|
|
70
70
|
const buildSecureContext = (host) => {
|
|
71
71
|
return {
|
|
72
72
|
key: fs.readFileSync(`./engine-private/ssl/${host}/key.key`, 'utf8'),
|
|
73
|
-
cert: fs.readFileSync(`./engine-private/ssl/${host}/
|
|
73
|
+
cert: fs.readFileSync(`./engine-private/ssl/${host}/ca_bundle.crt`, 'utf8'),
|
|
74
74
|
ca: fs.readFileSync(`./engine-private/ssl/${host}/ca_bundle.crt`, 'utf8'),
|
|
75
75
|
};
|
|
76
76
|
};
|
package/src/server/valkey.js
CHANGED
|
@@ -21,6 +21,8 @@ const selectDtoFactory = (payload, select) => {
|
|
|
21
21
|
|
|
22
22
|
const valkeyClientFactory = async () => {
|
|
23
23
|
const valkey = new Valkey({
|
|
24
|
+
// port: 6379,
|
|
25
|
+
// host: 'service-valkey.default.svc.cluster.local',
|
|
24
26
|
retryStrategy: (attempt) => {
|
|
25
27
|
if (attempt === 1) {
|
|
26
28
|
valkey.disconnect();
|
package/startup.cjs
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
const shell = require('shelljs');
|
|
2
|
+
|
|
3
|
+
// /usr/bin/supervisord -n
|
|
4
|
+
// /usr/sbin/sshd -D
|
|
5
|
+
|
|
6
|
+
shell.exec(`/usr/bin/supervisord -n`, { async: true });
|
|
7
|
+
|
|
8
|
+
// shell.exec(`sudo /opt/lampp/lampp start`, { async: true });
|
|
9
|
+
|
|
10
|
+
// shell.exec(`/usr/bin/mongod -f /etc/mongod.conf`, { async: true });
|
|
11
|
+
|
|
12
|
+
shell.exec(`underpost new app`);
|
package/startup.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { shellExec } from './src/server/process.js';
|
|
2
|
-
|
|
3
|
-
// /usr/bin/supervisord -n
|
|
4
|
-
// /usr/sbin/sshd -D
|
|
5
|
-
shellExec(`/usr/bin/supervisord -n`, { async: true });
|
|
6
|
-
|
|
7
|
-
shellExec(`sudo /opt/lampp/lampp start`, { async: true });
|
|
8
|
-
|
|
9
|
-
shellExec(`/usr/bin/mongod -f /etc/mongod.conf`, { async: true });
|
|
10
|
-
|
|
11
|
-
shellExec(`underpost new app server`);
|