@underpostnet/underpost 2.8.5 → 2.8.6
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/ghpkg.yml +1 -1
- package/.github/workflows/npmpkg.yml +1 -1
- package/.github/workflows/pwa-microservices-template.page.yml +1 -1
- package/.vscode/settings.json +4 -0
- package/CHANGELOG.md +24 -0
- package/bin/build.js +29 -4
- package/bin/deploy.js +70 -74
- package/bin/hwt.js +0 -10
- package/bin/index.js +54 -23
- package/bin/util.js +0 -7
- package/bin/vs.js +1 -0
- package/conf.js +0 -2
- package/docker-compose.yml +1 -1
- package/manifests/kind-config-dev.yaml +12 -0
- package/manifests/mongodb/kustomization.yaml +2 -2
- package/manifests/mongodb-4.4/kustomization.yaml +7 -0
- package/manifests/mongodb-4.4/service-deployment.yaml +63 -0
- package/package.json +9 -7
- package/src/cli/cluster.js +99 -51
- package/src/cli/cron.js +1 -1
- package/src/cli/db.js +102 -38
- package/src/cli/deploy.js +76 -35
- package/src/cli/fs.js +149 -0
- package/src/cli/image.js +50 -27
- package/src/cli/repository.js +21 -0
- package/src/cli/script.js +25 -1
- package/src/cli/test.js +39 -4
- package/src/client/components/core/CalendarCore.js +12 -1
- package/src/client/components/core/CommonJs.js +52 -1
- package/src/client/components/core/CssCore.js +2 -4
- package/src/client/components/core/Docs.js +1 -2
- package/src/client/components/core/Input.js +4 -2
- package/src/client/components/core/LoadingAnimation.js +8 -1
- package/src/client/components/core/Modal.js +30 -6
- package/src/client/components/core/Panel.js +8 -6
- package/src/client/components/core/PanelForm.js +23 -7
- package/src/client/services/core/core.service.js +15 -10
- package/src/client/ssr/Render.js +4 -1
- package/src/client/ssr/body/CacheControl.js +2 -3
- package/src/client/sw/default.sw.js +3 -3
- package/src/db/mongo/MongooseDB.js +17 -1
- package/src/index.js +9 -1
- package/src/server/backup.js +3 -3
- package/src/server/client-build.js +32 -23
- package/src/server/client-formatted.js +2 -1
- package/src/server/conf.js +17 -15
- package/src/server/dns.js +39 -46
- package/src/server/downloader.js +0 -8
- package/src/server/runtime.js +16 -1
- package/test/api.test.js +0 -8
- package/manifests/core/kustomization.yaml +0 -11
- package/manifests/core/underpost-engine-backup-access.yaml +0 -16
- package/manifests/core/underpost-engine-backup-pv-pvc.yaml +0 -22
- package/manifests/core/underpost-engine-headless-service.yaml +0 -10
- package/manifests/core/underpost-engine-mongodb-backup-cronjob.yaml +0 -40
- package/manifests/core/underpost-engine-mongodb-configmap.yaml +0 -26
- package/manifests/core/underpost-engine-statefulset.yaml +0 -91
- package/manifests/valkey/underpost-engine-valkey-service.yaml +0 -17
- package/manifests/valkey/underpost-engine-valkey-statefulset.yaml +0 -39
- /package/manifests/{core/underpost-engine-pv-pvc.yaml → mongodb-4.4/pv-pvc.yaml} +0 -0
|
@@ -43,7 +43,7 @@ jobs:
|
|
|
43
43
|
run: |
|
|
44
44
|
npm install -g underpost
|
|
45
45
|
underpost config set GITHUB_TOKEN ${{ secrets.GIT_AUTH_TOKEN }}
|
|
46
|
-
|
|
46
|
+
npm install
|
|
47
47
|
node ./bin/deploy rename-package @underpostnet/underpost
|
|
48
48
|
node ./bin/deploy set-repo underpostnet/pwa-microservices-template-ghpkg
|
|
49
49
|
|
|
@@ -43,7 +43,7 @@ jobs:
|
|
|
43
43
|
- name: Build the site
|
|
44
44
|
run: |
|
|
45
45
|
npm install -g underpost
|
|
46
|
-
|
|
46
|
+
npm install
|
|
47
47
|
node bin/deploy update-default-conf ghpkg
|
|
48
48
|
env-cmd -f .env.production node bin/deploy build-full-client github-pages underpostnet.github.io /pwa-microservices-template-ghpkg
|
|
49
49
|
# git lfs install
|
package/.vscode/settings.json
CHANGED
|
@@ -42,6 +42,7 @@
|
|
|
42
42
|
"Itemledger",
|
|
43
43
|
"jsonld",
|
|
44
44
|
"lampp",
|
|
45
|
+
"letsencrypt",
|
|
45
46
|
"loadingio",
|
|
46
47
|
"Longname",
|
|
47
48
|
"metanarrative",
|
|
@@ -118,5 +119,8 @@
|
|
|
118
119
|
"docwriter.hotkey.mac": "⌘ + .",
|
|
119
120
|
"[dotenv]": {
|
|
120
121
|
"editor.defaultFormatter": "foxundermoon.shell-format"
|
|
122
|
+
},
|
|
123
|
+
"[shellscript]": {
|
|
124
|
+
"editor.defaultFormatter": "foxundermoon.shell-format"
|
|
121
125
|
}
|
|
122
126
|
}
|
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,30 @@ All notable changes to this project will be documented in this file. Dates are d
|
|
|
4
4
|
|
|
5
5
|
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
|
6
6
|
|
|
7
|
+
#### [v2.8.521](https://github.com/underpostnet/engine/compare/v2.8.51...v2.8.521)
|
|
8
|
+
|
|
9
|
+
> 4 March 2025
|
|
10
|
+
|
|
11
|
+
- ci(package-pwa-microservices-template): ⚙️ Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs) [`5878342`](https://github.com/underpostnet/engine/commit/587834206f07a508b3e12ff5b5727c5979c06499)
|
|
12
|
+
- ci(package-pwa-microservices-template): ⚙️ update version 2.8.521 [`5fada73`](https://github.com/underpostnet/engine/commit/5fada73abf960567f4ecdc01062a987f4d7b4e79)
|
|
13
|
+
- fix(cli): 🐛 run prod img [`94743ef`](https://github.com/underpostnet/engine/commit/94743efe2cf214f0dbcf4db9f0b83ecf50b396f5)
|
|
14
|
+
|
|
15
|
+
#### [v2.8.51](https://github.com/underpostnet/engine/compare/v2.8.46...v2.8.51)
|
|
16
|
+
|
|
17
|
+
> 4 March 2025
|
|
18
|
+
|
|
19
|
+
- ci: ⚙️ add dd-core-development yamls [`a236466`](https://github.com/underpostnet/engine/commit/a2364666f5ddc0e824fa8b68b203bb9e021cca0c)
|
|
20
|
+
- refactor(cli): 📦 cron jobs management refactor [`8c28689`](https://github.com/underpostnet/engine/commit/8c28689cd514ee0e30a38be22ca3dbd292aa3a8a)
|
|
21
|
+
- ci(package-pwa-microservices-template): ⚙️ Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs) [`dd3557b`](https://github.com/underpostnet/engine/commit/dd3557bc52724d9231a0a13a320108758b6a84d2)
|
|
22
|
+
|
|
23
|
+
#### [v2.8.46](https://github.com/underpostnet/engine/compare/v2.8.44...v2.8.46)
|
|
24
|
+
|
|
25
|
+
> 28 February 2025
|
|
26
|
+
|
|
27
|
+
- refactor(add cli module directory): 📦 A code change that neither fixes a bug nor adds a feature [`56eea01`](https://github.com/underpostnet/engine/commit/56eea0121489998945c1b2040c3fc53cf6ee295c)
|
|
28
|
+
- refactor(bin): 📦 static API method access [`dcac59e`](https://github.com/underpostnet/engine/commit/dcac59e0cc3fb3e7eeef490d7ded3adb921f4e7a)
|
|
29
|
+
- ci(package-pwa-microservices-template): ⚙️ update version 2.8.45 [`11795eb`](https://github.com/underpostnet/engine/commit/11795eb2b57243530bfd027774005a83edbdee3b)
|
|
30
|
+
|
|
7
31
|
#### [v2.8.44](https://github.com/underpostnet/engine/compare/v2.8.42...v2.8.44)
|
|
8
32
|
|
|
9
33
|
> 18 February 2025
|
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,12 +147,23 @@ 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`,
|
|
139
155
|
`${basePath}/.github/workflows/engine.${confName.split('dd-')[1]}.ci.yml`,
|
|
140
156
|
);
|
|
141
157
|
|
|
158
|
+
switch (confName) {
|
|
159
|
+
case 'dd-cyberia':
|
|
160
|
+
fs.copyFileSync(`./bin/cyberia.js`, `${basePath}/bin/cyberia.js`);
|
|
161
|
+
break;
|
|
162
|
+
|
|
163
|
+
default:
|
|
164
|
+
break;
|
|
165
|
+
}
|
|
166
|
+
|
|
142
167
|
const packageJson = JSON.parse(fs.readFileSync(`${basePath}/package.json`, 'utf8'));
|
|
143
168
|
packageJson.name = repoName;
|
|
144
169
|
fs.writeFileSync(
|
package/bin/deploy.js
CHANGED
|
@@ -141,23 +141,6 @@ try {
|
|
|
141
141
|
loadConf(process.argv[3], process.argv[4]);
|
|
142
142
|
break;
|
|
143
143
|
}
|
|
144
|
-
case 'run':
|
|
145
|
-
{
|
|
146
|
-
if (process.argv.includes('replicas')) {
|
|
147
|
-
const deployGroupId = getDeployGroupId();
|
|
148
|
-
const dataDeploy = getDataDeploy({
|
|
149
|
-
deployId: process.argv[3],
|
|
150
|
-
buildSingleReplica: true,
|
|
151
|
-
deployGroupId,
|
|
152
|
-
});
|
|
153
|
-
if (fs.existsSync(`./tmp/await-deploy`)) fs.remove(`./tmp/await-deploy`);
|
|
154
|
-
await deployRun(dataDeploy);
|
|
155
|
-
} else {
|
|
156
|
-
loadConf(process.argv[3]);
|
|
157
|
-
shellExec(`npm start ${process.argv.includes('maintenance') ? 'maintenance' : ''}`);
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
break;
|
|
161
144
|
|
|
162
145
|
case 'new-nodejs-app':
|
|
163
146
|
{
|
|
@@ -453,12 +436,13 @@ try {
|
|
|
453
436
|
case 'run-macro':
|
|
454
437
|
{
|
|
455
438
|
if (fs.existsSync(`./tmp/await-deploy`)) fs.remove(`./tmp/await-deploy`);
|
|
456
|
-
const dataDeploy = getDataDeploy({
|
|
439
|
+
const dataDeploy = getDataDeploy({
|
|
440
|
+
deployGroupId: process.argv[3],
|
|
441
|
+
buildSingleReplica: true,
|
|
442
|
+
deployIdConcat: ['dd-proxy', 'dd-cron'],
|
|
443
|
+
});
|
|
457
444
|
if (!process.argv[4]) await setUpProxyMaintenanceServer({ deployGroupId: process.argv[3] });
|
|
458
|
-
await deployRun(
|
|
459
|
-
process.argv[4] ? dataDeploy.filter((d) => d.deployId.match(process.argv[4])) : dataDeploy,
|
|
460
|
-
true,
|
|
461
|
-
);
|
|
445
|
+
await deployRun(process.argv[4] ? dataDeploy.filter((d) => d.deployId.match(process.argv[4])) : dataDeploy);
|
|
462
446
|
}
|
|
463
447
|
break;
|
|
464
448
|
|
|
@@ -688,68 +672,80 @@ try {
|
|
|
688
672
|
break;
|
|
689
673
|
}
|
|
690
674
|
|
|
691
|
-
case '
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
);
|
|
722
|
-
}
|
|
675
|
+
case 'version-build': {
|
|
676
|
+
const newVersion = process.argv[3];
|
|
677
|
+
const originPackageJson = JSON.parse(fs.readFileSync(`package.json`, 'utf8'));
|
|
678
|
+
const { version } = originPackageJson;
|
|
679
|
+
originPackageJson.version = newVersion;
|
|
680
|
+
fs.writeFileSync(`package.json`, JSON.stringify(originPackageJson, null, 4), 'utf8');
|
|
681
|
+
|
|
682
|
+
const originPackageLockJson = JSON.parse(fs.readFileSync(`package-lock.json`, 'utf8'));
|
|
683
|
+
originPackageLockJson.version = newVersion;
|
|
684
|
+
originPackageLockJson.packages[''].version = newVersion;
|
|
685
|
+
fs.writeFileSync(`package-lock.json`, JSON.stringify(originPackageLockJson, null, 4), 'utf8');
|
|
686
|
+
|
|
687
|
+
if (fs.existsSync(`./engine-private/conf`)) {
|
|
688
|
+
const files = await fs.readdir(`./engine-private/conf`, { recursive: true });
|
|
689
|
+
for (const relativePath of files) {
|
|
690
|
+
const filePah = `./engine-private/conf/${relativePath.replaceAll(`\\`, '/')}`;
|
|
691
|
+
if (filePah.split('/').pop() === 'package.json') {
|
|
692
|
+
const originPackage = JSON.parse(fs.readFileSync(filePah, 'utf8'));
|
|
693
|
+
originPackage.version = newVersion;
|
|
694
|
+
fs.writeFileSync(filePah, JSON.stringify(originPackage, null, 4), 'utf8');
|
|
695
|
+
}
|
|
696
|
+
if (filePah.split('/').pop() === 'deployment.yaml') {
|
|
697
|
+
fs.writeFileSync(
|
|
698
|
+
filePah,
|
|
699
|
+
fs
|
|
700
|
+
.readFileSync(filePah, 'utf8')
|
|
701
|
+
.replaceAll(`v${version}`, `v${newVersion}`)
|
|
702
|
+
.replaceAll(`engine.version: ${version}`, `engine.version: ${newVersion}`),
|
|
703
|
+
'utf8',
|
|
704
|
+
);
|
|
723
705
|
}
|
|
724
706
|
}
|
|
707
|
+
}
|
|
725
708
|
|
|
709
|
+
fs.writeFileSync(
|
|
710
|
+
`./docker-compose.yml`,
|
|
711
|
+
fs
|
|
712
|
+
.readFileSync(`./docker-compose.yml`, 'utf8')
|
|
713
|
+
.replaceAll(`engine.version: '${version}'`, `engine.version: '${newVersion}'`),
|
|
714
|
+
'utf8',
|
|
715
|
+
);
|
|
716
|
+
|
|
717
|
+
if (fs.existsSync(`./.github/workflows/docker-image.yml`))
|
|
726
718
|
fs.writeFileSync(
|
|
727
|
-
|
|
719
|
+
`./.github/workflows/docker-image.yml`,
|
|
728
720
|
fs
|
|
729
|
-
.readFileSync(
|
|
730
|
-
.replaceAll(`engine
|
|
721
|
+
.readFileSync(`./.github/workflows/docker-image.yml`, 'utf8')
|
|
722
|
+
.replaceAll(`underpost-engine:v${version}`, `underpost-engine:v${newVersion}`),
|
|
731
723
|
'utf8',
|
|
732
724
|
);
|
|
733
725
|
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
.replaceAll(`underpost-engine:v${version}`, `underpost-engine:v${newVersion}`),
|
|
740
|
-
'utf8',
|
|
741
|
-
);
|
|
726
|
+
fs.writeFileSync(
|
|
727
|
+
`./src/index.js`,
|
|
728
|
+
fs.readFileSync(`./src/index.js`, 'utf8').replaceAll(`${version}`, `${newVersion}`),
|
|
729
|
+
'utf8',
|
|
730
|
+
);
|
|
742
731
|
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
732
|
+
shellExec(`node bin/deploy update-dependencies`);
|
|
733
|
+
shellExec(`auto-changelog`);
|
|
734
|
+
shellExec(`node bin/build dd`);
|
|
735
|
+
shellExec(`node bin deploy dd --build-manifest --sync --info-router`);
|
|
736
|
+
shellExec(`node bin deploy dd production --build-manifest --sync --info-router`);
|
|
737
|
+
break;
|
|
738
|
+
}
|
|
748
739
|
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
740
|
+
case 'version-deploy': {
|
|
741
|
+
shellExec(`node bin/build dd conf`);
|
|
742
|
+
shellExec(`git add . && cd ./engine-private && git add .`);
|
|
743
|
+
shellExec(`node bin cmt . ci package-pwa-microservices-template`);
|
|
744
|
+
shellExec(`node bin cmt ./engine-private ci package-pwa-microservices-template`);
|
|
745
|
+
shellExec(`node bin push . underpostnet/engine`);
|
|
746
|
+
shellExec(`cd ./engine-private && node ../bin push . underpostnet/engine-private`);
|
|
752
747
|
break;
|
|
748
|
+
}
|
|
753
749
|
|
|
754
750
|
case 'update-authors': {
|
|
755
751
|
// #### Ordered by first contribution.
|
|
@@ -842,7 +838,7 @@ ${shellExec(`git log | grep Author: | sort -u`, { stdout: true }).split(`\n`).jo
|
|
|
842
838
|
DefaultConf.client = JSON.parse(fs.readFileSync(`./engine-private/conf/${confName}/conf.client.json`, 'utf8'));
|
|
843
839
|
DefaultConf.server = JSON.parse(fs.readFileSync(`./engine-private/conf/${confName}/conf.server.json`, 'utf8'));
|
|
844
840
|
DefaultConf.ssr = JSON.parse(fs.readFileSync(`./engine-private/conf/${confName}/conf.ssr.json`, 'utf8'));
|
|
845
|
-
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'));
|
|
846
842
|
|
|
847
843
|
for (const host of Object.keys(DefaultConf.server)) {
|
|
848
844
|
for (const path of Object.keys(DefaultConf.server[host])) {
|
package/bin/hwt.js
CHANGED
|
@@ -1,19 +1,9 @@
|
|
|
1
1
|
import fs from 'fs-extra';
|
|
2
|
-
import axios from 'axios';
|
|
3
|
-
import https from 'https';
|
|
4
2
|
|
|
5
|
-
import dotenv from 'dotenv';
|
|
6
|
-
import { shellCd, shellExec } from '../src/server/process.js';
|
|
7
3
|
import { loggerFactory } from '../src/server/logger.js';
|
|
8
4
|
|
|
9
5
|
const logger = loggerFactory(import.meta);
|
|
10
6
|
|
|
11
|
-
const httpsAgent = new https.Agent({
|
|
12
|
-
rejectUnauthorized: false,
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
axios.defaults.httpsAgent = httpsAgent;
|
|
16
|
-
|
|
17
7
|
logger.info('argv', process.argv);
|
|
18
8
|
|
|
19
9
|
const [exe, dir, operator, templateId, publicPath] = process.argv;
|
package/bin/index.js
CHANGED
|
@@ -2,20 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
import dotenv from 'dotenv';
|
|
4
4
|
import { Command } from 'commander';
|
|
5
|
-
import { loggerFactory } from '../src/server/logger.js';
|
|
6
5
|
import Underpost from '../src/index.js';
|
|
7
|
-
import {
|
|
6
|
+
import { getUnderpostRootPath, loadConf } from '../src/server/conf.js';
|
|
8
7
|
import fs from 'fs-extra';
|
|
9
8
|
import { commitData } from '../src/client/components/core/CommonJs.js';
|
|
10
|
-
import UnderpostScript from '../src/cli/script.js';
|
|
11
|
-
import UnderpostDB from '../src/cli/db.js';
|
|
12
|
-
import UnderpostCron from '../src/cli/cron.js';
|
|
13
9
|
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const logger = loggerFactory(import.meta);
|
|
10
|
+
const underpostRootPath = getUnderpostRootPath();
|
|
11
|
+
fs.existsSync(`${underpostRootPath}/.env`)
|
|
12
|
+
? dotenv.config({ path: `${underpostRootPath}/.env`, override: true })
|
|
13
|
+
: dotenv.config();
|
|
19
14
|
|
|
20
15
|
const program = new Command();
|
|
21
16
|
|
|
@@ -83,18 +78,20 @@ program
|
|
|
83
78
|
|
|
84
79
|
program
|
|
85
80
|
.command('cluster')
|
|
81
|
+
.argument('[pod-name]', 'Optional pod name filter')
|
|
86
82
|
.option('--reset', `Delete all clusters and prune all data and caches`)
|
|
87
83
|
.option('--mariadb', 'Init with mariadb statefulset')
|
|
88
84
|
.option('--mongodb', 'Init with mongodb statefulset')
|
|
85
|
+
.option('--mongodb4', 'Init with mongodb 4.4 service')
|
|
89
86
|
.option('--valkey', 'Init with valkey service')
|
|
90
87
|
.option('--contour', 'Init with project contour base HTTPProxy and envoy')
|
|
88
|
+
.option('--cert-manager', 'Init with letsencrypt-prod ClusterIssuer')
|
|
91
89
|
.option('--info', 'Get all kinds objects deployed')
|
|
92
90
|
.option('--full', 'Init with all statefulsets and services available')
|
|
93
91
|
.option('--ns-use <ns-name>', 'Switches current context to namespace')
|
|
94
|
-
.
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
})
|
|
92
|
+
.option('--dev', 'init with dev cluster')
|
|
93
|
+
.option('--list-pods', 'Display list pods information')
|
|
94
|
+
.action(Underpost.cluster.init)
|
|
98
95
|
.description('Manage cluster, for default initialization base kind cluster');
|
|
99
96
|
|
|
100
97
|
program
|
|
@@ -104,7 +101,11 @@ program
|
|
|
104
101
|
.option('--remove', 'Delete deployments and services')
|
|
105
102
|
.option('--sync', 'Sync deployments env, ports, and replicas')
|
|
106
103
|
.option('--info-router', 'Display router structure')
|
|
104
|
+
.option('--expose', 'Expose service match deploy-list')
|
|
105
|
+
.option('--info-util', 'Display kubectl util management commands')
|
|
106
|
+
.option('--cert', 'Reset tls/ssl certificate secrets')
|
|
107
107
|
.option('--build-manifest', 'Build kind yaml manifests: deployments, services, proxy and secrets')
|
|
108
|
+
.option('--version', 'Set custom version')
|
|
108
109
|
.description('Manage deployment, for default deploy development pods')
|
|
109
110
|
.action(Underpost.deploy.callback);
|
|
110
111
|
|
|
@@ -136,7 +137,10 @@ program
|
|
|
136
137
|
.argument('<deploy-id>', 'Deploy configuration id')
|
|
137
138
|
.argument('[env]', 'Optional environment, for default is development')
|
|
138
139
|
.argument('[path]', 'Absolute or relative directory, for default is current')
|
|
139
|
-
.option('--image-archive', 'Only load tar image from
|
|
140
|
+
.option('--image-archive', 'Only load tar image from ./images')
|
|
141
|
+
.option('--podman-save', 'Save image from podman to ./images')
|
|
142
|
+
.option('--image-name <image-name>', 'Set custom image name')
|
|
143
|
+
.option('--image-version <image-version>', 'Set custom image version')
|
|
140
144
|
.description('Build image from Dockerfile')
|
|
141
145
|
.action(Underpost.image.dockerfile.build);
|
|
142
146
|
|
|
@@ -149,7 +153,7 @@ program
|
|
|
149
153
|
.command('install')
|
|
150
154
|
.description('Fast import underpost npm dependencies')
|
|
151
155
|
.action(() => {
|
|
152
|
-
fs.copySync(`${
|
|
156
|
+
fs.copySync(`${underpostRootPath}/node_modules`, './node_modules');
|
|
153
157
|
});
|
|
154
158
|
|
|
155
159
|
program
|
|
@@ -157,35 +161,62 @@ program
|
|
|
157
161
|
.argument('<deploy-list>', 'Deploy id list, e.g. default-a,default-b')
|
|
158
162
|
.option('--import', 'Import container backups from repositories')
|
|
159
163
|
.option('--export', 'Export container backups to repositories')
|
|
164
|
+
.option('--pod-name <pod-name>', 'Optional pod context')
|
|
165
|
+
.option('--collection <collection>', 'Collection')
|
|
166
|
+
.option('--out-path <out-path>', 'Custom out path backup')
|
|
167
|
+
.option('--drop', 'Drop databases')
|
|
168
|
+
.option('--preserveUUID', 'Preserve Ids')
|
|
169
|
+
.option('--git', 'Upload to github')
|
|
170
|
+
.option('--ns <ns-name>', 'Optional name space context')
|
|
160
171
|
.description('Manage databases')
|
|
161
|
-
.action(
|
|
172
|
+
.action(Underpost.db.callback);
|
|
162
173
|
|
|
163
174
|
program
|
|
164
175
|
.command('script')
|
|
165
|
-
.argument('operator', `Options: ${Object.keys(
|
|
176
|
+
.argument('operator', `Options: ${Object.keys(Underpost.script)}`)
|
|
166
177
|
.argument('<script-name>', 'Script name')
|
|
167
|
-
.argument('[script-value]', 'Literal command')
|
|
178
|
+
.argument('[script-value]', 'Literal command, or path')
|
|
179
|
+
.option('--itc', 'Inside container execution context')
|
|
180
|
+
.option('--itc-path', 'Inside container path options')
|
|
181
|
+
.option('--ns <ns-name>', 'Options name space context')
|
|
182
|
+
.option('--pod-name <pod-name>')
|
|
168
183
|
.description(
|
|
169
184
|
'Supports a number of built-in underpost global scripts and their preset life cycle events as well as arbitrary scripts',
|
|
170
185
|
)
|
|
171
|
-
.action((...args) => Underpost.script[args[0]](args[1], args[2]));
|
|
186
|
+
.action((...args) => Underpost.script[args[0]](args[1], args[2], args[3]));
|
|
172
187
|
|
|
173
188
|
program
|
|
174
189
|
.command('cron')
|
|
175
190
|
.argument('[deploy-list]', 'Deploy id list, e.g. default-a,default-b')
|
|
176
|
-
.argument('[job-list]', `Deploy id list, e.g. ${Object.keys(
|
|
177
|
-
.option('--
|
|
191
|
+
.argument('[job-list]', `Deploy id list, e.g. ${Object.keys(Underpost.cron)}, for default all available jobs`)
|
|
192
|
+
.option('--itc', 'Inside container execution context')
|
|
178
193
|
.option('--init', 'Init cron jobs for cron job default deploy id')
|
|
194
|
+
.option('--git', 'Upload to github')
|
|
179
195
|
.description('Cron jobs management')
|
|
180
196
|
.action(Underpost.cron.callback);
|
|
181
197
|
|
|
198
|
+
program
|
|
199
|
+
.command('fs')
|
|
200
|
+
.argument('[path]', 'Absolute or relative directory')
|
|
201
|
+
.option('--rm', 'Remove file')
|
|
202
|
+
.option('--git', 'Current git changes')
|
|
203
|
+
.option('--recursive', 'Upload files recursively')
|
|
204
|
+
.option('--deploy-id <deploy-id>', 'Deploy configuration id')
|
|
205
|
+
.option('--pull', 'Download file')
|
|
206
|
+
.option('--force', 'Force action')
|
|
207
|
+
.description('File storage management, for default upload file')
|
|
208
|
+
.action(Underpost.fs.callback);
|
|
209
|
+
|
|
182
210
|
program
|
|
183
211
|
.command('test')
|
|
184
212
|
.argument('[deploy-list]', 'Deploy id list, e.g. default-a,default-b')
|
|
185
213
|
.description('Manage Test, for default run current underpost default test')
|
|
186
|
-
.option('--
|
|
214
|
+
.option('--itc', 'Inside container execution context')
|
|
187
215
|
.option('--sh', 'Copy to clipboard, container entrypoint shell command')
|
|
188
216
|
.option('--logs', 'Display container logs')
|
|
217
|
+
.option('--pod-name <pod-name>')
|
|
218
|
+
.option('--pod-status <pod-status>')
|
|
219
|
+
.option('--kind-type <kind-type>')
|
|
189
220
|
.action(Underpost.test.callback);
|
|
190
221
|
|
|
191
222
|
program.parse();
|
package/bin/util.js
CHANGED
|
@@ -2,8 +2,6 @@ import fs from 'fs-extra';
|
|
|
2
2
|
import si from 'systeminformation';
|
|
3
3
|
import * as dir from 'path';
|
|
4
4
|
import { svg } from 'font-awesome-assets';
|
|
5
|
-
import axios from 'axios';
|
|
6
|
-
import https from 'https';
|
|
7
5
|
|
|
8
6
|
import { loggerFactory } from '../src/server/logger.js';
|
|
9
7
|
import { pbcopy, shellExec } from '../src/server/process.js';
|
|
@@ -12,11 +10,6 @@ import { FileFactory } from '../src/api/file/file.service.js';
|
|
|
12
10
|
import { faBase64Png, getBufferPngText } from '../src/server/client-icons.js';
|
|
13
11
|
import keyword_extractor from 'keyword-extractor';
|
|
14
12
|
|
|
15
|
-
const httpsAgent = new https.Agent({
|
|
16
|
-
rejectUnauthorized: false,
|
|
17
|
-
});
|
|
18
|
-
axios.defaults.httpsAgent = httpsAgent;
|
|
19
|
-
|
|
20
13
|
const logger = loggerFactory(import.meta);
|
|
21
14
|
|
|
22
15
|
logger.info('argv', process.argv);
|
package/bin/vs.js
CHANGED
|
@@ -20,6 +20,7 @@ switch (process.argv[2]) {
|
|
|
20
20
|
logger.info('Open new vs windows', 'Ctrl Shift N');
|
|
21
21
|
logger.info('Close current vs windows', 'Ctrl Shift W');
|
|
22
22
|
logger.info('Preview md', 'Ctrl shift V');
|
|
23
|
+
logger.info('Open git changes', 'Ctrl G + G');
|
|
23
24
|
logger.warn('Terminal shortcut configure with command pallette', 'Ctl shift T');
|
|
24
25
|
break;
|
|
25
26
|
}
|
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
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
kind: Cluster
|
|
2
|
+
apiVersion: kind.x-k8s.io/v1alpha4
|
|
3
|
+
nodes:
|
|
4
|
+
- role: control-plane
|
|
5
|
+
- role: worker
|
|
6
|
+
# extraPortMappings:
|
|
7
|
+
# - containerPort: 80
|
|
8
|
+
# hostPort: 80
|
|
9
|
+
# listenAddress: '0.0.0.0'
|
|
10
|
+
# - containerPort: 443
|
|
11
|
+
# hostPort: 443
|
|
12
|
+
# listenAddress: '0.0.0.0'
|