underpost 2.8.885 → 2.81.0
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/.vscode/zed.keymap.json +17 -0
- package/.vscode/zed.settings.json +20 -0
- package/CHANGELOG.md +145 -1
- package/Dockerfile +20 -3
- package/README.md +6 -6
- package/bin/build.js +18 -9
- package/bin/deploy.js +130 -195
- package/bin/zed.js +20 -0
- package/cli.md +13 -7
- package/manifests/deployment/dd-default-development/deployment.yaml +2 -2
- package/manifests/deployment/dd-test-development/deployment.yaml +50 -50
- package/manifests/deployment/dd-test-development/proxy.yaml +4 -4
- package/manifests/lxd/underpost-setup.sh +5 -5
- package/package.json +3 -4
- package/{manifests/maas → scripts}/ssh-cluster-info.sh +1 -1
- package/scripts/ssl.sh +164 -0
- package/src/cli/baremetal.js +8 -8
- package/src/cli/cloud-init.js +1 -1
- package/src/cli/cluster.js +15 -4
- package/src/cli/cron.js +1 -1
- package/src/cli/db.js +2 -1
- package/src/cli/deploy.js +65 -14
- package/src/cli/fs.js +2 -2
- package/src/cli/image.js +19 -2
- package/src/cli/index.js +11 -4
- package/src/cli/monitor.js +34 -1
- package/src/cli/repository.js +42 -1
- package/src/cli/run.js +396 -86
- 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/Dockerfile +41 -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 +495 -69
- package/src/server/dns.js +169 -46
- 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/src/cli/index.js
CHANGED
|
@@ -64,10 +64,11 @@ program
|
|
|
64
64
|
// 'cmt' command: Commit changes to a GitHub repository
|
|
65
65
|
program
|
|
66
66
|
.command('cmt')
|
|
67
|
-
.argument('
|
|
68
|
-
.argument(
|
|
67
|
+
.argument('[path]', 'The absolute or relative directory path of the repository.')
|
|
68
|
+
.argument(`[commit-type]`, `The type of commit to perform. Options: ${Object.keys(commitData).join(', ')}.`)
|
|
69
69
|
.argument(`[module-tag]`, 'Optional: Sets a specific module tag for the commit.')
|
|
70
70
|
.argument(`[message]`, 'Optional: Provides an additional custom message for the commit.')
|
|
71
|
+
.option(`--log`, 'Shows commit history from the specified number of latest n path commits.')
|
|
71
72
|
.option('--empty', 'Allows committing with empty files.')
|
|
72
73
|
.option('--copy', 'Copies the generated commit message to the clipboard.')
|
|
73
74
|
.option('--info', 'Displays information about available commit types.')
|
|
@@ -89,7 +90,7 @@ program
|
|
|
89
90
|
.command('env')
|
|
90
91
|
.argument(
|
|
91
92
|
'[deploy-id]',
|
|
92
|
-
`The deployment configuration ID. Use 'clean' to restore default environment settings.
|
|
93
|
+
`The deployment configuration ID. Use 'clean' to restore default environment settings. Use 'root' to load underpost root env. Use 'current' to get plain current deploy Id.`,
|
|
93
94
|
)
|
|
94
95
|
.argument('[env]', 'Optional: The environment to set (e.g., "production", "development"). Defaults to "production".')
|
|
95
96
|
.argument('[subConf]', 'Optional: The sub configuration to set.')
|
|
@@ -183,7 +184,11 @@ program
|
|
|
183
184
|
.option('--versions <deployment-versions>', 'A comma-separated list of custom deployment versions.')
|
|
184
185
|
.option('--traffic <traffic-versions>', 'A comma-separated list of custom deployment traffic weights.')
|
|
185
186
|
.option('--disable-update-deployment', 'Disables updates to deployments.')
|
|
186
|
-
.option('--
|
|
187
|
+
.option('--disable-update-proxy', 'Disables updates to proxies.')
|
|
188
|
+
.option(
|
|
189
|
+
'--status',
|
|
190
|
+
'Retrieves current network traffic data from resource deployments and the host machine network configuration.',
|
|
191
|
+
)
|
|
187
192
|
.option('--kubeadm', 'Enables the kubeadm context for deployment operations.')
|
|
188
193
|
.option('--etc-hosts', 'Enables the etc-hosts context for deployment operations.')
|
|
189
194
|
.option('--restore-hosts', 'Restores default `/etc/hosts` entries.')
|
|
@@ -217,6 +222,7 @@ program
|
|
|
217
222
|
.option('--secrets', 'Includes Dockerfile environment secrets during the build.')
|
|
218
223
|
.option('--secrets-path [secrets-path]', 'Specifies a custom path for Dockerfile environment secrets.')
|
|
219
224
|
.option('--reset', 'Performs a build without using the cache.')
|
|
225
|
+
.option('--dev', 'Use development mode.')
|
|
220
226
|
.option('--k3s-load', 'Loads the image into a K3s cluster.')
|
|
221
227
|
.description(
|
|
222
228
|
'Builds a Docker image from a specified Dockerfile with various options for naming, saving, and loading.',
|
|
@@ -231,6 +237,7 @@ program
|
|
|
231
237
|
.option('--kubeadm-load', 'Imports the pulled image into a Kubeadm cluster.')
|
|
232
238
|
.option('--version', 'Sets a custom version for the base images.')
|
|
233
239
|
.option('--k3s-load', 'Loads the image into a K3s cluster.')
|
|
240
|
+
.option('--dev', 'Use development mode.')
|
|
234
241
|
.description('Pulls required Underpost Dockerfile base images and optionally loads them into clusters.')
|
|
235
242
|
.action(Underpost.image.dockerfile.pullBaseImages);
|
|
236
243
|
|
package/src/cli/monitor.js
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Monitor module for managing the monitoring of deployments and services.
|
|
3
|
+
* @module src/cli/monitor.js
|
|
4
|
+
* @namespace UnderpostMonitor
|
|
5
|
+
*/
|
|
6
|
+
|
|
1
7
|
import { loadReplicas, pathPortAssignmentFactory } from '../server/conf.js';
|
|
2
8
|
import { loggerFactory } from '../server/logger.js';
|
|
3
9
|
import UnderpostDeploy from './deploy.js';
|
|
@@ -9,8 +15,34 @@ import { isInternetConnection } from '../server/dns.js';
|
|
|
9
15
|
|
|
10
16
|
const logger = loggerFactory(import.meta);
|
|
11
17
|
|
|
18
|
+
/**
|
|
19
|
+
* @class UnderpostMonitor
|
|
20
|
+
* @description Manages deployment monitoring and health checks.
|
|
21
|
+
* This class provides a set of static methods to monitor and manage
|
|
22
|
+
* deployment health, including checking server status, handling traffic
|
|
23
|
+
* switching, and orchestrating monitoring workflows.
|
|
24
|
+
* @memberof UnderpostMonitor
|
|
25
|
+
*/
|
|
12
26
|
class UnderpostMonitor {
|
|
13
27
|
static API = {
|
|
28
|
+
/**
|
|
29
|
+
* @method callback
|
|
30
|
+
* @description Initiates a deployment monitoring workflow based on the provided options.
|
|
31
|
+
* This method orchestrates the monitoring process for a specific deployment, handling
|
|
32
|
+
* traffic switching, error accumulation, and optional Git integration for version control.
|
|
33
|
+
* @param {string} deployId - The identifier for the deployment to monitor.
|
|
34
|
+
* @param {string} [env='development'] - The environment for the deployment (e.g., 'development', 'production').
|
|
35
|
+
* @param {object} [options] - An object containing boolean flags for various operations.
|
|
36
|
+
* @param {boolean} [options.now=false] - Perform a single health check immediately.
|
|
37
|
+
* @param {boolean} [options.single=false] - Perform a single health check and exit.
|
|
38
|
+
* @param {string} [options.msInterval=''] - Interval in milliseconds for periodic health checks.
|
|
39
|
+
* @param {string} [options.type=''] - Type of deployment (e.g., 'blue-green', 'remote').
|
|
40
|
+
* @param {string} [options.replicas=''] - Number of replicas for the deployment.
|
|
41
|
+
* @param {boolean} [options.sync=false] - Synchronize traffic switching with the deployment.
|
|
42
|
+
* @param {object} [commanderOptions] - Options passed from the command line interface.
|
|
43
|
+
* @param {object} [auxRouter] - Optional router configuration for the deployment.
|
|
44
|
+
* @memberof UnderpostMonitor
|
|
45
|
+
*/
|
|
14
46
|
async callback(
|
|
15
47
|
deployId,
|
|
16
48
|
env = 'development',
|
|
@@ -33,10 +65,11 @@ class UnderpostMonitor {
|
|
|
33
65
|
const router = auxRouter ?? (await UnderpostDeploy.API.routerFactory(deployId, env));
|
|
34
66
|
|
|
35
67
|
const confServer = loadReplicas(
|
|
68
|
+
deployId,
|
|
36
69
|
JSON.parse(fs.readFileSync(`./engine-private/conf/${deployId}/conf.server.json`, 'utf8')),
|
|
37
70
|
);
|
|
38
71
|
|
|
39
|
-
const pathPortAssignmentData = pathPortAssignmentFactory(router, confServer);
|
|
72
|
+
const pathPortAssignmentData = await pathPortAssignmentFactory(deployId, router, confServer);
|
|
40
73
|
|
|
41
74
|
let errorPayloads = [];
|
|
42
75
|
if (options.sync === true) {
|
package/src/cli/repository.js
CHANGED
|
@@ -83,7 +83,7 @@ class UnderpostRepository {
|
|
|
83
83
|
* @memberof UnderpostRepository
|
|
84
84
|
*/
|
|
85
85
|
commit(
|
|
86
|
-
repoPath =
|
|
86
|
+
repoPath = undefined,
|
|
87
87
|
commitType = 'feat',
|
|
88
88
|
subModule = '',
|
|
89
89
|
message = '',
|
|
@@ -91,8 +91,31 @@ class UnderpostRepository {
|
|
|
91
91
|
copy: false,
|
|
92
92
|
info: false,
|
|
93
93
|
empty: false,
|
|
94
|
+
log: false,
|
|
94
95
|
},
|
|
95
96
|
) {
|
|
97
|
+
if (options.log) {
|
|
98
|
+
const history = UnderpostRepository.API.getHistory(repoPath);
|
|
99
|
+
if (history[0]) {
|
|
100
|
+
pbcopy(
|
|
101
|
+
history
|
|
102
|
+
.reverse()
|
|
103
|
+
.map((commitData, i) => `${i === 0 ? '' : ' && '}git --no-pager show ${commitData.hash}`)
|
|
104
|
+
.join(''),
|
|
105
|
+
);
|
|
106
|
+
for (const commit of history) {
|
|
107
|
+
console.log(commit.hash.yellow, commit.message);
|
|
108
|
+
console.log(
|
|
109
|
+
shellExec(`git show --name-status --pretty="" ${commit.hash}`, {
|
|
110
|
+
stdout: true,
|
|
111
|
+
silent: true,
|
|
112
|
+
disableLog: true,
|
|
113
|
+
}).red,
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
} else logger.warn('No commits found');
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
96
119
|
if (commitType === 'reset') {
|
|
97
120
|
if (options.copy) pbcopy(shellExec(`git --no-pager log -1 --pretty=%B`, { stdout: true }));
|
|
98
121
|
shellExec(`cd ${repoPath} && git reset --soft HEAD~${isNaN(parseInt(subModule)) ? 1 : parseInt(subModule)}`);
|
|
@@ -268,6 +291,24 @@ Prevent build private config repo.`,
|
|
|
268
291
|
deployVersion: packageJsonDeploy.version,
|
|
269
292
|
};
|
|
270
293
|
},
|
|
294
|
+
getHistory(sinceCommit = 5) {
|
|
295
|
+
return shellExec(`git log --oneline --graph --decorate -n ${sinceCommit}`, { stdout: true, silent: true })
|
|
296
|
+
.split(`\n`)
|
|
297
|
+
.map((line) => {
|
|
298
|
+
return {
|
|
299
|
+
hash: line.slice(2, 10),
|
|
300
|
+
message: line.slice(11),
|
|
301
|
+
};
|
|
302
|
+
})
|
|
303
|
+
.filter((line) => line.hash)
|
|
304
|
+
.map((line) => {
|
|
305
|
+
line.files = shellExec(`git show --name-status --pretty="" ${line.hash}`, {
|
|
306
|
+
stdout: true,
|
|
307
|
+
silent: true,
|
|
308
|
+
});
|
|
309
|
+
return line;
|
|
310
|
+
});
|
|
311
|
+
},
|
|
271
312
|
};
|
|
272
313
|
}
|
|
273
314
|
|