@underpostnet/underpost 2.8.4 → 2.8.6
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/.github/workflows/ghpkg.yml +12 -45
- package/.github/workflows/npmpkg.yml +67 -0
- package/.github/workflows/publish.yml +5 -5
- package/.github/workflows/pwa-microservices-template.page.yml +2 -1
- package/.github/workflows/pwa-microservices-template.test.yml +2 -2
- package/.vscode/settings.json +10 -1
- package/CHANGELOG.md +40 -0
- package/Dockerfile +6 -27
- package/bin/build.js +73 -165
- package/bin/deploy.js +76 -101
- package/bin/file.js +29 -15
- package/bin/hwt.js +0 -10
- package/bin/index.js +191 -32
- package/bin/util.js +0 -15
- package/bin/vs.js +1 -0
- package/conf.js +0 -2
- package/docker-compose.yml +1 -1
- package/manifests/kind-config-dev.yaml +12 -0
- package/manifests/{core/underpost-engine-mongodb-backup-cronjob.yaml → mongodb/backup-cronjob.yaml} +14 -12
- package/manifests/mongodb/kustomization.yaml +11 -0
- package/manifests/mongodb/pv-pvc.yaml +23 -0
- package/manifests/{core/underpost-engine-statefulset.yaml → mongodb/statefulset.yaml} +34 -0
- package/manifests/mongodb-4.4/kustomization.yaml +7 -0
- package/manifests/mongodb-4.4/service-deployment.yaml +63 -0
- package/manifests/valkey/kustomization.yaml +2 -2
- package/package.json +22 -4
- package/src/api/core/core.service.js +1 -1
- package/src/cli/cluster.js +202 -0
- package/src/cli/cron.js +90 -0
- package/src/cli/db.js +212 -0
- package/src/cli/deploy.js +318 -0
- package/src/cli/env.js +52 -0
- package/src/cli/fs.js +149 -0
- package/src/cli/image.js +148 -0
- package/src/cli/repository.js +125 -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/Auth.js +22 -4
- package/src/client/components/core/CalendarCore.js +12 -1
- package/src/client/components/core/CommonJs.js +134 -2
- package/src/client/components/core/Css.js +1 -0
- package/src/client/components/core/CssCore.js +2 -4
- package/src/client/components/core/Docs.js +1 -2
- package/src/client/components/core/Input.js +5 -3
- package/src/client/components/core/LoadingAnimation.js +8 -1
- package/src/client/components/core/Modal.js +30 -7
- package/src/client/components/core/Panel.js +8 -6
- package/src/client/components/core/PanelForm.js +23 -7
- package/src/client/components/core/Scroll.js +1 -0
- package/src/client/components/core/Translate.js +4 -0
- package/src/client/components/core/VanillaJs.js +0 -9
- package/src/client/components/core/Worker.js +34 -31
- package/src/client/services/core/core.service.js +15 -10
- package/src/client/ssr/Render.js +4 -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 +17 -1
- package/src/index.js +85 -26
- package/src/server/backup.js +49 -93
- package/src/server/client-build.js +33 -33
- package/src/server/client-formatted.js +6 -3
- package/src/server/conf.js +82 -199
- package/src/server/dns.js +29 -53
- package/src/server/downloader.js +0 -8
- package/src/server/logger.js +7 -7
- package/src/server/network.js +17 -7
- package/src/server/runtime.js +24 -23
- package/test/api.test.js +0 -8
- package/manifests/core/kustomization.yaml +0 -11
- package/src/dns.js +0 -22
- package/src/server/project.js +0 -39
- package/startup.cjs +0 -12
- /package/manifests/deployment/{mongo-express.yaml → mongo-express/deployment.yaml} +0 -0
- /package/manifests/deployment/{phpmyadmin.yaml → phpmyadmin/deployment.yaml} +0 -0
- /package/manifests/{core/underpost-engine-backup-access.yaml → mongodb/backup-access.yaml} +0 -0
- /package/manifests/{core/underpost-engine-backup-pv-pvc.yaml → mongodb/backup-pv-pvc.yaml} +0 -0
- /package/manifests/{core/underpost-engine-mongodb-configmap.yaml → mongodb/configmap.yaml} +0 -0
- /package/manifests/{core/underpost-engine-headless-service.yaml → mongodb/headless-service.yaml} +0 -0
- /package/manifests/{core/underpost-engine-pv-pvc.yaml → mongodb-4.4/pv-pvc.yaml} +0 -0
- /package/manifests/valkey/{underpost-engine-valkey-service.yaml → service.yaml} +0 -0
- /package/manifests/valkey/{underpost-engine-valkey-statefulset.yaml → statefulset.yaml} +0 -0
package/src/server/runtime.js
CHANGED
|
@@ -15,11 +15,12 @@ import { getCapVariableName, newInstance } from '../client/components/core/Commo
|
|
|
15
15
|
import { Xampp } from '../runtime/xampp/Xampp.js';
|
|
16
16
|
import { MailerProvider } from '../mailer/MailerProvider.js';
|
|
17
17
|
import { DataBaseProvider } from '../db/DataBaseProvider.js';
|
|
18
|
-
import { createProxyMiddleware } from 'http-proxy-middleware';
|
|
18
|
+
// import { createProxyMiddleware } from 'http-proxy-middleware';
|
|
19
19
|
import { createPeerServer } from './peer.js';
|
|
20
20
|
import { Lampp } from '../runtime/lampp/Lampp.js';
|
|
21
21
|
import { getDeployId } from './conf.js';
|
|
22
|
-
import { ssrFactory } from './client-formatted.js';
|
|
22
|
+
import { JSONweb, ssrFactory } from './client-formatted.js';
|
|
23
|
+
import Underpost from '../index.js';
|
|
23
24
|
|
|
24
25
|
dotenv.config();
|
|
25
26
|
|
|
@@ -31,20 +32,6 @@ const buildRuntime = async () => {
|
|
|
31
32
|
const collectDefaultMetrics = promClient.collectDefaultMetrics;
|
|
32
33
|
collectDefaultMetrics();
|
|
33
34
|
|
|
34
|
-
if (fs.existsSync(`/root/.bashrc`) && !fs.readFileSync(`/root/.bashrc`, 'utf8').match(`underpost-engine`)) {
|
|
35
|
-
fs.writeFileSync(
|
|
36
|
-
`/root/.bashrc`,
|
|
37
|
-
`${fs.readFileSync(`/root/.bashrc`, 'utf8')}
|
|
38
|
-
` +
|
|
39
|
-
`export NVM_DIR="$HOME/.nvm"
|
|
40
|
-
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
|
|
41
|
-
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm underpost-engine bash_completion
|
|
42
|
-
|
|
43
|
-
export PATH=$PATH:/opt/lampp/bin`,
|
|
44
|
-
'utf8',
|
|
45
|
-
);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
35
|
const promCounterOption = {
|
|
49
36
|
name: `${deployId.replaceAll('-', '_')}_http_requests_total`,
|
|
50
37
|
help: 'Total number of HTTP requests',
|
|
@@ -54,7 +41,6 @@ export PATH=$PATH:/opt/lampp/bin`,
|
|
|
54
41
|
// logger.info('promCounterOption', promCounterOption);
|
|
55
42
|
|
|
56
43
|
const requestCounter = new promClient.Counter(promCounterOption);
|
|
57
|
-
|
|
58
44
|
const ipInstance = ''; // await ip.public.ipv4();
|
|
59
45
|
const initPort = parseInt(process.env.PORT) + 1;
|
|
60
46
|
let currentPort = initPort;
|
|
@@ -101,12 +87,13 @@ export PATH=$PATH:/opt/lampp/bin`,
|
|
|
101
87
|
apis,
|
|
102
88
|
};
|
|
103
89
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
90
|
+
const redirectTarget = redirect
|
|
91
|
+
? redirect[redirect.length - 1] === '/'
|
|
92
|
+
? redirect.slice(0, -1)
|
|
93
|
+
: redirect
|
|
94
|
+
: undefined;
|
|
95
|
+
|
|
96
|
+
// if (redirect) logger.info('redirect', new URL(redirect));
|
|
110
97
|
|
|
111
98
|
switch (runtime) {
|
|
112
99
|
case 'lampp':
|
|
@@ -398,6 +385,13 @@ export PATH=$PATH:/opt/lampp/bin`,
|
|
|
398
385
|
ssrPath,
|
|
399
386
|
ssrHeadComponents: '',
|
|
400
387
|
ssrBodyComponents: (await ssrFactory(`./src/client/ssr/body/404.js`))(),
|
|
388
|
+
renderPayload: {
|
|
389
|
+
apiBasePath: process.env.BASE_API,
|
|
390
|
+
version: Underpost.version,
|
|
391
|
+
},
|
|
392
|
+
renderApi: {
|
|
393
|
+
JSONweb,
|
|
394
|
+
},
|
|
401
395
|
});
|
|
402
396
|
const path404 = `${directory ? directory : `${getRootDirectory()}${rootHostPath}`}/404/index.html`;
|
|
403
397
|
const page404 = fs.existsSync(path404) ? `${path === '/' ? '' : path}/404` : undefined;
|
|
@@ -414,6 +408,13 @@ export PATH=$PATH:/opt/lampp/bin`,
|
|
|
414
408
|
ssrPath,
|
|
415
409
|
ssrHeadComponents: '',
|
|
416
410
|
ssrBodyComponents: (await ssrFactory(`./src/client/ssr/body/500.js`))(),
|
|
411
|
+
renderPayload: {
|
|
412
|
+
apiBasePath: process.env.BASE_API,
|
|
413
|
+
version: Underpost.version,
|
|
414
|
+
},
|
|
415
|
+
renderApi: {
|
|
416
|
+
JSONweb,
|
|
417
|
+
},
|
|
417
418
|
});
|
|
418
419
|
const path500 = `${directory ? directory : `${getRootDirectory()}${rootHostPath}`}/500/index.html`;
|
|
419
420
|
const page500 = fs.existsSync(path500) ? `${path === '/' ? '' : path}/500` : undefined;
|
package/test/api.test.js
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
import axios from 'axios';
|
|
4
4
|
import dotenv from 'dotenv';
|
|
5
|
-
import https from 'https';
|
|
6
5
|
|
|
7
6
|
import { expect } from 'chai';
|
|
8
7
|
import { loggerFactory } from '../src/server/logger.js';
|
|
@@ -20,13 +19,6 @@ const BASE_URL =
|
|
|
20
19
|
? `http://localhost:${PORT}/${process.env.BASE_API}`
|
|
21
20
|
: `https://www.nexodev.org/api`;
|
|
22
21
|
|
|
23
|
-
axios.defaults.baseURL = BASE_URL;
|
|
24
|
-
|
|
25
|
-
const httpsAgent = new https.Agent({
|
|
26
|
-
rejectUnauthorized: false,
|
|
27
|
-
});
|
|
28
|
-
axios.defaults.httpsAgent = httpsAgent;
|
|
29
|
-
|
|
30
22
|
describe(`GET 'Test' API Request `, async () => {
|
|
31
23
|
{
|
|
32
24
|
const url = `${BASE_URL}/test/youtube-id/?url=https://www.youtube.com/watch?v=o4f42SbyDMk`;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
# kubectl apply -k core/.
|
|
3
|
-
apiVersion: kustomize.config.k8s.io/v1beta1
|
|
4
|
-
kind: Kustomization
|
|
5
|
-
resources:
|
|
6
|
-
- underpost-engine-pv-pvc.yaml
|
|
7
|
-
- underpost-engine-headless-service.yaml
|
|
8
|
-
- underpost-engine-statefulset.yaml
|
|
9
|
-
- underpost-engine-backup-pv-pvc.yaml
|
|
10
|
-
- underpost-engine-mongodb-backup-cronjob.yaml
|
|
11
|
-
- underpost-engine-backup-access.yaml
|
package/src/dns.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
// https://nodejs.org/api
|
|
4
|
-
// https://expressjs.com/en/4x/api.html
|
|
5
|
-
|
|
6
|
-
import dotenv from 'dotenv';
|
|
7
|
-
import { loggerFactory } from './server/logger.js';
|
|
8
|
-
import { Dns } from './server/dns.js';
|
|
9
|
-
import { ProcessController } from './server/process.js';
|
|
10
|
-
import { Config } from './server/conf.js';
|
|
11
|
-
|
|
12
|
-
dotenv.config();
|
|
13
|
-
|
|
14
|
-
await Config.build();
|
|
15
|
-
|
|
16
|
-
const logger = loggerFactory(import.meta);
|
|
17
|
-
|
|
18
|
-
await logger.setUpInfo();
|
|
19
|
-
|
|
20
|
-
await Dns.InitIpDaemon();
|
|
21
|
-
|
|
22
|
-
ProcessController.init(logger);
|
package/src/server/project.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { loadConf, newProject, repoClone, repoCommit, repoPull, repoPush } from './conf.js';
|
|
2
|
-
|
|
3
|
-
class Project {
|
|
4
|
-
constructor(repositoryName, version) {
|
|
5
|
-
return newProject(repositoryName, version);
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
static clone(gitUri = 'underpostnet/pwa-microservices-template') {
|
|
9
|
-
return repoClone(gitUri);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
static useEnv(deployId = 'default', env = 'production') {
|
|
13
|
-
return loadConf(deployId, env);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
static pull(repoPath = './', gitUri = 'underpostnet/pwa-microservices-template') {
|
|
17
|
-
return repoPull(repoPath, gitUri);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
static commit(
|
|
21
|
-
repoPath = './',
|
|
22
|
-
commitType = 'feat',
|
|
23
|
-
subModule = '',
|
|
24
|
-
message = '',
|
|
25
|
-
options = {
|
|
26
|
-
copy: false,
|
|
27
|
-
info: false,
|
|
28
|
-
empty: false,
|
|
29
|
-
},
|
|
30
|
-
) {
|
|
31
|
-
return repoCommit(repoPath, commitType, subModule, message, options);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
static push(repoPath = './', gitUri = 'underpostnet/pwa-microservices-template') {
|
|
35
|
-
return repoPush(repoPath, gitUri);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export default Project;
|
package/startup.cjs
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
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`);
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/manifests/{core/underpost-engine-headless-service.yaml → mongodb/headless-service.yaml}
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|