underpost 2.8.1 → 2.8.7
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 +19 -49
- package/.github/workflows/npmpkg.yml +67 -0
- package/.github/workflows/publish.yml +5 -5
- package/.github/workflows/pwa-microservices-template.page.yml +12 -4
- package/.github/workflows/pwa-microservices-template.test.yml +2 -2
- package/.vscode/extensions.json +18 -71
- package/.vscode/settings.json +20 -3
- package/AUTHORS.md +16 -5
- package/CHANGELOG.md +123 -3
- package/Dockerfile +27 -70
- package/README.md +39 -29
- package/bin/build.js +186 -0
- package/bin/db.js +2 -24
- package/bin/deploy.js +1467 -236
- package/bin/file.js +67 -16
- package/bin/hwt.js +0 -10
- package/bin/index.js +1 -77
- package/bin/ssl.js +19 -11
- package/bin/util.js +9 -104
- package/bin/vs.js +26 -2
- package/cli.md +451 -0
- package/conf.js +29 -138
- package/docker-compose.yml +1 -1
- package/jsdoc.json +1 -1
- package/manifests/calico-custom-resources.yaml +25 -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/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/kafka/deployment.yaml +69 -0
- package/manifests/deployment/mongo-express/deployment.yaml +60 -0
- package/manifests/deployment/phpmyadmin/deployment.yaml +54 -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/letsencrypt-prod.yaml +15 -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 +55 -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 +125 -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/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/valkey/kustomization.yaml +7 -0
- package/manifests/valkey/service.yaml +17 -0
- package/manifests/valkey/statefulset.yaml +41 -0
- package/package.json +127 -136
- package/src/api/core/core.service.js +1 -1
- package/src/api/default/default.service.js +1 -1
- package/src/api/user/user.model.js +16 -3
- package/src/api/user/user.service.js +15 -12
- package/src/cli/cluster.js +389 -0
- package/src/cli/cron.js +121 -0
- package/src/cli/db.js +222 -0
- package/src/cli/deploy.js +487 -0
- package/src/cli/env.js +58 -0
- package/src/cli/fs.js +161 -0
- package/src/cli/image.js +66 -0
- package/src/cli/index.js +312 -0
- package/src/cli/monitor.js +236 -0
- package/src/cli/repository.js +128 -0
- package/src/cli/script.js +53 -0
- package/src/cli/secrets.js +37 -0
- package/src/cli/test.js +118 -0
- package/src/client/components/core/Account.js +28 -24
- package/src/client/components/core/Auth.js +22 -4
- package/src/client/components/core/Blockchain.js +1 -1
- package/src/client/components/core/CalendarCore.js +128 -121
- package/src/client/components/core/CommonJs.js +283 -19
- package/src/client/components/core/CssCore.js +16 -4
- package/src/client/components/core/Docs.js +1 -2
- package/src/client/components/core/DropDown.js +5 -1
- package/src/client/components/core/EventsUI.js +3 -3
- package/src/client/components/core/FileExplorer.js +86 -78
- package/src/client/components/core/Input.js +22 -6
- package/src/client/components/core/JoyStick.js +2 -2
- package/src/client/components/core/LoadingAnimation.js +3 -12
- package/src/client/components/core/LogIn.js +3 -3
- package/src/client/components/core/LogOut.js +1 -1
- package/src/client/components/core/Modal.js +54 -20
- package/src/client/components/core/Panel.js +109 -90
- package/src/client/components/core/PanelForm.js +23 -30
- package/src/client/components/core/Recover.js +3 -3
- package/src/client/components/core/RichText.js +1 -11
- package/src/client/components/core/Router.js +3 -1
- package/src/client/components/core/Scroll.js +1 -0
- package/src/client/components/core/SignUp.js +2 -2
- package/src/client/components/core/Translate.js +47 -9
- package/src/client/components/core/Validator.js +9 -1
- package/src/client/components/core/VanillaJs.js +0 -9
- package/src/client/components/core/Worker.js +34 -31
- package/src/client/components/default/RoutesDefault.js +3 -2
- package/src/client/services/core/core.service.js +15 -10
- package/src/client/services/default/default.management.js +46 -37
- package/src/client/ssr/Render.js +6 -1
- package/src/client/ssr/body/CacheControl.js +2 -3
- package/src/client/sw/default.sw.js +3 -3
- package/src/db/mongo/MongooseDB.js +29 -1
- package/src/index.js +101 -19
- package/src/mailer/MailerProvider.js +3 -0
- package/src/runtime/lampp/Dockerfile +65 -0
- package/src/runtime/lampp/Lampp.js +1 -13
- package/src/runtime/xampp/Xampp.js +0 -13
- package/src/server/auth.js +3 -3
- package/src/server/backup.js +49 -93
- package/src/server/client-build.js +49 -46
- package/src/server/client-formatted.js +6 -3
- package/src/server/conf.js +297 -55
- package/src/server/dns.js +75 -62
- package/src/server/downloader.js +0 -8
- package/src/server/json-schema.js +77 -0
- package/src/server/logger.js +15 -10
- package/src/server/network.js +20 -161
- package/src/server/peer.js +2 -2
- package/src/server/process.js +25 -2
- package/src/server/proxy.js +7 -29
- package/src/server/runtime.js +53 -40
- package/src/server/ssl.js +1 -1
- package/src/server/start.js +122 -0
- package/src/server/valkey.js +27 -11
- package/test/api.test.js +0 -8
- package/src/dns.js +0 -22
- package/src/server/prompt-optimizer.js +0 -28
- package/startup.js +0 -11
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { validatePassword } from './CommonJs.js';
|
|
1
|
+
import { isChileanIdentityDocument, validatePassword } from './CommonJs.js';
|
|
2
2
|
import { renderStatus } from './Css.js';
|
|
3
3
|
import { loggerFactory } from './Logger.js';
|
|
4
4
|
import { textFormatted, Translate } from './Translate.js';
|
|
@@ -58,6 +58,14 @@ const Validator = {
|
|
|
58
58
|
if (!validator.isLength(s(`.${validatorData.id}`).value, rule.options))
|
|
59
59
|
errorMessage += this.renderErrorMessage(rule);
|
|
60
60
|
break;
|
|
61
|
+
|
|
62
|
+
case 'isChileanIdentityDocument': {
|
|
63
|
+
if (!isChileanIdentityDocument(s(`.${validatorData.id}`).value)) {
|
|
64
|
+
errorMessage += this.renderErrorMessage(undefined, Translate.Render('invalid-identity-document'));
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
break;
|
|
68
|
+
}
|
|
61
69
|
default:
|
|
62
70
|
if (
|
|
63
71
|
validator[rule.type] &&
|
|
@@ -419,14 +419,6 @@ const isActiveTab = () => document.hasFocus();
|
|
|
419
419
|
const isActiveElement = (classSearch = '') =>
|
|
420
420
|
document.activeElement?.classList?.value?.match(classSearch) ? true : false;
|
|
421
421
|
|
|
422
|
-
const getCurrentTrace = () => {
|
|
423
|
-
try {
|
|
424
|
-
_stack;
|
|
425
|
-
} catch (error) {
|
|
426
|
-
return error.stack.split('is not defined')[1];
|
|
427
|
-
}
|
|
428
|
-
};
|
|
429
|
-
|
|
430
422
|
const isDevInstance = () => location.origin.match('localhost') && location.port;
|
|
431
423
|
|
|
432
424
|
const getDataFromInputFile = async (file) => Array.from(new Uint8Array(await file.arrayBuffer()));
|
|
@@ -460,7 +452,6 @@ export {
|
|
|
460
452
|
isNavigator,
|
|
461
453
|
getTimeZone,
|
|
462
454
|
getAllChildNodes,
|
|
463
|
-
getCurrentTrace,
|
|
464
455
|
isActiveTab,
|
|
465
456
|
isActiveElement,
|
|
466
457
|
isDevInstance,
|
|
@@ -22,41 +22,44 @@ const Worker = {
|
|
|
22
22
|
setTimeout(() => {
|
|
23
23
|
if ('onLine' in navigator && navigator.onLine) window.ononline();
|
|
24
24
|
});
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
25
|
+
if ('serviceWorker' in navigator) {
|
|
26
|
+
navigator.serviceWorker.addEventListener('controllerchange', () => {
|
|
27
|
+
logger.info('The controller of current browsing context has changed.');
|
|
28
|
+
});
|
|
29
|
+
navigator.serviceWorker.ready.then((worker) => {
|
|
30
|
+
logger.info('Ready', worker);
|
|
31
|
+
// event message
|
|
32
|
+
navigator.serviceWorker.addEventListener('message', (event) => {
|
|
33
|
+
logger.info('Received event message', event.data);
|
|
34
|
+
const { status } = event.data;
|
|
34
35
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
36
|
+
switch (status) {
|
|
37
|
+
case 'loader':
|
|
38
|
+
{
|
|
39
|
+
LoadingAnimation.RenderCurrentSrcLoad(event);
|
|
40
|
+
}
|
|
41
|
+
break;
|
|
41
42
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
default:
|
|
44
|
+
break;
|
|
45
|
+
}
|
|
46
|
+
});
|
|
46
47
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
// if (navigator.serviceWorker.controller)
|
|
49
|
+
// navigator.serviceWorker.controller.postMessage({
|
|
50
|
+
// title: 'Hello from Client event message',
|
|
51
|
+
// });
|
|
52
|
+
|
|
53
|
+
// broadcast message
|
|
54
|
+
// const channel = new BroadcastChannel('sw-messages');
|
|
55
|
+
// channel.addEventListener('message', (event) => {
|
|
56
|
+
// logger.info('Received broadcast message', event.data);
|
|
57
|
+
// });
|
|
58
|
+
// channel.postMessage({ title: 'Hello from Client broadcast message' });
|
|
59
|
+
// channel.close();
|
|
60
|
+
});
|
|
61
|
+
}
|
|
51
62
|
|
|
52
|
-
// broadcast message
|
|
53
|
-
// const channel = new BroadcastChannel('sw-messages');
|
|
54
|
-
// channel.addEventListener('message', (event) => {
|
|
55
|
-
// logger.info('Received broadcast message', event.data);
|
|
56
|
-
// });
|
|
57
|
-
// channel.postMessage({ title: 'Hello from Client broadcast message' });
|
|
58
|
-
// channel.close();
|
|
59
|
-
});
|
|
60
63
|
this.RouterInstance = router();
|
|
61
64
|
const isInstall = await this.status();
|
|
62
65
|
if (!isInstall) await this.install();
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { loggerFactory } from '../core/Logger.js';
|
|
2
|
+
import { Modal } from '../core/Modal.js';
|
|
2
3
|
import { getProxyPath, s } from '../core/VanillaJs.js';
|
|
3
4
|
|
|
4
5
|
const logger = loggerFactory(import.meta);
|
|
@@ -10,10 +11,10 @@ const RoutesDefault = () => {
|
|
|
10
11
|
return {
|
|
11
12
|
'/': {
|
|
12
13
|
title: 'Home',
|
|
13
|
-
render: () =>
|
|
14
|
+
render: () => Modal.onHomeRouterEvent(),
|
|
14
15
|
upperCase: false,
|
|
15
16
|
},
|
|
16
|
-
'/home': { title: 'home', render: () =>
|
|
17
|
+
'/home': { title: 'home', render: () => Modal.onHomeRouterEvent() },
|
|
17
18
|
'/settings': { title: 'settings', render: () => s(`.main-btn-settings`).click(), translateTitle: true },
|
|
18
19
|
'/log-in': { title: 'log-in', render: () => s(`.main-btn-log-in`).click(), translateTitle: true },
|
|
19
20
|
'/sign-up': { title: 'sign-up', render: () => s(`.main-btn-sign-up`).click(), translateTitle: true },
|
|
@@ -4,13 +4,24 @@ import { getProxyPath } from '../../components/core/VanillaJs.js';
|
|
|
4
4
|
|
|
5
5
|
const logger = loggerFactory(import.meta);
|
|
6
6
|
|
|
7
|
+
logger.info('Load service');
|
|
8
|
+
|
|
9
|
+
const endpoint = 'core';
|
|
10
|
+
|
|
7
11
|
// https://developer.mozilla.org/en-US/docs/Web/API/AbortController
|
|
8
|
-
const getBaseHost = () => location.host;
|
|
12
|
+
const getBaseHost = () => (window.renderPayload?.apiBaseHost ? window.renderPayload.apiBaseHost : location.host);
|
|
9
13
|
|
|
10
|
-
const getApiBasePath = () =>
|
|
14
|
+
const getApiBasePath = (options) =>
|
|
15
|
+
`${
|
|
16
|
+
options?.proxyPath
|
|
17
|
+
? `/${options.proxyPath}/`
|
|
18
|
+
: window.renderPayload?.apiBaseProxyPath
|
|
19
|
+
? window.renderPayload.apiBaseProxyPath
|
|
20
|
+
: getProxyPath()
|
|
21
|
+
}${window.renderPayload?.apiBasePath ? window.renderPayload.apiBasePath : 'api'}/`;
|
|
11
22
|
|
|
12
|
-
const getApiBaseUrl = (options = { id: '', endpoint: '' }) =>
|
|
13
|
-
`${location.protocol}//${getBaseHost()}${getApiBasePath()}${options?.endpoint ? options.endpoint : ''}${
|
|
23
|
+
const getApiBaseUrl = (options = { id: '', endpoint: '', proxyPath: '' }) =>
|
|
24
|
+
`${location.protocol}//${getBaseHost()}${getApiBasePath(options)}${options?.endpoint ? options.endpoint : ''}${
|
|
14
25
|
options?.id ? `/${options.id}` : ''
|
|
15
26
|
}`;
|
|
16
27
|
|
|
@@ -38,11 +49,6 @@ const payloadFactory = (body) => {
|
|
|
38
49
|
return JSON.stringify(body);
|
|
39
50
|
};
|
|
40
51
|
|
|
41
|
-
logger.info('Load service');
|
|
42
|
-
|
|
43
|
-
const endpoint = 'core';
|
|
44
|
-
const _VERSION = window._VERSION;
|
|
45
|
-
|
|
46
52
|
const CoreService = {
|
|
47
53
|
getRaw: (options = { url: '' }) =>
|
|
48
54
|
new Promise((resolve, reject) =>
|
|
@@ -159,7 +165,6 @@ const CoreService = {
|
|
|
159
165
|
const ApiBase = getApiBaseUrl;
|
|
160
166
|
|
|
161
167
|
export {
|
|
162
|
-
_VERSION,
|
|
163
168
|
CoreService,
|
|
164
169
|
headersFactory,
|
|
165
170
|
payloadFactory,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AgGrid } from '../../components/core/AgGrid.js';
|
|
2
2
|
import { BtnIcon } from '../../components/core/BtnIcon.js';
|
|
3
|
-
import { getId, timer } from '../../components/core/CommonJs.js';
|
|
3
|
+
import { getId, getValueFromJoinString, timer } from '../../components/core/CommonJs.js';
|
|
4
4
|
import { darkTheme } from '../../components/core/Css.js';
|
|
5
5
|
import { EventsUI } from '../../components/core/EventsUI.js';
|
|
6
6
|
import { loggerFactory } from '../../components/core/Logger.js';
|
|
@@ -80,34 +80,40 @@ const DefaultManagement = {
|
|
|
80
80
|
class: `in fll section-mp management-table-btn-mini management-table-btn-remove-${id}-${cellRenderId}`,
|
|
81
81
|
})}`;
|
|
82
82
|
setTimeout(() => {
|
|
83
|
-
EventsUI.onClick(
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
83
|
+
EventsUI.onClick(
|
|
84
|
+
`.management-table-btn-remove-${id}-${cellRenderId}`,
|
|
85
|
+
async () => {
|
|
86
|
+
const confirmResult = await Modal.RenderConfirm({
|
|
87
|
+
html: async () => {
|
|
88
|
+
return html`
|
|
89
|
+
<div class="in section-mp" style="text-align: center">
|
|
90
|
+
${Translate.Render('confirm-delete-item')}
|
|
91
|
+
${Object.keys(params.data).length > 0
|
|
92
|
+
? html`<br />
|
|
93
|
+
"${options.defaultColKeyFocus
|
|
94
|
+
? getValueFromJoinString(params.data, options.defaultColKeyFocus)
|
|
95
|
+
: params.data[Object.keys(params.data)[0]]}"`
|
|
96
|
+
: ''}
|
|
97
|
+
</div>
|
|
98
|
+
`;
|
|
99
|
+
},
|
|
100
|
+
id: `delete-${params.data._id}`,
|
|
101
|
+
});
|
|
102
|
+
if (confirmResult.status !== 'confirm') return;
|
|
103
|
+
let result;
|
|
104
|
+
if (params.data._id) result = await ServiceProvider.delete({ id: params.data._id });
|
|
105
|
+
else result = { status: 'success' };
|
|
102
106
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
107
|
+
NotificationManager.Push({
|
|
108
|
+
html: result.status === 'error' ? result.message : Translate.Render('item-success-delete'),
|
|
109
|
+
status: result.status,
|
|
110
|
+
});
|
|
111
|
+
if (result.status === 'success') {
|
|
112
|
+
AgGrid.grids[gridId].applyTransaction({ remove: [params.data] });
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
{ context: 'modal' },
|
|
116
|
+
);
|
|
111
117
|
});
|
|
112
118
|
}
|
|
113
119
|
|
|
@@ -218,16 +224,19 @@ const DefaultManagement = {
|
|
|
218
224
|
});
|
|
219
225
|
});
|
|
220
226
|
EventsUI.onClick(`.management-table-btn-clean-${id}`, async () => {
|
|
221
|
-
const confirmResult = await Modal.RenderConfirm(
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
<
|
|
226
|
-
|
|
227
|
-
|
|
227
|
+
const confirmResult = await Modal.RenderConfirm(
|
|
228
|
+
{
|
|
229
|
+
html: async () => {
|
|
230
|
+
return html`
|
|
231
|
+
<div class="in section-mp" style="text-align: center;">
|
|
232
|
+
<strong>${Translate.Render('confirm-delete-all-data')}</strong>
|
|
233
|
+
</div>
|
|
234
|
+
`;
|
|
235
|
+
},
|
|
236
|
+
id: `clean-table-${id}`,
|
|
228
237
|
},
|
|
229
|
-
|
|
230
|
-
|
|
238
|
+
{ context: 'modal' },
|
|
239
|
+
);
|
|
231
240
|
if (confirmResult.status === 'cancelled') return;
|
|
232
241
|
const result = await ServiceProvider.delete();
|
|
233
242
|
NotificationManager.Push({
|
package/src/client/ssr/Render.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
SrrComponent = ({ title, ssrPath, buildId, ssrHeadComponents, ssrBodyComponents }) => html`
|
|
1
|
+
SrrComponent = ({ title, ssrPath, buildId, ssrHeadComponents, ssrBodyComponents, renderPayload, renderApi }) => html`
|
|
2
2
|
<!DOCTYPE html>
|
|
3
3
|
<html dir="ltr" lang="en">
|
|
4
4
|
<head>
|
|
@@ -6,6 +6,9 @@ SrrComponent = ({ title, ssrPath, buildId, ssrHeadComponents, ssrBodyComponents
|
|
|
6
6
|
<link rel="icon" type="image/x-icon" href="${ssrPath}favicon.ico" />
|
|
7
7
|
<meta charset="UTF-8" />
|
|
8
8
|
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
|
|
9
|
+
<script>
|
|
10
|
+
window.renderPayload = ${renderApi.JSONweb(renderPayload)};
|
|
11
|
+
</script>
|
|
9
12
|
${ssrHeadComponents}
|
|
10
13
|
</head>
|
|
11
14
|
<body>
|
|
@@ -130,6 +133,8 @@ SrrComponent = ({ title, ssrPath, buildId, ssrHeadComponents, ssrBodyComponents
|
|
|
130
133
|
border: none;
|
|
131
134
|
padding-block: 0;
|
|
132
135
|
padding-inline: 0;
|
|
136
|
+
height: 30px;
|
|
137
|
+
line-height: 30px;
|
|
133
138
|
}
|
|
134
139
|
input::file-selector-button {
|
|
135
140
|
outline: none !important;
|
|
@@ -70,7 +70,7 @@ const CacheControl = function ({ ttiLoadTimeLimit }) {
|
|
|
70
70
|
setTimeout(window.cacheControlCallBack, ttiLoadTimeLimit); // 70s limit);
|
|
71
71
|
};
|
|
72
72
|
|
|
73
|
-
SrrComponent = ({ ttiLoadTimeLimit }) => {
|
|
73
|
+
SrrComponent = ({ ttiLoadTimeLimit, version }) => {
|
|
74
74
|
const borderChar = (px, color, selectors) => {
|
|
75
75
|
if (selectors) {
|
|
76
76
|
return selectors
|
|
@@ -106,10 +106,9 @@ SrrComponent = ({ ttiLoadTimeLimit }) => {
|
|
|
106
106
|
</style>
|
|
107
107
|
${borderChar(1, 'black', ['.clean-cache-container'])}
|
|
108
108
|
<script>
|
|
109
|
-
window._VERSION = '${process.env.npm_package_version}';
|
|
110
109
|
const CacheControl = ${CacheControl};
|
|
111
110
|
CacheControl({ ttiLoadTimeLimit: ${ttiLoadTimeLimit ? ttiLoadTimeLimit : 1000 * 70 * 1} });
|
|
112
111
|
</script>
|
|
113
|
-
<div class="clean-cache-container">${
|
|
112
|
+
<div class="clean-cache-container">${version}</div>
|
|
114
113
|
`;
|
|
115
114
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const PRE_CACHED_RESOURCES = [];
|
|
2
|
-
const CACHE_NAME = 'app-cache';
|
|
3
|
-
const PROXY_PATH = '/';
|
|
1
|
+
const PRE_CACHED_RESOURCES = self.renderPayload?.PRE_CACHED_RESOURCES ? self.renderPayload.PRE_CACHED_RESOURCES : [];
|
|
2
|
+
const CACHE_NAME = self.renderPayload?.CACHE_NAME ? self.renderPayload.CACHE_NAME : 'app-cache';
|
|
3
|
+
const PROXY_PATH = self.renderPayload?.PROXY_PATH ? self.renderPayload.PROXY_PATH : '/';
|
|
4
4
|
self.addEventListener('install', (event) => {
|
|
5
5
|
// Activate right away
|
|
6
6
|
self.skipWaiting();
|
|
@@ -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,27 @@ 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
|
+
// https://www.mongodb.com/docs/v6.0/tutorial/install-mongodb-on-red-hat/
|
|
83
|
+
// https://www.mongodb.com/docs/v4.4/tutorial/install-mongodb-on-red-hat/
|
|
84
|
+
// dnf install selinux-policy-devel
|
|
85
|
+
// git clone https://github.com/mongodb/mongodb-selinux
|
|
86
|
+
// cd mongodb-selinux
|
|
87
|
+
// make
|
|
88
|
+
// sudo make install
|
|
89
|
+
// yum list installed | grep mongo
|
|
90
|
+
// sudo yum erase $(rpm -qa | grep mongodb)
|
|
91
|
+
// remove service
|
|
92
|
+
// sudo systemctl reset-failed
|
|
93
|
+
// MongoDB 5.0+ requires a CPU with AVX support
|
|
94
|
+
// check: grep avx /proc/cpuinfo
|
|
95
|
+
}
|
|
72
96
|
logger.info('install legacy 4.4');
|
|
73
97
|
shellExec(`wget -qO - https://www.mongodb.org/static/pgp/server-4.4.asc | sudo apt-key add -`);
|
|
74
98
|
|
|
@@ -100,9 +124,13 @@ const MongooseDB = {
|
|
|
100
124
|
shellExec(`sudo systemctl unmask mongod`);
|
|
101
125
|
shellExec(`sudo pkill -f mongod`);
|
|
102
126
|
shellExec(`sudo systemctl enable mongod.service`);
|
|
127
|
+
|
|
103
128
|
shellExec(`sudo chown -R mongodb:mongodb /var/lib/mongodb`);
|
|
104
129
|
shellExec(`sudo chown mongodb:mongodb /tmp/mongodb-27017.sock`);
|
|
105
130
|
|
|
131
|
+
shellExec(`sudo chown -R mongod:mongod /var/lib/mongodb`);
|
|
132
|
+
shellExec(`sudo chown mongod:mongod /tmp/mongodb-27017.sock`);
|
|
133
|
+
|
|
106
134
|
logger.info('run server');
|
|
107
135
|
shellExec(`sudo service mongod restart`);
|
|
108
136
|
|
package/src/index.js
CHANGED
|
@@ -4,9 +4,19 @@
|
|
|
4
4
|
* @namespace Underpost
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
import UnderpostCluster from './cli/cluster.js';
|
|
8
|
+
import UnderpostCron from './cli/cron.js';
|
|
9
|
+
import UnderpostDB from './cli/db.js';
|
|
10
|
+
import UnderpostDeploy from './cli/deploy.js';
|
|
11
|
+
import UnderpostRootEnv from './cli/env.js';
|
|
12
|
+
import UnderpostFileStorage from './cli/fs.js';
|
|
13
|
+
import UnderpostImage from './cli/image.js';
|
|
14
|
+
import UnderpostMonitor from './cli/monitor.js';
|
|
15
|
+
import UnderpostRepository from './cli/repository.js';
|
|
16
|
+
import UnderpostScript from './cli/script.js';
|
|
17
|
+
import UnderpostSecret from './cli/secrets.js';
|
|
18
|
+
import UnderpostTest from './cli/test.js';
|
|
19
|
+
import UnderpostStartUp from './server/start.js';
|
|
10
20
|
|
|
11
21
|
/**
|
|
12
22
|
* Underpost main module methods
|
|
@@ -20,26 +30,98 @@ class Underpost {
|
|
|
20
30
|
* @type {String}
|
|
21
31
|
* @memberof Underpost
|
|
22
32
|
*/
|
|
23
|
-
static version = 'v2.8.
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
33
|
+
static version = 'v2.8.7';
|
|
34
|
+
/**
|
|
35
|
+
* Repository cli API
|
|
36
|
+
* @static
|
|
37
|
+
* @type {UnderpostRepository.API}
|
|
38
|
+
* @memberof Underpost
|
|
39
|
+
*/
|
|
40
|
+
static repo = UnderpostRepository.API;
|
|
41
|
+
/**
|
|
42
|
+
* Root Env cli API
|
|
43
|
+
* @static
|
|
44
|
+
* @type {UnderpostRootEnv.API}
|
|
45
|
+
* @memberof Underpost
|
|
46
|
+
*/
|
|
47
|
+
static env = UnderpostRootEnv.API;
|
|
48
|
+
/**
|
|
49
|
+
* Test cli API
|
|
50
|
+
* @static
|
|
51
|
+
* @type {UnderpostTest.API}
|
|
52
|
+
* @memberof Underpost
|
|
53
|
+
*/
|
|
54
|
+
static test = UnderpostTest.API;
|
|
55
|
+
/**
|
|
56
|
+
* Underpost Start Up cli API
|
|
57
|
+
* @static
|
|
58
|
+
* @type {UnderpostStartUp.API}
|
|
59
|
+
* @memberof Underpost
|
|
60
|
+
*/
|
|
61
|
+
static start = UnderpostStartUp.API;
|
|
62
|
+
/**
|
|
63
|
+
* Cluster cli API
|
|
64
|
+
* @static
|
|
65
|
+
* @type {UnderpostCluster.API}
|
|
66
|
+
* @memberof Underpost
|
|
67
|
+
*/
|
|
68
|
+
static cluster = UnderpostCluster.API;
|
|
69
|
+
/**
|
|
70
|
+
* Image cli API
|
|
71
|
+
* @static
|
|
72
|
+
* @type {UnderpostImage.API}
|
|
73
|
+
* @memberof Underpost
|
|
74
|
+
*/
|
|
75
|
+
static image = UnderpostImage.API;
|
|
76
|
+
/**
|
|
77
|
+
* Secrets cli API
|
|
78
|
+
* @static
|
|
79
|
+
* @type {UnderpostSecret.API}
|
|
80
|
+
* @memberof Underpost
|
|
81
|
+
*/
|
|
82
|
+
static secret = UnderpostSecret.API;
|
|
83
|
+
/**
|
|
84
|
+
* Scripts cli API
|
|
85
|
+
* @static
|
|
86
|
+
* @type {UnderpostScript.API}
|
|
87
|
+
* @memberof Underpost
|
|
88
|
+
*/
|
|
89
|
+
static script = UnderpostScript.API;
|
|
90
|
+
/**
|
|
91
|
+
* Database cli API
|
|
92
|
+
* @static
|
|
93
|
+
* @type {UnderpostDB.API}
|
|
94
|
+
* @memberof Underpost
|
|
95
|
+
*/
|
|
96
|
+
static db = UnderpostDB.API;
|
|
97
|
+
/**
|
|
98
|
+
* Deployment cli API
|
|
99
|
+
* @static
|
|
100
|
+
* @type {UnderpostDeploy.API}
|
|
101
|
+
* @memberof Underpost
|
|
102
|
+
*/
|
|
103
|
+
static deploy = UnderpostDeploy.API;
|
|
104
|
+
/**
|
|
105
|
+
* Cron cli API
|
|
106
|
+
* @static
|
|
107
|
+
* @type {UnderpostCron.API}
|
|
108
|
+
* @memberof Underpost
|
|
109
|
+
*/
|
|
110
|
+
static cron = UnderpostCron.API;
|
|
111
|
+
/**
|
|
112
|
+
* File Storage cli API
|
|
113
|
+
* @static
|
|
114
|
+
* @type {UnderpostFileStorage.API}
|
|
115
|
+
* @memberof Underpost
|
|
116
|
+
*/
|
|
117
|
+
static fs = UnderpostFileStorage.API;
|
|
27
118
|
/**
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
* This function is used to log details about
|
|
31
|
-
* the execution context, such as command-line arguments,
|
|
32
|
-
* environment variables, the process's administrative privileges,
|
|
33
|
-
* and the maximum available heap space size.
|
|
34
|
-
*
|
|
119
|
+
* Monitor cli API
|
|
35
120
|
* @static
|
|
36
|
-
* @
|
|
37
|
-
* @returns {Promise<void>}
|
|
121
|
+
* @type {UnderpostMonitor.API}
|
|
38
122
|
* @memberof Underpost
|
|
39
123
|
*/
|
|
40
|
-
static
|
|
41
|
-
return await setUpInfo(logger);
|
|
42
|
-
}
|
|
124
|
+
static monitor = UnderpostMonitor.API;
|
|
43
125
|
}
|
|
44
126
|
|
|
45
127
|
const up = Underpost;
|
|
@@ -32,6 +32,9 @@ const MailerProvider = {
|
|
|
32
32
|
},
|
|
33
33
|
) {
|
|
34
34
|
try {
|
|
35
|
+
options.transport.tls = {
|
|
36
|
+
rejectUnauthorized: false,
|
|
37
|
+
};
|
|
35
38
|
const { id } = options;
|
|
36
39
|
// Generate test SMTP service account from ethereal.email
|
|
37
40
|
// Only needed if you don't have a real mail account for testing
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
ARG BASE_DEBIAN=buster
|
|
2
|
+
|
|
3
|
+
USER root
|
|
4
|
+
|
|
5
|
+
FROM debian:${BASE_DEBIAN}
|
|
6
|
+
|
|
7
|
+
ENV DEBIAN_FRONTEND=noninteractive
|
|
8
|
+
|
|
9
|
+
# Set root password to root, format is 'user:password'.
|
|
10
|
+
RUN echo 'root:root' | chpasswd
|
|
11
|
+
|
|
12
|
+
RUN apt-get update --fix-missing
|
|
13
|
+
RUN apt-get upgrade -y
|
|
14
|
+
# install sudo
|
|
15
|
+
RUN apt-get -y install sudo
|
|
16
|
+
# net-tools provides netstat commands
|
|
17
|
+
RUN apt-get -y install curl net-tools
|
|
18
|
+
RUN apt-get -yq install openssh-server supervisor
|
|
19
|
+
# Few handy utilities which are nice to have
|
|
20
|
+
RUN apt-get -y install nano vim less --no-install-recommends
|
|
21
|
+
RUN apt-get clean
|
|
22
|
+
|
|
23
|
+
# install ssh
|
|
24
|
+
RUN mkdir -p /var/run/sshd
|
|
25
|
+
# Allow root login via password
|
|
26
|
+
RUN sed -ri 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/g' /etc/ssh/sshd_config
|
|
27
|
+
|
|
28
|
+
# install open ssl git and others tools
|
|
29
|
+
RUN apt-get install -yq --no-install-recommends libssl-dev curl wget git gnupg
|
|
30
|
+
|
|
31
|
+
# install lampp
|
|
32
|
+
RUN curl -Lo xampp-linux-installer.run https://sourceforge.net/projects/xampp/files/XAMPP%20Linux/7.4.33/xampp-linux-x64-7.4.33-0-installer.run?from_af=true
|
|
33
|
+
RUN chmod +x xampp-linux-installer.run
|
|
34
|
+
RUN bash -c './xampp-linux-installer.run'
|
|
35
|
+
RUN ln -sf /opt/lampp/lampp /usr/bin/lampp
|
|
36
|
+
# Enable XAMPP web interface(remove security checks)
|
|
37
|
+
RUN sed -i.bak s'/Require local/Require all granted/g' /opt/lampp/etc/extra/httpd-xampp.conf
|
|
38
|
+
# Enable error display in php
|
|
39
|
+
RUN sed -i.bak s'/display_errors=Off/display_errors=On/g' /opt/lampp/etc/php.ini
|
|
40
|
+
# Enable includes of several configuration files
|
|
41
|
+
RUN mkdir /opt/lampp/apache2/conf.d
|
|
42
|
+
RUN echo "IncludeOptional /opt/lampp/apache2/conf.d/*.conf" >>/opt/lampp/etc/httpd.conf
|
|
43
|
+
# Create a /www folder and a symbolic link to it in /opt/lampp/htdocs. It'll be accessible via http://localhost:[port]/www/
|
|
44
|
+
# This is convenient because it doesn't interfere with xampp, phpmyadmin or other tools in /opt/lampp/htdocs
|
|
45
|
+
# /opt/lampp/etc/httpd.conf
|
|
46
|
+
RUN mkdir /www
|
|
47
|
+
RUN ln -s /www /opt/lampp/htdocs
|
|
48
|
+
|
|
49
|
+
# install nodejs https://github.com/nodesource/distributions/blob/master/README.md#deb
|
|
50
|
+
RUN curl -fsSL https://deb.nodesource.com/setup_23.x | bash -
|
|
51
|
+
RUN apt-get install -y nodejs build-essential
|
|
52
|
+
RUN node --version
|
|
53
|
+
RUN npm --version
|
|
54
|
+
|
|
55
|
+
WORKDIR /home/dd
|
|
56
|
+
|
|
57
|
+
EXPOSE 22
|
|
58
|
+
|
|
59
|
+
EXPOSE 80
|
|
60
|
+
|
|
61
|
+
EXPOSE 443
|
|
62
|
+
|
|
63
|
+
EXPOSE 3000-3100
|
|
64
|
+
|
|
65
|
+
EXPOSE 4000-4100
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import fs from 'fs-extra';
|
|
2
|
-
import { network } from '../../server/network.js';
|
|
3
2
|
import { shellCd, shellExec } from '../../server/process.js';
|
|
4
3
|
import { timer } from '../../client/components/core/CommonJs.js';
|
|
5
4
|
import { loggerFactory } from '../../server/logger.js';
|
|
@@ -39,20 +38,9 @@ const Lampp = {
|
|
|
39
38
|
);
|
|
40
39
|
|
|
41
40
|
shellExec(cmd);
|
|
42
|
-
await network.port.portClean(3306);
|
|
43
|
-
for (const port of this.ports) await network.port.portClean(port);
|
|
44
41
|
cmd = `sudo /opt/lampp/lampp start`;
|
|
45
42
|
if (this.router) fs.writeFileSync(`./tmp/lampp-router.conf`, this.router, 'utf-8');
|
|
46
|
-
shellExec(cmd
|
|
47
|
-
if (options && options.daemon) this.daemon();
|
|
48
|
-
},
|
|
49
|
-
daemon: async function () {
|
|
50
|
-
await timer(1000 * 60 * 2); // 2 minutes
|
|
51
|
-
for (const port of this.ports) {
|
|
52
|
-
const [portStatus] = await network.port.status([port]);
|
|
53
|
-
if (!portStatus.open) return await this.initService();
|
|
54
|
-
}
|
|
55
|
-
this.daemon();
|
|
43
|
+
shellExec(cmd);
|
|
56
44
|
},
|
|
57
45
|
enabled: () => fs.existsSync(`/opt/lampp/apache2/conf/httpd.conf`),
|
|
58
46
|
appendRouter: function (render) {
|