Skip to content

Commit 2aaffee

Browse files
author
underpostnet
committed
ci(package-pwa-microservices-template-ghpkg): ⚙️ Update github repo package
1 parent 901d9f5 commit 2aaffee

File tree

9 files changed

+39
-17
lines changed

9 files changed

+39
-17
lines changed

bin/build.js

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,15 @@ const logger = loggerFactory(import.meta);
2020
const confName = process.argv[2];
2121
const basePath = '../pwa-microservices-template';
2222
const repoName = `engine-${confName.split('dd-')[1]}`;
23+
const deployList = (confName === 'dd' ? fs.readFileSync(`./engine-private/deploy/dd.router`, 'utf8') : confName).split(
24+
',',
25+
);
2326

2427
logger.info('', {
2528
confName,
2629
repoName,
2730
basePath,
31+
deployList,
2832
});
2933

3034
if (process.argv.includes('clean')) {
@@ -35,10 +39,7 @@ if (process.argv.includes('clean')) {
3539
}
3640

3741
if (process.argv.includes('conf')) {
38-
for (const _confName of (confName === 'dd'
39-
? fs.readFileSync(`./engine-private/deploy/dd.router`, 'utf8')
40-
: confName
41-
).split(',')) {
42+
for (const _confName of deployList) {
4243
const _repoName = `engine-${_confName.split('dd-')[1]}`;
4344
const privateRepoName = `${_repoName}-private`;
4445
const privateGitUri = `${process.env.GITHUB_USERNAME}/${privateRepoName}`;
@@ -58,6 +59,12 @@ if (process.argv.includes('conf')) {
5859
if (replica.match(_confName))
5960
fs.copySync(`./engine-private/replica/${replica}`, `../${privateRepoName}/replica/${replica}`);
6061
}
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+
}
6168
shellExec(
6269
`cd ../${privateRepoName}` +
6370
` && git add .` +
@@ -68,6 +75,13 @@ if (process.argv.includes('conf')) {
6875
process.exit(0);
6976
}
7077

78+
if (confName === 'dd') {
79+
for (const _confName of deployList) {
80+
shellExec(`node bin/build ${_confName}`);
81+
}
82+
process.exit(0);
83+
}
84+
7185
const { DefaultConf } = await import(`../conf.${confName}.js`);
7286

7387
{
@@ -133,6 +147,8 @@ const { DefaultConf } = await import(`../conf.${confName}.js`);
133147
}
134148
}
135149

150+
shellExec(`node bin/deploy update-default-conf ${confName}`);
151+
136152
fs.copyFileSync(`./conf.${confName}.js`, `${basePath}/conf.js`);
137153
fs.copyFileSync(
138154
`./.github/workflows/engine.${confName.split('dd-')[1]}.ci.yml`,

bin/deploy.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -731,6 +731,7 @@ try {
731731

732732
shellExec(`node bin/deploy update-dependencies`);
733733
shellExec(`auto-changelog`);
734+
shellExec(`node bin/build dd`);
734735
shellExec(`node bin deploy dd --build-manifest --sync --info-router`);
735736
shellExec(`node bin deploy dd production --build-manifest --sync --info-router`);
736737
break;
@@ -837,7 +838,7 @@ ${shellExec(`git log | grep Author: | sort -u`, { stdout: true }).split(`\n`).jo
837838
DefaultConf.client = JSON.parse(fs.readFileSync(`./engine-private/conf/${confName}/conf.client.json`, 'utf8'));
838839
DefaultConf.server = JSON.parse(fs.readFileSync(`./engine-private/conf/${confName}/conf.server.json`, 'utf8'));
839840
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'));
841842

842843
for (const host of Object.keys(DefaultConf.server)) {
843844
for (const path of Object.keys(DefaultConf.server[host])) {

bin/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,7 @@ program
165165
.argument('<script-name>', 'Script name')
166166
.argument('[script-value]', 'Literal command, or path')
167167
.option('--itc', 'Inside container execution context')
168+
.option('--itc-path', 'Inside container path options')
168169
.option('--ns <ns-name>', 'Options name space context')
169170
.option('--pod-name <pod-name>')
170171
.description(

conf.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,9 +179,7 @@ const DefaultConf = /**/ {
179179
},
180180
},
181181
cron: {
182-
ipDaemon: { ip: null },
183182
records: { A: [{ host: 'example.com', dns: 'dondominio', api_key: '???', user: '???' }] },
184-
backups: [{ deployGroupId: 'default-group' }],
185183
jobs: { dns: { expression: '* * * * *', enabled: true }, backups: { expression: '0 1 * * *', enabled: true } },
186184
},
187185
}; /**/

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ services:
5858
cpus: '0.25'
5959
memory: 20M
6060
labels: # labels in Compose file instead of Dockerfile
61-
engine.version: '2.8.531'
61+
engine.version: '2.8.532'
6262
networks:
6363
- load-balancer
6464

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"type": "module",
33
"main": "src/index.js",
44
"name": "@underpostnet/underpost",
5-
"version": "2.8.531",
5+
"version": "2.8.532",
66
"description": "pwa api rest template",
77
"scripts": {
88
"start": "env-cmd -f .env.production node --max-old-space-size=8192 src/server",

src/cli/script.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,22 @@ class UnderpostScript {
1919
const packageJson = JSON.parse(fs.readFileSync(`${npmRoot}/package.json`, 'utf8'));
2020
if (options.itc === true) {
2121
value = packageJson.scripts[key];
22-
if (fs.existsSync(`${value}`)) {
23-
const podScriptPath = `/${value.split('/').pop()}`;
24-
const nameSpace = options.ns && typeof options.ns === 'string' ? options.ns : 'default';
25-
const podMatch = options.podName && typeof options.podName === 'string' ? options.podName : key;
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;
2627

28+
if (fs.existsSync(`${value}`)) {
2729
for (const pod of UnderpostDeploy.API.getPods(podMatch)) {
2830
shellExec(`sudo kubectl cp ${value} ${nameSpace}/${pod.NAME}:${podScriptPath}`);
29-
const cmd = `cd / && node ${podScriptPath}`;
31+
const cmd = `node ${podScriptPath}`;
3032
shellExec(`sudo kubectl exec -i ${pod.NAME} -- sh -c "${cmd}"`);
3133
}
34+
} else {
35+
for (const pod of UnderpostDeploy.API.getPods(podMatch)) {
36+
shellExec(`sudo kubectl exec -i ${pod.NAME} -- sh -c "${value}"`);
37+
}
3238
}
3339

3440
return;

src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class Underpost {
2727
* @type {String}
2828
* @memberof Underpost
2929
*/
30-
static version = 'v2.8.531';
30+
static version = 'v2.8.532';
3131
/**
3232
* Repository cli API
3333
* @static

0 commit comments

Comments
 (0)