underpost 2.8.611 → 2.8.613
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/deploy.js +13 -0
- package/src/cli/env.js +9 -3
- package/src/cli/image.js +9 -5
- 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/deploy.js
CHANGED
|
@@ -78,8 +78,17 @@ spec:
|
|
|
78
78
|
- -c
|
|
79
79
|
- >
|
|
80
80
|
sleep 60 &&
|
|
81
|
+
npm install -g underpost
|
|
82
|
+
underpost secret underpost --create-from-file /etc/config/.env.${env}
|
|
81
83
|
underpost config set deploy-id ${deployId} &&
|
|
82
84
|
underpost config set deploy-env ${env}
|
|
85
|
+
volumeMounts:
|
|
86
|
+
- name: config-volume
|
|
87
|
+
mountPath: /etc/config
|
|
88
|
+
volumes:
|
|
89
|
+
- name: config-volume
|
|
90
|
+
configMap:
|
|
91
|
+
name: underpost-config
|
|
83
92
|
# image: localhost/${deployId}-${env}:${version && typeof version === 'string' ? version : Underpost.version}
|
|
84
93
|
---
|
|
85
94
|
apiVersion: v1
|
|
@@ -214,6 +223,10 @@ kubectl scale statefulsets <stateful-set-name> --replicas=<new-replicas>
|
|
|
214
223
|
if (options.buildManifest === true) await UnderpostDeploy.API.buildManifest(deployList, env, options.version);
|
|
215
224
|
if (options.infoRouter === true)
|
|
216
225
|
return logger.info('router', await UnderpostDeploy.API.routerFactory(deployList, env));
|
|
226
|
+
shellExec(`kubectl delete configmap underpost-config`);
|
|
227
|
+
shellExec(
|
|
228
|
+
`kubectl create configmap underpost-config --from-file=/home/dd/engine/engine-private/conf/dd-cron/.env.${env}`,
|
|
229
|
+
);
|
|
217
230
|
const etcHost = (
|
|
218
231
|
concat,
|
|
219
232
|
) => `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: {
|
|
@@ -43,32 +46,33 @@ 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
|
-
|
|
58
|
+
let attempts = 0;
|
|
59
|
+
if (deployId === 'service') {
|
|
58
60
|
const _deployId = UnderpostRootEnv.API.get('deploy-id');
|
|
59
61
|
const _env = UnderpostRootEnv.API.get('deploy-env');
|
|
60
|
-
|
|
62
|
+
process.env.GITHUB_TOKEN = UnderpostRootEnv.API.get('GITHUB_TOKEN');
|
|
63
|
+
if (_deployId && process.env.GITHUB_TOKEN) {
|
|
61
64
|
deployId = _deployId;
|
|
62
65
|
if (_env) env = _env;
|
|
63
66
|
} else {
|
|
64
67
|
await timer(30 * 1000);
|
|
68
|
+
attempts++;
|
|
69
|
+
logger.info('Deploy env status attempt', attempts);
|
|
65
70
|
return await UnderpostImage.API.dockerfile.script(deployId, env, options);
|
|
66
71
|
}
|
|
67
72
|
}
|
|
68
73
|
if (options.build === true) {
|
|
69
74
|
const buildBasePath = `/home/dd`;
|
|
70
75
|
const repoName = `engine-${deployId.split('-')[1]}`;
|
|
71
|
-
fs.mkdirSync(buildBasePath, { recursive: true });
|
|
72
76
|
shellExec(`cd ${buildBasePath} && underpost clone underpostnet/${repoName}`);
|
|
73
77
|
shellExec(`cd ${buildBasePath} && sudo mv ./${repoName} ./engine`);
|
|
74
78
|
shellExec(`cd ${buildBasePath}/engine && underpost clone underpostnet/${repoName}-private`);
|
|
@@ -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;
|