underpost 2.8.61 → 2.8.62
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/docker-compose.yml +1 -1
- package/package.json +1 -1
- package/src/cli/db.js +2 -2
- package/src/cli/deploy.js +21 -5
- package/src/cli/env.js +9 -3
- package/src/cli/image.js +7 -27
- package/src/client/components/core/Modal.js +1 -1
- package/src/index.js +1 -1
package/docker-compose.yml
CHANGED
package/package.json
CHANGED
package/src/cli/db.js
CHANGED
|
@@ -155,9 +155,9 @@ class UnderpostDB {
|
|
|
155
155
|
if (options.collections)
|
|
156
156
|
for (const collection of options.collections)
|
|
157
157
|
shellExec(
|
|
158
|
-
`sudo kubectl exec -i ${podName} -- sh -c "mongodump -d ${dbName} --collection ${collection} -o
|
|
158
|
+
`sudo kubectl exec -i ${podName} -- sh -c "mongodump -d ${dbName} --collection ${collection} -o /"`,
|
|
159
159
|
);
|
|
160
|
-
else shellExec(`sudo kubectl exec -i ${podName} -- sh -c "mongodump -d ${dbName} -o
|
|
160
|
+
else shellExec(`sudo kubectl exec -i ${podName} -- sh -c "mongodump -d ${dbName} -o /"`);
|
|
161
161
|
shellExec(
|
|
162
162
|
`sudo kubectl cp ${nameSpace}/${podName}:/${dbName} ${
|
|
163
163
|
options.outPath ? options.outPath : _toNewBsonPath
|
package/src/cli/deploy.js
CHANGED
|
@@ -50,7 +50,7 @@ class UnderpostDeploy {
|
|
|
50
50
|
if (env === 'development') fs.mkdirSync(`./manifests/deployment/${deployId}-${env}`, { recursive: true });
|
|
51
51
|
|
|
52
52
|
logger.info('port range', { deployId, fromPort, toPort });
|
|
53
|
-
|
|
53
|
+
// const customImg = `underpost-engine:${version && typeof version === 'string' ? version : Underpost.version}`;
|
|
54
54
|
const deploymentYamlParts = `apiVersion: apps/v1
|
|
55
55
|
kind: Deployment
|
|
56
56
|
metadata:
|
|
@@ -69,7 +69,12 @@ spec:
|
|
|
69
69
|
spec:
|
|
70
70
|
containers:
|
|
71
71
|
- name: ${deployId}-${env}
|
|
72
|
-
image: localhost/underpost
|
|
72
|
+
image: localhost/debian:underpost
|
|
73
|
+
command:
|
|
74
|
+
- /bin/sh
|
|
75
|
+
- -c
|
|
76
|
+
- >
|
|
77
|
+
underpost dockerfile-node-script --build --run ${deployId} ${env}
|
|
73
78
|
lifecycle:
|
|
74
79
|
postStart:
|
|
75
80
|
exec:
|
|
@@ -77,9 +82,16 @@ spec:
|
|
|
77
82
|
- /bin/sh
|
|
78
83
|
- -c
|
|
79
84
|
- >
|
|
80
|
-
sleep
|
|
81
|
-
|
|
82
|
-
underpost
|
|
85
|
+
sleep 20 &&
|
|
86
|
+
npm install -g underpost
|
|
87
|
+
underpost secret underpost --create-from-file /etc/config/.env.${env}
|
|
88
|
+
volumeMounts:
|
|
89
|
+
- name: config-volume
|
|
90
|
+
mountPath: /etc/config
|
|
91
|
+
volumes:
|
|
92
|
+
- name: config-volume
|
|
93
|
+
configMap:
|
|
94
|
+
name: underpost-config
|
|
83
95
|
# image: localhost/${deployId}-${env}:${version && typeof version === 'string' ? version : Underpost.version}
|
|
84
96
|
---
|
|
85
97
|
apiVersion: v1
|
|
@@ -214,6 +226,10 @@ kubectl scale statefulsets <stateful-set-name> --replicas=<new-replicas>
|
|
|
214
226
|
if (options.buildManifest === true) await UnderpostDeploy.API.buildManifest(deployList, env, options.version);
|
|
215
227
|
if (options.infoRouter === true)
|
|
216
228
|
return logger.info('router', await UnderpostDeploy.API.routerFactory(deployList, env));
|
|
229
|
+
shellExec(`kubectl delete configmap underpost-config`);
|
|
230
|
+
shellExec(
|
|
231
|
+
`kubectl create configmap underpost-config --from-file=/home/dd/engine/engine-private/conf/dd-cron/.env.${env}`,
|
|
232
|
+
);
|
|
217
233
|
const etcHost = (
|
|
218
234
|
concat,
|
|
219
235
|
) => `127.0.0.1 ${concat} localhost localhost.localdomain localhost4 localhost4.localdomain4
|
package/src/cli/env.js
CHANGED
|
@@ -28,15 +28,21 @@ class UnderpostRootEnv {
|
|
|
28
28
|
get(key) {
|
|
29
29
|
const exeRootPath = `${getNpmRootPath()}/underpost`;
|
|
30
30
|
const envPath = `${exeRootPath}/.env`;
|
|
31
|
-
if (!fs.existsSync(envPath))
|
|
31
|
+
if (!fs.existsSync(envPath)) {
|
|
32
|
+
logger.error(`Unable to find underpost root environment`);
|
|
33
|
+
return undefined;
|
|
34
|
+
}
|
|
32
35
|
const env = dotenv.parse(fs.readFileSync(envPath, 'utf8'));
|
|
33
|
-
logger.info(
|
|
36
|
+
logger.info(`${key}(${typeof env[key]})`, env[key]);
|
|
34
37
|
return env[key];
|
|
35
38
|
},
|
|
36
39
|
list() {
|
|
37
40
|
const exeRootPath = `${getNpmRootPath()}/underpost`;
|
|
38
41
|
const envPath = `${exeRootPath}/.env`;
|
|
39
|
-
if (!fs.existsSync(envPath))
|
|
42
|
+
if (!fs.existsSync(envPath)) {
|
|
43
|
+
logger.error(`Unable to find underpost root environment`);
|
|
44
|
+
return {};
|
|
45
|
+
}
|
|
40
46
|
const env = dotenv.parse(fs.readFileSync(envPath, 'utf8'));
|
|
41
47
|
logger.info('underpost root', env);
|
|
42
48
|
return env;
|
package/src/cli/image.js
CHANGED
|
@@ -5,9 +5,12 @@ import dotenv from 'dotenv';
|
|
|
5
5
|
import { getNpmRootPath } from '../server/conf.js';
|
|
6
6
|
import { timer } from '../client/components/core/CommonJs.js';
|
|
7
7
|
import UnderpostRootEnv from './env.js';
|
|
8
|
+
import { loggerFactory } from '../server/logger.js';
|
|
8
9
|
|
|
9
10
|
dotenv.config();
|
|
10
11
|
|
|
12
|
+
const logger = loggerFactory(import.meta);
|
|
13
|
+
|
|
11
14
|
class UnderpostImage {
|
|
12
15
|
static API = {
|
|
13
16
|
dockerfile: {
|
|
@@ -23,7 +26,7 @@ class UnderpostImage {
|
|
|
23
26
|
const imgName = `${
|
|
24
27
|
options.imageName && typeof options.imageName === 'string' ? options.imageName : `${deployId}-${env}`
|
|
25
28
|
}:${
|
|
26
|
-
options.imageVersion && typeof options.
|
|
29
|
+
options.imageVersion && typeof options.imageVersion === 'string' ? options.imageVersion : Underpost.version
|
|
27
30
|
}`;
|
|
28
31
|
const podManImg = `localhost/${imgName}`;
|
|
29
32
|
const imagesStoragePath = `/images`;
|
|
@@ -43,52 +46,29 @@ class UnderpostImage {
|
|
|
43
46
|
}
|
|
44
47
|
// --rm --no-cache
|
|
45
48
|
if (options.imageArchive !== true) {
|
|
46
|
-
fs.copyFile(`${getNpmRootPath()}/underpost/.env`, `${path}/.env.underpost`);
|
|
47
49
|
shellExec(
|
|
48
50
|
`cd ${path}${secrets}&& sudo podman build -f ./Dockerfile -t ${imgName} --pull=never --cap-add=CAP_AUDIT_WRITE${secretDockerInput}`,
|
|
49
51
|
);
|
|
50
|
-
fs.removeSync(`${path}/.env.underpost`);
|
|
51
52
|
}
|
|
52
53
|
if (options.imageArchive !== true || options.podmanSave === true)
|
|
53
54
|
shellExec(`cd ${path} && podman save -o ${tarFile} ${podManImg}`);
|
|
54
55
|
shellExec(`cd ${path} && sudo kind load image-archive ${tarFile}`);
|
|
55
56
|
},
|
|
56
57
|
async script(deployId = 'default', env = 'development', options = { run: false, build: false }) {
|
|
57
|
-
if (deployId === 'deploy') {
|
|
58
|
-
const _deployId = UnderpostRootEnv.API.get('deploy-id');
|
|
59
|
-
const _env = UnderpostRootEnv.API.get('deploy-env');
|
|
60
|
-
const _path = UnderpostRootEnv.API.get('deploy-path');
|
|
61
|
-
if (_deployId) {
|
|
62
|
-
deployId = _deployId;
|
|
63
|
-
if (_env) env = _env;
|
|
64
|
-
if (_path) path = _path;
|
|
65
|
-
} else {
|
|
66
|
-
await timer(30 * 1000);
|
|
67
|
-
return await UnderpostImage.API.script(deployId, env, path, options);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
58
|
if (options.build === true) {
|
|
71
59
|
const buildBasePath = `/home/dd`;
|
|
72
60
|
const repoName = `engine-${deployId.split('-')[1]}`;
|
|
73
|
-
fs.mkdirSync(buildBasePath, { recursive: true });
|
|
74
61
|
shellExec(`cd ${buildBasePath} && underpost clone underpostnet/${repoName}`);
|
|
75
62
|
shellExec(`cd ${buildBasePath} && sudo mv ./${repoName} ./engine`);
|
|
76
63
|
shellExec(`cd ${buildBasePath}/engine && underpost clone underpostnet/${repoName}-private`);
|
|
77
64
|
shellExec(`cd ${buildBasePath}/engine && sudo mv ./${repoName}-private ./engine-private`);
|
|
78
65
|
shellCd(`${buildBasePath}/engine`);
|
|
79
|
-
shellExec(`
|
|
66
|
+
shellExec(`underpost install`);
|
|
80
67
|
const itcScripts = fs.readdir('./engine-private/itc-scripts');
|
|
81
68
|
for (const itcScript of itcScripts)
|
|
82
69
|
if (itcScript.match(deployId)) shellExec(`node ./engine-private/itc-scripts/${itcScript}`);
|
|
83
70
|
}
|
|
84
71
|
switch (deployId) {
|
|
85
|
-
case 'dd-lampp':
|
|
86
|
-
{
|
|
87
|
-
const lamppPublicPath = '/xampp/htdocs/online';
|
|
88
|
-
shellExec(`sudo mkdir -p ${lamppPublicPath}`);
|
|
89
|
-
}
|
|
90
|
-
break;
|
|
91
|
-
|
|
92
72
|
default:
|
|
93
73
|
{
|
|
94
74
|
{
|
|
@@ -129,7 +109,7 @@ class UnderpostImage {
|
|
|
129
109
|
const replicas = await fs.readdir(`./engine-private/replica`);
|
|
130
110
|
for (const replica of replicas) {
|
|
131
111
|
shellExec(`node bin/deploy conf ${replica} ${env}`);
|
|
132
|
-
shellExec(`npm ${runCmd}
|
|
112
|
+
shellExec(`npm ${runCmd} deploy deploy-id:${replica}`, { async: true });
|
|
133
113
|
fs.writeFileSync(`./tmp/await-deploy`, '', 'utf8');
|
|
134
114
|
const monitor = async () => {
|
|
135
115
|
await timer(1000);
|
|
@@ -139,7 +119,7 @@ class UnderpostImage {
|
|
|
139
119
|
}
|
|
140
120
|
shellExec(`node bin/deploy conf ${deployId} ${env}`);
|
|
141
121
|
}
|
|
142
|
-
shellExec(`npm ${runCmd}
|
|
122
|
+
shellExec(`npm ${runCmd} deploy deploy-id:${deployId}`);
|
|
143
123
|
}
|
|
144
124
|
},
|
|
145
125
|
},
|
|
@@ -1157,7 +1157,7 @@ const Modal = {
|
|
|
1157
1157
|
top: ${top};
|
|
1158
1158
|
left: ${left};
|
|
1159
1159
|
overflow: auto; /* resizable required */
|
|
1160
|
-
resize:
|
|
1160
|
+
resize: both; /* resizable required */
|
|
1161
1161
|
transition: ${transition};
|
|
1162
1162
|
opacity: 0;
|
|
1163
1163
|
z-index: 1;
|