underpost 2.8.875 → 2.8.876
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/.github/workflows/pwa-microservices-template-page.cd.yml +5 -4
- package/.github/workflows/release.cd.yml +1 -0
- package/README.md +6 -2
- package/bin/deploy.js +21 -7
- package/bin/file.js +3 -2
- package/cli.md +1 -1
- package/manifests/deployment/dd-default-development/deployment.yaml +2 -2
- package/manifests/deployment/dd-test-development/deployment.yaml +2 -2
- package/package.json +1 -1
- package/src/cli/repository.js +21 -3
- package/src/cli/run.js +8 -7
- package/src/index.js +1 -1
- package/src/server/backup.js +2 -2
- package/src/server/conf.js +1 -1
- package/src/server/start.js +2 -2
|
@@ -4,7 +4,7 @@ name: CD | Gihub page | PWA Microservices Template
|
|
|
4
4
|
on:
|
|
5
5
|
# Runs on pushes targeting the default branch
|
|
6
6
|
push:
|
|
7
|
-
branches: [
|
|
7
|
+
branches: ["main"]
|
|
8
8
|
|
|
9
9
|
# Allows you to run this workflow manually from the Actions tab
|
|
10
10
|
workflow_dispatch:
|
|
@@ -18,7 +18,7 @@ permissions:
|
|
|
18
18
|
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
|
|
19
19
|
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
|
|
20
20
|
concurrency:
|
|
21
|
-
group:
|
|
21
|
+
group: "pages"
|
|
22
22
|
cancel-in-progress: false
|
|
23
23
|
|
|
24
24
|
jobs:
|
|
@@ -53,7 +53,8 @@ jobs:
|
|
|
53
53
|
run: |
|
|
54
54
|
npm install -g underpost
|
|
55
55
|
npm install
|
|
56
|
-
node bin/deploy update-default-conf
|
|
56
|
+
node bin/deploy update-default-conf dd-github-pages
|
|
57
|
+
underpost env dd-github-pages production
|
|
57
58
|
env-cmd -f .env.production node bin/deploy build-full-client dd-github-pages underpostnet.github.io /pwa-microservices-template-ghpkg
|
|
58
59
|
# git lfs install
|
|
59
60
|
# git lfs track
|
|
@@ -65,7 +66,7 @@ jobs:
|
|
|
65
66
|
uses: actions/upload-pages-artifact@v3
|
|
66
67
|
with:
|
|
67
68
|
# Upload entire repository
|
|
68
|
-
path:
|
|
69
|
+
path: "./public/underpostnet.github.io/pwa-microservices-template-ghpkg/"
|
|
69
70
|
- name: Deploy to GitHub Pages
|
|
70
71
|
id: deployment
|
|
71
72
|
uses: actions/deploy-pages@v4
|
package/README.md
CHANGED
|
@@ -51,13 +51,15 @@
|
|
|
51
51
|
|
|
52
52
|
|
|
53
53
|
|
|
54
|
+
|
|
55
|
+
|
|
54
56
|
|
|
55
57
|
|
|
56
58
|
|
|
57
59
|
<!-- badges -->
|
|
58
60
|
|
|
59
61
|
|
|
60
|
-
[](https://github.com/underpostnet/engine/actions/workflows/docker-image.yml) [](https://github.com/underpostnet/engine/actions/workflows/coverall.yml) [](https://www.npmjs.com/package/underpost) [](https://github.com/underpostnet/engine/actions/workflows/docker-image.yml) [](https://github.com/underpostnet/engine/actions/workflows/coverall.yml) [](https://www.npmjs.com/package/underpost) [](https://socket.dev/npm/package/underpost/overview/2.8.876) [](https://coveralls.io/github/underpostnet/engine?branch=master) [](https://www.npmjs.org/package/underpost) [](https://www.npmjs.com/package/underpost)
|
|
61
63
|
|
|
62
64
|
|
|
63
65
|
<!-- end-badges -->
|
|
@@ -97,6 +99,8 @@
|
|
|
97
99
|
|
|
98
100
|
|
|
99
101
|
|
|
102
|
+
|
|
103
|
+
|
|
100
104
|
|
|
101
105
|
|
|
102
106
|
|
|
@@ -144,7 +148,7 @@ Run dev client server
|
|
|
144
148
|
npm run dev
|
|
145
149
|
```
|
|
146
150
|
<!-- -->
|
|
147
|
-
## underpost ci/cd cli v2.8.
|
|
151
|
+
## underpost ci/cd cli v2.8.876
|
|
148
152
|
|
|
149
153
|
### Usage: `underpost [options] [command]`
|
|
150
154
|
```
|
package/bin/deploy.js
CHANGED
|
@@ -370,6 +370,7 @@ try {
|
|
|
370
370
|
case 'version-build': {
|
|
371
371
|
shellCd(`/home/dd/engine`);
|
|
372
372
|
shellExec(`node bin/deploy clean-core-repo`);
|
|
373
|
+
shellExec(`node bin pull . ${process.env.GITHUB_USERNAME}/engine`);
|
|
373
374
|
shellExec(`node bin run kill 4001`);
|
|
374
375
|
shellExec(`node bin run kill 4002`);
|
|
375
376
|
shellExec(`node bin run kill 4003`);
|
|
@@ -479,8 +480,8 @@ try {
|
|
|
479
480
|
shellExec(`git add . && cd ./engine-private && git add .`);
|
|
480
481
|
shellExec(`node bin cmt . ci package-pwa-microservices-template`);
|
|
481
482
|
shellExec(`node bin cmt ./engine-private ci package-pwa-microservices-template`);
|
|
482
|
-
shellExec(`node bin push .
|
|
483
|
-
shellExec(`cd ./engine-private && node ../bin push .
|
|
483
|
+
shellExec(`node bin push . ${process.env.GITHUB_USERNAME}/engine`);
|
|
484
|
+
shellExec(`cd ./engine-private && node ../bin push . ${process.env.GITHUB_USERNAME}/engine-private`);
|
|
484
485
|
break;
|
|
485
486
|
}
|
|
486
487
|
|
|
@@ -538,15 +539,16 @@ ${shellExec(`git log | grep Author: | sort -u`, { stdout: true }).split(`\n`).jo
|
|
|
538
539
|
case 'update-default-conf': {
|
|
539
540
|
const defaultServer = DefaultConf.server['default.net']['/'];
|
|
540
541
|
let confName = process.argv[3];
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
const host = 'underpostnet.github.io
|
|
542
|
+
let defaultConf = false;
|
|
543
|
+
if (confName === 'dd-github-pages') {
|
|
544
|
+
const host = `${process.env.GITHUB_USERNAME ?? 'underpostnet'}.github.io`;
|
|
544
545
|
const path = '/pwa-microservices-template-ghpkg';
|
|
545
546
|
DefaultConf.server = {
|
|
546
547
|
[host]: { [path]: defaultServer },
|
|
547
548
|
};
|
|
548
549
|
DefaultConf.server[host][path].apiBaseProxyPath = '/';
|
|
549
550
|
DefaultConf.server[host][path].apiBaseHost = 'www.nexodev.org';
|
|
551
|
+
defaultConf = true;
|
|
550
552
|
} else if (confName === 'template') {
|
|
551
553
|
const host = 'default.net';
|
|
552
554
|
const path = '/';
|
|
@@ -556,7 +558,7 @@ ${shellExec(`git log | grep Author: | sort -u`, { stdout: true }).split(`\n`).jo
|
|
|
556
558
|
};
|
|
557
559
|
// mongodb-0.mongodb-service
|
|
558
560
|
DefaultConf.server[host][path].db.host = 'mongodb://mongodb-service:27017';
|
|
559
|
-
|
|
561
|
+
defaultConf = true;
|
|
560
562
|
} else if (confName && fs.existsSync(`./engine-private/conf/${confName}`)) {
|
|
561
563
|
DefaultConf.client = JSON.parse(fs.readFileSync(`./engine-private/conf/${confName}/conf.client.json`, 'utf8'));
|
|
562
564
|
DefaultConf.server = JSON.parse(fs.readFileSync(`./engine-private/conf/${confName}/conf.server.json`, 'utf8'));
|
|
@@ -580,10 +582,22 @@ ${shellExec(`git log | grep Author: | sort -u`, { stdout: true }).split(`\n`).jo
|
|
|
580
582
|
const sepRender = '/**/';
|
|
581
583
|
const confRawPaths = fs.readFileSync('./conf.js', 'utf8').split(sepRender);
|
|
582
584
|
confRawPaths[1] = `${JSON.stringify(DefaultConf)};`;
|
|
583
|
-
const targetConfPath = `./conf${
|
|
585
|
+
const targetConfPath = `./conf${defaultConf ? '' : `.${confName}`}.js`;
|
|
584
586
|
fs.writeFileSync(targetConfPath, confRawPaths.join(sepRender), 'utf8');
|
|
585
587
|
shellExec(`prettier --write ${targetConfPath}`);
|
|
586
588
|
|
|
589
|
+
switch (confName) {
|
|
590
|
+
case 'dd-github-pages':
|
|
591
|
+
{
|
|
592
|
+
if (fs.exists(`./engine-private/conf/${confName}`)) fs.removeSync(`./engine-private/conf/${confName}`);
|
|
593
|
+
shellExec(`node bin new --deploy-id ${confName}`);
|
|
594
|
+
}
|
|
595
|
+
break;
|
|
596
|
+
|
|
597
|
+
default:
|
|
598
|
+
break;
|
|
599
|
+
}
|
|
600
|
+
|
|
587
601
|
break;
|
|
588
602
|
}
|
|
589
603
|
|
package/bin/file.js
CHANGED
|
@@ -56,10 +56,11 @@ try {
|
|
|
56
56
|
console.log('copy paths', result);
|
|
57
57
|
|
|
58
58
|
if (type === 'update-template') {
|
|
59
|
-
if (!fs.existsSync(toPath))
|
|
59
|
+
if (!fs.existsSync(toPath))
|
|
60
|
+
shellExec(`cd .. && underpost clone ${process.env.GITHUB_USERNAME}/pwa-microservices-template`);
|
|
60
61
|
else {
|
|
61
62
|
shellExec(`cd ${toPath} && git reset && git checkout . && git clean -f -d`);
|
|
62
|
-
shellExec(`underpost pull ${toPath}
|
|
63
|
+
shellExec(`underpost pull ${toPath} ${process.env.GITHUB_USERNAME}/pwa-microservices-template`);
|
|
63
64
|
shellExec(`sudo rm -rf ${toPath}/engine-private`);
|
|
64
65
|
shellExec(`sudo rm -rf ${toPath}/logs`);
|
|
65
66
|
}
|
package/cli.md
CHANGED
|
@@ -17,7 +17,7 @@ spec:
|
|
|
17
17
|
spec:
|
|
18
18
|
containers:
|
|
19
19
|
- name: dd-default-development-blue
|
|
20
|
-
image: localhost/rockylinux9-underpost:v2.8.
|
|
20
|
+
image: localhost/rockylinux9-underpost:v2.8.876
|
|
21
21
|
# resources:
|
|
22
22
|
# requests:
|
|
23
23
|
# memory: "124Ki"
|
|
@@ -100,7 +100,7 @@ spec:
|
|
|
100
100
|
spec:
|
|
101
101
|
containers:
|
|
102
102
|
- name: dd-default-development-green
|
|
103
|
-
image: localhost/rockylinux9-underpost:v2.8.
|
|
103
|
+
image: localhost/rockylinux9-underpost:v2.8.876
|
|
104
104
|
# resources:
|
|
105
105
|
# requests:
|
|
106
106
|
# memory: "124Ki"
|
|
@@ -17,7 +17,7 @@ spec:
|
|
|
17
17
|
spec:
|
|
18
18
|
containers:
|
|
19
19
|
- name: dd-test-development-blue
|
|
20
|
-
image: localhost/rockylinux9-underpost:v2.8.
|
|
20
|
+
image: localhost/rockylinux9-underpost:v2.8.876
|
|
21
21
|
# resources:
|
|
22
22
|
# requests:
|
|
23
23
|
# memory: "96294Ki"
|
|
@@ -104,7 +104,7 @@ spec:
|
|
|
104
104
|
spec:
|
|
105
105
|
containers:
|
|
106
106
|
- name: dd-test-development-green
|
|
107
|
-
image: localhost/rockylinux9-underpost:v2.8.
|
|
107
|
+
image: localhost/rockylinux9-underpost:v2.8.876
|
|
108
108
|
# resources:
|
|
109
109
|
# requests:
|
|
110
110
|
# memory: "96294Ki"
|
package/package.json
CHANGED
package/src/cli/repository.js
CHANGED
|
@@ -13,7 +13,7 @@ const logger = loggerFactory(import.meta);
|
|
|
13
13
|
|
|
14
14
|
class UnderpostRepository {
|
|
15
15
|
static API = {
|
|
16
|
-
clone(gitUri =
|
|
16
|
+
clone(gitUri = `${process.env.GITHUB_USERNAME}/pwa-microservices-template`, options = { bare: false, g8: false }) {
|
|
17
17
|
const gExtension = options.g8 === true ? '.g8' : '.git';
|
|
18
18
|
const repoName = gitUri.split('/').pop();
|
|
19
19
|
if (fs.existsSync(`./${repoName}`)) fs.removeSync(`./${repoName}`);
|
|
@@ -26,7 +26,11 @@ class UnderpostRepository {
|
|
|
26
26
|
},
|
|
27
27
|
);
|
|
28
28
|
},
|
|
29
|
-
pull(
|
|
29
|
+
pull(
|
|
30
|
+
repoPath = './',
|
|
31
|
+
gitUri = `${process.env.GITHUB_USERNAME}/pwa-microservices-template`,
|
|
32
|
+
options = { g8: false },
|
|
33
|
+
) {
|
|
30
34
|
const gExtension = options.g8 === true ? '.g8' : '.git';
|
|
31
35
|
shellExec(
|
|
32
36
|
`cd ${repoPath} && git pull https://${
|
|
@@ -61,7 +65,11 @@ class UnderpostRepository {
|
|
|
61
65
|
shellExec(`cd ${repoPath} && git commit ${options?.empty ? `--allow-empty ` : ''}-m "${_message}"`);
|
|
62
66
|
},
|
|
63
67
|
|
|
64
|
-
push(
|
|
68
|
+
push(
|
|
69
|
+
repoPath = './',
|
|
70
|
+
gitUri = `${process.env.GITHUB_USERNAME}/pwa-microservices-template}`,
|
|
71
|
+
options = { f: false, g8: false },
|
|
72
|
+
) {
|
|
65
73
|
const gExtension = options.g8 === true || options.G8 === true ? '.g8' : '.git';
|
|
66
74
|
shellExec(
|
|
67
75
|
`cd ${repoPath} && git push https://${process.env.GITHUB_TOKEN}@github.com/${gitUri}${gExtension}${
|
|
@@ -145,7 +153,17 @@ class UnderpostRepository {
|
|
|
145
153
|
if (fs.existsSync(privateRepoPath)) fs.removeSync(privateRepoPath);
|
|
146
154
|
shellExec(`cd .. && underpost clone ${process.env.GITHUB_USERNAME}/${privateRepoName}`);
|
|
147
155
|
shellExec(`cd ${privateRepoPath} && underpost pull . ${process.env.GITHUB_USERNAME}/${privateRepoName}`);
|
|
156
|
+
const packageJsonDeploy = JSON.parse(fs.readFileSync(`./engine-private/conf/${deployId}/package.json`, 'utf8'));
|
|
157
|
+
const packageJsonEngine = JSON.parse(fs.readFileSync(`./package.json`, 'utf8'));
|
|
158
|
+
if (packageJsonDeploy.version !== packageJsonEngine.version) {
|
|
159
|
+
logger.warn(
|
|
160
|
+
`Version mismatch: deploy-version:${packageJsonDeploy.version} !== engine-version:${packageJsonEngine.version},
|
|
161
|
+
Prevent build private config repo.`,
|
|
162
|
+
);
|
|
163
|
+
return { validVersion: false };
|
|
164
|
+
}
|
|
148
165
|
shellExec(`node bin/build ${deployId} conf`);
|
|
166
|
+
return { validVersion: true };
|
|
149
167
|
},
|
|
150
168
|
};
|
|
151
169
|
}
|
package/src/cli/run.js
CHANGED
|
@@ -27,9 +27,9 @@ class UnderpostRun {
|
|
|
27
27
|
shellExec(`sudo rm -rf ${dir}`);
|
|
28
28
|
shellCd('/home/dd');
|
|
29
29
|
|
|
30
|
-
// pbcopy(`cd /home/dd && sbt new
|
|
30
|
+
// pbcopy(`cd /home/dd && sbt new ${process.env.GITHUB_USERNAME}/spark-template.g8`);
|
|
31
31
|
// await read({ prompt: 'Command copy to clipboard, press enter to continue.\n' });
|
|
32
|
-
shellExec(`cd /home/dd && sbt new
|
|
32
|
+
shellExec(`cd /home/dd && sbt new ${process.env.GITHUB_USERNAME}/spark-template.g8 '--name=spark-template'`);
|
|
33
33
|
|
|
34
34
|
shellCd(dir);
|
|
35
35
|
|
|
@@ -107,7 +107,7 @@ class UnderpostRun {
|
|
|
107
107
|
shellCd('/home/dd/engine');
|
|
108
108
|
shellExec(`git reset`);
|
|
109
109
|
shellExec(`${baseCommand} cmt . --empty ci package-pwa-microservices-template`);
|
|
110
|
-
shellExec(`${baseCommand} push .
|
|
110
|
+
shellExec(`${baseCommand} push . ${process.env.GITHUB_USERNAME}/engine`);
|
|
111
111
|
},
|
|
112
112
|
clean: (path, options = UnderpostRun.DEFAULT_OPTION) => {
|
|
113
113
|
shellCd(path ?? `/home/dd/engine`);
|
|
@@ -116,8 +116,8 @@ class UnderpostRun {
|
|
|
116
116
|
pull: (path, options = UnderpostRun.DEFAULT_OPTION) => {
|
|
117
117
|
shellCd(`/home/dd/engine`);
|
|
118
118
|
shellExec(`node bin/deploy clean-core-repo`);
|
|
119
|
-
shellExec(`underpost pull .
|
|
120
|
-
shellExec(`underpost pull engine-private
|
|
119
|
+
shellExec(`underpost pull . ${process.env.GITHUB_USERNAME}/engine`);
|
|
120
|
+
shellExec(`underpost pull ./engine-private ${process.env.GITHUB_USERNAME}/engine-private`);
|
|
121
121
|
},
|
|
122
122
|
'release-deploy': (path, options = UnderpostRun.DEFAULT_OPTION) => {
|
|
123
123
|
actionInitLog();
|
|
@@ -134,7 +134,7 @@ class UnderpostRun {
|
|
|
134
134
|
shellCd('/home/dd/engine');
|
|
135
135
|
shellExec(`git reset`);
|
|
136
136
|
shellExec(`${baseCommand} cmt . --empty cd ssh-${path}`);
|
|
137
|
-
shellExec(`${baseCommand} push .
|
|
137
|
+
shellExec(`${baseCommand} push . ${process.env.GITHUB_USERNAME}/engine`);
|
|
138
138
|
},
|
|
139
139
|
ide: (path, options = UnderpostRun.DEFAULT_OPTION) => {
|
|
140
140
|
const { underpostRoot } = options;
|
|
@@ -303,7 +303,8 @@ class UnderpostRun {
|
|
|
303
303
|
},
|
|
304
304
|
deploy: async (path, options = UnderpostRun.DEFAULT_OPTION) => {
|
|
305
305
|
const deployId = path;
|
|
306
|
-
UnderpostRepository.API.privateConfUpdate(deployId);
|
|
306
|
+
const { validVersion } = UnderpostRepository.API.privateConfUpdate(deployId);
|
|
307
|
+
if (!validVersion) throw new Error('Version mismatch');
|
|
307
308
|
const currentTraffic = UnderpostDeploy.API.getCurrentTraffic(deployId);
|
|
308
309
|
const targetTraffic = currentTraffic === 'blue' ? 'green' : 'blue';
|
|
309
310
|
const env = 'production';
|
package/src/index.js
CHANGED
package/src/server/backup.js
CHANGED
|
@@ -61,10 +61,10 @@ class BackUp {
|
|
|
61
61
|
}
|
|
62
62
|
shellExec(
|
|
63
63
|
`cd ./engine-private/cron-backups` +
|
|
64
|
-
` && underpost pull .
|
|
64
|
+
` && underpost pull . ${process.env.GITHUB_USERNAME}/cron-backups` +
|
|
65
65
|
` && git add .` +
|
|
66
66
|
` && underpost cmt . backup cron-job '${new Date().toLocaleDateString()}'` +
|
|
67
|
-
` && underpost push .
|
|
67
|
+
` && underpost push . ${process.env.GITHUB_USERNAME}/cron-backups`,
|
|
68
68
|
{
|
|
69
69
|
disableLog: true,
|
|
70
70
|
},
|
package/src/server/conf.js
CHANGED
|
@@ -918,7 +918,7 @@ const buildCliDoc = (program, oldVersion, newVersion) => {
|
|
|
918
918
|
baseOptions +
|
|
919
919
|
`
|
|
920
920
|
|
|
921
|
-
<a target="_top" href="https://github.com/
|
|
921
|
+
<a target="_top" href="https://github.com/${process.env.GITHUB_USERNAME}/pwa-microservices-template/blob/master/cli.md">See complete CLI Docs here.</a>
|
|
922
922
|
|
|
923
923
|
`
|
|
924
924
|
).replaceAll(oldVersion, newVersion),
|
package/src/server/start.js
CHANGED
|
@@ -86,9 +86,9 @@ class UnderpostStartUp {
|
|
|
86
86
|
async build(deployId = 'dd-default', env = 'development') {
|
|
87
87
|
const buildBasePath = `/home/dd`;
|
|
88
88
|
const repoName = `engine-${deployId.split('-')[1]}`;
|
|
89
|
-
shellExec(`cd ${buildBasePath} && underpost clone
|
|
89
|
+
shellExec(`cd ${buildBasePath} && underpost clone ${process.env.GITHUB_USERNAME}/${repoName}`);
|
|
90
90
|
shellExec(`cd ${buildBasePath} && sudo mv ./${repoName} ./engine`);
|
|
91
|
-
shellExec(`cd ${buildBasePath}/engine && underpost clone
|
|
91
|
+
shellExec(`cd ${buildBasePath}/engine && underpost clone ${process.env.GITHUB_USERNAME}/${repoName}-private`);
|
|
92
92
|
shellExec(`cd ${buildBasePath}/engine && sudo mv ./${repoName}-private ./engine-private`);
|
|
93
93
|
shellCd(`${buildBasePath}/engine`);
|
|
94
94
|
shellExec(`npm install`);
|