underpost 2.8.531 → 2.8.532
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/build.js +20 -4
- package/bin/deploy.js +2 -1
- package/bin/index.js +1 -0
- package/conf.js +0 -2
- package/docker-compose.yml +1 -1
- package/package.json +1 -1
- package/src/cli/script.js +11 -5
- package/src/index.js +1 -1
package/bin/build.js
CHANGED
|
@@ -20,11 +20,15 @@ const logger = loggerFactory(import.meta);
|
|
|
20
20
|
const confName = process.argv[2];
|
|
21
21
|
const basePath = '../pwa-microservices-template';
|
|
22
22
|
const repoName = `engine-${confName.split('dd-')[1]}`;
|
|
23
|
+
const deployList = (confName === 'dd' ? fs.readFileSync(`./engine-private/deploy/dd.router`, 'utf8') : confName).split(
|
|
24
|
+
',',
|
|
25
|
+
);
|
|
23
26
|
|
|
24
27
|
logger.info('', {
|
|
25
28
|
confName,
|
|
26
29
|
repoName,
|
|
27
30
|
basePath,
|
|
31
|
+
deployList,
|
|
28
32
|
});
|
|
29
33
|
|
|
30
34
|
if (process.argv.includes('clean')) {
|
|
@@ -35,10 +39,7 @@ if (process.argv.includes('clean')) {
|
|
|
35
39
|
}
|
|
36
40
|
|
|
37
41
|
if (process.argv.includes('conf')) {
|
|
38
|
-
for (const _confName of
|
|
39
|
-
? fs.readFileSync(`./engine-private/deploy/dd.router`, 'utf8')
|
|
40
|
-
: confName
|
|
41
|
-
).split(',')) {
|
|
42
|
+
for (const _confName of deployList) {
|
|
42
43
|
const _repoName = `engine-${_confName.split('dd-')[1]}`;
|
|
43
44
|
const privateRepoName = `${_repoName}-private`;
|
|
44
45
|
const privateGitUri = `${process.env.GITHUB_USERNAME}/${privateRepoName}`;
|
|
@@ -58,6 +59,12 @@ if (process.argv.includes('conf')) {
|
|
|
58
59
|
if (replica.match(_confName))
|
|
59
60
|
fs.copySync(`./engine-private/replica/${replica}`, `../${privateRepoName}/replica/${replica}`);
|
|
60
61
|
}
|
|
62
|
+
if (fs.existsSync(`./engine-private/itc-scripts`)) {
|
|
63
|
+
const itcScripts = await fs.readdir(`./engine-private/itc-scripts`);
|
|
64
|
+
for (const itcScript of itcScripts)
|
|
65
|
+
if (itcScript.match(_confName))
|
|
66
|
+
fs.copySync(`./engine-private/itc-scripts/${itcScript}`, `../${privateRepoName}/itc-scripts/${itcScript}`);
|
|
67
|
+
}
|
|
61
68
|
shellExec(
|
|
62
69
|
`cd ../${privateRepoName}` +
|
|
63
70
|
` && git add .` +
|
|
@@ -68,6 +75,13 @@ if (process.argv.includes('conf')) {
|
|
|
68
75
|
process.exit(0);
|
|
69
76
|
}
|
|
70
77
|
|
|
78
|
+
if (confName === 'dd') {
|
|
79
|
+
for (const _confName of deployList) {
|
|
80
|
+
shellExec(`node bin/build ${_confName}`);
|
|
81
|
+
}
|
|
82
|
+
process.exit(0);
|
|
83
|
+
}
|
|
84
|
+
|
|
71
85
|
const { DefaultConf } = await import(`../conf.${confName}.js`);
|
|
72
86
|
|
|
73
87
|
{
|
|
@@ -133,6 +147,8 @@ const { DefaultConf } = await import(`../conf.${confName}.js`);
|
|
|
133
147
|
}
|
|
134
148
|
}
|
|
135
149
|
|
|
150
|
+
shellExec(`node bin/deploy update-default-conf ${confName}`);
|
|
151
|
+
|
|
136
152
|
fs.copyFileSync(`./conf.${confName}.js`, `${basePath}/conf.js`);
|
|
137
153
|
fs.copyFileSync(
|
|
138
154
|
`./.github/workflows/engine.${confName.split('dd-')[1]}.ci.yml`,
|
package/bin/deploy.js
CHANGED
|
@@ -731,6 +731,7 @@ try {
|
|
|
731
731
|
|
|
732
732
|
shellExec(`node bin/deploy update-dependencies`);
|
|
733
733
|
shellExec(`auto-changelog`);
|
|
734
|
+
shellExec(`node bin/build dd`);
|
|
734
735
|
shellExec(`node bin deploy dd --build-manifest --sync --info-router`);
|
|
735
736
|
shellExec(`node bin deploy dd production --build-manifest --sync --info-router`);
|
|
736
737
|
break;
|
|
@@ -837,7 +838,7 @@ ${shellExec(`git log | grep Author: | sort -u`, { stdout: true }).split(`\n`).jo
|
|
|
837
838
|
DefaultConf.client = JSON.parse(fs.readFileSync(`./engine-private/conf/${confName}/conf.client.json`, 'utf8'));
|
|
838
839
|
DefaultConf.server = JSON.parse(fs.readFileSync(`./engine-private/conf/${confName}/conf.server.json`, 'utf8'));
|
|
839
840
|
DefaultConf.ssr = JSON.parse(fs.readFileSync(`./engine-private/conf/${confName}/conf.ssr.json`, 'utf8'));
|
|
840
|
-
DefaultConf.cron = JSON.parse(fs.readFileSync(`./engine-private/conf/${confName}/conf.cron.json`, 'utf8'));
|
|
841
|
+
// DefaultConf.cron = JSON.parse(fs.readFileSync(`./engine-private/conf/${confName}/conf.cron.json`, 'utf8'));
|
|
841
842
|
|
|
842
843
|
for (const host of Object.keys(DefaultConf.server)) {
|
|
843
844
|
for (const path of Object.keys(DefaultConf.server[host])) {
|
package/bin/index.js
CHANGED
|
@@ -165,6 +165,7 @@ program
|
|
|
165
165
|
.argument('<script-name>', 'Script name')
|
|
166
166
|
.argument('[script-value]', 'Literal command, or path')
|
|
167
167
|
.option('--itc', 'Inside container execution context')
|
|
168
|
+
.option('--itc-path', 'Inside container path options')
|
|
168
169
|
.option('--ns <ns-name>', 'Options name space context')
|
|
169
170
|
.option('--pod-name <pod-name>')
|
|
170
171
|
.description(
|
package/conf.js
CHANGED
|
@@ -179,9 +179,7 @@ const DefaultConf = /**/ {
|
|
|
179
179
|
},
|
|
180
180
|
},
|
|
181
181
|
cron: {
|
|
182
|
-
ipDaemon: { ip: null },
|
|
183
182
|
records: { A: [{ host: 'example.com', dns: 'dondominio', api_key: '???', user: '???' }] },
|
|
184
|
-
backups: [{ deployGroupId: 'default-group' }],
|
|
185
183
|
jobs: { dns: { expression: '* * * * *', enabled: true }, backups: { expression: '0 1 * * *', enabled: true } },
|
|
186
184
|
},
|
|
187
185
|
}; /**/
|
package/docker-compose.yml
CHANGED
package/package.json
CHANGED
package/src/cli/script.js
CHANGED
|
@@ -19,16 +19,22 @@ class UnderpostScript {
|
|
|
19
19
|
const packageJson = JSON.parse(fs.readFileSync(`${npmRoot}/package.json`, 'utf8'));
|
|
20
20
|
if (options.itc === true) {
|
|
21
21
|
value = packageJson.scripts[key];
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
const podScriptPath = `${options.itcPath && typeof options.itcPath === 'string' ? options.itcPath : '/'}${value
|
|
23
|
+
.split('/')
|
|
24
|
+
.pop()}`;
|
|
25
|
+
const nameSpace = options.ns && typeof options.ns === 'string' ? options.ns : 'default';
|
|
26
|
+
const podMatch = options.podName && typeof options.podName === 'string' ? options.podName : key;
|
|
26
27
|
|
|
28
|
+
if (fs.existsSync(`${value}`)) {
|
|
27
29
|
for (const pod of UnderpostDeploy.API.getPods(podMatch)) {
|
|
28
30
|
shellExec(`sudo kubectl cp ${value} ${nameSpace}/${pod.NAME}:${podScriptPath}`);
|
|
29
|
-
const cmd = `
|
|
31
|
+
const cmd = `node ${podScriptPath}`;
|
|
30
32
|
shellExec(`sudo kubectl exec -i ${pod.NAME} -- sh -c "${cmd}"`);
|
|
31
33
|
}
|
|
34
|
+
} else {
|
|
35
|
+
for (const pod of UnderpostDeploy.API.getPods(podMatch)) {
|
|
36
|
+
shellExec(`sudo kubectl exec -i ${pod.NAME} -- sh -c "${value}"`);
|
|
37
|
+
}
|
|
32
38
|
}
|
|
33
39
|
|
|
34
40
|
return;
|