underpost 2.8.613 → 2.8.622
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/bin/deploy.js +1 -1
- package/docker-compose.yml +1 -1
- package/package.json +1 -1
- package/src/cli/deploy.js +24 -14
- package/src/cli/image.js +7 -27
- package/src/index.js +1 -1
package/bin/deploy.js
CHANGED
|
@@ -673,8 +673,8 @@ try {
|
|
|
673
673
|
}
|
|
674
674
|
|
|
675
675
|
case 'version-build': {
|
|
676
|
-
const newVersion = process.argv[3];
|
|
677
676
|
const originPackageJson = JSON.parse(fs.readFileSync(`package.json`, 'utf8'));
|
|
677
|
+
const newVersion = process.argv[3] ?? originPackageJson.version;
|
|
678
678
|
const { version } = originPackageJson;
|
|
679
679
|
originPackageJson.version = newVersion;
|
|
680
680
|
fs.writeFileSync(`package.json`, JSON.stringify(originPackageJson, null, 4), 'utf8');
|
package/docker-compose.yml
CHANGED
package/package.json
CHANGED
package/src/cli/deploy.js
CHANGED
|
@@ -50,7 +50,17 @@ 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
|
+
// lifecycle:
|
|
55
|
+
// postStart:
|
|
56
|
+
// exec:
|
|
57
|
+
// command:
|
|
58
|
+
// - /bin/sh
|
|
59
|
+
// - -c
|
|
60
|
+
// - >
|
|
61
|
+
// sleep 20 &&
|
|
62
|
+
// npm install -g underpost &&
|
|
63
|
+
// underpost secret underpost --create-from-file /etc/config/.env.${env}
|
|
54
64
|
const deploymentYamlParts = `apiVersion: apps/v1
|
|
55
65
|
kind: Deployment
|
|
56
66
|
metadata:
|
|
@@ -69,19 +79,19 @@ spec:
|
|
|
69
79
|
spec:
|
|
70
80
|
containers:
|
|
71
81
|
- name: ${deployId}-${env}
|
|
72
|
-
image: localhost/underpost
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
82
|
+
image: localhost/debian:underpost
|
|
83
|
+
command:
|
|
84
|
+
- /bin/sh
|
|
85
|
+
- -c
|
|
86
|
+
- >
|
|
87
|
+
npm install -g npm@11.2.0 &&
|
|
88
|
+
npm config delete proxy &&
|
|
89
|
+
npm config delete http-proxy &&
|
|
90
|
+
npm config delete https-proxy &&
|
|
91
|
+
npm config set registry http://registry.npmjs.org/ &&
|
|
92
|
+
npm install --unsafe-perm --ignore-scripts -g underpost &&
|
|
93
|
+
underpost secret underpost --create-from-file /etc/config/.env.${env} &&
|
|
94
|
+
underpost dockerfile-node-script --build --run ${deployId} ${env}
|
|
85
95
|
volumeMounts:
|
|
86
96
|
- name: config-volume
|
|
87
97
|
mountPath: /etc/config
|
package/src/cli/image.js
CHANGED
|
@@ -26,7 +26,7 @@ class UnderpostImage {
|
|
|
26
26
|
const imgName = `${
|
|
27
27
|
options.imageName && typeof options.imageName === 'string' ? options.imageName : `${deployId}-${env}`
|
|
28
28
|
}:${
|
|
29
|
-
options.imageVersion && typeof options.
|
|
29
|
+
options.imageVersion && typeof options.imageVersion === 'string' ? options.imageVersion : Underpost.version
|
|
30
30
|
}`;
|
|
31
31
|
const podManImg = `localhost/${imgName}`;
|
|
32
32
|
const imagesStoragePath = `/images`;
|
|
@@ -55,21 +55,6 @@ class UnderpostImage {
|
|
|
55
55
|
shellExec(`cd ${path} && sudo kind load image-archive ${tarFile}`);
|
|
56
56
|
},
|
|
57
57
|
async script(deployId = 'default', env = 'development', options = { run: false, build: false }) {
|
|
58
|
-
let attempts = 0;
|
|
59
|
-
if (deployId === 'service') {
|
|
60
|
-
const _deployId = UnderpostRootEnv.API.get('deploy-id');
|
|
61
|
-
const _env = UnderpostRootEnv.API.get('deploy-env');
|
|
62
|
-
process.env.GITHUB_TOKEN = UnderpostRootEnv.API.get('GITHUB_TOKEN');
|
|
63
|
-
if (_deployId && process.env.GITHUB_TOKEN) {
|
|
64
|
-
deployId = _deployId;
|
|
65
|
-
if (_env) env = _env;
|
|
66
|
-
} else {
|
|
67
|
-
await timer(30 * 1000);
|
|
68
|
-
attempts++;
|
|
69
|
-
logger.info('Deploy env status attempt', attempts);
|
|
70
|
-
return await UnderpostImage.API.dockerfile.script(deployId, env, options);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
58
|
if (options.build === true) {
|
|
74
59
|
const buildBasePath = `/home/dd`;
|
|
75
60
|
const repoName = `engine-${deployId.split('-')[1]}`;
|
|
@@ -78,19 +63,14 @@ class UnderpostImage {
|
|
|
78
63
|
shellExec(`cd ${buildBasePath}/engine && underpost clone underpostnet/${repoName}-private`);
|
|
79
64
|
shellExec(`cd ${buildBasePath}/engine && sudo mv ./${repoName}-private ./engine-private`);
|
|
80
65
|
shellCd(`${buildBasePath}/engine`);
|
|
81
|
-
shellExec(`
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
66
|
+
shellExec(`underpost install`);
|
|
67
|
+
if (fs.existsSync('./engine-private/itc-scripts')) {
|
|
68
|
+
const itcScripts = await fs.readdir('./engine-private/itc-scripts');
|
|
69
|
+
for (const itcScript of itcScripts)
|
|
70
|
+
if (itcScript.match(deployId)) shellExec(`node ./engine-private/itc-scripts/${itcScript}`);
|
|
71
|
+
}
|
|
85
72
|
}
|
|
86
73
|
switch (deployId) {
|
|
87
|
-
case 'dd-lampp':
|
|
88
|
-
{
|
|
89
|
-
const lamppPublicPath = '/xampp/htdocs/online';
|
|
90
|
-
shellExec(`sudo mkdir -p ${lamppPublicPath}`);
|
|
91
|
-
}
|
|
92
|
-
break;
|
|
93
|
-
|
|
94
74
|
default:
|
|
95
75
|
{
|
|
96
76
|
{
|