underpost 2.8.861 → 2.8.867
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.development +6 -1
- package/.env.production +6 -1
- package/.env.test +6 -1
- package/README.md +42 -36
- package/bin/deploy.js +32 -32
- package/bin/file.js +3 -0
- package/cli.md +93 -90
- package/conf.js +1 -1
- package/manifests/deployment/dd-default-development/deployment.yaml +2 -2
- package/package.json +2 -2
- package/src/cli/cluster.js +2 -10
- package/src/cli/deploy.js +4 -3
- package/src/cli/index.js +3 -1
- package/src/cli/repository.js +4 -2
- package/src/cli/run.js +8 -0
- package/src/client/components/core/Modal.js +25 -39
- package/src/index.js +1 -1
- package/src/server/client-build.js +1 -7
- package/src/server/conf.js +82 -83
- package/src/server/proxy.js +1 -1
- package/src/server/runtime.js +1 -2
- package/src/server/start.js +2 -2
- package/test/api.test.js +3 -2
- package/bin/cyberia0.js +0 -78
package/.env.development
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
DEPLOY_ID=dd-default
|
|
2
|
+
DEFAULT_DEPLOY_ID=dd-default
|
|
2
3
|
NODE_ENV=development
|
|
3
4
|
PORT=4000
|
|
4
5
|
JWT_SECRET=test
|
|
5
6
|
EXPIRE=168
|
|
6
7
|
NODE_OPTIONS=--max-old-space-size=8192
|
|
7
|
-
BASE_API=api
|
|
8
|
+
BASE_API=api
|
|
9
|
+
DEFAULT_DEPLOY_HOST=default.net
|
|
10
|
+
DEFAULT_DEPLOY_PATH=/
|
|
11
|
+
DEFAULT_ADMIN_EMAIL=admin@default.net
|
|
12
|
+
DEFAULT_ADMIN_PASSWORD=changethis
|
package/.env.production
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
DEPLOY_ID=dd-default
|
|
2
|
+
DEFAULT_DEPLOY_ID=dd-default
|
|
2
3
|
NODE_ENV=production
|
|
3
4
|
PORT=3000
|
|
4
5
|
JWT_SECRET=test
|
|
5
6
|
EXPIRE=168
|
|
6
7
|
NODE_OPTIONS=--max-old-space-size=8192
|
|
7
|
-
BASE_API=api
|
|
8
|
+
BASE_API=api
|
|
9
|
+
DEFAULT_DEPLOY_HOST=default.net
|
|
10
|
+
DEFAULT_DEPLOY_PATH=/
|
|
11
|
+
DEFAULT_ADMIN_EMAIL=admin@default.net
|
|
12
|
+
DEFAULT_ADMIN_PASSWORD=changethis
|
package/.env.test
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
DEPLOY_ID=dd-default
|
|
2
|
+
DEFAULT_DEPLOY_ID=dd-default
|
|
2
3
|
NODE_ENV=test
|
|
3
4
|
PORT=5000
|
|
4
5
|
JWT_SECRET=test
|
|
5
6
|
EXPIRE=168
|
|
6
7
|
NODE_OPTIONS=--max-old-space-size=8192
|
|
7
|
-
BASE_API=api
|
|
8
|
+
BASE_API=api
|
|
9
|
+
DEFAULT_DEPLOY_HOST=default.net
|
|
10
|
+
DEFAULT_DEPLOY_PATH=/
|
|
11
|
+
DEFAULT_ADMIN_EMAIL=admin@default.net
|
|
12
|
+
DEFAULT_ADMIN_PASSWORD=changethis
|
package/README.md
CHANGED
|
@@ -27,10 +27,13 @@
|
|
|
27
27
|
|
|
28
28
|
|
|
29
29
|
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
30
33
|
<!-- badges -->
|
|
31
34
|
|
|
32
35
|
|
|
33
|
-
[](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.8.867) [](https://coveralls.io/github/underpostnet/engine?branch=master) [](https://www.npmjs.org/package/underpost) [](https://www.npmjs.com/package/underpost)
|
|
34
37
|
|
|
35
38
|
|
|
36
39
|
<!-- end-badges -->
|
|
@@ -46,6 +49,9 @@
|
|
|
46
49
|
|
|
47
50
|
|
|
48
51
|
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
49
55
|
</div>
|
|
50
56
|
|
|
51
57
|
<div align="center">
|
|
@@ -90,44 +96,44 @@ Run dev client server
|
|
|
90
96
|
npm run dev
|
|
91
97
|
```
|
|
92
98
|
<!-- -->
|
|
93
|
-
## underpost ci/cd cli v2.8.
|
|
99
|
+
## underpost ci/cd cli v2.8.867
|
|
94
100
|
|
|
95
101
|
### Usage: `underpost [options] [command]`
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
-
|
|
100
|
-
-h, --help display help for command
|
|
102
|
+
```
|
|
103
|
+
Options:
|
|
104
|
+
-V, --version output the version number
|
|
105
|
+
-h, --help display help for command
|
|
101
106
|
|
|
102
107
|
Commands:
|
|
103
|
-
new [options] <app-name> Initializes a new Underpost project with a predefined structure.
|
|
104
|
-
start [options] <deploy-id> [env] Initiates application servers, build pipelines, or other defined services based on the deployment ID.
|
|
105
|
-
clone [options] <uri> Clones a specified GitHub repository into the current directory.
|
|
106
|
-
pull [options] <path> <uri> Pulls the latest changes from a specified GitHub repository.
|
|
107
|
-
cmt [options] <path> <commit-type> [module-tag] [message] Manages commits to a GitHub repository, supporting various commit types and options.
|
|
108
|
-
push [options] <path> <uri> Pushes committed changes from a local repository to a remote GitHub repository.
|
|
109
|
-
env <deploy-id> [env] Sets environment variables and configurations related to a specific deployment ID.
|
|
110
|
-
config [options] <operator> [key] [value] Manages Underpost configurations using various operators.
|
|
111
|
-
root Displays the root path of the npm installation.
|
|
112
|
-
cluster [options] [pod-name] Manages Kubernetes clusters, defaulting to Kind cluster initialization.
|
|
113
|
-
deploy [options] [deploy-list] [env] Manages application deployments, defaulting to deploying development pods.
|
|
114
|
-
secret [options] <platform> Manages secrets for various platforms.
|
|
115
|
-
dockerfile-image-build [options] Builds a Docker image from a specified Dockerfile with various options for naming, saving, and loading.
|
|
116
|
-
dockerfile-pull-base-images [options] Pulls required Underpost Dockerfile base images and optionally loads them into clusters.
|
|
117
|
-
install Quickly imports Underpost npm dependencies by copying them.
|
|
118
|
-
db [options] <deploy-list> Manages database operations, including import, export, and collection management.
|
|
119
|
-
metadata [options] [deploy-id] [host] [path] Manages cluster metadata operations, including import and export.
|
|
120
|
-
script [options] <operator> <script-name> [script-value] Supports a variety of built-in Underpost global scripts, their preset lifecycle events, and arbitrary custom scripts.
|
|
121
|
-
cron [options] [deploy-list] [job-list] Manages cron jobs, including initialization, execution, and configuration updates.
|
|
122
|
-
fs [options] [path] Manages file storage, defaulting to file upload operations.
|
|
123
|
-
test [options] [deploy-list] Manages and runs tests, defaulting to the current Underpost default test suite.
|
|
124
|
-
monitor [options] <deploy-id> [env] Manages health server monitoring for specified deployments.
|
|
125
|
-
ssh [options] Import and start ssh server and client based on current default deployment ID.
|
|
126
|
-
run [options] <runner-id> [path] Runs a script from the specified path.
|
|
127
|
-
lxd [options] Manages LXD containers and virtual machines.
|
|
128
|
-
baremetal [options] [workflow-id] [hostname] [ip-address] Manages baremetal server operations, including installation, database setup, commissioning, and user management.
|
|
129
|
-
help [command] display help for command
|
|
130
|
-
|
|
108
|
+
new [options] <app-name> Initializes a new Underpost project with a predefined structure.
|
|
109
|
+
start [options] <deploy-id> [env] Initiates application servers, build pipelines, or other defined services based on the deployment ID.
|
|
110
|
+
clone [options] <uri> Clones a specified GitHub repository into the current directory.
|
|
111
|
+
pull [options] <path> <uri> Pulls the latest changes from a specified GitHub repository.
|
|
112
|
+
cmt [options] <path> <commit-type> [module-tag] [message] Manages commits to a GitHub repository, supporting various commit types and options.
|
|
113
|
+
push [options] <path> <uri> Pushes committed changes from a local repository to a remote GitHub repository.
|
|
114
|
+
env <deploy-id> [env] Sets environment variables and configurations related to a specific deployment ID.
|
|
115
|
+
config [options] <operator> [key] [value] Manages Underpost configurations using various operators.
|
|
116
|
+
root Displays the root path of the npm installation.
|
|
117
|
+
cluster [options] [pod-name] Manages Kubernetes clusters, defaulting to Kind cluster initialization.
|
|
118
|
+
deploy [options] [deploy-list] [env] Manages application deployments, defaulting to deploying development pods.
|
|
119
|
+
secret [options] <platform> Manages secrets for various platforms.
|
|
120
|
+
dockerfile-image-build [options] Builds a Docker image from a specified Dockerfile with various options for naming, saving, and loading.
|
|
121
|
+
dockerfile-pull-base-images [options] Pulls required Underpost Dockerfile base images and optionally loads them into clusters.
|
|
122
|
+
install Quickly imports Underpost npm dependencies by copying them.
|
|
123
|
+
db [options] <deploy-list> Manages database operations, including import, export, and collection management.
|
|
124
|
+
metadata [options] [deploy-id] [host] [path] Manages cluster metadata operations, including import and export.
|
|
125
|
+
script [options] <operator> <script-name> [script-value] Supports a variety of built-in Underpost global scripts, their preset lifecycle events, and arbitrary custom scripts.
|
|
126
|
+
cron [options] [deploy-list] [job-list] Manages cron jobs, including initialization, execution, and configuration updates.
|
|
127
|
+
fs [options] [path] Manages file storage, defaulting to file upload operations.
|
|
128
|
+
test [options] [deploy-list] Manages and runs tests, defaulting to the current Underpost default test suite.
|
|
129
|
+
monitor [options] <deploy-id> [env] Manages health server monitoring for specified deployments.
|
|
130
|
+
ssh [options] Import and start ssh server and client based on current default deployment ID.
|
|
131
|
+
run [options] <runner-id> [path] Runs a script from the specified path.
|
|
132
|
+
lxd [options] Manages LXD containers and virtual machines.
|
|
133
|
+
baremetal [options] [workflow-id] [hostname] [ip-address] Manages baremetal server operations, including installation, database setup, commissioning, and user management.
|
|
134
|
+
help [command] display help for command
|
|
135
|
+
|
|
131
136
|
```
|
|
132
|
-
|
|
137
|
+
|
|
133
138
|
<a target="_top" href="https://github.com/underpostnet/pwa-microservices-template/blob/master/cli.md">See complete CLI Docs here.</a>
|
|
139
|
+
|
package/bin/deploy.js
CHANGED
|
@@ -28,6 +28,7 @@ import { DefaultConf } from '../conf.js';
|
|
|
28
28
|
import colors from 'colors';
|
|
29
29
|
import { program } from '../src/cli/index.js';
|
|
30
30
|
import { getLocalIPv4Address, ip } from '../src/server/dns.js';
|
|
31
|
+
import { timer } from '../src/client/components/core/CommonJs.js';
|
|
31
32
|
|
|
32
33
|
colors.enable();
|
|
33
34
|
|
|
@@ -39,31 +40,6 @@ const [exe, dir, operator] = process.argv;
|
|
|
39
40
|
|
|
40
41
|
try {
|
|
41
42
|
switch (operator) {
|
|
42
|
-
case 'save':
|
|
43
|
-
{
|
|
44
|
-
let deployId = process.argv[3] ?? 'dd-default';
|
|
45
|
-
if (!deployId.startsWith('dd-')) deployId = 'dd-default';
|
|
46
|
-
const folder = `./engine-private/conf/${deployId}`;
|
|
47
|
-
if (fs.existsSync(folder)) fs.removeSync(folder);
|
|
48
|
-
await Config.build({ folder });
|
|
49
|
-
fs.writeFileSync(
|
|
50
|
-
`${folder}/.env.production`,
|
|
51
|
-
fs.readFileSync('./.env.production', 'utf8').replace('dd-default', deployId),
|
|
52
|
-
'utf8',
|
|
53
|
-
);
|
|
54
|
-
fs.writeFileSync(
|
|
55
|
-
`${folder}/.env.development`,
|
|
56
|
-
fs.readFileSync('./.env.development', 'utf8').replace('dd-default', deployId),
|
|
57
|
-
'utf8',
|
|
58
|
-
);
|
|
59
|
-
fs.writeFileSync(
|
|
60
|
-
`${folder}/.env.test`,
|
|
61
|
-
fs.readFileSync('./.env.test', 'utf8').replace('dd-default', deployId),
|
|
62
|
-
'utf8',
|
|
63
|
-
);
|
|
64
|
-
fs.writeFileSync(`${folder}/package.json`, fs.readFileSync('./package.json', 'utf8'), 'utf8');
|
|
65
|
-
}
|
|
66
|
-
break;
|
|
67
43
|
case 'add-nodejs-app-client-conf':
|
|
68
44
|
{
|
|
69
45
|
const toOptions = {
|
|
@@ -283,23 +259,20 @@ try {
|
|
|
283
259
|
for (const deployIdObj of dataDeploy) {
|
|
284
260
|
const { deployId, replicaHost } = deployIdObj;
|
|
285
261
|
if (replicaHost && !singleReplicaHosts.includes(replicaHost)) singleReplicaHosts.push(replicaHost);
|
|
286
|
-
const proxyInstance = deployId.match('proxy') || deployId.match('cron');
|
|
287
262
|
const baseConfPath = fs.existsSync(`./engine-private/replica/${deployId}`)
|
|
288
263
|
? `./engine-private/replica`
|
|
289
264
|
: `./engine-private/conf`;
|
|
290
265
|
for (const envInstanceObj of dataEnv) {
|
|
291
266
|
const envPath = `${baseConfPath}/${deployId}/.env.${envInstanceObj.env}`;
|
|
292
267
|
const envObj = dotenv.parse(fs.readFileSync(envPath, 'utf8'));
|
|
293
|
-
envObj.PORT =
|
|
294
|
-
? envInstanceObj.port
|
|
295
|
-
: envInstanceObj.port + port - singleReplicaHosts.length - (replicaHost ? 1 : 0);
|
|
268
|
+
envObj.PORT = envInstanceObj.port + port - singleReplicaHosts.length - (replicaHost ? 1 : 0);
|
|
296
269
|
|
|
297
270
|
writeEnv(envPath, envObj);
|
|
298
271
|
}
|
|
299
272
|
const serverConf = loadReplicas(
|
|
300
273
|
JSON.parse(fs.readFileSync(`${baseConfPath}/${deployId}/conf.server.json`, 'utf8')),
|
|
301
274
|
);
|
|
302
|
-
|
|
275
|
+
for (const host of Object.keys(serverConf)) port += Object.keys(serverConf[host]).length;
|
|
303
276
|
}
|
|
304
277
|
break;
|
|
305
278
|
|
|
@@ -395,10 +368,22 @@ try {
|
|
|
395
368
|
}
|
|
396
369
|
|
|
397
370
|
case 'version-build': {
|
|
371
|
+
shellExec(`node bin run kill 4001`);
|
|
372
|
+
shellExec(`node bin run kill 4002`);
|
|
373
|
+
shellExec(`node bin run kill 4003`);
|
|
374
|
+
shellExec(`npm run update-template`);
|
|
375
|
+
shellExec(`cd ../pwa-microservices-template && npm run build && timeout 5s npm run dev`, {
|
|
376
|
+
async: true,
|
|
377
|
+
});
|
|
378
|
+
await timer(5500);
|
|
379
|
+
const templateRunnerResult = fs.readFileSync(`../pwa-microservices-template/logs/start.js/all.log`, 'utf8');
|
|
380
|
+
logger.info('Test template runner result');
|
|
381
|
+
console.log(templateRunnerResult);
|
|
398
382
|
shellExec(`node bin/deploy clean-core-repo`);
|
|
399
383
|
shellCd(`/home/dd/engine`);
|
|
400
384
|
const originPackageJson = JSON.parse(fs.readFileSync(`package.json`, 'utf8'));
|
|
401
385
|
const newVersion = process.argv[3] ?? originPackageJson.version;
|
|
386
|
+
const node = process.argv[4] ?? 'kind-control-plane';
|
|
402
387
|
const { version } = originPackageJson;
|
|
403
388
|
originPackageJson.version = newVersion;
|
|
404
389
|
fs.writeFileSync(`package.json`, JSON.stringify(originPackageJson, null, 4), 'utf8');
|
|
@@ -456,8 +441,23 @@ try {
|
|
|
456
441
|
shellExec(`node bin/deploy update-dependencies`);
|
|
457
442
|
shellExec(`auto-changelog`);
|
|
458
443
|
shellExec(`node bin/build dd`);
|
|
459
|
-
shellExec(
|
|
460
|
-
|
|
444
|
+
shellExec(
|
|
445
|
+
`node bin deploy --kubeadm --build-manifest --sync --info-router --replicas 1 --node ${node} dd production`,
|
|
446
|
+
);
|
|
447
|
+
for (const deployId of fs.readFileSync(`./engine-private/deploy/dd.router`, 'utf8').split(`,`)) {
|
|
448
|
+
fs.copySync(
|
|
449
|
+
`./engine-private/conf/${deployId}/build/development/deployment.yaml`,
|
|
450
|
+
`./manifests/deployment/${deployId}-development/deployment.yaml`,
|
|
451
|
+
);
|
|
452
|
+
fs.copySync(
|
|
453
|
+
`./engine-private/conf/${deployId}/build/development/proxy.yaml`,
|
|
454
|
+
`./manifests/deployment/${deployId}-development/proxy.yaml`,
|
|
455
|
+
);
|
|
456
|
+
}
|
|
457
|
+
shellExec(`sudo rm -rf ./engine-private/conf/dd-default`);
|
|
458
|
+
shellExec(`node bin new --deploy-id dd-default`);
|
|
459
|
+
console.log(fs.existsSync(`./engine-private/conf/dd-default`));
|
|
460
|
+
shellExec(`sudo rm -rf ./engine-private/conf/dd-default`);
|
|
461
461
|
break;
|
|
462
462
|
}
|
|
463
463
|
|
package/bin/file.js
CHANGED
|
@@ -60,6 +60,8 @@ try {
|
|
|
60
60
|
else {
|
|
61
61
|
shellExec(`cd ${toPath} && git reset && git checkout . && git clean -f -d`);
|
|
62
62
|
shellExec(`underpost pull ${toPath} underpostnet/pwa-microservices-template`);
|
|
63
|
+
shellExec(`sudo rm -rf ${toPath}/engine-private`);
|
|
64
|
+
shellExec(`sudo rm -rf ${toPath}/logs`);
|
|
63
65
|
}
|
|
64
66
|
} else {
|
|
65
67
|
fs.removeSync(toPath);
|
|
@@ -94,6 +96,7 @@ try {
|
|
|
94
96
|
'./manifests/deployment/dd-template-development',
|
|
95
97
|
'bin/web3.js',
|
|
96
98
|
'bin/cyberia.js',
|
|
99
|
+
'bin/cyberia0.js',
|
|
97
100
|
]) {
|
|
98
101
|
if (fs.existsSync(deletePath)) fs.removeSync('../pwa-microservices-template/' + deletePath);
|
|
99
102
|
}
|