underpost 2.8.858 → 2.8.861
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 +44 -36
- package/bin/cyberia0.js +78 -0
- package/bin/deploy.js +17 -5
- package/bin/file.js +2 -2
- package/cli.md +88 -87
- package/conf.js +1 -1
- package/manifests/deployment/dd-default-development/deployment.yaml +2 -2
- package/package.json +2 -2
- package/src/api/user/user.router.js +7 -5
- package/src/cli/deploy.js +7 -0
- package/src/cli/index.js +1 -0
- package/src/cli/repository.js +12 -5
- package/src/cli/run.js +29 -7
- package/src/client/components/core/VanillaJs.js +14 -0
- package/src/index.js +1 -1
- package/src/server/client-build-docs.js +1 -1
- package/src/server/client-build.js +7 -1
- package/src/server/conf.js +2 -2
- package/src/server/start.js +3 -3
package/README.md
CHANGED
|
@@ -23,10 +23,14 @@
|
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
26
30
|
<!-- badges -->
|
|
27
31
|
|
|
28
32
|
|
|
29
|
-
[](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.861) [](https://coveralls.io/github/underpostnet/engine?branch=master) [](https://www.npmjs.org/package/underpost) [](https://www.npmjs.com/package/underpost)
|
|
30
34
|
|
|
31
35
|
|
|
32
36
|
<!-- end-badges -->
|
|
@@ -38,6 +42,10 @@
|
|
|
38
42
|
|
|
39
43
|
|
|
40
44
|
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
41
49
|
</div>
|
|
42
50
|
|
|
43
51
|
<div align="center">
|
|
@@ -82,44 +90,44 @@ Run dev client server
|
|
|
82
90
|
npm run dev
|
|
83
91
|
```
|
|
84
92
|
<!-- -->
|
|
85
|
-
## underpost ci/cd cli v2.8.
|
|
93
|
+
## underpost ci/cd cli v2.8.861
|
|
86
94
|
|
|
87
95
|
### Usage: `underpost [options] [command]`
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
96
|
+
|
|
97
|
+
```
|
|
98
|
+
Options:
|
|
99
|
+
-V, --version output the version number
|
|
100
|
+
-h, --help display help for command
|
|
92
101
|
|
|
93
102
|
Commands:
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
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
|
+
|
|
122
131
|
```
|
|
123
|
-
|
|
132
|
+
|
|
124
133
|
<a target="_top" href="https://github.com/underpostnet/pwa-microservices-template/blob/master/cli.md">See complete CLI Docs here.</a>
|
|
125
|
-
|
package/bin/cyberia0.js
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
#! /usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import dotenv from 'dotenv';
|
|
4
|
+
import { Command } from 'commander';
|
|
5
|
+
import fs from 'fs-extra';
|
|
6
|
+
import { pbcopy, shellExec } from '../src/server/process.js';
|
|
7
|
+
import Jimp from 'jimp';
|
|
8
|
+
import Underpost from '../src/index.js';
|
|
9
|
+
import { loggerFactory } from '../src/server/logger.js';
|
|
10
|
+
import { DataBaseProvider } from '../src/db/DataBaseProvider.js';
|
|
11
|
+
|
|
12
|
+
dotenv.config();
|
|
13
|
+
|
|
14
|
+
const logger = loggerFactory(import.meta);
|
|
15
|
+
|
|
16
|
+
const deployId = process.env.DEFAULT_DEPLOY_ID;
|
|
17
|
+
const host = process.env.DEFAULT_DEPLOY_HOST;
|
|
18
|
+
const path = process.env.DEFAULT_DEPLOY_PATH;
|
|
19
|
+
|
|
20
|
+
const confServerPath = `./engine-private/conf/${deployId}/conf.server.json`;
|
|
21
|
+
const confServer = JSON.parse(fs.readFileSync(confServerPath, 'utf8'));
|
|
22
|
+
const { db } = confServer[host][path];
|
|
23
|
+
|
|
24
|
+
logger.info('env', {
|
|
25
|
+
deployId,
|
|
26
|
+
host,
|
|
27
|
+
path,
|
|
28
|
+
db,
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
await DataBaseProvider.load({
|
|
32
|
+
apis: ['object-layer'],
|
|
33
|
+
host,
|
|
34
|
+
path,
|
|
35
|
+
db,
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
const ObjectLayer = DataBaseProvider.instance[`${host}${path}`].mongoose.models.ObjectLayer;
|
|
39
|
+
|
|
40
|
+
const program = new Command();
|
|
41
|
+
|
|
42
|
+
program.name('cyberia').description(`content generator cli ${Underpost.version}`).version(Underpost.version);
|
|
43
|
+
|
|
44
|
+
const pngDirectoryIteratorByObjectLayerType = async (
|
|
45
|
+
objectLayerType = 'skin',
|
|
46
|
+
callback = ({ path, objectLayerType, objectLayerId, direction, frame }) => {},
|
|
47
|
+
) => {
|
|
48
|
+
for (const objectLayerId of await fs.readdir(`./src/client/public/cyberia/assets/${objectLayerType}`)) {
|
|
49
|
+
for (const direction of await fs.readdir(
|
|
50
|
+
`./src/client/public/cyberia/assets/${objectLayerType}/${objectLayerId}`,
|
|
51
|
+
)) {
|
|
52
|
+
const dirFolder = `./src/client/public/cyberia/assets/${objectLayerType}/${objectLayerId}/${direction}`;
|
|
53
|
+
if (!fs.statSync(dirFolder).isDirectory()) continue;
|
|
54
|
+
for (const frame of await fs.readdir(dirFolder)) {
|
|
55
|
+
const imageFilePath = `./src/client/public/cyberia/assets/${objectLayerType}/${objectLayerId}/${direction}/${frame}`;
|
|
56
|
+
await callback({ path: imageFilePath, objectLayerType, objectLayerId, direction, frame });
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
program
|
|
63
|
+
.command('ol')
|
|
64
|
+
.option('--import [object-layer-type]', 'Import object layer from type storage png image')
|
|
65
|
+
.action(async (options = { import: false }) => {
|
|
66
|
+
if (options.import) {
|
|
67
|
+
await pngDirectoryIteratorByObjectLayerType(
|
|
68
|
+
options.import,
|
|
69
|
+
async ({ path, objectLayerType, objectLayerId, direction, frame }) => {
|
|
70
|
+
console.log(path, { objectLayerType, objectLayerId, direction, frame });
|
|
71
|
+
},
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
await DataBaseProvider.instance[`${host}${path}`].mongoose.close();
|
|
75
|
+
})
|
|
76
|
+
.description('Object layer management');
|
|
77
|
+
|
|
78
|
+
program.parse();
|
package/bin/deploy.js
CHANGED
|
@@ -42,13 +42,25 @@ try {
|
|
|
42
42
|
case 'save':
|
|
43
43
|
{
|
|
44
44
|
let deployId = process.argv[3] ?? 'dd-default';
|
|
45
|
-
if (!deployId.startsWith('dd-')) deployId = 'dd-'
|
|
45
|
+
if (!deployId.startsWith('dd-')) deployId = 'dd-default';
|
|
46
46
|
const folder = `./engine-private/conf/${deployId}`;
|
|
47
47
|
if (fs.existsSync(folder)) fs.removeSync(folder);
|
|
48
48
|
await Config.build({ folder });
|
|
49
|
-
fs.writeFileSync(
|
|
50
|
-
|
|
51
|
-
|
|
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
|
+
);
|
|
52
64
|
fs.writeFileSync(`${folder}/package.json`, fs.readFileSync('./package.json', 'utf8'), 'utf8');
|
|
53
65
|
}
|
|
54
66
|
break;
|
|
@@ -205,7 +217,7 @@ try {
|
|
|
205
217
|
case 'build-full-client':
|
|
206
218
|
{
|
|
207
219
|
dotenv.config({ override: true });
|
|
208
|
-
if (!process.argv[3]) process.argv[3] = 'default';
|
|
220
|
+
if (!process.argv[3]) process.argv[3] = 'dd-default';
|
|
209
221
|
const { deployId, folder } = loadConf(process.argv[3]);
|
|
210
222
|
|
|
211
223
|
let argHost = process.argv[4] ? process.argv[4].split(',') : [];
|
package/bin/file.js
CHANGED
|
@@ -125,8 +125,8 @@ try {
|
|
|
125
125
|
templatePackageJson.scripts = originPackageJson.scripts;
|
|
126
126
|
templatePackageJson.name = name;
|
|
127
127
|
templatePackageJson.description = description;
|
|
128
|
-
templatePackageJson.scripts.dev = dev;
|
|
129
|
-
templatePackageJson.scripts.build = build;
|
|
128
|
+
// templatePackageJson.scripts.dev = dev;
|
|
129
|
+
// templatePackageJson.scripts.build = build;
|
|
130
130
|
templatePackageJson.keywords = uniqueArray(
|
|
131
131
|
['pwa', 'microservices', 'template', 'builder'].concat(templatePackageJson.keywords),
|
|
132
132
|
);
|
package/cli.md
CHANGED
|
@@ -1,46 +1,47 @@
|
|
|
1
|
-
## underpost ci/cd cli v2.8.
|
|
1
|
+
## underpost ci/cd cli v2.8.861
|
|
2
2
|
|
|
3
3
|
### Usage: `underpost [options] [command]`
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
Options:
|
|
7
|
+
-V, --version output the version number
|
|
8
|
+
-h, --help display help for command
|
|
8
9
|
|
|
9
10
|
Commands:
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
11
|
+
new [options] <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
|
+
metadata [options] [deploy-id] [host] [path] Manages cluster metadata operations, including import and export.
|
|
28
|
+
script [options] <operator> <script-name> [script-value] Supports a variety of built-in Underpost global scripts, their preset lifecycle events, and arbitrary custom scripts.
|
|
29
|
+
cron [options] [deploy-list] [job-list] Manages cron jobs, including initialization, execution, and configuration updates.
|
|
30
|
+
fs [options] [path] Manages file storage, defaulting to file upload operations.
|
|
31
|
+
test [options] [deploy-list] Manages and runs tests, defaulting to the current Underpost default test suite.
|
|
32
|
+
monitor [options] <deploy-id> [env] Manages health server monitoring for specified deployments.
|
|
33
|
+
ssh [options] Import and start ssh server and client based on current default deployment ID.
|
|
34
|
+
run [options] <runner-id> [path] Runs a script from the specified path.
|
|
35
|
+
lxd [options] Manages LXD containers and virtual machines.
|
|
36
|
+
baremetal [options] [workflow-id] [hostname] [ip-address] Manages baremetal server operations, including installation, database setup, commissioning, and user management.
|
|
37
|
+
help [command] display help for command
|
|
38
|
+
|
|
38
39
|
```
|
|
39
40
|
|
|
40
41
|
## Commands:
|
|
41
|
-
|
|
42
42
|
|
|
43
43
|
### `new` :
|
|
44
|
+
|
|
44
45
|
```
|
|
45
46
|
Usage: underpost new [options] <app-name>
|
|
46
47
|
|
|
@@ -50,12 +51,13 @@ Arguments:
|
|
|
50
51
|
app-name The name of the application to create.
|
|
51
52
|
|
|
52
53
|
Options:
|
|
54
|
+
--dev Sets the development cli context
|
|
53
55
|
-h, --help display help for command
|
|
54
|
-
|
|
56
|
+
|
|
55
57
|
```
|
|
56
|
-
|
|
57
58
|
|
|
58
59
|
### `start` :
|
|
60
|
+
|
|
59
61
|
```
|
|
60
62
|
Usage: underpost start [options] <deploy-id> [env]
|
|
61
63
|
|
|
@@ -71,11 +73,11 @@ Options:
|
|
|
71
73
|
--run Starts application servers and monitors their health.
|
|
72
74
|
--build Triggers the client-side application build process.
|
|
73
75
|
-h, --help display help for command
|
|
74
|
-
|
|
76
|
+
|
|
75
77
|
```
|
|
76
|
-
|
|
77
78
|
|
|
78
79
|
### `clone` :
|
|
80
|
+
|
|
79
81
|
```
|
|
80
82
|
Usage: underpost clone [options] <uri>
|
|
81
83
|
|
|
@@ -88,11 +90,11 @@ Options:
|
|
|
88
90
|
--bare Performs a bare clone, downloading only the .git files.
|
|
89
91
|
-g8 Uses the g8 repository extension for cloning.
|
|
90
92
|
-h, --help display help for command
|
|
91
|
-
|
|
93
|
+
|
|
92
94
|
```
|
|
93
|
-
|
|
94
95
|
|
|
95
96
|
### `pull` :
|
|
97
|
+
|
|
96
98
|
```
|
|
97
99
|
Usage: underpost pull [options] <path> <uri>
|
|
98
100
|
|
|
@@ -106,11 +108,11 @@ Arguments:
|
|
|
106
108
|
Options:
|
|
107
109
|
-g8 Uses the g8 repository extension for pulling.
|
|
108
110
|
-h, --help display help for command
|
|
109
|
-
|
|
111
|
+
|
|
110
112
|
```
|
|
111
|
-
|
|
112
113
|
|
|
113
114
|
### `cmt` :
|
|
115
|
+
|
|
114
116
|
```
|
|
115
117
|
Usage: underpost cmt [options] <path> <commit-type> [module-tag] [message]
|
|
116
118
|
|
|
@@ -130,11 +132,11 @@ Options:
|
|
|
130
132
|
--copy Copies the generated commit message to the clipboard.
|
|
131
133
|
--info Displays information about available commit types.
|
|
132
134
|
-h, --help display help for command
|
|
133
|
-
|
|
135
|
+
|
|
134
136
|
```
|
|
135
|
-
|
|
136
137
|
|
|
137
138
|
### `push` :
|
|
139
|
+
|
|
138
140
|
```
|
|
139
141
|
Usage: underpost push [options] <path> <uri>
|
|
140
142
|
|
|
@@ -148,11 +150,11 @@ Options:
|
|
|
148
150
|
-f Forces the push, overwriting the remote repository history.
|
|
149
151
|
-g8 Uses the g8 repository extension for pushing.
|
|
150
152
|
-h, --help display help for command
|
|
151
|
-
|
|
153
|
+
|
|
152
154
|
```
|
|
153
|
-
|
|
154
155
|
|
|
155
156
|
### `env` :
|
|
157
|
+
|
|
156
158
|
```
|
|
157
159
|
Usage: underpost env [options] <deploy-id> [env]
|
|
158
160
|
|
|
@@ -167,11 +169,11 @@ Arguments:
|
|
|
167
169
|
|
|
168
170
|
Options:
|
|
169
171
|
-h, --help display help for command
|
|
170
|
-
|
|
172
|
+
|
|
171
173
|
```
|
|
172
|
-
|
|
173
174
|
|
|
174
175
|
### `config` :
|
|
176
|
+
|
|
175
177
|
```
|
|
176
178
|
Usage: underpost config [options] <operator> [key] [value]
|
|
177
179
|
|
|
@@ -186,11 +188,11 @@ Arguments:
|
|
|
186
188
|
Options:
|
|
187
189
|
--plain Prints the configuration value in plain text.
|
|
188
190
|
-h, --help display help for command
|
|
189
|
-
|
|
191
|
+
|
|
190
192
|
```
|
|
191
|
-
|
|
192
193
|
|
|
193
194
|
### `root` :
|
|
195
|
+
|
|
194
196
|
```
|
|
195
197
|
Usage: underpost root [options]
|
|
196
198
|
|
|
@@ -198,11 +200,11 @@ Displays the root path of the npm installation.
|
|
|
198
200
|
|
|
199
201
|
Options:
|
|
200
202
|
-h, --help display help for command
|
|
201
|
-
|
|
203
|
+
|
|
202
204
|
```
|
|
203
|
-
|
|
204
205
|
|
|
205
206
|
### `cluster` :
|
|
207
|
+
|
|
206
208
|
```
|
|
207
209
|
Usage: underpost cluster [options] [pod-name]
|
|
208
210
|
|
|
@@ -259,11 +261,11 @@ Options:
|
|
|
259
261
|
--k3s Initializes the cluster using K3s (Lightweight
|
|
260
262
|
Kubernetes).
|
|
261
263
|
-h, --help display help for command
|
|
262
|
-
|
|
264
|
+
|
|
263
265
|
```
|
|
264
|
-
|
|
265
266
|
|
|
266
267
|
### `deploy` :
|
|
268
|
+
|
|
267
269
|
```
|
|
268
270
|
Usage: underpost deploy [options] [deploy-list] [env]
|
|
269
271
|
|
|
@@ -305,11 +307,11 @@ Options:
|
|
|
305
307
|
operations.
|
|
306
308
|
--restore-hosts Restores default `/etc/hosts` entries.
|
|
307
309
|
-h, --help display help for command
|
|
308
|
-
|
|
310
|
+
|
|
309
311
|
```
|
|
310
|
-
|
|
311
312
|
|
|
312
313
|
### `secret` :
|
|
314
|
+
|
|
313
315
|
```
|
|
314
316
|
Usage: underpost secret [options] <platform>
|
|
315
317
|
|
|
@@ -327,11 +329,11 @@ Options:
|
|
|
327
329
|
--list Lists all available secrets for the
|
|
328
330
|
platform.
|
|
329
331
|
-h, --help display help for command
|
|
330
|
-
|
|
332
|
+
|
|
331
333
|
```
|
|
332
|
-
|
|
333
334
|
|
|
334
335
|
### `dockerfile-image-build` :
|
|
336
|
+
|
|
335
337
|
```
|
|
336
338
|
Usage: underpost dockerfile-image-build [options]
|
|
337
339
|
|
|
@@ -358,11 +360,11 @@ Options:
|
|
|
358
360
|
cache.
|
|
359
361
|
--k3s-load Loads the image into a K3s cluster.
|
|
360
362
|
-h, --help display help for command
|
|
361
|
-
|
|
363
|
+
|
|
362
364
|
```
|
|
363
|
-
|
|
364
365
|
|
|
365
366
|
### `dockerfile-pull-base-images` :
|
|
367
|
+
|
|
366
368
|
```
|
|
367
369
|
Usage: underpost dockerfile-pull-base-images [options]
|
|
368
370
|
|
|
@@ -376,11 +378,11 @@ Options:
|
|
|
376
378
|
--version Sets a custom version for the base images.
|
|
377
379
|
--k3s-load Loads the image into a K3s cluster.
|
|
378
380
|
-h, --help display help for command
|
|
379
|
-
|
|
381
|
+
|
|
380
382
|
```
|
|
381
|
-
|
|
382
383
|
|
|
383
384
|
### `install` :
|
|
385
|
+
|
|
384
386
|
```
|
|
385
387
|
Usage: underpost install [options]
|
|
386
388
|
|
|
@@ -388,11 +390,11 @@ Quickly imports Underpost npm dependencies by copying them.
|
|
|
388
390
|
|
|
389
391
|
Options:
|
|
390
392
|
-h, --help display help for command
|
|
391
|
-
|
|
393
|
+
|
|
392
394
|
```
|
|
393
|
-
|
|
394
395
|
|
|
395
396
|
### `db` :
|
|
397
|
+
|
|
396
398
|
```
|
|
397
399
|
Usage: underpost db [options] <deploy-list>
|
|
398
400
|
|
|
@@ -422,11 +424,11 @@ Options:
|
|
|
422
424
|
--ns <ns-name> Optional: Specifies the namespace context for
|
|
423
425
|
database operations.
|
|
424
426
|
-h, --help display help for command
|
|
425
|
-
|
|
427
|
+
|
|
426
428
|
```
|
|
427
|
-
|
|
428
429
|
|
|
429
430
|
### `metadata` :
|
|
431
|
+
|
|
430
432
|
```
|
|
431
433
|
Usage: underpost metadata [options] [deploy-id] [host] [path]
|
|
432
434
|
|
|
@@ -445,11 +447,11 @@ Options:
|
|
|
445
447
|
--generate Generate cluster metadata
|
|
446
448
|
--itc Apply under container execution context
|
|
447
449
|
-h, --help display help for command
|
|
448
|
-
|
|
450
|
+
|
|
449
451
|
```
|
|
450
|
-
|
|
451
452
|
|
|
452
453
|
### `script` :
|
|
454
|
+
|
|
453
455
|
```
|
|
454
456
|
Usage: underpost script [options] <operator> <script-name> [script-value]
|
|
455
457
|
|
|
@@ -471,11 +473,11 @@ Options:
|
|
|
471
473
|
execution.
|
|
472
474
|
--pod-name <pod-name> Optional: Specifies the pod name for script execution.
|
|
473
475
|
-h, --help display help for command
|
|
474
|
-
|
|
476
|
+
|
|
475
477
|
```
|
|
476
|
-
|
|
477
478
|
|
|
478
479
|
### `cron` :
|
|
480
|
+
|
|
479
481
|
```
|
|
480
482
|
Usage: underpost cron [options] [deploy-list] [job-list]
|
|
481
483
|
|
|
@@ -493,11 +495,11 @@ Options:
|
|
|
493
495
|
--init Initializes cron jobs for the default deployment ID.
|
|
494
496
|
--git Uploads cron job configurations to GitHub.
|
|
495
497
|
-h, --help display help for command
|
|
496
|
-
|
|
498
|
+
|
|
497
499
|
```
|
|
498
|
-
|
|
499
500
|
|
|
500
501
|
### `fs` :
|
|
502
|
+
|
|
501
503
|
```
|
|
502
504
|
Usage: underpost fs [options] [path]
|
|
503
505
|
|
|
@@ -515,11 +517,11 @@ Options:
|
|
|
515
517
|
--force Forces the action, overriding any warnings or conflicts.
|
|
516
518
|
--storage-file-path <storage-file-path> Specifies a custom file storage path.
|
|
517
519
|
-h, --help display help for command
|
|
518
|
-
|
|
520
|
+
|
|
519
521
|
```
|
|
520
|
-
|
|
521
522
|
|
|
522
523
|
### `test` :
|
|
524
|
+
|
|
523
525
|
```
|
|
524
526
|
Usage: underpost test [options] [deploy-list]
|
|
525
527
|
|
|
@@ -541,11 +543,11 @@ Options:
|
|
|
541
543
|
--kind-type <kind-type> Optional: Specifies the Kind cluster type for
|
|
542
544
|
tests.
|
|
543
545
|
-h, --help display help for command
|
|
544
|
-
|
|
546
|
+
|
|
545
547
|
```
|
|
546
|
-
|
|
547
548
|
|
|
548
549
|
### `monitor` :
|
|
550
|
+
|
|
549
551
|
```
|
|
550
552
|
Usage: underpost monitor [options] <deploy-id> [env]
|
|
551
553
|
|
|
@@ -568,11 +570,11 @@ Options:
|
|
|
568
570
|
--sync Synchronizes with current proxy deployments and
|
|
569
571
|
traffic configurations.
|
|
570
572
|
-h, --help display help for command
|
|
571
|
-
|
|
573
|
+
|
|
572
574
|
```
|
|
573
|
-
|
|
574
575
|
|
|
575
576
|
### `ssh` :
|
|
577
|
+
|
|
576
578
|
```
|
|
577
579
|
Usage: underpost ssh [options]
|
|
578
580
|
|
|
@@ -582,18 +584,18 @@ Options:
|
|
|
582
584
|
--generate Generates new ssh credential and stores it in current private
|
|
583
585
|
keys file storage.
|
|
584
586
|
-h, --help display help for command
|
|
585
|
-
|
|
587
|
+
|
|
586
588
|
```
|
|
587
|
-
|
|
588
589
|
|
|
589
590
|
### `run` :
|
|
591
|
+
|
|
590
592
|
```
|
|
591
593
|
Usage: underpost run [options] <runner-id> [path]
|
|
592
594
|
|
|
593
595
|
Runs a script from the specified path.
|
|
594
596
|
|
|
595
597
|
Arguments:
|
|
596
|
-
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, template-deploy, clean, pull, release-deploy, ssh-deploy, ide, dev-client, dev-api, monitor, db-client, cluster, deploy, tf-vae-test, deploy-job.
|
|
598
|
+
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, template-deploy, clean, pull, release-deploy, ssh-deploy, ide, dev-client, dev-api, monitor, db-client, promote, metrics, cluster, deploy, tf-vae-test, deploy-job.
|
|
597
599
|
path The absolute or relative directory path where the script is located.
|
|
598
600
|
|
|
599
601
|
Options:
|
|
@@ -608,11 +610,11 @@ Options:
|
|
|
608
610
|
--container-name <container-name> Optional: Specifies the container name for test execution.
|
|
609
611
|
--namespace <namespace> Optional: Specifies the namespace for test execution.
|
|
610
612
|
-h, --help display help for command
|
|
611
|
-
|
|
613
|
+
|
|
612
614
|
```
|
|
613
|
-
|
|
614
615
|
|
|
615
616
|
### `lxd` :
|
|
617
|
+
|
|
616
618
|
```
|
|
617
619
|
Usage: underpost lxd [options]
|
|
618
620
|
|
|
@@ -653,11 +655,11 @@ Options:
|
|
|
653
655
|
--auto-expose-k8s-ports <vm-id> Automatically exposes common Kubernetes
|
|
654
656
|
ports for the specified VM.
|
|
655
657
|
-h, --help display help for command
|
|
656
|
-
|
|
658
|
+
|
|
657
659
|
```
|
|
658
|
-
|
|
659
660
|
|
|
660
661
|
### `baremetal` :
|
|
662
|
+
|
|
661
663
|
```
|
|
662
664
|
Usage: underpost baremetal [options] [workflow-id] [hostname] [ip-address]
|
|
663
665
|
|
|
@@ -691,6 +693,5 @@ Options:
|
|
|
691
693
|
baremetal operations.
|
|
692
694
|
--ls Lists available boot resources and machines.
|
|
693
695
|
-h, --help display help for command
|
|
694
|
-
|
|
696
|
+
|
|
695
697
|
```
|
|
696
|
-
|
package/conf.js
CHANGED
|
@@ -17,7 +17,7 @@ spec:
|
|
|
17
17
|
spec:
|
|
18
18
|
containers:
|
|
19
19
|
- name: dd-default-development-blue
|
|
20
|
-
image: localhost/rockylinux9-underpost:v2.8.
|
|
20
|
+
image: localhost/rockylinux9-underpost:v2.8.861
|
|
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.8.
|
|
103
|
+
image: localhost/rockylinux9-underpost:v2.8.861
|
|
104
104
|
# resources:
|
|
105
105
|
# requests:
|
|
106
106
|
# memory: "124Ki"
|
package/package.json
CHANGED
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
"type": "module",
|
|
3
3
|
"main": "src/index.js",
|
|
4
4
|
"name": "underpost",
|
|
5
|
-
"version": "2.8.
|
|
5
|
+
"version": "2.8.861",
|
|
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",
|
|
9
9
|
"build": "node bin/deploy build-full-client",
|
|
10
10
|
"test": "env-cmd -f .env.test c8 mocha",
|
|
11
11
|
"pm2": "env-cmd -f .env.production pm2 start src/server.js --node-args=\"--max-old-space-size=8192\" --name engine",
|
|
12
|
-
"dev": "env-cmd -f .env.development
|
|
12
|
+
"dev": "env-cmd -f .env.development nodemon src/server",
|
|
13
13
|
"dev-img": "env-cmd -f .env.development node src/server",
|
|
14
14
|
"prod-img": "env-cmd -f .env.production node src/server",
|
|
15
15
|
"monitor": "pm2 start src/monitor.js --name monitor -- dd production",
|
|
@@ -11,9 +11,9 @@ const UserRouter = (options) => {
|
|
|
11
11
|
const router = express.Router();
|
|
12
12
|
|
|
13
13
|
(async () => {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
try {
|
|
15
|
+
const models = DataBaseProvider.instance[`${options.host}${options.path}`].mongoose.models;
|
|
16
|
+
if (models.User) {
|
|
17
17
|
const adminUser = await models.User.findOne({ role: 'admin' });
|
|
18
18
|
if (!adminUser) {
|
|
19
19
|
const defaultPassword = process.env.DEFAULT_ADMIN_PASSWORD || 'changethis';
|
|
@@ -29,10 +29,12 @@ const UserRouter = (options) => {
|
|
|
29
29
|
});
|
|
30
30
|
logger.warn('Default admin user created. Please change the default password immediately!', result._doc);
|
|
31
31
|
}
|
|
32
|
-
} catch (error) {
|
|
33
|
-
logger.error('Error checking/creating admin user:', error);
|
|
34
32
|
}
|
|
33
|
+
} catch (error) {
|
|
34
|
+
logger.error('Error checking/creating admin user');
|
|
35
|
+
console.log(error);
|
|
35
36
|
}
|
|
37
|
+
|
|
36
38
|
options.png = {
|
|
37
39
|
buffer: {
|
|
38
40
|
'invalid-token': fs.readFileSync(`./src/client/public/default/assets/mailer/api-user-invalid-token.png`),
|
package/src/cli/deploy.js
CHANGED
|
@@ -480,6 +480,13 @@ Password: <Your Key>
|
|
|
480
480
|
`kubectl create configmap underpost-config --from-file=/home/dd/engine/engine-private/conf/dd-cron/.env.${env}`,
|
|
481
481
|
);
|
|
482
482
|
},
|
|
483
|
+
switchTraffic(deployId, env, targetTraffic, replicas = 1) {
|
|
484
|
+
UnderpostRootEnv.API.set(`${deployId}-${env}-traffic`, targetTraffic);
|
|
485
|
+
shellExec(
|
|
486
|
+
`node bin deploy --info-router --build-manifest --traffic ${targetTraffic} --replicas ${replicas} ${deployId} ${env}`,
|
|
487
|
+
);
|
|
488
|
+
shellExec(`sudo kubectl apply -f ./engine-private/conf/${deployId}/build/${env}/proxy.yaml`);
|
|
489
|
+
},
|
|
483
490
|
};
|
|
484
491
|
}
|
|
485
492
|
|
package/src/cli/index.js
CHANGED
|
@@ -23,6 +23,7 @@ program.name('underpost').description(`underpost ci/cd cli ${Underpost.version}`
|
|
|
23
23
|
program
|
|
24
24
|
.command('new')
|
|
25
25
|
.argument('<app-name>', 'The name of the application to create.')
|
|
26
|
+
.option('--dev', 'Sets the development cli context')
|
|
26
27
|
.description('Initializes a new Underpost project with a predefined structure.')
|
|
27
28
|
.action(Underpost.repo.new);
|
|
28
29
|
|
package/src/cli/repository.js
CHANGED
|
@@ -80,7 +80,7 @@ class UnderpostRepository {
|
|
|
80
80
|
);
|
|
81
81
|
},
|
|
82
82
|
|
|
83
|
-
new(repositoryName) {
|
|
83
|
+
new(repositoryName, options = { dev: false }) {
|
|
84
84
|
return new Promise(async (resolve, reject) => {
|
|
85
85
|
try {
|
|
86
86
|
await logger.setUpInfo();
|
|
@@ -89,15 +89,22 @@ class UnderpostRepository {
|
|
|
89
89
|
await UnderpostStartUp.API.listenPortController(UnderpostStartUp.API.listenServerFactory(), ':'),
|
|
90
90
|
);
|
|
91
91
|
else actionInitLog();
|
|
92
|
-
const
|
|
92
|
+
const npmRoot = getNpmRootPath();
|
|
93
|
+
const underpostRoot = options?.dev === true ? '.' : `${npmRoot}/underpost`;
|
|
93
94
|
const destFolder = `./${repositoryName}`;
|
|
94
95
|
logger.info('Note: This process may take several minutes to complete');
|
|
95
96
|
logger.info('build app', { destFolder });
|
|
96
97
|
if (fs.existsSync(destFolder)) fs.removeSync(destFolder);
|
|
97
98
|
fs.mkdirSync(destFolder, { recursive: true });
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
99
|
+
if (!options.dev) {
|
|
100
|
+
fs.copySync(underpostRoot, destFolder);
|
|
101
|
+
fs.writeFileSync(
|
|
102
|
+
`${destFolder}/.gitignore`,
|
|
103
|
+
fs.readFileSync(`${underpostRoot}/.dockerignore`, 'utf8'),
|
|
104
|
+
'utf8',
|
|
105
|
+
);
|
|
106
|
+
shellExec(`cd ${destFolder} && git init && git add . && git commit -m "Base template implementation"`);
|
|
107
|
+
}
|
|
101
108
|
shellExec(`cd ${destFolder} && npm run build`);
|
|
102
109
|
shellExec(`cd ${destFolder} && npm run dev`);
|
|
103
110
|
return resolve();
|
package/src/cli/run.js
CHANGED
|
@@ -218,6 +218,34 @@ class UnderpostRun {
|
|
|
218
218
|
const { underpostRoot } = options;
|
|
219
219
|
shellExec(`kubectl apply -k ${underpostRoot}/manifests/deployment/adminer/.`);
|
|
220
220
|
},
|
|
221
|
+
promote: async (path, options = UnderpostRun.DEFAULT_OPTION) => {
|
|
222
|
+
let [inputDeployId, inputEnv, inputReplicas] = path.split(',');
|
|
223
|
+
if (!inputEnv) inputEnv = 'production';
|
|
224
|
+
if (!inputReplicas) inputReplicas = 1;
|
|
225
|
+
if (inputDeployId === 'dd') {
|
|
226
|
+
for (const deployId of fs.readFileSync(`./engine-private/deploy/dd.router`, 'utf8').split(',')) {
|
|
227
|
+
const currentTraffic = UnderpostDeploy.API.getCurrentTraffic(deployId);
|
|
228
|
+
const targetTraffic = currentTraffic === 'blue' ? 'green' : 'blue';
|
|
229
|
+
UnderpostDeploy.API.switchTraffic(deployId, inputEnv, targetTraffic, inputReplicas);
|
|
230
|
+
}
|
|
231
|
+
} else {
|
|
232
|
+
const currentTraffic = UnderpostDeploy.API.getCurrentTraffic(inputDeployId);
|
|
233
|
+
const targetTraffic = currentTraffic === 'blue' ? 'green' : 'blue';
|
|
234
|
+
UnderpostDeploy.API.switchTraffic(inputDeployId, inputEnv, targetTraffic, inputReplicas);
|
|
235
|
+
}
|
|
236
|
+
},
|
|
237
|
+
|
|
238
|
+
metrics: async (path, options = UnderpostRun.DEFAULT_OPTION) => {
|
|
239
|
+
const deployList = fs.readFileSync(`./engine-private/deploy/dd.router`, 'utf8').split(',');
|
|
240
|
+
let hosts = [];
|
|
241
|
+
for (const deployId of deployList) {
|
|
242
|
+
const confServer = JSON.parse(fs.readFileSync(`./engine-private/conf/${deployId}/conf.server.json`, 'utf8'));
|
|
243
|
+
hosts = hosts.concat(Object.keys(confServer));
|
|
244
|
+
}
|
|
245
|
+
shellExec(`node bin cluster --prom ${hosts.join(',')}`);
|
|
246
|
+
shellExec(`node bin cluster --grafana`);
|
|
247
|
+
},
|
|
248
|
+
|
|
221
249
|
cluster: async (path, options = UnderpostRun.DEFAULT_OPTION) => {
|
|
222
250
|
const deployList = fs.readFileSync(`./engine-private/deploy/dd.router`, 'utf8').split(',');
|
|
223
251
|
const env = 'production';
|
|
@@ -268,14 +296,8 @@ class UnderpostRun {
|
|
|
268
296
|
|
|
269
297
|
logger.info(`${iteratorTag} | Deployment ready. | Total delay number check iterations: ${checkStatusIteration}`);
|
|
270
298
|
|
|
271
|
-
|
|
299
|
+
UnderpostDeploy.API.switchTraffic(deployId, env, targetTraffic);
|
|
272
300
|
|
|
273
|
-
shellExec(
|
|
274
|
-
`node bin deploy --info-router --build-manifest --traffic ${targetTraffic} --replicas ${
|
|
275
|
-
options.replicas ? options.replicas : 1
|
|
276
|
-
} ${deployId} ${env}`,
|
|
277
|
-
);
|
|
278
|
-
shellExec(`sudo kubectl apply -f ./engine-private/conf/${deployId}/build/${env}/proxy.yaml`);
|
|
279
301
|
shellExec(`sudo kubectl rollout restart deployment/${deployId}-${env}-${currentTraffic}`);
|
|
280
302
|
},
|
|
281
303
|
'tf-vae-test': async (path, options = UnderpostRun.DEFAULT_OPTION) => {
|
|
@@ -457,6 +457,19 @@ const getLang = () =>
|
|
|
457
457
|
.slice(0, 2)
|
|
458
458
|
.toLowerCase();
|
|
459
459
|
|
|
460
|
+
function hexToRgbA(hex) {
|
|
461
|
+
let c;
|
|
462
|
+
if (/^#([A-Fa-f0-9]{3}){1,2}$/.test(hex)) {
|
|
463
|
+
c = hex.substring(1).split('');
|
|
464
|
+
if (c.length == 3) {
|
|
465
|
+
c = [c[0], c[0], c[1], c[1], c[2], c[2]];
|
|
466
|
+
}
|
|
467
|
+
c = '0x' + c.join('');
|
|
468
|
+
return [(c >> 16) & 255, (c >> 8) & 255, c & 255];
|
|
469
|
+
}
|
|
470
|
+
throw new Error('Invalid Hex');
|
|
471
|
+
}
|
|
472
|
+
|
|
460
473
|
export {
|
|
461
474
|
s,
|
|
462
475
|
htmls,
|
|
@@ -486,4 +499,5 @@ export {
|
|
|
486
499
|
isDevInstance,
|
|
487
500
|
getDataFromInputFile,
|
|
488
501
|
getLang,
|
|
502
|
+
hexToRgbA,
|
|
489
503
|
};
|
package/src/index.js
CHANGED
|
@@ -159,7 +159,7 @@ const buildCoverage = async ({ host, path }) => {
|
|
|
159
159
|
shellExec(`npm test`);
|
|
160
160
|
}
|
|
161
161
|
|
|
162
|
-
const coverageBuildPath = `${jsDocsConfig.opts.destination}
|
|
162
|
+
const coverageBuildPath = `${jsDocsConfig.opts.destination}coverage`;
|
|
163
163
|
fs.mkdirSync(coverageBuildPath, { recursive: true });
|
|
164
164
|
fs.copySync(`./coverage`, coverageBuildPath);
|
|
165
165
|
|
|
@@ -535,7 +535,13 @@ Sitemap: https://${host}${path === '/' ? '' : path}/sitemap.xml`,
|
|
|
535
535
|
);
|
|
536
536
|
}
|
|
537
537
|
|
|
538
|
-
if (
|
|
538
|
+
if (
|
|
539
|
+
fullBuildEnabled &&
|
|
540
|
+
!enableLiveRebuild &&
|
|
541
|
+
!process.argv.includes('l') &&
|
|
542
|
+
!process.argv.includes('deploy') &&
|
|
543
|
+
docsBuild
|
|
544
|
+
) {
|
|
539
545
|
await buildDocs({
|
|
540
546
|
host,
|
|
541
547
|
path,
|
package/src/server/conf.js
CHANGED
|
@@ -35,10 +35,9 @@ const Config = {
|
|
|
35
35
|
if (!deployContext) deployContext = process.argv[2];
|
|
36
36
|
if (!fs.existsSync(`./tmp`)) fs.mkdirSync(`./tmp`, { recursive: true });
|
|
37
37
|
fs.writeFileSync(`./tmp/await-deploy`, '', 'utf8');
|
|
38
|
-
if (fs.existsSync(`./engine-private/conf/${deployContext}`))
|
|
39
|
-
return loadConf(deployContext, process.env.NODE_ENV, subConf);
|
|
40
38
|
if (fs.existsSync(`./engine-private/replica/${deployContext}`))
|
|
41
39
|
return loadConf(deployContext, process.env.NODE_ENV, subConf);
|
|
40
|
+
else if (deployContext.startsWith('dd-')) return loadConf(deployContext, process.env.NODE_ENV, subConf);
|
|
42
41
|
|
|
43
42
|
if (deployContext === 'deploy') return;
|
|
44
43
|
|
|
@@ -104,6 +103,7 @@ const loadConf = (deployId, envInput, subConf) => {
|
|
|
104
103
|
shellExec(`git checkout ${path}/package-lock.json`);
|
|
105
104
|
return;
|
|
106
105
|
}
|
|
106
|
+
if (!deployId.startsWith('dd-')) deployId = 'dd-default';
|
|
107
107
|
const folder = fs.existsSync(`./engine-private/replica/${deployId}`)
|
|
108
108
|
? `./engine-private/replica/${deployId}`
|
|
109
109
|
: `./engine-private/conf/${deployId}`;
|
package/src/server/start.js
CHANGED
|
@@ -79,11 +79,11 @@ class UnderpostStartUp {
|
|
|
79
79
|
}
|
|
80
80
|
}),
|
|
81
81
|
|
|
82
|
-
async callback(deployId = 'default', env = 'development', options = { build: false, run: false }) {
|
|
82
|
+
async callback(deployId = 'dd-default', env = 'development', options = { build: false, run: false }) {
|
|
83
83
|
if (options.build === true) await UnderpostStartUp.API.build(deployId, env);
|
|
84
84
|
if (options.run === true) await UnderpostStartUp.API.run(deployId, env);
|
|
85
85
|
},
|
|
86
|
-
async build(deployId = 'default', env = 'development') {
|
|
86
|
+
async build(deployId = 'dd-default', env = 'development') {
|
|
87
87
|
const buildBasePath = `/home/dd`;
|
|
88
88
|
const repoName = `engine-${deployId.split('-')[1]}`;
|
|
89
89
|
shellExec(`cd ${buildBasePath} && underpost clone underpostnet/${repoName}`);
|
|
@@ -100,7 +100,7 @@ class UnderpostStartUp {
|
|
|
100
100
|
}
|
|
101
101
|
shellExec(`node bin/deploy build-full-client ${deployId}`);
|
|
102
102
|
},
|
|
103
|
-
async run(deployId = 'default', env = 'development') {
|
|
103
|
+
async run(deployId = 'dd-default', env = 'development') {
|
|
104
104
|
const runCmd = env === 'production' ? 'run prod-img' : 'run dev-img';
|
|
105
105
|
if (fs.existsSync(`./engine-private/replica`)) {
|
|
106
106
|
const replicas = await fs.readdir(`./engine-private/replica`);
|