underpost 2.8.885 → 2.8.886
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.production +3 -0
- package/.github/workflows/ghpkg.ci.yml +1 -1
- package/.github/workflows/npmpkg.ci.yml +1 -1
- package/.github/workflows/publish.ci.yml +5 -5
- package/.github/workflows/pwa-microservices-template-page.cd.yml +1 -1
- package/.github/workflows/pwa-microservices-template-test.ci.yml +1 -1
- package/CHANGELOG.md +145 -1
- package/Dockerfile +1 -1
- package/README.md +3 -3
- package/bin/build.js +18 -9
- package/bin/deploy.js +93 -187
- package/cli.md +2 -2
- package/manifests/deployment/dd-default-development/deployment.yaml +2 -2
- package/manifests/deployment/dd-test-development/deployment.yaml +54 -54
- package/manifests/deployment/dd-test-development/proxy.yaml +4 -4
- package/manifests/lxd/underpost-setup.sh +5 -5
- package/package.json +3 -3
- package/scripts/ssl.sh +164 -0
- package/src/cli/baremetal.js +7 -7
- package/src/cli/cloud-init.js +1 -1
- package/src/cli/cluster.js +10 -3
- package/src/cli/cron.js +1 -1
- package/src/cli/db.js +1 -1
- package/src/cli/deploy.js +33 -1
- package/src/cli/fs.js +2 -2
- package/src/cli/image.js +7 -0
- package/src/cli/monitor.js +33 -1
- package/src/cli/run.js +315 -51
- package/src/cli/script.js +32 -0
- package/src/cli/secrets.js +34 -0
- package/src/cli/test.js +42 -1
- package/src/client/components/core/Css.js +0 -8
- package/src/client/components/core/windowGetDimensions.js +229 -162
- package/src/index.js +2 -2
- package/src/mailer/MailerProvider.js +1 -0
- package/src/runtime/express/Express.js +12 -4
- package/src/runtime/lampp/Dockerfile +1 -1
- package/src/server/backup.js +20 -0
- package/src/server/client-build-live.js +12 -10
- package/src/server/client-build.js +136 -91
- package/src/server/client-dev-server.js +16 -2
- package/src/server/client-icons.js +19 -0
- package/src/server/conf.js +470 -60
- package/src/server/dns.js +184 -42
- package/src/server/downloader.js +65 -24
- package/src/server/object-layer.js +260 -162
- package/src/server/peer.js +2 -8
- package/src/server/proxy.js +93 -76
- package/src/server/runtime.js +15 -16
- package/src/server/ssr.js +4 -4
- package/src/server/tls.js +251 -0
- package/src/server/valkey.js +11 -10
- package/src/ws/IoInterface.js +2 -1
- package/src/ws/IoServer.js +2 -1
- package/src/ws/core/core.ws.connection.js +1 -1
- package/src/ws/core/core.ws.emit.js +1 -1
- package/src/ws/core/core.ws.server.js +1 -1
- package/manifests/maas/lxd-preseed.yaml +0 -32
- package/src/server/ssl.js +0 -108
- /package/{manifests/maas → scripts}/device-scan.sh +0 -0
- /package/{manifests/maas → scripts}/gpu-diag.sh +0 -0
- /package/{manifests/maas → scripts}/maas-setup.sh +0 -0
- /package/{manifests/maas → scripts}/nat-iptables.sh +0 -0
- /package/{manifests/maas → scripts}/nvim.sh +0 -0
- /package/{manifests/maas → scripts}/snap-clean.sh +0 -0
- /package/{manifests/maas → scripts}/ssh-cluster-info.sh +0 -0
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Module for live building client-side code
|
|
3
|
+
* @module src/server/client-build-live.js
|
|
4
|
+
* @namespace clientLiveBuild
|
|
5
|
+
*/
|
|
6
|
+
|
|
1
7
|
import fs from 'fs-extra';
|
|
2
8
|
import { Config, loadConf } from './conf.js';
|
|
3
9
|
import { loggerFactory } from './logger.js';
|
|
@@ -5,6 +11,11 @@ import { buildClient } from './client-build.js';
|
|
|
5
11
|
|
|
6
12
|
const logger = loggerFactory(import.meta);
|
|
7
13
|
|
|
14
|
+
/**
|
|
15
|
+
* @function clientLiveBuild
|
|
16
|
+
* @description Initiates a live build of client-side code.
|
|
17
|
+
* @memberof clientLiveBuild
|
|
18
|
+
*/
|
|
8
19
|
const clientLiveBuild = async () => {
|
|
9
20
|
if (fs.existsSync(`./tmp/client.build.json`)) {
|
|
10
21
|
const deployId = process.argv[2];
|
|
@@ -33,16 +44,7 @@ const clientLiveBuild = async () => {
|
|
|
33
44
|
),
|
|
34
45
|
);
|
|
35
46
|
const confServer = JSON.parse(
|
|
36
|
-
fs.readFileSync(
|
|
37
|
-
fs.existsSync(`./engine-private/conf/${deployId}/conf.server.dev.${subConf}.json`)
|
|
38
|
-
? `./engine-private/conf/${deployId}/conf.server.dev.${subConf}.json`
|
|
39
|
-
: fs.existsSync(`./engine-private/replica/${deployId}`)
|
|
40
|
-
? `./engine-private/replica/${deployId}/conf.server.json`
|
|
41
|
-
: fs.existsSync(`./engine-private/conf/${deployId}/conf.server.json`)
|
|
42
|
-
? `./engine-private/conf/${deployId}/conf.server.json`
|
|
43
|
-
: `./conf/conf.server.json`,
|
|
44
|
-
'utf8',
|
|
45
|
-
),
|
|
47
|
+
fs.readFileSync(`./engine-private/conf/${deployId}/conf.server.dev.${subConf}.json`, 'utf8'),
|
|
46
48
|
);
|
|
47
49
|
host = process.argv[4];
|
|
48
50
|
path = process.argv[5];
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Manages the client-side build process, including full builds and incremental builds.
|
|
3
|
+
* @module server/client-build.js
|
|
4
|
+
* @namespace clientBuild
|
|
5
|
+
*/
|
|
6
|
+
|
|
1
7
|
'use strict';
|
|
2
8
|
|
|
3
9
|
import fs from 'fs-extra';
|
|
@@ -26,97 +32,17 @@ dotenv.config();
|
|
|
26
32
|
|
|
27
33
|
// Static Site Generation (SSG)
|
|
28
34
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
db,
|
|
41
|
-
dists,
|
|
42
|
-
rootClientPath,
|
|
43
|
-
acmeChallengeFullPath,
|
|
44
|
-
publicClientId,
|
|
45
|
-
iconsBuild,
|
|
46
|
-
metadata,
|
|
47
|
-
}) => {
|
|
48
|
-
logger.warn('Full build', rootClientPath);
|
|
49
|
-
|
|
50
|
-
buildAcmeChallengePath(acmeChallengeFullPath);
|
|
51
|
-
|
|
52
|
-
if (publicClientId && publicClientId.startsWith('html-website-templates')) {
|
|
53
|
-
if (!fs.existsSync(`/home/dd/html-website-templates/`))
|
|
54
|
-
shellExec(`cd /home/dd && git clone https://github.com/designmodo/html-website-templates.git`);
|
|
55
|
-
if (!fs.existsSync(`${rootClientPath}/index.php`)) {
|
|
56
|
-
fs.copySync(`/home/dd/html-website-templates/${publicClientId.split('-publicClientId-')[1]}`, rootClientPath);
|
|
57
|
-
shellExec(`cd ${rootClientPath} && git init && git add . && git commit -m "Base template implementation"`);
|
|
58
|
-
// git remote add origin git@github.com:<username>/<repo>.git
|
|
59
|
-
fs.writeFileSync(`${rootClientPath}/.git/.htaccess`, `Deny from all`, 'utf8');
|
|
60
|
-
}
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
fs.removeSync(rootClientPath);
|
|
65
|
-
|
|
66
|
-
if (fs.existsSync(`./src/client/public/${publicClientId}`)) {
|
|
67
|
-
if (iconsBuild === true) await buildIcons({ publicClientId, metadata });
|
|
68
|
-
|
|
69
|
-
fs.copySync(
|
|
70
|
-
`./src/client/public/${publicClientId}`,
|
|
71
|
-
rootClientPath /* {
|
|
72
|
-
filter: function (name) {
|
|
73
|
-
console.log(name);
|
|
74
|
-
return true;
|
|
75
|
-
},
|
|
76
|
-
} */,
|
|
77
|
-
);
|
|
78
|
-
} else if (fs.existsSync(`./engine-private/src/client/public/${publicClientId}`)) {
|
|
79
|
-
switch (publicClientId) {
|
|
80
|
-
case 'mysql_test':
|
|
81
|
-
if (db) {
|
|
82
|
-
fs.copySync(`./engine-private/src/client/public/${publicClientId}`, rootClientPath);
|
|
83
|
-
fs.writeFileSync(
|
|
84
|
-
`${rootClientPath}/index.php`,
|
|
85
|
-
fs
|
|
86
|
-
.readFileSync(`${rootClientPath}/index.php`, 'utf8')
|
|
87
|
-
.replace('test_servername', 'localhost')
|
|
88
|
-
.replace('test_username', db.user)
|
|
89
|
-
.replace('test_password', db.password)
|
|
90
|
-
.replace('test_dbname', db.name),
|
|
91
|
-
'utf8',
|
|
92
|
-
);
|
|
93
|
-
} else logger.error('not provided db config');
|
|
94
|
-
break;
|
|
95
|
-
|
|
96
|
-
default:
|
|
97
|
-
break;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
if (dists)
|
|
101
|
-
for (const dist of dists) {
|
|
102
|
-
if ('folder' in dist) {
|
|
103
|
-
if (fs.statSync(dist.folder).isDirectory()) {
|
|
104
|
-
fs.mkdirSync(`${rootClientPath}${dist.public_folder}`, { recursive: true });
|
|
105
|
-
fs.copySync(dist.folder, `${rootClientPath}${dist.public_folder}`);
|
|
106
|
-
} else {
|
|
107
|
-
const folder = dist.public_folder.split('/');
|
|
108
|
-
folder.pop();
|
|
109
|
-
fs.mkdirSync(`${rootClientPath}${folder.join('/')}`, { recursive: true });
|
|
110
|
-
fs.copyFileSync(dist.folder, `${rootClientPath}${dist.public_folder}`);
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
if ('styles' in dist) {
|
|
114
|
-
fs.mkdirSync(`${rootClientPath}${dist.public_styles_folder}`, { recursive: true });
|
|
115
|
-
fs.copySync(dist.styles, `${rootClientPath}${dist.public_styles_folder}`);
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
};
|
|
119
|
-
|
|
35
|
+
/**
|
|
36
|
+
* @async
|
|
37
|
+
* @function buildClient
|
|
38
|
+
* @memberof clientBuild
|
|
39
|
+
* @param {Object} options - Options for the build process.
|
|
40
|
+
* @param {Array} options.liveClientBuildPaths - List of paths to build incrementally.
|
|
41
|
+
* @param {Array} options.instances - List of instances to build.
|
|
42
|
+
* @returns {Promise<void>} - Promise that resolves when the build is complete.
|
|
43
|
+
* @throws {Error} - If the build fails.
|
|
44
|
+
* @memberof clientBuild
|
|
45
|
+
*/
|
|
120
46
|
const buildClient = async (options = { liveClientBuildPaths: [], instances: [] }) => {
|
|
121
47
|
const logger = loggerFactory(import.meta);
|
|
122
48
|
const confClient = JSON.parse(fs.readFileSync(`./conf/conf.client.json`, 'utf8'));
|
|
@@ -126,6 +52,125 @@ const buildClient = async (options = { liveClientBuildPaths: [], instances: [] }
|
|
|
126
52
|
const acmeChallengePath = `/.well-known/acme-challenge`;
|
|
127
53
|
const publicPath = `./public`;
|
|
128
54
|
|
|
55
|
+
/**
|
|
56
|
+
* @async
|
|
57
|
+
* @function buildAcmeChallengePath
|
|
58
|
+
* @memberof clientBuild
|
|
59
|
+
* @param {string} acmeChallengeFullPath - Full path to the acme-challenge directory.
|
|
60
|
+
* @returns {void}
|
|
61
|
+
* @throws {Error} - If the directory cannot be created.
|
|
62
|
+
* @memberof clientBuild
|
|
63
|
+
*/
|
|
64
|
+
const buildAcmeChallengePath = (acmeChallengeFullPath = '') => {
|
|
65
|
+
fs.mkdirSync(acmeChallengeFullPath, {
|
|
66
|
+
recursive: true,
|
|
67
|
+
});
|
|
68
|
+
fs.writeFileSync(`${acmeChallengeFullPath}/.gitkeep`, '', 'utf8');
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* @async
|
|
73
|
+
* @function fullBuild
|
|
74
|
+
* @memberof clientBuild
|
|
75
|
+
* @param {Object} options - Options for the full build process.
|
|
76
|
+
* @param {string} options.path - Path to the client directory.
|
|
77
|
+
* @param {Object} options.logger - Logger instance.
|
|
78
|
+
* @param {string} options.client - Client name.
|
|
79
|
+
* @param {Object} options.db - Database configuration.
|
|
80
|
+
* @param {Array} options.dists - List of distributions to build.
|
|
81
|
+
* @param {string} options.rootClientPath - Full path to the client directory.
|
|
82
|
+
* @param {string} options.acmeChallengeFullPath - Full path to the acme-challenge directory.
|
|
83
|
+
* @param {string} options.publicClientId - Public client ID.
|
|
84
|
+
* @param {boolean} options.iconsBuild - Whether to build icons.
|
|
85
|
+
* @param {Object} options.metadata - Metadata for the client.
|
|
86
|
+
* @returns {Promise<void>} - Promise that resolves when the full build is complete.
|
|
87
|
+
* @throws {Error} - If the full build fails.
|
|
88
|
+
* @memberof clientBuild
|
|
89
|
+
*/
|
|
90
|
+
const fullBuild = async ({
|
|
91
|
+
path,
|
|
92
|
+
logger,
|
|
93
|
+
client,
|
|
94
|
+
db,
|
|
95
|
+
dists,
|
|
96
|
+
rootClientPath,
|
|
97
|
+
acmeChallengeFullPath,
|
|
98
|
+
publicClientId,
|
|
99
|
+
iconsBuild,
|
|
100
|
+
metadata,
|
|
101
|
+
}) => {
|
|
102
|
+
logger.warn('Full build', rootClientPath);
|
|
103
|
+
|
|
104
|
+
buildAcmeChallengePath(acmeChallengeFullPath);
|
|
105
|
+
|
|
106
|
+
if (publicClientId && publicClientId.startsWith('html-website-templates')) {
|
|
107
|
+
if (!fs.existsSync(`/home/dd/html-website-templates/`))
|
|
108
|
+
shellExec(`cd /home/dd && git clone https://github.com/designmodo/html-website-templates.git`);
|
|
109
|
+
if (!fs.existsSync(`${rootClientPath}/index.php`)) {
|
|
110
|
+
fs.copySync(`/home/dd/html-website-templates/${publicClientId.split('-publicClientId-')[1]}`, rootClientPath);
|
|
111
|
+
shellExec(`cd ${rootClientPath} && git init && git add . && git commit -m "Base template implementation"`);
|
|
112
|
+
// git remote add origin git@github.com:<username>/<repo>.git
|
|
113
|
+
fs.writeFileSync(`${rootClientPath}/.git/.htaccess`, `Deny from all`, 'utf8');
|
|
114
|
+
}
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
fs.removeSync(rootClientPath);
|
|
119
|
+
|
|
120
|
+
if (fs.existsSync(`./src/client/public/${publicClientId}`)) {
|
|
121
|
+
if (iconsBuild === true) await buildIcons({ publicClientId, metadata });
|
|
122
|
+
|
|
123
|
+
fs.copySync(
|
|
124
|
+
`./src/client/public/${publicClientId}`,
|
|
125
|
+
rootClientPath /* {
|
|
126
|
+
filter: function (name) {
|
|
127
|
+
console.log(name);
|
|
128
|
+
return true;
|
|
129
|
+
},
|
|
130
|
+
} */,
|
|
131
|
+
);
|
|
132
|
+
} else if (fs.existsSync(`./engine-private/src/client/public/${publicClientId}`)) {
|
|
133
|
+
switch (publicClientId) {
|
|
134
|
+
case 'mysql_test':
|
|
135
|
+
if (db) {
|
|
136
|
+
fs.copySync(`./engine-private/src/client/public/${publicClientId}`, rootClientPath);
|
|
137
|
+
fs.writeFileSync(
|
|
138
|
+
`${rootClientPath}/index.php`,
|
|
139
|
+
fs
|
|
140
|
+
.readFileSync(`${rootClientPath}/index.php`, 'utf8')
|
|
141
|
+
.replace('test_servername', 'localhost')
|
|
142
|
+
.replace('test_username', db.user)
|
|
143
|
+
.replace('test_password', db.password)
|
|
144
|
+
.replace('test_dbname', db.name),
|
|
145
|
+
'utf8',
|
|
146
|
+
);
|
|
147
|
+
} else logger.error('not provided db config');
|
|
148
|
+
break;
|
|
149
|
+
|
|
150
|
+
default:
|
|
151
|
+
break;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
if (dists)
|
|
155
|
+
for (const dist of dists) {
|
|
156
|
+
if ('folder' in dist) {
|
|
157
|
+
if (fs.statSync(dist.folder).isDirectory()) {
|
|
158
|
+
fs.mkdirSync(`${rootClientPath}${dist.public_folder}`, { recursive: true });
|
|
159
|
+
fs.copySync(dist.folder, `${rootClientPath}${dist.public_folder}`);
|
|
160
|
+
} else {
|
|
161
|
+
const folder = dist.public_folder.split('/');
|
|
162
|
+
folder.pop();
|
|
163
|
+
fs.mkdirSync(`${rootClientPath}${folder.join('/')}`, { recursive: true });
|
|
164
|
+
fs.copyFileSync(dist.folder, `${rootClientPath}${dist.public_folder}`);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
if ('styles' in dist) {
|
|
168
|
+
fs.mkdirSync(`${rootClientPath}${dist.public_styles_folder}`, { recursive: true });
|
|
169
|
+
fs.copySync(dist.styles, `${rootClientPath}${dist.public_styles_folder}`);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
|
|
129
174
|
// { srcBuildPath, publicBuildPath }
|
|
130
175
|
const enableLiveRebuild =
|
|
131
176
|
options && options.liveClientBuildPaths && options.liveClientBuildPaths.length > 0 ? true : false;
|
|
@@ -1,12 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Module for creating a client-side development server
|
|
3
|
+
* @module src/server/client-dev-server.js
|
|
4
|
+
* @namespace clientDevServer
|
|
5
|
+
*/
|
|
1
6
|
import fs from 'fs-extra';
|
|
2
7
|
import nodemon from 'nodemon';
|
|
3
8
|
import { shellExec } from './process.js';
|
|
4
9
|
import { loggerFactory } from './logger.js';
|
|
5
|
-
import { writeEnv } from './conf.js';
|
|
6
|
-
import dotenv from 'dotenv';
|
|
7
10
|
|
|
8
11
|
const logger = loggerFactory(import.meta);
|
|
9
12
|
|
|
13
|
+
/**
|
|
14
|
+
* @function createClientDevServer
|
|
15
|
+
* @description Creates a client-side development server.
|
|
16
|
+
* @memberof clientDevServer
|
|
17
|
+
* @param {string} deployId - The deployment ID.
|
|
18
|
+
* @param {string} subConf - The sub-configuration.
|
|
19
|
+
* @param {string} host - The host.
|
|
20
|
+
* @param {string} path - The path.
|
|
21
|
+
* @returns {void}
|
|
22
|
+
* @memberof clientDevServer
|
|
23
|
+
*/
|
|
10
24
|
const createClientDevServer = (
|
|
11
25
|
deployId = process.argv[2] || 'dd-default',
|
|
12
26
|
subConf = process.argv[3] || '',
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Module for building client-side icons
|
|
3
|
+
* @module src/server/client-icons.js
|
|
4
|
+
* @namespace clientIcons
|
|
5
|
+
*/
|
|
1
6
|
import { favicons } from 'favicons';
|
|
2
7
|
import { loggerFactory } from './logger.js';
|
|
3
8
|
import fs from 'fs-extra';
|
|
@@ -5,6 +10,20 @@ import { getCapVariableName } from '../client/components/core/CommonJs.js';
|
|
|
5
10
|
|
|
6
11
|
const logger = loggerFactory(import.meta);
|
|
7
12
|
|
|
13
|
+
/**
|
|
14
|
+
* @function buildIcons
|
|
15
|
+
* @description Builds icons for a client-side application.
|
|
16
|
+
* @memberof clientIcons
|
|
17
|
+
* @param {Object} metadata - The metadata for the client-side application.
|
|
18
|
+
* @param {string} metadata.title - The title of the client-side application.
|
|
19
|
+
* @param {string} metadata.description - The description of the client-side application.
|
|
20
|
+
* @param {string} metadata.keywords - The keywords for the client-side application.
|
|
21
|
+
* @param {string} metadata.author - The author of the client-side application.
|
|
22
|
+
* @param {string} metadata.thumbnail - The thumbnail of the client-side application.
|
|
23
|
+
* @param {string} metadata.themeColor - The theme color of the client-side application.
|
|
24
|
+
* @param {string} metadata.baseBuildIconReference - The base build icon reference for the client-side application.
|
|
25
|
+
* @returns {Promise<void>}
|
|
26
|
+
*/
|
|
8
27
|
const buildIcons = async ({
|
|
9
28
|
publicClientId,
|
|
10
29
|
metadata: { title, description, keywords, author, thumbnail, themeColor, baseBuildIconReference },
|