underpost 2.8.851 → 2.8.853
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/README.md +40 -35
- package/bin/deploy.js +0 -37
- package/cli.md +113 -99
- package/docker-compose.yml +1 -1
- package/manifests/deployment/dd-template-development/deployment.yaml +2 -2
- package/manifests/maas/ssh-cluster-info.sh +14 -0
- package/package.json +1 -1
- package/src/api/user/user.service.js +3 -3
- package/src/cli/cron.js +3 -31
- package/src/cli/db.js +124 -0
- package/src/cli/deploy.js +6 -77
- package/src/cli/index.js +12 -6
- package/src/cli/run.js +5 -0
- package/src/client/components/core/Account.js +6 -2
- package/src/client/components/core/Recover.js +4 -2
- package/src/client/components/core/VanillaJs.js +46 -48
- package/src/index.js +1 -1
package/README.md
CHANGED
|
@@ -47,13 +47,15 @@ template
|
|
|
47
47
|
|
|
48
48
|
|
|
49
49
|
|
|
50
|
+
|
|
51
|
+
|
|
50
52
|
|
|
51
53
|
|
|
52
54
|
|
|
53
55
|
<!-- badges -->
|
|
54
56
|
|
|
55
57
|
|
|
56
|
-
[](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.853) [](https://coveralls.io/github/underpostnet/engine?branch=master) [](https://www.npmjs.org/package/underpost) [](https://www.npmjs.com/package/underpost)
|
|
57
59
|
|
|
58
60
|
|
|
59
61
|
<!-- end-badges -->
|
|
@@ -83,6 +85,8 @@ template
|
|
|
83
85
|
|
|
84
86
|
|
|
85
87
|
|
|
88
|
+
|
|
89
|
+
|
|
86
90
|
|
|
87
91
|
|
|
88
92
|
|
|
@@ -130,43 +134,44 @@ Run dev client server
|
|
|
130
134
|
npm run dev
|
|
131
135
|
```
|
|
132
136
|
<!-- -->
|
|
133
|
-
## underpost ci/cd cli v2.8.
|
|
137
|
+
## underpost ci/cd cli v2.8.853
|
|
134
138
|
|
|
135
139
|
### Usage: `underpost [options] [command]`
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
-
|
|
140
|
-
-h, --help display help for command
|
|
140
|
+
```
|
|
141
|
+
Options:
|
|
142
|
+
-V, --version output the version number
|
|
143
|
+
-h, --help display help for command
|
|
141
144
|
|
|
142
145
|
Commands:
|
|
143
|
-
new <app-name> Initializes a new Underpost project with a predefined structure.
|
|
144
|
-
start [options] <deploy-id> [env] Initiates application servers, build pipelines, or other defined services based on the deployment ID.
|
|
145
|
-
clone [options] <uri> Clones a specified GitHub repository into the current directory.
|
|
146
|
-
pull [options] <path> <uri> Pulls the latest changes from a specified GitHub repository.
|
|
147
|
-
cmt [options] <path> <commit-type> [module-tag] [message] Manages commits to a GitHub repository, supporting various commit types and options.
|
|
148
|
-
push [options] <path> <uri> Pushes committed changes from a local repository to a remote GitHub repository.
|
|
149
|
-
env <deploy-id> [env] Sets environment variables and configurations related to a specific deployment ID.
|
|
150
|
-
config [options] <operator> [key] [value] Manages Underpost configurations using various operators.
|
|
151
|
-
root Displays the root path of the npm installation.
|
|
152
|
-
cluster [options] [pod-name] Manages Kubernetes clusters, defaulting to Kind cluster initialization.
|
|
153
|
-
deploy [options] [deploy-list] [env] Manages application deployments, defaulting to deploying development pods.
|
|
154
|
-
secret [options] <platform> Manages secrets for various platforms.
|
|
155
|
-
dockerfile-image-build [options] Builds a Docker image from a specified Dockerfile with various options for naming, saving, and loading.
|
|
156
|
-
dockerfile-pull-base-images [options] Pulls required Underpost Dockerfile base images and optionally loads them into clusters.
|
|
157
|
-
install Quickly imports Underpost npm dependencies by copying them.
|
|
158
|
-
db [options] <deploy-list> Manages database operations, including import, export, and collection management.
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
146
|
+
new <app-name> Initializes a new Underpost project with a predefined structure.
|
|
147
|
+
start [options] <deploy-id> [env] Initiates application servers, build pipelines, or other defined services based on the deployment ID.
|
|
148
|
+
clone [options] <uri> Clones a specified GitHub repository into the current directory.
|
|
149
|
+
pull [options] <path> <uri> Pulls the latest changes from a specified GitHub repository.
|
|
150
|
+
cmt [options] <path> <commit-type> [module-tag] [message] Manages commits to a GitHub repository, supporting various commit types and options.
|
|
151
|
+
push [options] <path> <uri> Pushes committed changes from a local repository to a remote GitHub repository.
|
|
152
|
+
env <deploy-id> [env] Sets environment variables and configurations related to a specific deployment ID.
|
|
153
|
+
config [options] <operator> [key] [value] Manages Underpost configurations using various operators.
|
|
154
|
+
root Displays the root path of the npm installation.
|
|
155
|
+
cluster [options] [pod-name] Manages Kubernetes clusters, defaulting to Kind cluster initialization.
|
|
156
|
+
deploy [options] [deploy-list] [env] Manages application deployments, defaulting to deploying development pods.
|
|
157
|
+
secret [options] <platform> Manages secrets for various platforms.
|
|
158
|
+
dockerfile-image-build [options] Builds a Docker image from a specified Dockerfile with various options for naming, saving, and loading.
|
|
159
|
+
dockerfile-pull-base-images [options] Pulls required Underpost Dockerfile base images and optionally loads them into clusters.
|
|
160
|
+
install Quickly imports Underpost npm dependencies by copying them.
|
|
161
|
+
db [options] <deploy-list> Manages database operations, including import, export, and collection management.
|
|
162
|
+
metadata [options] [deploy-id] [host] [path] Manages cluster metadata operations, including import and export.
|
|
163
|
+
script [options] <operator> <script-name> [script-value] Supports a variety of built-in Underpost global scripts, their preset lifecycle events, and arbitrary custom scripts.
|
|
164
|
+
cron [options] [deploy-list] [job-list] Manages cron jobs, including initialization, execution, and configuration updates.
|
|
165
|
+
fs [options] [path] Manages file storage, defaulting to file upload operations.
|
|
166
|
+
test [options] [deploy-list] Manages and runs tests, defaulting to the current Underpost default test suite.
|
|
167
|
+
monitor [options] <deploy-id> [env] Manages health server monitoring for specified deployments.
|
|
168
|
+
ssh [options] Import and start ssh server and client based on current default deployment ID.
|
|
169
|
+
run [options] <runner-id> [path] Runs a script from the specified path.
|
|
170
|
+
lxd [options] Manages LXD containers and virtual machines.
|
|
171
|
+
baremetal [options] [workflow-id] [hostname] [ip-address] Manages baremetal server operations, including installation, database setup, commissioning, and user management.
|
|
172
|
+
help [command] display help for command
|
|
173
|
+
|
|
170
174
|
```
|
|
171
|
-
|
|
175
|
+
|
|
172
176
|
<a target="_top" href="https://github.com/underpostnet/pwa-microservices-template/blob/master/cli.md">See complete CLI Docs here.</a>
|
|
177
|
+
|
package/bin/deploy.js
CHANGED
|
@@ -1015,43 +1015,6 @@ EOF`);
|
|
|
1015
1015
|
break;
|
|
1016
1016
|
}
|
|
1017
1017
|
|
|
1018
|
-
case 'update-instances': {
|
|
1019
|
-
shellExec(`node bin deploy dd production --sync --build-manifest --info-router --dashboard-update`);
|
|
1020
|
-
shellExec(`node bin cron --dashboard-update --init`);
|
|
1021
|
-
const deployId = 'dd-core';
|
|
1022
|
-
const host = 'www.nexodev.org';
|
|
1023
|
-
const path = '/';
|
|
1024
|
-
|
|
1025
|
-
{
|
|
1026
|
-
const outputPath = './engine-private/instances';
|
|
1027
|
-
if (fs.existsSync(outputPath)) fs.mkdirSync(outputPath, { recursive: true });
|
|
1028
|
-
const collection = 'instances';
|
|
1029
|
-
if (process.argv.includes('export'))
|
|
1030
|
-
shellExec(
|
|
1031
|
-
`node bin db --export --collections ${collection} --out-path ${outputPath} --hosts ${host} --paths '${path}' ${deployId}`,
|
|
1032
|
-
);
|
|
1033
|
-
if (process.argv.includes('import'))
|
|
1034
|
-
shellExec(
|
|
1035
|
-
`node bin db --import --drop --preserveUUID --out-path ${outputPath} --hosts ${host} --paths '${path}' ${deployId}`,
|
|
1036
|
-
);
|
|
1037
|
-
}
|
|
1038
|
-
{
|
|
1039
|
-
const outputPath = './engine-private/crons';
|
|
1040
|
-
if (fs.existsSync(outputPath)) fs.mkdirSync(outputPath, { recursive: true });
|
|
1041
|
-
const collection = 'crons';
|
|
1042
|
-
if (process.argv.includes('export'))
|
|
1043
|
-
shellExec(
|
|
1044
|
-
`node bin db --export --collections ${collection} --out-path ${outputPath} --hosts ${host} --paths '${path}' ${deployId}`,
|
|
1045
|
-
);
|
|
1046
|
-
if (process.argv.includes('import'))
|
|
1047
|
-
shellExec(
|
|
1048
|
-
`node bin db --import --drop --preserveUUID --out-path ${outputPath} --hosts ${host} --paths '${path}' ${deployId}`,
|
|
1049
|
-
);
|
|
1050
|
-
}
|
|
1051
|
-
|
|
1052
|
-
break;
|
|
1053
|
-
}
|
|
1054
|
-
|
|
1055
1018
|
case 'cli-docs': {
|
|
1056
1019
|
buildCliDoc(program, process.argv[3], process.argv[4]);
|
|
1057
1020
|
break;
|
package/cli.md
CHANGED
|
@@ -1,46 +1,46 @@
|
|
|
1
|
-
## underpost ci/cd cli v2.8.
|
|
1
|
+
## underpost ci/cd cli v2.8.853
|
|
2
2
|
|
|
3
3
|
### Usage: `underpost [options] [command]`
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
-
|
|
8
|
-
-h, --help display help for command
|
|
4
|
+
```
|
|
5
|
+
Options:
|
|
6
|
+
-V, --version output the version number
|
|
7
|
+
-h, --help display help for command
|
|
9
8
|
|
|
10
9
|
Commands:
|
|
11
|
-
new <app-name> Initializes a new Underpost project with a predefined structure.
|
|
12
|
-
start [options] <deploy-id> [env] Initiates application servers, build pipelines, or other defined services based on the deployment ID.
|
|
13
|
-
clone [options] <uri> Clones a specified GitHub repository into the current directory.
|
|
14
|
-
pull [options] <path> <uri> Pulls the latest changes from a specified GitHub repository.
|
|
15
|
-
cmt [options] <path> <commit-type> [module-tag] [message] Manages commits to a GitHub repository, supporting various commit types and options.
|
|
16
|
-
push [options] <path> <uri> Pushes committed changes from a local repository to a remote GitHub repository.
|
|
17
|
-
env <deploy-id> [env] Sets environment variables and configurations related to a specific deployment ID.
|
|
18
|
-
config [options] <operator> [key] [value] Manages Underpost configurations using various operators.
|
|
19
|
-
root Displays the root path of the npm installation.
|
|
20
|
-
cluster [options] [pod-name] Manages Kubernetes clusters, defaulting to Kind cluster initialization.
|
|
21
|
-
deploy [options] [deploy-list] [env] Manages application deployments, defaulting to deploying development pods.
|
|
22
|
-
secret [options] <platform> Manages secrets for various platforms.
|
|
23
|
-
dockerfile-image-build [options] Builds a Docker image from a specified Dockerfile with various options for naming, saving, and loading.
|
|
24
|
-
dockerfile-pull-base-images [options] Pulls required Underpost Dockerfile base images and optionally loads them into clusters.
|
|
25
|
-
install Quickly imports Underpost npm dependencies by copying them.
|
|
26
|
-
db [options] <deploy-list> Manages database operations, including import, export, and collection management.
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
10
|
+
new <app-name> Initializes a new Underpost project with a predefined structure.
|
|
11
|
+
start [options] <deploy-id> [env] Initiates application servers, build pipelines, or other defined services based on the deployment ID.
|
|
12
|
+
clone [options] <uri> Clones a specified GitHub repository into the current directory.
|
|
13
|
+
pull [options] <path> <uri> Pulls the latest changes from a specified GitHub repository.
|
|
14
|
+
cmt [options] <path> <commit-type> [module-tag] [message] Manages commits to a GitHub repository, supporting various commit types and options.
|
|
15
|
+
push [options] <path> <uri> Pushes committed changes from a local repository to a remote GitHub repository.
|
|
16
|
+
env <deploy-id> [env] Sets environment variables and configurations related to a specific deployment ID.
|
|
17
|
+
config [options] <operator> [key] [value] Manages Underpost configurations using various operators.
|
|
18
|
+
root Displays the root path of the npm installation.
|
|
19
|
+
cluster [options] [pod-name] Manages Kubernetes clusters, defaulting to Kind cluster initialization.
|
|
20
|
+
deploy [options] [deploy-list] [env] Manages application deployments, defaulting to deploying development pods.
|
|
21
|
+
secret [options] <platform> Manages secrets for various platforms.
|
|
22
|
+
dockerfile-image-build [options] Builds a Docker image from a specified Dockerfile with various options for naming, saving, and loading.
|
|
23
|
+
dockerfile-pull-base-images [options] Pulls required Underpost Dockerfile base images and optionally loads them into clusters.
|
|
24
|
+
install Quickly imports Underpost npm dependencies by copying them.
|
|
25
|
+
db [options] <deploy-list> Manages database operations, including import, export, and collection management.
|
|
26
|
+
metadata [options] [deploy-id] [host] [path] Manages cluster metadata operations, including import and export.
|
|
27
|
+
script [options] <operator> <script-name> [script-value] Supports a variety of built-in Underpost global scripts, their preset lifecycle events, and arbitrary custom scripts.
|
|
28
|
+
cron [options] [deploy-list] [job-list] Manages cron jobs, including initialization, execution, and configuration updates.
|
|
29
|
+
fs [options] [path] Manages file storage, defaulting to file upload operations.
|
|
30
|
+
test [options] [deploy-list] Manages and runs tests, defaulting to the current Underpost default test suite.
|
|
31
|
+
monitor [options] <deploy-id> [env] Manages health server monitoring for specified deployments.
|
|
32
|
+
ssh [options] Import and start ssh server and client based on current default deployment ID.
|
|
33
|
+
run [options] <runner-id> [path] Runs a script from the specified path.
|
|
34
|
+
lxd [options] Manages LXD containers and virtual machines.
|
|
35
|
+
baremetal [options] [workflow-id] [hostname] [ip-address] Manages baremetal server operations, including installation, database setup, commissioning, and user management.
|
|
36
|
+
help [command] display help for command
|
|
37
|
+
|
|
38
38
|
```
|
|
39
39
|
|
|
40
40
|
## Commands:
|
|
41
|
+
|
|
41
42
|
|
|
42
43
|
### `new` :
|
|
43
|
-
|
|
44
44
|
```
|
|
45
45
|
Usage: underpost new [options] <app-name>
|
|
46
46
|
|
|
@@ -51,11 +51,11 @@ Arguments:
|
|
|
51
51
|
|
|
52
52
|
Options:
|
|
53
53
|
-h, --help display help for command
|
|
54
|
-
|
|
54
|
+
|
|
55
55
|
```
|
|
56
|
+
|
|
56
57
|
|
|
57
58
|
### `start` :
|
|
58
|
-
|
|
59
59
|
```
|
|
60
60
|
Usage: underpost start [options] <deploy-id> [env]
|
|
61
61
|
|
|
@@ -71,11 +71,11 @@ Options:
|
|
|
71
71
|
--run Starts application servers and monitors their health.
|
|
72
72
|
--build Triggers the client-side application build process.
|
|
73
73
|
-h, --help display help for command
|
|
74
|
-
|
|
74
|
+
|
|
75
75
|
```
|
|
76
|
+
|
|
76
77
|
|
|
77
78
|
### `clone` :
|
|
78
|
-
|
|
79
79
|
```
|
|
80
80
|
Usage: underpost clone [options] <uri>
|
|
81
81
|
|
|
@@ -88,11 +88,11 @@ Options:
|
|
|
88
88
|
--bare Performs a bare clone, downloading only the .git files.
|
|
89
89
|
-g8 Uses the g8 repository extension for cloning.
|
|
90
90
|
-h, --help display help for command
|
|
91
|
-
|
|
91
|
+
|
|
92
92
|
```
|
|
93
|
+
|
|
93
94
|
|
|
94
95
|
### `pull` :
|
|
95
|
-
|
|
96
96
|
```
|
|
97
97
|
Usage: underpost pull [options] <path> <uri>
|
|
98
98
|
|
|
@@ -106,11 +106,11 @@ Arguments:
|
|
|
106
106
|
Options:
|
|
107
107
|
-g8 Uses the g8 repository extension for pulling.
|
|
108
108
|
-h, --help display help for command
|
|
109
|
-
|
|
109
|
+
|
|
110
110
|
```
|
|
111
|
+
|
|
111
112
|
|
|
112
113
|
### `cmt` :
|
|
113
|
-
|
|
114
114
|
```
|
|
115
115
|
Usage: underpost cmt [options] <path> <commit-type> [module-tag] [message]
|
|
116
116
|
|
|
@@ -130,11 +130,11 @@ Options:
|
|
|
130
130
|
--copy Copies the generated commit message to the clipboard.
|
|
131
131
|
--info Displays information about available commit types.
|
|
132
132
|
-h, --help display help for command
|
|
133
|
-
|
|
133
|
+
|
|
134
134
|
```
|
|
135
|
+
|
|
135
136
|
|
|
136
137
|
### `push` :
|
|
137
|
-
|
|
138
138
|
```
|
|
139
139
|
Usage: underpost push [options] <path> <uri>
|
|
140
140
|
|
|
@@ -148,11 +148,11 @@ Options:
|
|
|
148
148
|
-f Forces the push, overwriting the remote repository history.
|
|
149
149
|
-g8 Uses the g8 repository extension for pushing.
|
|
150
150
|
-h, --help display help for command
|
|
151
|
-
|
|
151
|
+
|
|
152
152
|
```
|
|
153
|
+
|
|
153
154
|
|
|
154
155
|
### `env` :
|
|
155
|
-
|
|
156
156
|
```
|
|
157
157
|
Usage: underpost env [options] <deploy-id> [env]
|
|
158
158
|
|
|
@@ -167,11 +167,11 @@ Arguments:
|
|
|
167
167
|
|
|
168
168
|
Options:
|
|
169
169
|
-h, --help display help for command
|
|
170
|
-
|
|
170
|
+
|
|
171
171
|
```
|
|
172
|
+
|
|
172
173
|
|
|
173
174
|
### `config` :
|
|
174
|
-
|
|
175
175
|
```
|
|
176
176
|
Usage: underpost config [options] <operator> [key] [value]
|
|
177
177
|
|
|
@@ -186,11 +186,11 @@ Arguments:
|
|
|
186
186
|
Options:
|
|
187
187
|
--plain Prints the configuration value in plain text.
|
|
188
188
|
-h, --help display help for command
|
|
189
|
-
|
|
189
|
+
|
|
190
190
|
```
|
|
191
|
+
|
|
191
192
|
|
|
192
193
|
### `root` :
|
|
193
|
-
|
|
194
194
|
```
|
|
195
195
|
Usage: underpost root [options]
|
|
196
196
|
|
|
@@ -198,11 +198,11 @@ Displays the root path of the npm installation.
|
|
|
198
198
|
|
|
199
199
|
Options:
|
|
200
200
|
-h, --help display help for command
|
|
201
|
-
|
|
201
|
+
|
|
202
202
|
```
|
|
203
|
+
|
|
203
204
|
|
|
204
205
|
### `cluster` :
|
|
205
|
-
|
|
206
206
|
```
|
|
207
207
|
Usage: underpost cluster [options] [pod-name]
|
|
208
208
|
|
|
@@ -256,11 +256,11 @@ Options:
|
|
|
256
256
|
--k3s Initializes the cluster using K3s (Lightweight
|
|
257
257
|
Kubernetes).
|
|
258
258
|
-h, --help display help for command
|
|
259
|
-
|
|
259
|
+
|
|
260
260
|
```
|
|
261
|
+
|
|
261
262
|
|
|
262
263
|
### `deploy` :
|
|
263
|
-
|
|
264
264
|
```
|
|
265
265
|
Usage: underpost deploy [options] [deploy-list] [env]
|
|
266
266
|
|
|
@@ -289,8 +289,6 @@ Options:
|
|
|
289
289
|
--build-manifest Builds Kubernetes YAML manifests, including
|
|
290
290
|
deployments, services, proxies, and
|
|
291
291
|
secrets.
|
|
292
|
-
--dashboard-update Updates dashboard instance data with the
|
|
293
|
-
current router configuration.
|
|
294
292
|
--replicas <replicas> Sets a custom number of replicas for
|
|
295
293
|
deployments.
|
|
296
294
|
--versions <deployment-versions> A comma-separated list of custom deployment
|
|
@@ -303,15 +301,12 @@ Options:
|
|
|
303
301
|
--kubeadm Enables the kubeadm context for deployment
|
|
304
302
|
operations.
|
|
305
303
|
--restore-hosts Restores default `/etc/hosts` entries.
|
|
306
|
-
--rebuild-clients-bundle Inside the container, rebuilds client
|
|
307
|
-
bundles (only static public or storage
|
|
308
|
-
client files).
|
|
309
304
|
-h, --help display help for command
|
|
310
|
-
|
|
305
|
+
|
|
311
306
|
```
|
|
307
|
+
|
|
312
308
|
|
|
313
309
|
### `secret` :
|
|
314
|
-
|
|
315
310
|
```
|
|
316
311
|
Usage: underpost secret [options] <platform>
|
|
317
312
|
|
|
@@ -329,11 +324,11 @@ Options:
|
|
|
329
324
|
--list Lists all available secrets for the
|
|
330
325
|
platform.
|
|
331
326
|
-h, --help display help for command
|
|
332
|
-
|
|
327
|
+
|
|
333
328
|
```
|
|
329
|
+
|
|
334
330
|
|
|
335
331
|
### `dockerfile-image-build` :
|
|
336
|
-
|
|
337
332
|
```
|
|
338
333
|
Usage: underpost dockerfile-image-build [options]
|
|
339
334
|
|
|
@@ -360,11 +355,11 @@ Options:
|
|
|
360
355
|
cache.
|
|
361
356
|
--k3s-load Loads the image into a K3s cluster.
|
|
362
357
|
-h, --help display help for command
|
|
363
|
-
|
|
358
|
+
|
|
364
359
|
```
|
|
360
|
+
|
|
365
361
|
|
|
366
362
|
### `dockerfile-pull-base-images` :
|
|
367
|
-
|
|
368
363
|
```
|
|
369
364
|
Usage: underpost dockerfile-pull-base-images [options]
|
|
370
365
|
|
|
@@ -378,11 +373,11 @@ Options:
|
|
|
378
373
|
--version Sets a custom version for the base images.
|
|
379
374
|
--k3s-load Loads the image into a K3s cluster.
|
|
380
375
|
-h, --help display help for command
|
|
381
|
-
|
|
376
|
+
|
|
382
377
|
```
|
|
378
|
+
|
|
383
379
|
|
|
384
380
|
### `install` :
|
|
385
|
-
|
|
386
381
|
```
|
|
387
382
|
Usage: underpost install [options]
|
|
388
383
|
|
|
@@ -390,11 +385,11 @@ Quickly imports Underpost npm dependencies by copying them.
|
|
|
390
385
|
|
|
391
386
|
Options:
|
|
392
387
|
-h, --help display help for command
|
|
393
|
-
|
|
388
|
+
|
|
394
389
|
```
|
|
390
|
+
|
|
395
391
|
|
|
396
392
|
### `db` :
|
|
397
|
-
|
|
398
393
|
```
|
|
399
394
|
Usage: underpost db [options] <deploy-list>
|
|
400
395
|
|
|
@@ -424,11 +419,32 @@ Options:
|
|
|
424
419
|
--ns <ns-name> Optional: Specifies the namespace context for
|
|
425
420
|
database operations.
|
|
426
421
|
-h, --help display help for command
|
|
422
|
+
|
|
423
|
+
```
|
|
424
|
+
|
|
427
425
|
|
|
426
|
+
### `metadata` :
|
|
428
427
|
```
|
|
428
|
+
Usage: underpost metadata [options] [deploy-id] [host] [path]
|
|
429
429
|
|
|
430
|
-
|
|
430
|
+
Manages cluster metadata operations, including import and export.
|
|
431
|
+
|
|
432
|
+
Arguments:
|
|
433
|
+
deploy-id The deployment ID to manage metadata.
|
|
434
|
+
host The host to manage metadata.
|
|
435
|
+
path The path to manage metadata.
|
|
431
436
|
|
|
437
|
+
Options:
|
|
438
|
+
--import Imports from local storage.
|
|
439
|
+
--export Exports to local storage.
|
|
440
|
+
--crons Apply to cron data collection
|
|
441
|
+
--instances Apply to instance data collection
|
|
442
|
+
-h, --help display help for command
|
|
443
|
+
|
|
444
|
+
```
|
|
445
|
+
|
|
446
|
+
|
|
447
|
+
### `script` :
|
|
432
448
|
```
|
|
433
449
|
Usage: underpost script [options] <operator> <script-name> [script-value]
|
|
434
450
|
|
|
@@ -450,11 +466,11 @@ Options:
|
|
|
450
466
|
execution.
|
|
451
467
|
--pod-name <pod-name> Optional: Specifies the pod name for script execution.
|
|
452
468
|
-h, --help display help for command
|
|
453
|
-
|
|
469
|
+
|
|
454
470
|
```
|
|
471
|
+
|
|
455
472
|
|
|
456
473
|
### `cron` :
|
|
457
|
-
|
|
458
474
|
```
|
|
459
475
|
Usage: underpost cron [options] [deploy-list] [job-list]
|
|
460
476
|
|
|
@@ -462,24 +478,21 @@ Manages cron jobs, including initialization, execution, and configuration
|
|
|
462
478
|
updates.
|
|
463
479
|
|
|
464
480
|
Arguments:
|
|
465
|
-
deploy-list
|
|
466
|
-
|
|
467
|
-
job-list
|
|
468
|
-
|
|
481
|
+
deploy-list A comma-separated list of deployment IDs (e.g.,
|
|
482
|
+
"default-a,default-b").
|
|
483
|
+
job-list A comma-separated list of job IDs. Options: callback. Defaults
|
|
484
|
+
to all available jobs.
|
|
469
485
|
|
|
470
486
|
Options:
|
|
471
|
-
--itc
|
|
472
|
-
|
|
473
|
-
--
|
|
474
|
-
--
|
|
475
|
-
|
|
476
|
-
configurations.
|
|
477
|
-
-h, --help display help for command
|
|
478
|
-
|
|
487
|
+
--itc Executes cron jobs within the container execution context.
|
|
488
|
+
--init Initializes cron jobs for the default deployment ID.
|
|
489
|
+
--git Uploads cron job configurations to GitHub.
|
|
490
|
+
-h, --help display help for command
|
|
491
|
+
|
|
479
492
|
```
|
|
493
|
+
|
|
480
494
|
|
|
481
495
|
### `fs` :
|
|
482
|
-
|
|
483
496
|
```
|
|
484
497
|
Usage: underpost fs [options] [path]
|
|
485
498
|
|
|
@@ -497,11 +510,11 @@ Options:
|
|
|
497
510
|
--force Forces the action, overriding any warnings or conflicts.
|
|
498
511
|
--storage-file-path <storage-file-path> Specifies a custom file storage path.
|
|
499
512
|
-h, --help display help for command
|
|
500
|
-
|
|
513
|
+
|
|
501
514
|
```
|
|
515
|
+
|
|
502
516
|
|
|
503
517
|
### `test` :
|
|
504
|
-
|
|
505
518
|
```
|
|
506
519
|
Usage: underpost test [options] [deploy-list]
|
|
507
520
|
|
|
@@ -523,11 +536,11 @@ Options:
|
|
|
523
536
|
--kind-type <kind-type> Optional: Specifies the Kind cluster type for
|
|
524
537
|
tests.
|
|
525
538
|
-h, --help display help for command
|
|
526
|
-
|
|
539
|
+
|
|
527
540
|
```
|
|
541
|
+
|
|
528
542
|
|
|
529
543
|
### `monitor` :
|
|
530
|
-
|
|
531
544
|
```
|
|
532
545
|
Usage: underpost monitor [options] <deploy-id> [env]
|
|
533
546
|
|
|
@@ -550,11 +563,11 @@ Options:
|
|
|
550
563
|
--sync Synchronizes with current proxy deployments and
|
|
551
564
|
traffic configurations.
|
|
552
565
|
-h, --help display help for command
|
|
553
|
-
|
|
566
|
+
|
|
554
567
|
```
|
|
568
|
+
|
|
555
569
|
|
|
556
570
|
### `ssh` :
|
|
557
|
-
|
|
558
571
|
```
|
|
559
572
|
Usage: underpost ssh [options]
|
|
560
573
|
|
|
@@ -564,18 +577,18 @@ Options:
|
|
|
564
577
|
--generate Generates new ssh credential and stores it in current private
|
|
565
578
|
keys file storage.
|
|
566
579
|
-h, --help display help for command
|
|
567
|
-
|
|
580
|
+
|
|
568
581
|
```
|
|
582
|
+
|
|
569
583
|
|
|
570
584
|
### `run` :
|
|
571
|
-
|
|
572
585
|
```
|
|
573
586
|
Usage: underpost run [options] <runner-id> [path]
|
|
574
587
|
|
|
575
588
|
Runs a script from the specified path.
|
|
576
589
|
|
|
577
590
|
Arguments:
|
|
578
|
-
runner-id The runner ID to run. Options: spark-template, rmi, kill, secret, gpu-env, tf-gpu-test, dev-cluster, cyberia-ide, engine-ide, template-deploy, ssh-deploy, ide, monitor, db-client, cluster, deploy, tf-vae-test, deploy-job.
|
|
591
|
+
runner-id The runner ID to run. Options: spark-template, rmi, kill, secret, gpu-env, tf-gpu-test, dev-cluster, ssh-cluster-info, cyberia-ide, engine-ide, template-deploy, ssh-deploy, ide, monitor, db-client, cluster, deploy, tf-vae-test, deploy-job.
|
|
579
592
|
path The absolute or relative directory path where the script is located.
|
|
580
593
|
|
|
581
594
|
Options:
|
|
@@ -590,11 +603,11 @@ Options:
|
|
|
590
603
|
--container-name <container-name> Optional: Specifies the container name for test execution.
|
|
591
604
|
--namespace <namespace> Optional: Specifies the namespace for test execution.
|
|
592
605
|
-h, --help display help for command
|
|
593
|
-
|
|
606
|
+
|
|
594
607
|
```
|
|
608
|
+
|
|
595
609
|
|
|
596
610
|
### `lxd` :
|
|
597
|
-
|
|
598
611
|
```
|
|
599
612
|
Usage: underpost lxd [options]
|
|
600
613
|
|
|
@@ -635,11 +648,11 @@ Options:
|
|
|
635
648
|
--auto-expose-k8s-ports <vm-id> Automatically exposes common Kubernetes
|
|
636
649
|
ports for the specified VM.
|
|
637
650
|
-h, --help display help for command
|
|
638
|
-
|
|
651
|
+
|
|
639
652
|
```
|
|
653
|
+
|
|
640
654
|
|
|
641
655
|
### `baremetal` :
|
|
642
|
-
|
|
643
656
|
```
|
|
644
657
|
Usage: underpost baremetal [options] [workflow-id] [hostname] [ip-address]
|
|
645
658
|
|
|
@@ -673,5 +686,6 @@ Options:
|
|
|
673
686
|
baremetal operations.
|
|
674
687
|
--ls Lists available boot resources and machines.
|
|
675
688
|
-h, --help display help for command
|
|
676
|
-
|
|
689
|
+
|
|
677
690
|
```
|
|
691
|
+
|
package/docker-compose.yml
CHANGED
|
@@ -17,7 +17,7 @@ spec:
|
|
|
17
17
|
spec:
|
|
18
18
|
containers:
|
|
19
19
|
- name: dd-template-development-blue
|
|
20
|
-
image: localhost/rockylinux9-underpost:v2.8.
|
|
20
|
+
image: localhost/rockylinux9-underpost:v2.8.853
|
|
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-template-development-green
|
|
103
|
-
image: localhost/rockylinux9-underpost:v2.8.
|
|
103
|
+
image: localhost/rockylinux9-underpost:v2.8.853
|
|
104
104
|
# resources:
|
|
105
105
|
# requests:
|
|
106
106
|
# memory: "124Ki"
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
REMOTE_USER=$(node bin config get --plain DEFAULT_SSH_USER)
|
|
5
|
+
REMOTE_HOST=$(node bin config get --plain DEFAULT_SSH_HOST)
|
|
6
|
+
SSH_KEY=$(node bin config get --plain DEFAULT_SSH_KEY_PATH)
|
|
7
|
+
|
|
8
|
+
chmod 600 "$SSH_KEY"
|
|
9
|
+
|
|
10
|
+
ssh -i "$SSH_KEY" -o BatchMode=yes "${REMOTE_USER}@${REMOTE_HOST}" sh <<EOF
|
|
11
|
+
cd /home/dd/engine
|
|
12
|
+
node bin deploy dd production --info-traffic
|
|
13
|
+
kubectl get pods -A
|
|
14
|
+
EOF
|
package/package.json
CHANGED
|
@@ -32,7 +32,7 @@ const UserService = {
|
|
|
32
32
|
const payloadToken = hashJWT({ email: req.body.email }, '15m');
|
|
33
33
|
const id = `${options.host}${options.path}`;
|
|
34
34
|
const translate = MailerProvider.instance[id].translateTemplates.recoverEmail;
|
|
35
|
-
const recoverUrl = `${process.env.NODE_ENV === 'development' ? 'http://' : 'https://'}${req.hostname}${
|
|
35
|
+
const recoverUrl = `${process.env.NODE_ENV === 'development' ? 'http://' : 'https://'}${req.body.hostname}${
|
|
36
36
|
req.body.proxyPath
|
|
37
37
|
}recover?payload=${payloadToken}`;
|
|
38
38
|
const sendResult = await MailerProvider.send({
|
|
@@ -45,7 +45,7 @@ const UserService = {
|
|
|
45
45
|
.replace('{{H1}}', translate.H1[req.lang])
|
|
46
46
|
.replace('{{P1}}', translate.P1[req.lang])
|
|
47
47
|
.replace('{{TOKEN}}', token)
|
|
48
|
-
.replace(`{{COMPANY}}`, req.hostname) // html body
|
|
48
|
+
.replace(`{{COMPANY}}`, req.body.hostname) // html body
|
|
49
49
|
.replace('{{RECOVER_WEB_URL}}', recoverUrl)
|
|
50
50
|
.replace('{{RECOVER_BTN_LABEL}}', translate.BTN_LABEL[req.lang]),
|
|
51
51
|
|
|
@@ -94,7 +94,7 @@ const UserService = {
|
|
|
94
94
|
.replace('{{H1}}', translate.H1[req.lang])
|
|
95
95
|
.replace('{{P1}}', translate.P1[req.lang])
|
|
96
96
|
.replace('{{TOKEN}}', token)
|
|
97
|
-
.replace(`{{COMPANY}}`, req.hostname), // html body
|
|
97
|
+
.replace(`{{COMPANY}}`, req.body.hostname), // html body
|
|
98
98
|
attachments: [
|
|
99
99
|
// {
|
|
100
100
|
// filename: 'logo.png',
|
package/src/cli/cron.js
CHANGED
|
@@ -50,7 +50,7 @@ class UnderpostCron {
|
|
|
50
50
|
callback: async function (
|
|
51
51
|
deployList = 'default',
|
|
52
52
|
jobList = Object.keys(UnderpostCron.JOB),
|
|
53
|
-
options = { itc: false, init: false, git: false
|
|
53
|
+
options = { itc: false, init: false, git: false },
|
|
54
54
|
) {
|
|
55
55
|
if (options.init === true) {
|
|
56
56
|
UnderpostCron.NETWORK = [];
|
|
@@ -61,7 +61,7 @@ class UnderpostCron {
|
|
|
61
61
|
for (const job of Object.keys(confCronConfig.jobs)) {
|
|
62
62
|
const name = `${jobDeployId}-${job}`;
|
|
63
63
|
let deployId;
|
|
64
|
-
|
|
64
|
+
shellExec(Cmd.delete(name));
|
|
65
65
|
switch (job) {
|
|
66
66
|
case 'dns':
|
|
67
67
|
deployId = jobDeployId;
|
|
@@ -71,8 +71,7 @@ class UnderpostCron {
|
|
|
71
71
|
deployId = deployList;
|
|
72
72
|
break;
|
|
73
73
|
}
|
|
74
|
-
|
|
75
|
-
shellExec(Cmd.cron(deployId, job, name, confCronConfig.jobs[job].expression, options));
|
|
74
|
+
shellExec(Cmd.cron(deployId, job, name, confCronConfig.jobs[job].expression, options));
|
|
76
75
|
UnderpostCron.NETWORK.push({
|
|
77
76
|
deployId,
|
|
78
77
|
jobId: job,
|
|
@@ -80,7 +79,6 @@ class UnderpostCron {
|
|
|
80
79
|
});
|
|
81
80
|
}
|
|
82
81
|
}
|
|
83
|
-
if (options.dashboardUpdate === true) await UnderpostCron.API.updateDashboardData();
|
|
84
82
|
if (fs.existsSync(`./tmp/await-deploy`)) fs.remove(`./tmp/await-deploy`);
|
|
85
83
|
return;
|
|
86
84
|
}
|
|
@@ -89,32 +87,6 @@ class UnderpostCron {
|
|
|
89
87
|
if (UnderpostCron.JOB[jobId]) await UnderpostCron.JOB[jobId].callback(deployList, options);
|
|
90
88
|
}
|
|
91
89
|
},
|
|
92
|
-
async updateDashboardData() {
|
|
93
|
-
try {
|
|
94
|
-
const deployId = process.env.DEFAULT_DEPLOY_ID;
|
|
95
|
-
const host = process.env.DEFAULT_DEPLOY_HOST;
|
|
96
|
-
const path = process.env.DEFAULT_DEPLOY_PATH;
|
|
97
|
-
const confServerPath = `./engine-private/conf/${deployId}/conf.server.json`;
|
|
98
|
-
const confServer = JSON.parse(fs.readFileSync(confServerPath, 'utf8'));
|
|
99
|
-
const { db } = confServer[host][path];
|
|
100
|
-
|
|
101
|
-
await DataBaseProvider.load({ apis: ['cron'], host, path, db });
|
|
102
|
-
|
|
103
|
-
/** @type {import('../api/cron/cron.model.js').CronModel} */
|
|
104
|
-
const Cron = DataBaseProvider.instance[`${host}${path}`].mongoose.models.Cron;
|
|
105
|
-
|
|
106
|
-
await Cron.deleteMany();
|
|
107
|
-
|
|
108
|
-
for (const cronInstance of UnderpostCron.NETWORK) {
|
|
109
|
-
logger.info('save', cronInstance);
|
|
110
|
-
await new Cron(cronInstance).save();
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
await DataBaseProvider.instance[`${host}${path}`].mongoose.close();
|
|
114
|
-
} catch (error) {
|
|
115
|
-
logger.error(error, error.stack);
|
|
116
|
-
}
|
|
117
|
-
},
|
|
118
90
|
};
|
|
119
91
|
}
|
|
120
92
|
|
package/src/cli/db.js
CHANGED
|
@@ -3,6 +3,7 @@ import { loggerFactory } from '../server/logger.js';
|
|
|
3
3
|
import { shellExec } from '../server/process.js';
|
|
4
4
|
import fs from 'fs-extra';
|
|
5
5
|
import UnderpostDeploy from './deploy.js';
|
|
6
|
+
import UnderpostCron from './cron.js';
|
|
6
7
|
|
|
7
8
|
const logger = loggerFactory(import.meta);
|
|
8
9
|
|
|
@@ -216,6 +217,129 @@ class UnderpostDB {
|
|
|
216
217
|
}
|
|
217
218
|
}
|
|
218
219
|
},
|
|
220
|
+
async updateDashboardData(
|
|
221
|
+
deployId = process.env.DEFAULT_DEPLOY_ID,
|
|
222
|
+
host = process.env.DEFAULT_DEPLOY_HOST,
|
|
223
|
+
path = process.env.DEFAULT_DEPLOY_PATH,
|
|
224
|
+
) {
|
|
225
|
+
try {
|
|
226
|
+
deployId = deployId ?? process.env.DEFAULT_DEPLOY_ID;
|
|
227
|
+
host = host ?? process.env.DEFAULT_DEPLOY_HOST;
|
|
228
|
+
path = path ?? process.env.DEFAULT_DEPLOY_PATH;
|
|
229
|
+
|
|
230
|
+
const { db } = JSON.parse(fs.readFileSync(`./engine-private/conf/${deployId}/conf.server.json`, 'utf8'))[host][
|
|
231
|
+
path
|
|
232
|
+
];
|
|
233
|
+
|
|
234
|
+
await DataBaseProvider.load({ apis: ['instance'], host, path, db });
|
|
235
|
+
|
|
236
|
+
/** @type {import('../api/instance/instance.model.js').InstanceModel} */
|
|
237
|
+
const Instance = DataBaseProvider.instance[`${host}${path}`].mongoose.models.Instance;
|
|
238
|
+
|
|
239
|
+
await Instance.deleteMany();
|
|
240
|
+
|
|
241
|
+
for (const _deployId of deployList.split(',')) {
|
|
242
|
+
const deployId = _deployId.trim();
|
|
243
|
+
if (!deployId) continue;
|
|
244
|
+
const confServer = loadReplicas(
|
|
245
|
+
JSON.parse(fs.readFileSync(`./engine-private/conf/${deployId}/conf.server.json`, 'utf8')),
|
|
246
|
+
'proxy',
|
|
247
|
+
);
|
|
248
|
+
const router = await UnderpostDeploy.API.routerFactory(deployId, env);
|
|
249
|
+
const pathPortAssignmentData = pathPortAssignmentFactory(router, confServer);
|
|
250
|
+
|
|
251
|
+
for (const host of Object.keys(confServer)) {
|
|
252
|
+
for (const { path, port } of pathPortAssignmentData[host]) {
|
|
253
|
+
if (!confServer[host][path]) continue;
|
|
254
|
+
|
|
255
|
+
const { client, runtime, apis } = confServer[host][path];
|
|
256
|
+
|
|
257
|
+
const body = {
|
|
258
|
+
deployId,
|
|
259
|
+
host,
|
|
260
|
+
path,
|
|
261
|
+
port,
|
|
262
|
+
client,
|
|
263
|
+
runtime,
|
|
264
|
+
apis,
|
|
265
|
+
};
|
|
266
|
+
|
|
267
|
+
logger.info('save', body);
|
|
268
|
+
|
|
269
|
+
await new Instance(body).save();
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
await DataBaseProvider.instance[`${host}${path}`].mongoose.close();
|
|
275
|
+
} catch (error) {
|
|
276
|
+
logger.error(error, error.stack);
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
try {
|
|
280
|
+
const confServerPath = `./engine-private/conf/${deployId}/conf.server.json`;
|
|
281
|
+
const confServer = JSON.parse(fs.readFileSync(confServerPath, 'utf8'));
|
|
282
|
+
const { db } = confServer[host][path];
|
|
283
|
+
|
|
284
|
+
await DataBaseProvider.load({ apis: ['cron'], host, path, db });
|
|
285
|
+
|
|
286
|
+
/** @type {import('../api/cron/cron.model.js').CronModel} */
|
|
287
|
+
const Cron = DataBaseProvider.instance[`${host}${path}`].mongoose.models.Cron;
|
|
288
|
+
|
|
289
|
+
await Cron.deleteMany();
|
|
290
|
+
|
|
291
|
+
for (const cronInstance of UnderpostCron.NETWORK) {
|
|
292
|
+
logger.info('save', cronInstance);
|
|
293
|
+
await new Cron(cronInstance).save();
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
await DataBaseProvider.instance[`${host}${path}`].mongoose.close();
|
|
297
|
+
} catch (error) {
|
|
298
|
+
logger.error(error, error.stack);
|
|
299
|
+
}
|
|
300
|
+
},
|
|
301
|
+
clusterMetadataBackupCallback(
|
|
302
|
+
deployId = process.env.DEFAULT_DEPLOY_ID,
|
|
303
|
+
host = process.env.DEFAULT_DEPLOY_HOST,
|
|
304
|
+
path = process.env.DEFAULT_DEPLOY_PATH,
|
|
305
|
+
options = {
|
|
306
|
+
import: false,
|
|
307
|
+
export: false,
|
|
308
|
+
instances: false,
|
|
309
|
+
crons: false,
|
|
310
|
+
},
|
|
311
|
+
) {
|
|
312
|
+
deployId = deployId ?? process.env.DEFAULT_DEPLOY_ID;
|
|
313
|
+
host = host ?? process.env.DEFAULT_DEPLOY_HOST;
|
|
314
|
+
path = path ?? process.env.DEFAULT_DEPLOY_PATH;
|
|
315
|
+
|
|
316
|
+
if (options.instances === true) {
|
|
317
|
+
const outputPath = './engine-private/instances';
|
|
318
|
+
if (fs.existsSync(outputPath)) fs.mkdirSync(outputPath, { recursive: true });
|
|
319
|
+
const collection = 'instances';
|
|
320
|
+
if (options.export === true)
|
|
321
|
+
shellExec(
|
|
322
|
+
`node bin db --export --collections ${collection} --out-path ${outputPath} --hosts ${host} --paths '${path}' ${deployId}`,
|
|
323
|
+
);
|
|
324
|
+
if (options.import === true)
|
|
325
|
+
shellExec(
|
|
326
|
+
`node bin db --import --drop --preserveUUID --out-path ${outputPath} --hosts ${host} --paths '${path}' ${deployId}`,
|
|
327
|
+
);
|
|
328
|
+
}
|
|
329
|
+
if (options.crons === true) {
|
|
330
|
+
const outputPath = './engine-private/crons';
|
|
331
|
+
if (fs.existsSync(outputPath)) fs.mkdirSync(outputPath, { recursive: true });
|
|
332
|
+
const collection = 'crons';
|
|
333
|
+
if (options.export === true)
|
|
334
|
+
shellExec(
|
|
335
|
+
`node bin db --export --collections ${collection} --out-path ${outputPath} --hosts ${host} --paths '${path}' ${deployId}`,
|
|
336
|
+
);
|
|
337
|
+
if (options.import === true)
|
|
338
|
+
shellExec(
|
|
339
|
+
`node bin db --import --drop --preserveUUID --out-path ${outputPath} --hosts ${host} --paths '${path}' ${deployId}`,
|
|
340
|
+
);
|
|
341
|
+
}
|
|
342
|
+
},
|
|
219
343
|
};
|
|
220
344
|
}
|
|
221
345
|
|
package/src/cli/deploy.js
CHANGED
|
@@ -242,12 +242,10 @@ spec:
|
|
|
242
242
|
cert: false,
|
|
243
243
|
versions: '',
|
|
244
244
|
traffic: '',
|
|
245
|
-
dashboardUpdate: false,
|
|
246
245
|
replicas: '',
|
|
247
246
|
restoreHosts: false,
|
|
248
247
|
disableUpdateDeployment: false,
|
|
249
248
|
infoTraffic: false,
|
|
250
|
-
rebuildClientsBundle: false,
|
|
251
249
|
},
|
|
252
250
|
) {
|
|
253
251
|
if (options.infoUtil === true)
|
|
@@ -311,18 +309,20 @@ Password: <Your Key>
|
|
|
311
309
|
deployId,
|
|
312
310
|
env,
|
|
313
311
|
traffic: UnderpostDeploy.API.getCurrentTraffic(deployId),
|
|
312
|
+
router: await UnderpostDeploy.API.routerFactory(deployId, env),
|
|
313
|
+
pods: await UnderpostDeploy.API.get(deployId),
|
|
314
314
|
});
|
|
315
315
|
}
|
|
316
316
|
return;
|
|
317
317
|
}
|
|
318
|
-
if (options.rebuildClientsBundle === true) await UnderpostDeploy.API.rebuildClientsBundle(deployList);
|
|
319
318
|
if (!(options.versions && typeof options.versions === 'string')) options.versions = 'blue,green';
|
|
320
319
|
if (!options.replicas) options.replicas = 1;
|
|
321
320
|
if (options.sync) UnderpostDeploy.API.sync(deployList, options);
|
|
322
321
|
if (options.buildManifest === true) await UnderpostDeploy.API.buildManifest(deployList, env, options);
|
|
323
|
-
if (options.infoRouter === true)
|
|
324
|
-
|
|
325
|
-
|
|
322
|
+
if (options.infoRouter === true) {
|
|
323
|
+
logger.info('router', await UnderpostDeploy.API.routerFactory(deployList, env));
|
|
324
|
+
return;
|
|
325
|
+
}
|
|
326
326
|
shellExec(`kubectl delete configmap underpost-config`);
|
|
327
327
|
shellExec(
|
|
328
328
|
`kubectl create configmap underpost-config --from-file=/home/dd/engine/engine-private/conf/dd-cron/.env.${env}`,
|
|
@@ -435,23 +435,6 @@ Password: <Your Key>
|
|
|
435
435
|
|
|
436
436
|
return result;
|
|
437
437
|
},
|
|
438
|
-
rebuildClientsBundle(deployList) {
|
|
439
|
-
for (const _deployId of deployList.split(',')) {
|
|
440
|
-
const deployId = _deployId.trim();
|
|
441
|
-
const repoName = `engine-${deployId.split('-')[1]}`;
|
|
442
|
-
|
|
443
|
-
shellExec(`underpost script set ${deployId}-client-build '
|
|
444
|
-
cd /home/dd/engine &&
|
|
445
|
-
git checkout . &&
|
|
446
|
-
underpost pull . underpostnet/${repoName} &&
|
|
447
|
-
underpost pull ./engine-private underpostnet/${repoName}-private &&
|
|
448
|
-
underpost env ${deployId} production &&
|
|
449
|
-
node bin/deploy build-full-client ${deployId}
|
|
450
|
-
'`);
|
|
451
|
-
|
|
452
|
-
shellExec(`node bin script run ${deployId}-client-build --itc --pod-name ${deployId}`);
|
|
453
|
-
}
|
|
454
|
-
},
|
|
455
438
|
resourcesFactory() {
|
|
456
439
|
return {
|
|
457
440
|
requests: {
|
|
@@ -465,60 +448,6 @@ node bin/deploy build-full-client ${deployId}
|
|
|
465
448
|
totalPods: UnderpostRootEnv.API.get('total-pods'),
|
|
466
449
|
};
|
|
467
450
|
},
|
|
468
|
-
async updateDashboardData(deployList, env, options) {
|
|
469
|
-
try {
|
|
470
|
-
const deployId = process.env.DEFAULT_DEPLOY_ID;
|
|
471
|
-
const host = process.env.DEFAULT_DEPLOY_HOST;
|
|
472
|
-
const path = process.env.DEFAULT_DEPLOY_PATH;
|
|
473
|
-
const { db } = JSON.parse(fs.readFileSync(`./engine-private/conf/${deployId}/conf.server.json`, 'utf8'))[host][
|
|
474
|
-
path
|
|
475
|
-
];
|
|
476
|
-
|
|
477
|
-
await DataBaseProvider.load({ apis: ['instance'], host, path, db });
|
|
478
|
-
|
|
479
|
-
/** @type {import('../api/instance/instance.model.js').InstanceModel} */
|
|
480
|
-
const Instance = DataBaseProvider.instance[`${host}${path}`].mongoose.models.Instance;
|
|
481
|
-
|
|
482
|
-
await Instance.deleteMany();
|
|
483
|
-
|
|
484
|
-
for (const _deployId of deployList.split(',')) {
|
|
485
|
-
const deployId = _deployId.trim();
|
|
486
|
-
if (!deployId) continue;
|
|
487
|
-
const confServer = loadReplicas(
|
|
488
|
-
JSON.parse(fs.readFileSync(`./engine-private/conf/${deployId}/conf.server.json`, 'utf8')),
|
|
489
|
-
'proxy',
|
|
490
|
-
);
|
|
491
|
-
const router = await UnderpostDeploy.API.routerFactory(deployId, env);
|
|
492
|
-
const pathPortAssignmentData = pathPortAssignmentFactory(router, confServer);
|
|
493
|
-
|
|
494
|
-
for (const host of Object.keys(confServer)) {
|
|
495
|
-
for (const { path, port } of pathPortAssignmentData[host]) {
|
|
496
|
-
if (!confServer[host][path]) continue;
|
|
497
|
-
|
|
498
|
-
const { client, runtime, apis } = confServer[host][path];
|
|
499
|
-
|
|
500
|
-
const body = {
|
|
501
|
-
deployId,
|
|
502
|
-
host,
|
|
503
|
-
path,
|
|
504
|
-
port,
|
|
505
|
-
client,
|
|
506
|
-
runtime,
|
|
507
|
-
apis,
|
|
508
|
-
};
|
|
509
|
-
|
|
510
|
-
logger.info('save', body);
|
|
511
|
-
|
|
512
|
-
await new Instance(body).save();
|
|
513
|
-
}
|
|
514
|
-
}
|
|
515
|
-
}
|
|
516
|
-
|
|
517
|
-
await DataBaseProvider.instance[`${host}${path}`].mongoose.close();
|
|
518
|
-
} catch (error) {
|
|
519
|
-
logger.error(error, error.stack);
|
|
520
|
-
}
|
|
521
|
-
},
|
|
522
451
|
existsContainerFile({ podName, path }) {
|
|
523
452
|
return JSON.parse(
|
|
524
453
|
shellExec(`kubectl exec ${podName} -- test -f ${path} && echo "true" || echo "false"`, {
|
package/src/cli/index.js
CHANGED
|
@@ -155,7 +155,6 @@ program
|
|
|
155
155
|
'--build-manifest',
|
|
156
156
|
'Builds Kubernetes YAML manifests, including deployments, services, proxies, and secrets.',
|
|
157
157
|
)
|
|
158
|
-
.option('--dashboard-update', 'Updates dashboard instance data with the current router configuration.')
|
|
159
158
|
.option('--replicas <replicas>', 'Sets a custom number of replicas for deployments.')
|
|
160
159
|
.option('--versions <deployment-versions>', 'A comma-separated list of custom deployment versions.')
|
|
161
160
|
.option('--traffic <traffic-versions>', 'A comma-separated list of custom deployment traffic weights.')
|
|
@@ -163,10 +162,6 @@ program
|
|
|
163
162
|
.option('--info-traffic', 'Retrieves traffic configuration from current resource deployments.')
|
|
164
163
|
.option('--kubeadm', 'Enables the kubeadm context for deployment operations.')
|
|
165
164
|
.option('--restore-hosts', 'Restores default `/etc/hosts` entries.')
|
|
166
|
-
.option(
|
|
167
|
-
'--rebuild-clients-bundle',
|
|
168
|
-
'Inside the container, rebuilds client bundles (only static public or storage client files).',
|
|
169
|
-
)
|
|
170
165
|
.description('Manages application deployments, defaulting to deploying development pods.')
|
|
171
166
|
.action(Underpost.deploy.callback);
|
|
172
167
|
|
|
@@ -240,6 +235,18 @@ program
|
|
|
240
235
|
.description('Manages database operations, including import, export, and collection management.')
|
|
241
236
|
.action(Underpost.db.callback);
|
|
242
237
|
|
|
238
|
+
program
|
|
239
|
+
.command('metadata')
|
|
240
|
+
.argument('[deploy-id]', 'The deployment ID to manage metadata.')
|
|
241
|
+
.argument('[host]', 'The host to manage metadata.')
|
|
242
|
+
.argument('[path]', 'The path to manage metadata.')
|
|
243
|
+
.option('--import', 'Imports from local storage.')
|
|
244
|
+
.option('--export', 'Exports to local storage.')
|
|
245
|
+
.option('--crons', 'Apply to cron data collection')
|
|
246
|
+
.option('--instances', 'Apply to instance data collection')
|
|
247
|
+
.description('Manages cluster metadata operations, including import and export.')
|
|
248
|
+
.action(Underpost.db.clusterMetadataBackupCallback);
|
|
249
|
+
|
|
243
250
|
// 'script' command: Execute scripts
|
|
244
251
|
program
|
|
245
252
|
.command('script')
|
|
@@ -268,7 +275,6 @@ program
|
|
|
268
275
|
.option('--itc', 'Executes cron jobs within the container execution context.')
|
|
269
276
|
.option('--init', 'Initializes cron jobs for the default deployment ID.')
|
|
270
277
|
.option('--git', 'Uploads cron job configurations to GitHub.')
|
|
271
|
-
.option('--dashboard-update', 'Updates dashboard cron data with the current job configurations.')
|
|
272
278
|
.description('Manages cron jobs, including initialization, execution, and configuration updates.')
|
|
273
279
|
.action(Underpost.cron.callback);
|
|
274
280
|
|
package/src/cli/run.js
CHANGED
|
@@ -76,6 +76,11 @@ class UnderpostRun {
|
|
|
76
76
|
shellExec(`${baseCommand} deploy --expose mongo`, { async: true });
|
|
77
77
|
shellExec(`${baseCommand} deploy --expose valkey`, { async: true });
|
|
78
78
|
},
|
|
79
|
+
'ssh-cluster-info': (path, options = UnderpostRun.DEFAULT_OPTION) => {
|
|
80
|
+
const { underpostRoot } = options;
|
|
81
|
+
shellExec(`chmod +x ${underpostRoot}/manifests/maas/ssh-cluster-info.sh`);
|
|
82
|
+
shellExec(`${underpostRoot}/manifests/maas/ssh-cluster-info.sh`);
|
|
83
|
+
},
|
|
79
84
|
'cyberia-ide': (path, options = UnderpostRun.DEFAULT_OPTION) => {
|
|
80
85
|
const baseCommand = options.dev ? 'node bin' : 'underpost';
|
|
81
86
|
shellExec(`${baseCommand} run ide /home/dd/cyberia-server`);
|
|
@@ -10,7 +10,7 @@ import { Modal } from './Modal.js';
|
|
|
10
10
|
import { NotificationManager } from './NotificationManager.js';
|
|
11
11
|
import { Translate } from './Translate.js';
|
|
12
12
|
import { Validator } from './Validator.js';
|
|
13
|
-
import { append, htmls, s } from './VanillaJs.js';
|
|
13
|
+
import { append, getProxyPath, htmls, s } from './VanillaJs.js';
|
|
14
14
|
|
|
15
15
|
const Account = {
|
|
16
16
|
UpdateEvent: {},
|
|
@@ -103,7 +103,11 @@ const Account = {
|
|
|
103
103
|
e.preventDefault();
|
|
104
104
|
const result = await UserService.post({
|
|
105
105
|
id: 'mailer/verify-email',
|
|
106
|
-
body: {
|
|
106
|
+
body: {
|
|
107
|
+
email: s(`.account-email`).value,
|
|
108
|
+
hostname: `${location.hostname}`,
|
|
109
|
+
proxyPath: getProxyPath(),
|
|
110
|
+
},
|
|
107
111
|
});
|
|
108
112
|
NotificationManager.Push({
|
|
109
113
|
html: result.status === 'error' ? result.message : Translate.Render(`email send`),
|
|
@@ -80,8 +80,10 @@ const Recover = {
|
|
|
80
80
|
}
|
|
81
81
|
switch (mode) {
|
|
82
82
|
case 'recover-verify-email': {
|
|
83
|
-
|
|
84
|
-
|
|
83
|
+
const result = await UserService.post({
|
|
84
|
+
id: 'recover-verify-email',
|
|
85
|
+
body: { ...body, proxyPath: getProxyPath(), hostname: `${location.hostname}` },
|
|
86
|
+
});
|
|
85
87
|
NotificationManager.Push({
|
|
86
88
|
html:
|
|
87
89
|
result.status === 'error' ? result.message : Translate.Render(`${result.status}-recover-verify-email`),
|
|
@@ -133,56 +133,54 @@ const copyData = (data) =>
|
|
|
133
133
|
const pasteData = () => new Promise((resolve) => navigator.clipboard.readText().then((clipText) => resolve(clipText)));
|
|
134
134
|
|
|
135
135
|
/**
|
|
136
|
-
*
|
|
137
|
-
*
|
|
138
|
-
*
|
|
139
|
-
*
|
|
140
|
-
*
|
|
141
|
-
*
|
|
142
|
-
*
|
|
143
|
-
|
|
144
|
-
function
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
// empty -> root
|
|
150
|
-
if (input === '') return '/';
|
|
151
|
-
|
|
152
|
-
// Use URL to parse relative or absolute paths relative to current origin
|
|
153
|
-
let url;
|
|
154
|
-
try {
|
|
155
|
-
url = new URL(input, window.location.origin);
|
|
156
|
-
} catch (e) {
|
|
157
|
-
// fallback (very rare)
|
|
158
|
-
input = input.replace(/\s+/g, ''); // remove problematic spaces
|
|
159
|
-
input = input.replace(/\/+/g, '/'); // collapse multiple '/'
|
|
160
|
-
if (!input.startsWith('/')) input = '/' + input;
|
|
161
|
-
if (input.length > 1 && input.endsWith('/')) input = input.slice(0, -1);
|
|
162
|
-
return input;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
// Normalize pathname: collapse slashes, ensure leading slash, remove trailing except root
|
|
166
|
-
let pathname = url.pathname.replace(/\/+/g, '/');
|
|
167
|
-
if (!pathname.startsWith('/')) pathname = '/' + pathname;
|
|
168
|
-
if (pathname.length > 1 && pathname.endsWith('/')) pathname = pathname.slice(0, -1);
|
|
169
|
-
|
|
170
|
-
// Rebuild: pathname + search + hash
|
|
171
|
-
return pathname + url.search + url.hash;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
/**
|
|
175
|
-
* Improved setPath: normalizes path and avoids pushState if nothing changes.
|
|
136
|
+
* The setPath function in JavaScript updates the browser's history with a new path, state, and title.
|
|
137
|
+
* @param path - The `path` parameter is a string that represents the URL path where you want to
|
|
138
|
+
* navigate or update in the browser history. It is the first parameter in the `setPath` function and
|
|
139
|
+
* has a default value of `'/'`.
|
|
140
|
+
* @param stateStorage - The `stateStorage` parameter in the `setPath` function is an object that
|
|
141
|
+
* represents the state object associated with the new history entry. It is used to store data related
|
|
142
|
+
* to the state of the application when navigating to a new path using `history.pushState()`. This data
|
|
143
|
+
* can be accessed later
|
|
144
|
+
* @param title - The `title` parameter in the `setPath` function is a string that represents the
|
|
145
|
+
* title of the new history entry. It is used as the title of the new history entry in the browser's
|
|
146
|
+
* history.
|
|
147
|
+
* @memberof VanillaJS
|
|
176
148
|
*/
|
|
177
149
|
const setPath = (path = '/', stateStorage = {}, title = '') => {
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
150
|
+
if (!path) path = '/';
|
|
151
|
+
|
|
152
|
+
const [inputPath, inputSearch] = `${path}`.split('?');
|
|
153
|
+
|
|
154
|
+
let sanitizedPath = (inputPath[0] !== '/' ? `/${inputPath}` : inputPath)
|
|
155
|
+
.trim()
|
|
156
|
+
.replaceAll('//', '/')
|
|
157
|
+
.replaceAll(`\\`, '/');
|
|
158
|
+
|
|
159
|
+
if (sanitizedPath.length > 1 && sanitizedPath[sanitizedPath.length - 1] === '/')
|
|
160
|
+
sanitizedPath = sanitizedPath.slice(0, -1);
|
|
161
|
+
|
|
162
|
+
if (window.location.pathname === sanitizedPath && (!inputSearch || inputSearch === location.search)) {
|
|
163
|
+
console.warn('Prevent overwriting same path', {
|
|
164
|
+
inputPath: inputPath,
|
|
165
|
+
inputSearch: inputSearch,
|
|
166
|
+
sanitizedPath: sanitizedPath,
|
|
167
|
+
currentLocationSearch: location.search,
|
|
168
|
+
currentLocationHash: location.hash,
|
|
169
|
+
});
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
console.warn('Set path', {
|
|
173
|
+
inputPath: inputPath,
|
|
174
|
+
inputSearch: inputSearch,
|
|
175
|
+
sanitizedPath: sanitizedPath,
|
|
176
|
+
currentLocationSearch: location.search,
|
|
177
|
+
currentLocationHash: location.hash,
|
|
178
|
+
});
|
|
179
|
+
return history.pushState(
|
|
180
|
+
stateStorage,
|
|
181
|
+
title,
|
|
182
|
+
`${sanitizedPath}${inputSearch ? `?${inputSearch}` : ''}${location.hash ?? ''}`,
|
|
183
|
+
);
|
|
186
184
|
};
|
|
187
185
|
|
|
188
186
|
/**
|