underpost 2.8.886 → 2.81.1
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/release.cd.yml +1 -1
- package/.vscode/zed.keymap.json +17 -0
- package/.vscode/zed.settings.json +20 -0
- package/Dockerfile +19 -2
- package/README.md +5 -5
- package/bin/deploy.js +38 -10
- 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 +6 -6
- package/package.json +3 -5
- package/scripts/ssh-cluster-info.sh +1 -1
- package/src/cli/baremetal.js +1 -1
- package/src/cli/cluster.js +5 -1
- package/src/cli/db.js +1 -0
- package/src/cli/deploy.js +33 -16
- package/src/cli/image.js +12 -2
- package/src/cli/index.js +11 -4
- package/src/cli/monitor.js +1 -0
- package/src/cli/repository.js +47 -1
- package/src/cli/run.js +85 -39
- package/src/index.js +1 -1
- package/src/runtime/express/Dockerfile +41 -0
- package/src/server/conf.js +40 -34
- package/src/server/dns.js +25 -44
- package/CHANGELOG.md +0 -349
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"context": "Editor && edit_prediction",
|
|
4
|
+
"bindings": {
|
|
5
|
+
"tab": "editor::AcceptEditPrediction",
|
|
6
|
+
"alt-tab": "editor::AcceptEditPrediction",
|
|
7
|
+
"alt-l": null
|
|
8
|
+
}
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"context": "Editor && edit_prediction_conflict",
|
|
12
|
+
"bindings": {
|
|
13
|
+
"alt-l": "editor::AcceptEditPrediction",
|
|
14
|
+
"tab": "editor::ComposeCompletion"
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
]
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"ui_font_size": 16,
|
|
3
|
+
"buffer_font_size": 15,
|
|
4
|
+
"theme": {
|
|
5
|
+
"mode": "system",
|
|
6
|
+
"light": "One Dark",
|
|
7
|
+
"dark": "One Dark"
|
|
8
|
+
},
|
|
9
|
+
|
|
10
|
+
"features": {
|
|
11
|
+
"edit_prediction_provider": "copilot",
|
|
12
|
+
"copilot": true // https://github.com/login/device
|
|
13
|
+
},
|
|
14
|
+
|
|
15
|
+
"show_edit_predictions": true,
|
|
16
|
+
|
|
17
|
+
"edit_predictions": {
|
|
18
|
+
"mode": "eager"
|
|
19
|
+
}
|
|
20
|
+
}
|
package/Dockerfile
CHANGED
|
@@ -1,7 +1,24 @@
|
|
|
1
1
|
FROM rockylinux:9
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
RUN dnf
|
|
3
|
+
# --- Update and install required packages
|
|
4
|
+
RUN dnf -y update && \
|
|
5
|
+
dnf -y install epel-release && \
|
|
6
|
+
dnf -y install --allowerasing \
|
|
7
|
+
bzip2 \
|
|
8
|
+
sudo \
|
|
9
|
+
curl \
|
|
10
|
+
net-tools \
|
|
11
|
+
openssh-server \
|
|
12
|
+
nano \
|
|
13
|
+
vim-enhanced \
|
|
14
|
+
less \
|
|
15
|
+
openssl-devel \
|
|
16
|
+
wget \
|
|
17
|
+
git \
|
|
18
|
+
gnupg2 \
|
|
19
|
+
libnsl \
|
|
20
|
+
perl && \
|
|
21
|
+
dnf clean all
|
|
5
22
|
|
|
6
23
|
|
|
7
24
|
# Install Node.js
|
package/README.md
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
|
|
19
19
|
<!-- badges -->
|
|
20
20
|
|
|
21
|
-
[](https://github.com/underpostnet/engine/actions/workflows/docker-image.yml) [](https://github.com/underpostnet/engine/actions/workflows/coverall.yml) [](https://www.npmjs.com/package/underpost) [](https://github.com/underpostnet/engine/actions/workflows/docker-image.yml) [](https://github.com/underpostnet/engine/actions/workflows/coverall.yml) [](https://www.npmjs.com/package/underpost) [](https://socket.dev/npm/package/underpost/overview/2.81.1) [](https://coveralls.io/github/underpostnet/engine?branch=master) [](https://www.npmjs.org/package/underpost) [](https://www.npmjs.com/package/underpost)
|
|
22
22
|
|
|
23
23
|
<!-- end-badges -->
|
|
24
24
|
|
|
@@ -66,7 +66,7 @@ Run dev client server
|
|
|
66
66
|
npm run dev
|
|
67
67
|
```
|
|
68
68
|
<!-- -->
|
|
69
|
-
## underpost ci/cd cli v2.
|
|
69
|
+
## underpost ci/cd cli v2.81.1
|
|
70
70
|
|
|
71
71
|
### Usage: `underpost [options] [command]`
|
|
72
72
|
```
|
|
@@ -79,7 +79,7 @@ Commands:
|
|
|
79
79
|
start [options] <deploy-id> [env] Initiates application servers, build pipelines, or other defined services based on the deployment ID.
|
|
80
80
|
clone [options] <uri> Clones a specified GitHub repository into the current directory.
|
|
81
81
|
pull [options] <path> <uri> Pulls the latest changes from a specified GitHub repository.
|
|
82
|
-
cmt [options]
|
|
82
|
+
cmt [options] [path] [commit-type] [module-tag] [message] Manages commits to a GitHub repository, supporting various commit types and options.
|
|
83
83
|
push [options] <path> <uri> Pushes committed changes from a local repository to a remote GitHub repository.
|
|
84
84
|
env [deploy-id] [env] [subConf] Sets environment variables and configurations related to a specific deployment ID.
|
|
85
85
|
config [options] <operator> [key] [value] Manages Underpost configurations using various operators.
|
|
@@ -104,6 +104,6 @@ Commands:
|
|
|
104
104
|
help [command] display help for command
|
|
105
105
|
|
|
106
106
|
```
|
|
107
|
-
|
|
107
|
+
|
|
108
108
|
<a target="_top" href="https://github.com/underpostnet/pwa-microservices-template/blob/master/cli.md">See complete CLI Docs here.</a>
|
|
109
|
-
|
|
109
|
+
|
package/bin/deploy.js
CHANGED
|
@@ -27,7 +27,7 @@ import { buildClient } from '../src/server/client-build.js';
|
|
|
27
27
|
import { DefaultConf } from '../conf.js';
|
|
28
28
|
import colors from 'colors';
|
|
29
29
|
import { program } from '../src/cli/index.js';
|
|
30
|
-
import { getLocalIPv4Address
|
|
30
|
+
import Dns, { getLocalIPv4Address } from '../src/server/dns.js';
|
|
31
31
|
import { timer } from '../src/client/components/core/CommonJs.js';
|
|
32
32
|
|
|
33
33
|
colors.enable();
|
|
@@ -124,8 +124,12 @@ try {
|
|
|
124
124
|
case 'conf': {
|
|
125
125
|
let subConf = process.argv[5] ?? '';
|
|
126
126
|
|
|
127
|
-
if (!['current', 'clean'].includes(process.argv[3]))
|
|
128
|
-
|
|
127
|
+
if (!['current', 'clean', 'root'].includes(process.argv[3])) {
|
|
128
|
+
const path = fs.existsSync(`./engine-private/replica/${process.argv[3]}`)
|
|
129
|
+
? `./engine-private/replica/${process.argv[3]}/.env.${process.argv[4]}`
|
|
130
|
+
: `./engine-private/conf/${process.argv[3]}/.env.${process.argv[4]}`;
|
|
131
|
+
dotenv.config({ path, override: true });
|
|
132
|
+
}
|
|
129
133
|
|
|
130
134
|
loadConf(process.argv[3], subConf);
|
|
131
135
|
break;
|
|
@@ -247,7 +251,7 @@ try {
|
|
|
247
251
|
break;
|
|
248
252
|
|
|
249
253
|
case 'sync-env-port':
|
|
250
|
-
const dataDeploy = getDataDeploy({
|
|
254
|
+
const dataDeploy = getDataDeploy({ disableSyncEnvPort: true });
|
|
251
255
|
const dataEnv = [
|
|
252
256
|
{ env: 'production', port: 3000 },
|
|
253
257
|
{ env: 'development', port: 4000 },
|
|
@@ -267,6 +271,7 @@ try {
|
|
|
267
271
|
writeEnv(envPath, envObj);
|
|
268
272
|
}
|
|
269
273
|
const serverConf = loadReplicas(
|
|
274
|
+
deployId,
|
|
270
275
|
JSON.parse(fs.readFileSync(`${baseConfPath}/${deployId}/conf.server.json`, 'utf8')),
|
|
271
276
|
);
|
|
272
277
|
for (const host of Object.keys(serverConf)) {
|
|
@@ -287,6 +292,7 @@ try {
|
|
|
287
292
|
const host = process.argv[4];
|
|
288
293
|
const path = process.argv[5];
|
|
289
294
|
const serverConf = loadReplicas(
|
|
295
|
+
deployId,
|
|
290
296
|
JSON.parse(fs.readFileSync(`./engine-private/conf/${deployId}/conf.server.json`, 'utf8')),
|
|
291
297
|
);
|
|
292
298
|
|
|
@@ -453,7 +459,6 @@ try {
|
|
|
453
459
|
);
|
|
454
460
|
shellExec(`node bin/deploy cli-docs ${version} ${newVersion}`);
|
|
455
461
|
shellExec(`node bin/deploy update-dependencies`);
|
|
456
|
-
shellExec(`auto-changelog`);
|
|
457
462
|
shellExec(`node bin/build dd`);
|
|
458
463
|
shellExec(
|
|
459
464
|
`node bin deploy --kubeadm --build-manifest --sync --info-router --replicas 1 --node ${node} dd production`,
|
|
@@ -479,10 +484,19 @@ try {
|
|
|
479
484
|
break;
|
|
480
485
|
}
|
|
481
486
|
|
|
487
|
+
case 'private': {
|
|
488
|
+
shellExec(`node bin/deploy sync-deploy-envs`);
|
|
489
|
+
shellExec(`node bin/build dd conf`);
|
|
490
|
+
shellExec(`cd ./engine-private && git add . && node ../bin cmt . build`);
|
|
491
|
+
shellExec(`cd ./engine-private && node ../bin push . ${process.env.GITHUB_USERNAME}/engine-private`);
|
|
492
|
+
break;
|
|
493
|
+
}
|
|
494
|
+
|
|
482
495
|
case 'version-deploy': {
|
|
483
496
|
shellExec(
|
|
484
497
|
`underpost secret underpost --create-from-file /home/dd/engine/engine-private/conf/dd-cron/.env.production`,
|
|
485
498
|
);
|
|
499
|
+
shellExec(`node bin/deploy sync-deploy-envs`);
|
|
486
500
|
shellExec(`node bin/build dd conf`);
|
|
487
501
|
shellExec(`git add . && cd ./engine-private && git add .`);
|
|
488
502
|
shellExec(`node bin cmt . ci package-pwa-microservices-template`);
|
|
@@ -564,10 +578,10 @@ ${shellExec(`git log | grep Author: | sort -u`, { stdout: true }).split(`\n`).jo
|
|
|
564
578
|
`${key}`.toUpperCase().match('MAC')
|
|
565
579
|
? 'changethis'
|
|
566
580
|
: isNaN(parseFloat(privateEnv[key]))
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
581
|
+
? `${privateEnv[key]}`.match(`@`)
|
|
582
|
+
? 'admin@default.net'
|
|
583
|
+
: 'changethis'
|
|
584
|
+
: privateEnv[key];
|
|
571
585
|
}
|
|
572
586
|
return env;
|
|
573
587
|
};
|
|
@@ -654,7 +668,7 @@ ${shellExec(`git log | grep Author: | sort -u`, { stdout: true }).split(`\n`).jo
|
|
|
654
668
|
// generate + import + start
|
|
655
669
|
// node bin/deploy ssh root@<host> <password>
|
|
656
670
|
|
|
657
|
-
const host = process.argv[3] ?? `root@${await
|
|
671
|
+
const host = process.argv[3] ?? `root@${await Dns.getPublicIp()}`;
|
|
658
672
|
const domain = host.split('@')[1];
|
|
659
673
|
const user = 'root'; // host.split('@')[0];
|
|
660
674
|
const password = process.argv[4] ?? '';
|
|
@@ -1294,6 +1308,20 @@ nvidia/gpu-operator \
|
|
|
1294
1308
|
shellExec(`./scripts/ssl.sh ${targetDir} "${domains.join(' ')}"`);
|
|
1295
1309
|
break;
|
|
1296
1310
|
}
|
|
1311
|
+
|
|
1312
|
+
case 'sync-deploy-envs': {
|
|
1313
|
+
const envObj = dotenv.parse(fs.readFileSync(`./engine-private/conf/dd-cron/.env.production`));
|
|
1314
|
+
for (const deployId of ['dd-cron'].concat(
|
|
1315
|
+
fs.readFileSync(`./engine-private/deploy/dd.router`, 'utf8').split(','),
|
|
1316
|
+
)) {
|
|
1317
|
+
for (const env of ['production', 'development', 'test']) {
|
|
1318
|
+
const _envObj = dotenv.parse(fs.readFileSync(`./engine-private/conf/${deployId}/.env.${env}`, 'utf8'));
|
|
1319
|
+
_envObj.GITHUB_TOKEN = envObj.GITHUB_TOKEN;
|
|
1320
|
+
writeEnv(`./engine-private/conf/${deployId}/.env.${env}`, _envObj);
|
|
1321
|
+
}
|
|
1322
|
+
}
|
|
1323
|
+
break;
|
|
1324
|
+
}
|
|
1297
1325
|
}
|
|
1298
1326
|
} catch (error) {
|
|
1299
1327
|
logger.error(error, error.stack);
|
package/bin/zed.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { shellExec } from '../src/server/process.js';
|
|
2
|
+
import fs from 'fs-extra';
|
|
3
|
+
import { loggerFactory } from '../src/server/logger.js';
|
|
4
|
+
|
|
5
|
+
const logger = loggerFactory(import.meta);
|
|
6
|
+
|
|
7
|
+
fs.copyFileSync(`./.vscode/zed.settings.json`, `/root/.config/zed/settings.json`);
|
|
8
|
+
fs.copyFileSync(`./.vscode/zed.keymap.json`, `/root/.config/zed/keymap.json`);
|
|
9
|
+
|
|
10
|
+
shellExec(`ZED_ALLOW_ROOT=true zed ${process.argv[2] ? process.argv[2] : '.'}`);
|
|
11
|
+
|
|
12
|
+
logger.info('Connect copilot device', 'https://github.com/login/device');
|
|
13
|
+
logger.info('Comments', 'Ctrl shift 7');
|
|
14
|
+
logger.info('Unfold', 'Ctrl K + Ctrl J');
|
|
15
|
+
logger.info('Fold', 'Ctrl K + Ctrl 0');
|
|
16
|
+
logger.info('Command Palette', 'Ctrl Shift P');
|
|
17
|
+
logger.info('Open File', 'Ctrl P');
|
|
18
|
+
logger.info('Find in Files', 'Ctrl Shift F');
|
|
19
|
+
logger.info('Go to Line', 'Ctrl G');
|
|
20
|
+
logger.info('New file', 'Ctrl N');
|
package/cli.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
## underpost ci/cd cli v2.
|
|
1
|
+
## underpost ci/cd cli v2.81.1
|
|
2
2
|
|
|
3
3
|
### Usage: `underpost [options] [command]`
|
|
4
4
|
```
|
|
@@ -11,7 +11,7 @@ Commands:
|
|
|
11
11
|
start [options] <deploy-id> [env] Initiates application servers, build pipelines, or other defined services based on the deployment ID.
|
|
12
12
|
clone [options] <uri> Clones a specified GitHub repository into the current directory.
|
|
13
13
|
pull [options] <path> <uri> Pulls the latest changes from a specified GitHub repository.
|
|
14
|
-
cmt [options]
|
|
14
|
+
cmt [options] [path] [commit-type] [module-tag] [message] Manages commits to a GitHub repository, supporting various commit types and options.
|
|
15
15
|
push [options] <path> <uri> Pushes committed changes from a local repository to a remote GitHub repository.
|
|
16
16
|
env [deploy-id] [env] [subConf] Sets environment variables and configurations related to a specific deployment ID.
|
|
17
17
|
config [options] <operator> [key] [value] Manages Underpost configurations using various operators.
|
|
@@ -117,7 +117,7 @@ Options:
|
|
|
117
117
|
|
|
118
118
|
### `cmt` :
|
|
119
119
|
```
|
|
120
|
-
Usage: underpost cmt [options]
|
|
120
|
+
Usage: underpost cmt [options] [path] [commit-type] [module-tag] [message]
|
|
121
121
|
|
|
122
122
|
Manages commits to a GitHub repository, supporting various commit types and
|
|
123
123
|
options.
|
|
@@ -131,6 +131,8 @@ Arguments:
|
|
|
131
131
|
message Optional: Provides an additional custom message for the commit.
|
|
132
132
|
|
|
133
133
|
Options:
|
|
134
|
+
--log Shows commit history from the specified number of latest n path
|
|
135
|
+
commits.
|
|
134
136
|
--empty Allows committing with empty files.
|
|
135
137
|
--copy Copies the generated commit message to the clipboard.
|
|
136
138
|
--info Displays information about available commit types.
|
|
@@ -166,7 +168,7 @@ ID.
|
|
|
166
168
|
|
|
167
169
|
Arguments:
|
|
168
170
|
deploy-id The deployment configuration ID. Use 'clean' to restore default
|
|
169
|
-
environment settings.
|
|
171
|
+
environment settings. Use 'root' to load underpost root env. Use
|
|
170
172
|
'current' to get plain current deploy Id.
|
|
171
173
|
env Optional: The environment to set (e.g., "production",
|
|
172
174
|
"development"). Defaults to "production".
|
|
@@ -311,8 +313,10 @@ Options:
|
|
|
311
313
|
--traffic <traffic-versions> A comma-separated list of custom deployment
|
|
312
314
|
traffic weights.
|
|
313
315
|
--disable-update-deployment Disables updates to deployments.
|
|
314
|
-
--
|
|
315
|
-
|
|
316
|
+
--disable-update-proxy Disables updates to proxies.
|
|
317
|
+
--status Retrieves current network traffic data from
|
|
318
|
+
resource deployments and the host machine
|
|
319
|
+
network configuration.
|
|
316
320
|
--kubeadm Enables the kubeadm context for deployment
|
|
317
321
|
operations.
|
|
318
322
|
--etc-hosts Enables the etc-hosts context for
|
|
@@ -370,6 +374,7 @@ Options:
|
|
|
370
374
|
environment secrets.
|
|
371
375
|
--reset Performs a build without using the
|
|
372
376
|
cache.
|
|
377
|
+
--dev Use development mode.
|
|
373
378
|
--k3s-load Loads the image into a K3s cluster.
|
|
374
379
|
-h, --help display help for command
|
|
375
380
|
|
|
@@ -389,6 +394,7 @@ Options:
|
|
|
389
394
|
--kubeadm-load Imports the pulled image into a Kubeadm cluster.
|
|
390
395
|
--version Sets a custom version for the base images.
|
|
391
396
|
--k3s-load Loads the image into a K3s cluster.
|
|
397
|
+
--dev Use development mode.
|
|
392
398
|
-h, --help display help for command
|
|
393
399
|
|
|
394
400
|
```
|
|
@@ -607,7 +613,7 @@ Options:
|
|
|
607
613
|
Runs a script from the specified path.
|
|
608
614
|
|
|
609
615
|
Arguments:
|
|
610
|
-
runner-id The runner ID to run. Options: spark-template, rmi, kill, secret, underpost-config, gpu-env, tf-gpu-test, dev-cluster, ssh-cluster-info, cyberia-ide, engine-ide, cluster-build, template-deploy, clean, pull, release-deploy, ssh-deploy, ide, sync, ls-deployments, monitor, db-client, promote, metrics, cluster, deploy, sync-replica, tf-vae-test, deploy-job.
|
|
616
|
+
runner-id The runner ID to run. Options: spark-template, rmi, kill, secret, underpost-config, gpu-env, tf-gpu-test, dev-cluster, ssh-cluster-info, dev-hosts-expose, dev-hosts-restore, cyberia-ide, engine-ide, cluster-build, template-deploy, clean, pull, release-deploy, ssh-deploy, ide, sync, ls-deployments, monitor, db-client, promote, metrics, cluster, deploy, sync-replica, tf-vae-test, deploy-job.
|
|
611
617
|
path The absolute or relative directory path where the script is located.
|
|
612
618
|
|
|
613
619
|
Options:
|
|
@@ -17,7 +17,7 @@ spec:
|
|
|
17
17
|
spec:
|
|
18
18
|
containers:
|
|
19
19
|
- name: dd-default-development-blue
|
|
20
|
-
image: localhost/rockylinux9-underpost:v2.
|
|
20
|
+
image: localhost/rockylinux9-underpost:v2.81.1
|
|
21
21
|
# resources:
|
|
22
22
|
# requests:
|
|
23
23
|
# memory: "124Ki"
|
|
@@ -100,7 +100,7 @@ spec:
|
|
|
100
100
|
spec:
|
|
101
101
|
containers:
|
|
102
102
|
- name: dd-default-development-green
|
|
103
|
-
image: localhost/rockylinux9-underpost:v2.
|
|
103
|
+
image: localhost/rockylinux9-underpost:v2.81.1
|
|
104
104
|
# resources:
|
|
105
105
|
# requests:
|
|
106
106
|
# memory: "124Ki"
|
|
@@ -17,13 +17,13 @@ spec:
|
|
|
17
17
|
spec:
|
|
18
18
|
containers:
|
|
19
19
|
- name: dd-test-development-blue
|
|
20
|
-
image: localhost/rockylinux9-underpost:v2.
|
|
20
|
+
image: localhost/rockylinux9-underpost:v2.81.1
|
|
21
21
|
# resources:
|
|
22
22
|
# requests:
|
|
23
|
-
# memory: "
|
|
23
|
+
# memory: "96294Ki"
|
|
24
24
|
# cpu: "75m"
|
|
25
25
|
# limits:
|
|
26
|
-
# memory: "
|
|
26
|
+
# memory: "1540709Ki"
|
|
27
27
|
# cpu: "1200m"
|
|
28
28
|
command:
|
|
29
29
|
- /bin/sh
|
|
@@ -104,13 +104,13 @@ spec:
|
|
|
104
104
|
spec:
|
|
105
105
|
containers:
|
|
106
106
|
- name: dd-test-development-green
|
|
107
|
-
image: localhost/rockylinux9-underpost:v2.
|
|
107
|
+
image: localhost/rockylinux9-underpost:v2.81.1
|
|
108
108
|
# resources:
|
|
109
109
|
# requests:
|
|
110
|
-
# memory: "
|
|
110
|
+
# memory: "96294Ki"
|
|
111
111
|
# cpu: "75m"
|
|
112
112
|
# limits:
|
|
113
|
-
# memory: "
|
|
113
|
+
# memory: "1540709Ki"
|
|
114
114
|
# cpu: "1200m"
|
|
115
115
|
command:
|
|
116
116
|
- /bin/sh
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"type": "module",
|
|
3
3
|
"main": "src/index.js",
|
|
4
4
|
"name": "underpost",
|
|
5
|
-
"version": "2.
|
|
5
|
+
"version": "2.81.1",
|
|
6
6
|
"description": "pwa api rest template",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"start": "env-cmd -f .env.production node --max-old-space-size=8192 src/server",
|
|
@@ -17,13 +17,12 @@
|
|
|
17
17
|
"dev-client": "env-cmd -f .env.development node src/client.dev",
|
|
18
18
|
"proxy": "node src/proxy proxy",
|
|
19
19
|
"docs": "jsdoc -c jsdoc.json",
|
|
20
|
-
"install-global": "npm install -g pm2 && npm install -g jsdoc && npm install -g prettier && npm install -g env-cmd
|
|
20
|
+
"install-global": "npm install -g pm2 && npm install -g jsdoc && npm install -g prettier && npm install -g env-cmd",
|
|
21
21
|
"install-test": "npm install -g mocha && npm install -g c8 && npm install -g nyc && npm install -g coveralls",
|
|
22
22
|
"install-underpost": "cp -a $(npm root -g)/underpost/node_modules ./node_modules && npm install --only=dev --ignore-scripts",
|
|
23
23
|
"install": "npm run install-global && npm run install-test",
|
|
24
24
|
"prettier": "prettier --write .",
|
|
25
|
-
"fix": "npm audit fix --force && npm audit"
|
|
26
|
-
"changelog": "auto-changelog"
|
|
25
|
+
"fix": "npm audit fix --force && npm audit"
|
|
27
26
|
},
|
|
28
27
|
"bin": {
|
|
29
28
|
"underpost": "bin/index.js"
|
|
@@ -93,7 +92,6 @@
|
|
|
93
92
|
"peer": "^1.0.2",
|
|
94
93
|
"peerjs": "^1.5.2",
|
|
95
94
|
"prom-client": "^15.1.2",
|
|
96
|
-
"public-ip": "^6.0.1",
|
|
97
95
|
"read": "^2.1.0",
|
|
98
96
|
"rrule": "^2.8.1",
|
|
99
97
|
"sharp": "^0.32.5",
|
package/src/cli/baremetal.js
CHANGED
|
@@ -952,7 +952,7 @@ EOF`);
|
|
|
952
952
|
*/
|
|
953
953
|
getHostArch() {
|
|
954
954
|
// `uname -m` returns e.g. 'x86_64' or 'aarch64'
|
|
955
|
-
const machine = shellExec('uname -m', { stdout: true }).trim();
|
|
955
|
+
const machine = shellExec('uname -m', { stdout: true, silent: true }).trim();
|
|
956
956
|
if (machine === 'x86_64') return { alias: 'amd64', name: 'x86_64' };
|
|
957
957
|
if (machine === 'aarch64') return { alias: 'arm64', name: 'aarch64' };
|
|
958
958
|
throw new Error(`Unsupported host architecture: ${machine}`);
|
package/src/cli/cluster.js
CHANGED
|
@@ -698,7 +698,11 @@ net.ipv4.ip_forward = 1' | sudo tee ${iptableConfPath}`,
|
|
|
698
698
|
*/
|
|
699
699
|
getResourcesCapacity(node) {
|
|
700
700
|
const resources = {};
|
|
701
|
-
const nodeName = node
|
|
701
|
+
const nodeName = node
|
|
702
|
+
? node
|
|
703
|
+
: UnderpostDeploy.API.get('kind-control-plane', 'node').length > 0
|
|
704
|
+
? 'kind-control-plane'
|
|
705
|
+
: os.hostname();
|
|
702
706
|
const info = shellExec(`kubectl describe node ${nodeName} | grep -E '(Allocatable:|Capacity:)' -A 6`, {
|
|
703
707
|
stdout: true,
|
|
704
708
|
silent: true,
|
package/src/cli/db.js
CHANGED
|
@@ -271,6 +271,7 @@ class UnderpostDB {
|
|
|
271
271
|
const deployId = _deployId.trim();
|
|
272
272
|
if (!deployId) continue;
|
|
273
273
|
const confServer = loadReplicas(
|
|
274
|
+
deployId,
|
|
274
275
|
JSON.parse(fs.readFileSync(`./engine-private/conf/${deployId}/conf.server.json`, 'utf8')),
|
|
275
276
|
);
|
|
276
277
|
const router = await UnderpostDeploy.API.routerFactory(deployId, env);
|
package/src/cli/deploy.js
CHANGED
|
@@ -21,6 +21,9 @@ import dotenv from 'dotenv';
|
|
|
21
21
|
import UnderpostRootEnv from './env.js';
|
|
22
22
|
import UnderpostCluster from './cluster.js';
|
|
23
23
|
import { timer } from '../client/components/core/CommonJs.js';
|
|
24
|
+
import os from 'node:os';
|
|
25
|
+
import Dns, { getLocalIPv4Address } from '../server/dns.js';
|
|
26
|
+
import UnderpostBaremetal from './baremetal.js';
|
|
24
27
|
|
|
25
28
|
const logger = loggerFactory(import.meta);
|
|
26
29
|
|
|
@@ -45,8 +48,7 @@ class UnderpostDeploy {
|
|
|
45
48
|
* @memberof UnderpostDeploy
|
|
46
49
|
*/
|
|
47
50
|
sync(deployList, { versions, replicas, node }) {
|
|
48
|
-
|
|
49
|
-
fs.writeFileSync(`./engine-private/deploy/${deployGroupId}`, deployList, 'utf8');
|
|
51
|
+
fs.writeFileSync(`./engine-private/deploy/dd.router`, deployList, 'utf8');
|
|
50
52
|
const totalPods = deployList.split(',').length * versions.split(',').length * parseInt(replicas);
|
|
51
53
|
const limitFactor = 0.8;
|
|
52
54
|
const reserveFactor = 0.05;
|
|
@@ -63,7 +65,6 @@ class UnderpostDeploy {
|
|
|
63
65
|
UnderpostRootEnv.API.set('total-pods', totalPods);
|
|
64
66
|
return getDataDeploy({
|
|
65
67
|
buildSingleReplica: true,
|
|
66
|
-
deployGroupId,
|
|
67
68
|
});
|
|
68
69
|
},
|
|
69
70
|
/**
|
|
@@ -184,6 +185,7 @@ spec:
|
|
|
184
185
|
const deployId = _deployId.trim();
|
|
185
186
|
if (!deployId) continue;
|
|
186
187
|
const confServer = loadReplicas(
|
|
188
|
+
deployId,
|
|
187
189
|
JSON.parse(fs.readFileSync(`./engine-private/conf/${deployId}/conf.server.json`, 'utf8')),
|
|
188
190
|
);
|
|
189
191
|
const router = await UnderpostDeploy.API.routerFactory(deployId, env);
|
|
@@ -227,12 +229,12 @@ metadata:
|
|
|
227
229
|
spec:
|
|
228
230
|
virtualhost:
|
|
229
231
|
fqdn: ${host}${
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
232
|
+
env === 'development'
|
|
233
|
+
? ''
|
|
234
|
+
: `
|
|
233
235
|
tls:
|
|
234
236
|
secretName: ${host}`
|
|
235
|
-
|
|
237
|
+
}
|
|
236
238
|
routes:`;
|
|
237
239
|
for (const conditionObj of pathPortAssignment) {
|
|
238
240
|
const { path, port } = conditionObj;
|
|
@@ -325,7 +327,8 @@ spec:
|
|
|
325
327
|
* @param {string} options.node - Node name for resource allocation.
|
|
326
328
|
* @param {string} options.restoreHosts - Whether to restore hosts.
|
|
327
329
|
* @param {string} options.disableUpdateDeployment - Whether to disable updating the deployment.
|
|
328
|
-
* @param {string} options.
|
|
330
|
+
* @param {string} options.disableUpdateProxy - Whether to disable updating the proxy.
|
|
331
|
+
* @param {string} options.status - Whether to display status host machine server and traffic information.
|
|
329
332
|
* @param {string} options.etcHosts - Whether to update /etc/hosts.
|
|
330
333
|
* @returns {Promise<void>} - Promise that resolves when the callback is complete.
|
|
331
334
|
* @memberof UnderpostDeploy
|
|
@@ -349,7 +352,8 @@ spec:
|
|
|
349
352
|
node: '',
|
|
350
353
|
restoreHosts: false,
|
|
351
354
|
disableUpdateDeployment: false,
|
|
352
|
-
|
|
355
|
+
disableUpdateProxy: false,
|
|
356
|
+
status: false,
|
|
353
357
|
etcHosts: false,
|
|
354
358
|
},
|
|
355
359
|
) {
|
|
@@ -415,7 +419,7 @@ EOF`);
|
|
|
415
419
|
} else if (!deployList) deployList = 'dd-default';
|
|
416
420
|
if (deployList === 'dd' && fs.existsSync(`./engine-private/deploy/dd.router`))
|
|
417
421
|
deployList = fs.readFileSync(`./engine-private/deploy/dd.router`, 'utf8');
|
|
418
|
-
if (options.
|
|
422
|
+
if (options.status === true) {
|
|
419
423
|
for (const _deployId of deployList.split(',')) {
|
|
420
424
|
const deployId = _deployId.trim();
|
|
421
425
|
logger.info('', {
|
|
@@ -426,6 +430,16 @@ EOF`);
|
|
|
426
430
|
pods: await UnderpostDeploy.API.get(deployId),
|
|
427
431
|
});
|
|
428
432
|
}
|
|
433
|
+
const interfaceName = Dns.getDefaultNetworkInterface();
|
|
434
|
+
logger.info('Machine', {
|
|
435
|
+
node: os.hostname(),
|
|
436
|
+
arch: UnderpostBaremetal.API.getHostArch(),
|
|
437
|
+
ipv4Public: await Dns.getPublicIp(),
|
|
438
|
+
ipv4Local: getLocalIPv4Address(),
|
|
439
|
+
resources: UnderpostCluster.API.getResourcesCapacity(),
|
|
440
|
+
defaultInterfaceName: interfaceName,
|
|
441
|
+
defaultInterfaceInfo: os.networkInterfaces()[interfaceName],
|
|
442
|
+
});
|
|
429
443
|
return;
|
|
430
444
|
}
|
|
431
445
|
if (!(options.versions && typeof options.versions === 'string')) options.versions = 'blue,green';
|
|
@@ -467,11 +481,14 @@ EOF`);
|
|
|
467
481
|
}
|
|
468
482
|
|
|
469
483
|
const confServer = JSON.parse(fs.readFileSync(`./engine-private/conf/${deployId}/conf.server.json`, 'utf8'));
|
|
484
|
+
|
|
470
485
|
for (const host of Object.keys(confServer)) {
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
486
|
+
if (!options.disableUpdateProxy) {
|
|
487
|
+
shellExec(`sudo kubectl delete HTTPProxy ${host}`);
|
|
488
|
+
if (UnderpostDeploy.API.isValidTLSContext({ host, env, options }))
|
|
489
|
+
shellExec(`sudo kubectl delete Certificate ${host}`);
|
|
490
|
+
}
|
|
491
|
+
if (!options.remove) etcHosts.push(host);
|
|
475
492
|
}
|
|
476
493
|
|
|
477
494
|
const manifestsPath =
|
|
@@ -479,9 +496,9 @@ EOF`);
|
|
|
479
496
|
? `engine-private/conf/${deployId}/build/production`
|
|
480
497
|
: `manifests/deployment/${deployId}-${env}`;
|
|
481
498
|
|
|
482
|
-
if (!options.remove
|
|
499
|
+
if (!options.remove) {
|
|
483
500
|
if (!options.disableUpdateDeployment) shellExec(`sudo kubectl apply -f ./${manifestsPath}/deployment.yaml`);
|
|
484
|
-
shellExec(`sudo kubectl apply -f ./${manifestsPath}/proxy.yaml`);
|
|
501
|
+
if (!options.disableUpdateProxy) shellExec(`sudo kubectl apply -f ./${manifestsPath}/proxy.yaml`);
|
|
485
502
|
|
|
486
503
|
if (UnderpostDeploy.API.isValidTLSContext({ host: Object.keys(confServer)[0], env, options }))
|
|
487
504
|
shellExec(`sudo kubectl apply -f ./${manifestsPath}/secret.yaml`);
|
package/src/cli/image.js
CHANGED
|
@@ -34,6 +34,7 @@ class UnderpostImage {
|
|
|
34
34
|
* @param {boolean} [options.kubeadmLoad=false] - If true, load image into Kubeadm cluster.
|
|
35
35
|
* @param {boolean} [options.k3sLoad=false] - If true, load image into K3s cluster.
|
|
36
36
|
* @param {string} [options.path=false] - Path to the Dockerfile context.
|
|
37
|
+
* @param {boolean} [options.dev=false] - If true, use development mode.
|
|
37
38
|
* @param {string} [options.version=''] - Version tag for the image.
|
|
38
39
|
* @memberof UnderpostImage
|
|
39
40
|
*/
|
|
@@ -43,11 +44,14 @@ class UnderpostImage {
|
|
|
43
44
|
kubeadmLoad: false,
|
|
44
45
|
k3sLoad: false,
|
|
45
46
|
path: false,
|
|
47
|
+
dev: false,
|
|
46
48
|
version: '',
|
|
47
49
|
},
|
|
48
50
|
) {
|
|
49
51
|
// shellExec(`sudo podman pull docker.io/library/debian:buster`);
|
|
50
52
|
shellExec(`sudo podman pull docker.io/library/rockylinux:9`);
|
|
53
|
+
const baseCommand = options.dev ? 'node bin' : 'underpost';
|
|
54
|
+
const baseCommandOption = options.dev ? ' --dev' : '';
|
|
51
55
|
const IMAGE_NAME = `rockylinux9-underpost`;
|
|
52
56
|
const IMAGE_NAME_FULL = `${IMAGE_NAME}:${options.version ?? Underpost.version}`;
|
|
53
57
|
let LOAD_TYPE = '';
|
|
@@ -61,7 +65,7 @@ class UnderpostImage {
|
|
|
61
65
|
}
|
|
62
66
|
|
|
63
67
|
shellExec(
|
|
64
|
-
|
|
68
|
+
`${baseCommand} dockerfile-image-build${baseCommandOption} --podman-save --reset --image-path=. --path ${
|
|
65
69
|
options.path ?? getUnderpostRootPath()
|
|
66
70
|
} --image-name=${IMAGE_NAME_FULL} ${LOAD_TYPE}`,
|
|
67
71
|
);
|
|
@@ -82,6 +86,7 @@ class UnderpostImage {
|
|
|
82
86
|
* @param {boolean} [options.secrets=false] - If true, load secrets from the .env file for the build.
|
|
83
87
|
* @param {string} [options.secretsPath=''] - Custom path to the .env file for secrets.
|
|
84
88
|
* @param {boolean} [options.reset=false] - If true, perform a no-cache build.
|
|
89
|
+
* @param {boolean} [options.dev=false] - If true, use development mode.
|
|
85
90
|
* @memberof UnderpostImage
|
|
86
91
|
*/
|
|
87
92
|
build(
|
|
@@ -97,6 +102,7 @@ class UnderpostImage {
|
|
|
97
102
|
secrets: false,
|
|
98
103
|
secretsPath: '',
|
|
99
104
|
reset: false,
|
|
105
|
+
dev: false,
|
|
100
106
|
},
|
|
101
107
|
) {
|
|
102
108
|
const {
|
|
@@ -111,6 +117,7 @@ class UnderpostImage {
|
|
|
111
117
|
kubeadmLoad,
|
|
112
118
|
k3sLoad,
|
|
113
119
|
reset,
|
|
120
|
+
dev,
|
|
114
121
|
} = options;
|
|
115
122
|
const podManImg = `localhost/${imageName}`;
|
|
116
123
|
if (imagePath && typeof imagePath === 'string' && !fs.existsSync(imagePath))
|
|
@@ -139,7 +146,10 @@ class UnderpostImage {
|
|
|
139
146
|
} -t ${imageName} --pull=never --cap-add=CAP_AUDIT_WRITE${cache}${secretDockerInput} --network host`,
|
|
140
147
|
);
|
|
141
148
|
|
|
142
|
-
if (podmanSave === true)
|
|
149
|
+
if (podmanSave === true) {
|
|
150
|
+
if (fs.existsSync(tarFile)) fs.removeSync(tarFile);
|
|
151
|
+
shellExec(`podman save -o ${tarFile} ${podManImg}`);
|
|
152
|
+
}
|
|
143
153
|
if (kindLoad === true) shellExec(`sudo kind load image-archive ${tarFile}`);
|
|
144
154
|
if (kubeadmLoad === true) {
|
|
145
155
|
// Use 'ctr' for Kubeadm
|