underpost 2.8.843 → 2.8.844
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 → ghpkg.ci.yml} +1 -1
- package/.github/workflows/{npmpkg.yml → npmpkg.ci.yml} +1 -1
- package/.github/workflows/{publish.yml → publish.ci.yml} +1 -1
- package/.github/workflows/{pwa-microservices-template.page.yml → pwa-microservices-template-page.cd.yml} +1 -1
- package/.github/workflows/{pwa-microservices-template.test.yml → pwa-microservices-template-test.ci.yml} +1 -1
- package/.vscode/settings.json +0 -1
- package/README.md +12 -2
- package/bin/build.js +8 -5
- package/bin/deploy.js +10 -69
- package/bin/file.js +15 -11
- package/cli.md +47 -43
- package/docker-compose.yml +1 -1
- package/manifests/deployment/dd-template-development/deployment.yaml +2 -2
- package/manifests/maas/gpu-diag.sh +1 -1
- package/package.json +3 -4
- package/src/api/user/user.router.js +24 -1
- package/src/cli/cluster.js +19 -10
- package/src/cli/index.js +1 -0
- package/src/cli/run.js +21 -0
- package/src/client/components/core/CssCore.js +0 -4
- package/src/client/components/core/Docs.js +1 -47
- package/src/client/components/core/EventsUI.js +92 -5
- package/src/client/components/core/Modal.js +431 -87
- package/src/client/components/core/NotificationManager.js +2 -2
- package/src/client/components/core/Panel.js +2 -2
- package/src/client/components/core/PanelForm.js +2 -0
- package/src/client/components/core/Recover.js +1 -1
- package/src/index.js +1 -1
- package/src/server/client-build.js +0 -20
- package/src/server/valkey.js +102 -41
package/.vscode/settings.json
CHANGED
package/README.md
CHANGED
|
@@ -30,10 +30,15 @@ template
|
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
33
38
|
<!-- badges -->
|
|
34
39
|
|
|
35
40
|
|
|
36
|
-
[](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.844) [](https://coveralls.io/github/underpostnet/engine?branch=master) [](https://www.npmjs.org/package/underpost) [](https://www.npmjs.com/package/underpost)
|
|
37
42
|
|
|
38
43
|
|
|
39
44
|
<!-- end-badges -->
|
|
@@ -46,6 +51,11 @@ template
|
|
|
46
51
|
|
|
47
52
|
|
|
48
53
|
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
49
59
|
</div>
|
|
50
60
|
|
|
51
61
|
<div align="center">
|
|
@@ -90,7 +100,7 @@ Run dev client server
|
|
|
90
100
|
npm run dev
|
|
91
101
|
```
|
|
92
102
|
<!-- -->
|
|
93
|
-
## underpost ci/cd cli v2.8.
|
|
103
|
+
## underpost ci/cd cli v2.8.844
|
|
94
104
|
|
|
95
105
|
### Usage: `underpost [options] [command]`
|
|
96
106
|
```
|
package/bin/build.js
CHANGED
|
@@ -150,10 +150,6 @@ const { DefaultConf } = await import(`../conf.${confName}.js`);
|
|
|
150
150
|
shellExec(`node bin/deploy update-default-conf ${confName}`);
|
|
151
151
|
|
|
152
152
|
fs.copyFileSync(`./conf.${confName}.js`, `${basePath}/conf.js`);
|
|
153
|
-
fs.copyFileSync(
|
|
154
|
-
`./.github/workflows/engine.${confName.split('dd-')[1]}.ci.yml`,
|
|
155
|
-
`${basePath}/.github/workflows/engine.${confName.split('dd-')[1]}.ci.yml`,
|
|
156
|
-
);
|
|
157
153
|
|
|
158
154
|
switch (confName) {
|
|
159
155
|
case 'dd-cyberia':
|
|
@@ -183,5 +179,12 @@ const { DefaultConf } = await import(`../conf.${confName}.js`);
|
|
|
183
179
|
fs.copyFileSync(`./manifests/deployment/${confName}-${env}/${file}`, `${basePath}/${file}`);
|
|
184
180
|
}
|
|
185
181
|
}
|
|
186
|
-
|
|
182
|
+
|
|
183
|
+
if (!fs.existsSync(`${basePath}/.github/workflows`))
|
|
184
|
+
fs.mkdirSync(`${basePath}/.github/workflows`, {
|
|
185
|
+
recursive: true,
|
|
186
|
+
});
|
|
187
|
+
|
|
188
|
+
fs.copyFileSync(`./.github/workflows/${repoName}.ci.yml`, `${basePath}/.github/workflows/${repoName}.ci.yml`);
|
|
189
|
+
fs.copyFileSync(`./.github/workflows/${repoName}.cd.yml`, `${basePath}/.github/workflows/${repoName}.cd.yml`);
|
|
187
190
|
}
|
package/bin/deploy.js
CHANGED
|
@@ -531,74 +531,6 @@ try {
|
|
|
531
531
|
if (!proxyInstance) for (const host of Object.keys(serverConf)) port += Object.keys(serverConf[host]).length;
|
|
532
532
|
}
|
|
533
533
|
break;
|
|
534
|
-
case 'uml':
|
|
535
|
-
{
|
|
536
|
-
shellExec(`node bin/deploy fix-uml ${process.argv.slice(3).join(' ')}`);
|
|
537
|
-
shellExec(`node bin/deploy build-uml ${process.argv.slice(3).join(' ')}`);
|
|
538
|
-
}
|
|
539
|
-
break;
|
|
540
|
-
|
|
541
|
-
case 'fix-uml': {
|
|
542
|
-
// required: java jdk-11.0.1
|
|
543
|
-
|
|
544
|
-
// comment:
|
|
545
|
-
// '--add-opens=java.xml/com.sun.org.apache.xalan.internal.xsltc.trax="ALL-UNNAMED"'
|
|
546
|
-
// in plantuml.js src
|
|
547
|
-
|
|
548
|
-
// const deployId = process.argv[3];
|
|
549
|
-
// const clientId = process.argv[4];
|
|
550
|
-
// const folder = `./src/client/public/${clientId ? clientId : 'default'}/docs/plantuml`;
|
|
551
|
-
// const privateConfFolder = `./engine-private/conf/${deployId}`;
|
|
552
|
-
// const confData = !deployId
|
|
553
|
-
// ? Config.default
|
|
554
|
-
// : {
|
|
555
|
-
// client: JSON.parse(fs.readFileSync(`${privateConfFolder}/conf.client.json`, 'utf8')),
|
|
556
|
-
// ssr: JSON.parse(fs.readFileSync(`${privateConfFolder}/conf.ssr.json`, 'utf8')),
|
|
557
|
-
// server: JSON.parse(fs.readFileSync(`${privateConfFolder}/conf.server.json`, 'utf8')),
|
|
558
|
-
// cron: JSON.parse(fs.readFileSync(`${privateConfFolder}/conf.cron.json`, 'utf8')),
|
|
559
|
-
// };
|
|
560
|
-
|
|
561
|
-
fs.writeFileSync(
|
|
562
|
-
`./node_modules/plantuml/lib/plantuml.js`,
|
|
563
|
-
fs
|
|
564
|
-
.readFileSync(`./node_modules/plantuml/lib/plantuml.js`, 'utf8')
|
|
565
|
-
.replace(`'--add-opens=java.xml/com.sun.org.apache.xalan.internal.xsltc.trax="ALL-UNNAMED"'`, `//`),
|
|
566
|
-
);
|
|
567
|
-
}
|
|
568
|
-
case 'build-uml':
|
|
569
|
-
{
|
|
570
|
-
const plantuml = await import('plantuml');
|
|
571
|
-
const folder = process.argv[3] ? process.argv[3] : `./src/client/public/default/plantuml`;
|
|
572
|
-
const confData = Config.default;
|
|
573
|
-
|
|
574
|
-
if (!fs.existsSync(folder)) fs.mkdirSync(folder, { recursive: true });
|
|
575
|
-
|
|
576
|
-
for (const typeConf of Object.keys(confData)) {
|
|
577
|
-
logger.info(`generate ${typeConf} instance`);
|
|
578
|
-
try {
|
|
579
|
-
const svg = await plantuml(`
|
|
580
|
-
@startjson
|
|
581
|
-
${JSON.stringify(confData[typeConf])}
|
|
582
|
-
@endjson
|
|
583
|
-
`);
|
|
584
|
-
fs.writeFileSync(`${folder}/${typeConf}-conf.svg`, svg);
|
|
585
|
-
} catch (error) {
|
|
586
|
-
logger.error(error, error.stack);
|
|
587
|
-
}
|
|
588
|
-
logger.info(`generate ${typeConf} schema`);
|
|
589
|
-
try {
|
|
590
|
-
const svg = await plantuml(`
|
|
591
|
-
@startjson
|
|
592
|
-
${JSON.stringify(ejs(confData[typeConf]))}
|
|
593
|
-
@endjson
|
|
594
|
-
`);
|
|
595
|
-
fs.writeFileSync(`${folder}/${typeConf}-schema.svg`, svg);
|
|
596
|
-
} catch (error) {
|
|
597
|
-
logger.error(error, error.stack);
|
|
598
|
-
}
|
|
599
|
-
}
|
|
600
|
-
}
|
|
601
|
-
break;
|
|
602
534
|
|
|
603
535
|
case 'build-single-replica': {
|
|
604
536
|
const deployId = process.argv[3];
|
|
@@ -682,6 +614,15 @@ try {
|
|
|
682
614
|
}
|
|
683
615
|
|
|
684
616
|
case 'version-build': {
|
|
617
|
+
shellCd(`/home/dd/engine`);
|
|
618
|
+
shellExec(`git reset`);
|
|
619
|
+
shellExec(`git checkout .`);
|
|
620
|
+
shellExec(`git clean -f -d`);
|
|
621
|
+
shellCd(`/home/dd/engine/engine-private`);
|
|
622
|
+
shellExec(`git reset`);
|
|
623
|
+
shellExec(`git checkout .`);
|
|
624
|
+
shellExec(`git clean -f -d`);
|
|
625
|
+
shellCd(`/home/dd/engine`);
|
|
685
626
|
const originPackageJson = JSON.parse(fs.readFileSync(`package.json`, 'utf8'));
|
|
686
627
|
const newVersion = process.argv[3] ?? originPackageJson.version;
|
|
687
628
|
const { version } = originPackageJson;
|
|
@@ -863,7 +804,7 @@ ${shellExec(`git log | grep Author: | sort -u`, { stdout: true }).split(`\n`).jo
|
|
|
863
804
|
// mongodb-0.mongodb-service
|
|
864
805
|
DefaultConf.server[host][path].db.host = 'mongodb://mongodb-service:27017';
|
|
865
806
|
confName = '';
|
|
866
|
-
} else if (confName) {
|
|
807
|
+
} else if (confName && fs.existsSync(`./engine-private/conf/${confName}`)) {
|
|
867
808
|
DefaultConf.client = JSON.parse(fs.readFileSync(`./engine-private/conf/${confName}/conf.client.json`, 'utf8'));
|
|
868
809
|
DefaultConf.server = JSON.parse(fs.readFileSync(`./engine-private/conf/${confName}/conf.server.json`, 'utf8'));
|
|
869
810
|
DefaultConf.ssr = JSON.parse(fs.readFileSync(`./engine-private/conf/${confName}/conf.ssr.json`, 'utf8'));
|
package/bin/file.js
CHANGED
|
@@ -72,23 +72,14 @@ try {
|
|
|
72
72
|
|
|
73
73
|
if (type === 'update-template') {
|
|
74
74
|
fs.copySync(`./.vscode`, `../pwa-microservices-template/.vscode`);
|
|
75
|
-
fs.copySync(`./.github`, `../pwa-microservices-template/.github`);
|
|
75
|
+
// fs.copySync(`./.github`, `../pwa-microservices-template/.github`);
|
|
76
76
|
fs.copySync(`./src/client/public/default`, `../pwa-microservices-template/src/client/public/default`);
|
|
77
77
|
|
|
78
78
|
for (const checkoutPath of ['README.md', 'package-lock.json', 'package.json'])
|
|
79
79
|
shellExec(`cd ../pwa-microservices-template && git checkout ${checkoutPath}`);
|
|
80
80
|
|
|
81
81
|
for (const deletePath of [
|
|
82
|
-
'
|
|
83
|
-
'.github/workflows/docker-image.yml',
|
|
84
|
-
'.github/workflows/deploy.ssh.yml',
|
|
85
|
-
'.github/workflows/deploy.api-rest.yml',
|
|
86
|
-
'.github/workflows/engine.lampp.ci.yml',
|
|
87
|
-
'.github/workflows/engine.core.ci.yml',
|
|
88
|
-
'.github/workflows/engine.cyberia.ci.yml',
|
|
89
|
-
'.github/workflows/deploy.dd-core.yml',
|
|
90
|
-
'.github/workflows/deploy.dd-cyberia.yml',
|
|
91
|
-
'.github/workflows/deploy.dd-lampp.yml',
|
|
82
|
+
'./.github',
|
|
92
83
|
'./manifests/deployment/dd-lampp-development',
|
|
93
84
|
'./manifests/deployment/dd-cyberia-development',
|
|
94
85
|
'./manifests/deployment/dd-core-development',
|
|
@@ -97,6 +88,19 @@ try {
|
|
|
97
88
|
]) {
|
|
98
89
|
if (fs.existsSync(deletePath)) fs.removeSync('../pwa-microservices-template/' + deletePath);
|
|
99
90
|
}
|
|
91
|
+
|
|
92
|
+
fs.mkdirSync(`../pwa-microservices-template/.github/workflows`, {
|
|
93
|
+
recursive: true,
|
|
94
|
+
});
|
|
95
|
+
for (const _path of [
|
|
96
|
+
`./.github/workflows/pwa-microservices-template-page.cd.yml`,
|
|
97
|
+
`./.github/workflows/pwa-microservices-template-test.ci.yml`,
|
|
98
|
+
`./.github/workflows/npmpkg.ci.yml`,
|
|
99
|
+
`./.github/workflows/ghpkg.ci.yml`,
|
|
100
|
+
`./.github/workflows/publish.ci.yml`,
|
|
101
|
+
])
|
|
102
|
+
fs.copyFileSync(_path, `../pwa-microservices-template/${_path}`);
|
|
103
|
+
|
|
100
104
|
const originPackageJson = JSON.parse(fs.readFileSync('./package.json', 'utf8'));
|
|
101
105
|
const templatePackageJson = JSON.parse(fs.readFileSync('../pwa-microservices-template/package.json', 'utf8'));
|
|
102
106
|
|
package/cli.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
## underpost ci/cd cli v2.8.
|
|
1
|
+
## underpost ci/cd cli v2.8.844
|
|
2
2
|
|
|
3
3
|
### Usage: `underpost [options] [command]`
|
|
4
4
|
```
|
|
@@ -206,49 +206,53 @@ Options:
|
|
|
206
206
|
Manages Kubernetes clusters, defaulting to Kind cluster initialization.
|
|
207
207
|
|
|
208
208
|
Arguments:
|
|
209
|
-
pod-name
|
|
209
|
+
pod-name Optional: Filters information by a specific pod name.
|
|
210
210
|
|
|
211
211
|
Options:
|
|
212
|
-
--reset
|
|
213
|
-
|
|
214
|
-
--mariadb
|
|
215
|
-
--mysql
|
|
216
|
-
--mongodb
|
|
217
|
-
--
|
|
218
|
-
--
|
|
219
|
-
|
|
220
|
-
--
|
|
221
|
-
|
|
222
|
-
--
|
|
223
|
-
|
|
224
|
-
--
|
|
225
|
-
|
|
226
|
-
--
|
|
227
|
-
|
|
228
|
-
--
|
|
229
|
-
|
|
230
|
-
--
|
|
231
|
-
|
|
232
|
-
--
|
|
233
|
-
|
|
234
|
-
--
|
|
235
|
-
|
|
236
|
-
--
|
|
237
|
-
|
|
238
|
-
--
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
--
|
|
246
|
-
|
|
247
|
-
--
|
|
248
|
-
|
|
249
|
-
--
|
|
250
|
-
|
|
251
|
-
|
|
212
|
+
--reset Deletes all clusters and prunes all related data and
|
|
213
|
+
caches.
|
|
214
|
+
--mariadb Initializes the cluster with a MariaDB statefulset.
|
|
215
|
+
--mysql Initializes the cluster with a MySQL statefulset.
|
|
216
|
+
--mongodb Initializes the cluster with a MongoDB statefulset.
|
|
217
|
+
--mongo-db-host <host> Set custom mongo db host
|
|
218
|
+
--postgresql Initializes the cluster with a PostgreSQL
|
|
219
|
+
statefulset.
|
|
220
|
+
--mongodb4 Initializes the cluster with a MongoDB 4.4 service.
|
|
221
|
+
--valkey Initializes the cluster with a Valkey service.
|
|
222
|
+
--contour Initializes the cluster with Project Contour base
|
|
223
|
+
HTTPProxy and Envoy.
|
|
224
|
+
--cert-manager Initializes the cluster with a Let's Encrypt
|
|
225
|
+
production ClusterIssuer.
|
|
226
|
+
--dedicated-gpu Initializes the cluster with dedicated GPU base
|
|
227
|
+
resources and environment settings.
|
|
228
|
+
--info Retrieves information about all deployed Kubernetes
|
|
229
|
+
objects.
|
|
230
|
+
--full Initializes the cluster with all available
|
|
231
|
+
statefulsets and services.
|
|
232
|
+
--ns-use <ns-name> Switches the current Kubernetes context to the
|
|
233
|
+
specified namespace.
|
|
234
|
+
--kubeadm Initializes the cluster using kubeadm for control
|
|
235
|
+
plane management.
|
|
236
|
+
--dev Initializes a development-specific cluster
|
|
237
|
+
configuration.
|
|
238
|
+
--list-pods Displays detailed information about all pods.
|
|
239
|
+
--info-capacity Displays the current total machine capacity
|
|
240
|
+
information.
|
|
241
|
+
--info-capacity-pod Displays the current machine capacity information per
|
|
242
|
+
pod.
|
|
243
|
+
--pull-image Sets an optional associated image to pull during
|
|
244
|
+
initialization.
|
|
245
|
+
--init-host Installs necessary Kubernetes node CLI tools (e.g.,
|
|
246
|
+
kind, kubeadm, docker, podman, helm).
|
|
247
|
+
--uninstall-host Uninstalls all host components installed by
|
|
248
|
+
init-host.
|
|
249
|
+
--config Sets the base Kubernetes node configuration.
|
|
250
|
+
--worker Sets the context for a worker node.
|
|
251
|
+
--chown Sets the appropriate ownership for Kubernetes
|
|
252
|
+
kubeconfig files.
|
|
253
|
+
--k3s Initializes the cluster using K3s (Lightweight
|
|
254
|
+
Kubernetes).
|
|
255
|
+
-h, --help display help for command
|
|
252
256
|
|
|
253
257
|
```
|
|
254
258
|
|
|
@@ -554,7 +558,7 @@ Options:
|
|
|
554
558
|
Runs a script from the specified path.
|
|
555
559
|
|
|
556
560
|
Arguments:
|
|
557
|
-
runner-id The runner ID to run. Options: spark-template, rmi, kill, secret, gpu-env, tf-gpu-test, ide, monitor, db-client, cluster, deploy, tf-vae-test, deploy-job.
|
|
561
|
+
runner-id The runner ID to run. Options: spark-template, rmi, kill, secret, gpu-env, tf-gpu-test, dev-cluster, cyberia-ide, engine-ide, ide, monitor, db-client, cluster, deploy, tf-vae-test, deploy-job.
|
|
558
562
|
path The absolute or relative directory path where the script is located.
|
|
559
563
|
|
|
560
564
|
Options:
|
package/docker-compose.yml
CHANGED
|
@@ -17,7 +17,7 @@ spec:
|
|
|
17
17
|
spec:
|
|
18
18
|
containers:
|
|
19
19
|
- name: dd-template-development-blue
|
|
20
|
-
image: localhost/rockylinux9-underpost:v2.8.
|
|
20
|
+
image: localhost/rockylinux9-underpost:v2.8.844
|
|
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-template-development-green
|
|
103
|
-
image: localhost/rockylinux9-underpost:v2.8.
|
|
103
|
+
image: localhost/rockylinux9-underpost:v2.8.844
|
|
104
104
|
# resources:
|
|
105
105
|
# requests:
|
|
106
106
|
# memory: "124Ki"
|
|
@@ -5,7 +5,7 @@ sudo lspci -nnk | egrep -i 'vga|3d' -A3
|
|
|
5
5
|
lsmod | egrep 'nvidia|nouveau|amdgpu' || true
|
|
6
6
|
|
|
7
7
|
# if exists nvidia tool
|
|
8
|
-
nvidia-smi 2>/dev/null || echo "nvidia-smi
|
|
8
|
+
nvidia-smi 2>/dev/null || echo "nvidia-smi not found"
|
|
9
9
|
|
|
10
10
|
# kernel related errors
|
|
11
11
|
sudo dmesg | egrep -i 'nvidia|nouveau|amdgpu' --color=auto
|
package/package.json
CHANGED
|
@@ -2,10 +2,11 @@
|
|
|
2
2
|
"type": "module",
|
|
3
3
|
"main": "src/index.js",
|
|
4
4
|
"name": "underpost",
|
|
5
|
-
"version": "2.8.
|
|
5
|
+
"version": "2.8.844",
|
|
6
6
|
"description": "pwa api rest template",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"start": "env-cmd -f .env.production node --max-old-space-size=8192 src/server",
|
|
9
|
+
"build": "node bin/deploy build-full-client",
|
|
9
10
|
"test": "env-cmd -f .env.test c8 mocha",
|
|
10
11
|
"pm2": "env-cmd -f .env.production pm2 start src/server.js --node-args=\"--max-old-space-size=8192\" --name engine",
|
|
11
12
|
"dev": "env-cmd -f .env.development node src/client.dev default",
|
|
@@ -23,8 +24,7 @@
|
|
|
23
24
|
"docker:start": "docker-compose up",
|
|
24
25
|
"prettier": "prettier --write .",
|
|
25
26
|
"fix": "npm audit fix --force && npm audit",
|
|
26
|
-
"changelog": "auto-changelog"
|
|
27
|
-
"build": "node bin/deploy build-full-client"
|
|
27
|
+
"changelog": "auto-changelog"
|
|
28
28
|
},
|
|
29
29
|
"bin": {
|
|
30
30
|
"underpost": "bin/index.js"
|
|
@@ -99,7 +99,6 @@
|
|
|
99
99
|
"peer": "^1.0.2",
|
|
100
100
|
"peerjs": "^1.5.2",
|
|
101
101
|
"pixi.js": "7.4.2",
|
|
102
|
-
"plantuml": "^0.0.2",
|
|
103
102
|
"prom-client": "^15.1.2",
|
|
104
103
|
"public-ip": "^6.0.1",
|
|
105
104
|
"read": "^2.1.0",
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { authMiddleware } from '../../server/auth.js';
|
|
1
|
+
import { authMiddleware, hashPassword } from '../../server/auth.js';
|
|
2
2
|
import fs from 'fs-extra';
|
|
3
3
|
import { loggerFactory } from '../../server/logger.js';
|
|
4
4
|
import { UserController } from './user.controller.js';
|
|
5
5
|
import express from 'express';
|
|
6
|
+
import { DataBaseProvider } from '../../db/DataBaseProvider.js';
|
|
6
7
|
|
|
7
8
|
const logger = loggerFactory(import.meta);
|
|
8
9
|
|
|
@@ -10,6 +11,28 @@ const UserRouter = (options) => {
|
|
|
10
11
|
const router = express.Router();
|
|
11
12
|
|
|
12
13
|
(async () => {
|
|
14
|
+
const models = DataBaseProvider.instance[`${options.host}${options.path}`].mongoose.models;
|
|
15
|
+
if (models.User) {
|
|
16
|
+
try {
|
|
17
|
+
const adminUser = await models.User.findOne({ role: 'admin' });
|
|
18
|
+
if (!adminUser) {
|
|
19
|
+
const defaultPassword = process.env.DEFAULT_ADMIN_PASSWORD || 'changethis';
|
|
20
|
+
const hashedPassword = hashPassword(defaultPassword);
|
|
21
|
+
|
|
22
|
+
const result = await models.User.create({
|
|
23
|
+
username: 'admin',
|
|
24
|
+
email: process.env.DEFAULT_ADMIN_EMAIL || 'admin@' + options.host,
|
|
25
|
+
password: hashedPassword,
|
|
26
|
+
role: 'admin',
|
|
27
|
+
emailConfirmed: true,
|
|
28
|
+
publicKey: [],
|
|
29
|
+
});
|
|
30
|
+
logger.warn('Default admin user created. Please change the default password immediately!', result._doc);
|
|
31
|
+
}
|
|
32
|
+
} catch (error) {
|
|
33
|
+
logger.error('Error checking/creating admin user:', error);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
13
36
|
options.png = {
|
|
14
37
|
buffer: {
|
|
15
38
|
'invalid-token': fs.readFileSync(`./src/client/public/default/assets/mailer/api-user-invalid-token.png`),
|
package/src/cli/cluster.js
CHANGED
|
@@ -19,6 +19,7 @@ class UnderpostCluster {
|
|
|
19
19
|
* @param {object} [options] - Configuration options for cluster initialization.
|
|
20
20
|
* @param {boolean} [options.mongodb=false] - Deploy MongoDB.
|
|
21
21
|
* @param {boolean} [options.mongodb4=false] - Deploy MongoDB 4.4.
|
|
22
|
+
* @param {String} [options.mongoDbHost=''] - Set custom mongo db host
|
|
22
23
|
* @param {boolean} [options.mariadb=false] - Deploy MariaDB.
|
|
23
24
|
* @param {boolean} [options.mysql=false] - Deploy MySQL.
|
|
24
25
|
* @param {boolean} [options.postgresql=false] - Deploy PostgreSQL.
|
|
@@ -48,6 +49,7 @@ class UnderpostCluster {
|
|
|
48
49
|
options = {
|
|
49
50
|
mongodb: false,
|
|
50
51
|
mongodb4: false,
|
|
52
|
+
mongoDbHost: '',
|
|
51
53
|
mariadb: false,
|
|
52
54
|
mysql: false,
|
|
53
55
|
postgresql: false,
|
|
@@ -271,6 +273,7 @@ class UnderpostCluster {
|
|
|
271
273
|
}
|
|
272
274
|
shellExec(`kubectl delete statefulset valkey-service --ignore-not-found`);
|
|
273
275
|
shellExec(`kubectl apply -k ${underpostRoot}/manifests/valkey`);
|
|
276
|
+
await UnderpostTest.API.statusMonitor('valkey-service', 'Running', 'pods', 1000, 60);
|
|
274
277
|
}
|
|
275
278
|
if (options.full === true || options.mariadb === true) {
|
|
276
279
|
shellExec(
|
|
@@ -288,9 +291,7 @@ class UnderpostCluster {
|
|
|
288
291
|
// For kubeadm/k3s, ensure it's available for containerd
|
|
289
292
|
shellExec(`sudo crictl pull mariadb:latest`);
|
|
290
293
|
}
|
|
291
|
-
|
|
292
|
-
// This storage class is specific to kubeadm setup
|
|
293
|
-
shellExec(`kubectl apply -f ${underpostRoot}/manifests/mariadb/storage-class.yaml`);
|
|
294
|
+
shellExec(`kubectl apply -f ${underpostRoot}/manifests/mariadb/storage-class.yaml`);
|
|
294
295
|
shellExec(`kubectl apply -k ${underpostRoot}/manifests/mariadb`);
|
|
295
296
|
}
|
|
296
297
|
if (options.full === true || options.mysql === true) {
|
|
@@ -334,9 +335,10 @@ class UnderpostCluster {
|
|
|
334
335
|
const successInstance = await UnderpostTest.API.statusMonitor(deploymentName);
|
|
335
336
|
|
|
336
337
|
if (successInstance) {
|
|
338
|
+
if (!options.mongoDbHost) options.mongoDbHost = 'mongodb-service';
|
|
337
339
|
const mongoConfig = {
|
|
338
340
|
_id: 'rs0',
|
|
339
|
-
members: [{ _id: 0, host:
|
|
341
|
+
members: [{ _id: 0, host: `${options.mongoDbHost}:27017` }],
|
|
340
342
|
};
|
|
341
343
|
|
|
342
344
|
const [pod] = UnderpostDeploy.API.get(deploymentName);
|
|
@@ -363,19 +365,26 @@ class UnderpostCluster {
|
|
|
363
365
|
`sudo kubectl create secret generic mongodb-secret --from-file=username=/home/dd/engine/engine-private/mongodb-username --from-file=password=/home/dd/engine/engine-private/mongodb-password --dry-run=client -o yaml | kubectl apply -f -`,
|
|
364
366
|
);
|
|
365
367
|
shellExec(`kubectl delete statefulset mongodb --ignore-not-found`);
|
|
366
|
-
|
|
367
|
-
// This storage class is specific to kubeadm setup
|
|
368
|
-
shellExec(`kubectl apply -f ${underpostRoot}/manifests/mongodb/storage-class.yaml`);
|
|
368
|
+
shellExec(`kubectl apply -f ${underpostRoot}/manifests/mongodb/storage-class.yaml`);
|
|
369
369
|
shellExec(`kubectl apply -k ${underpostRoot}/manifests/mongodb`);
|
|
370
370
|
|
|
371
|
-
const successInstance = await UnderpostTest.API.statusMonitor('mongodb-
|
|
371
|
+
const successInstance = await UnderpostTest.API.statusMonitor('mongodb-0', 'Running', 'pods', 1000, 60 * 10);
|
|
372
372
|
|
|
373
373
|
if (successInstance) {
|
|
374
|
+
if (!options.mongoDbHost) options.mongoDbHost = 'mongodb-service';
|
|
374
375
|
const mongoConfig = {
|
|
375
376
|
_id: 'rs0',
|
|
376
377
|
members: [
|
|
377
|
-
{
|
|
378
|
-
|
|
378
|
+
{
|
|
379
|
+
_id: 0,
|
|
380
|
+
host: `${options.mongoDbHost === 'mongodb-service' ? 'mongodb-0.' : ''}${options.mongoDbHost}:27017`,
|
|
381
|
+
priority: 1,
|
|
382
|
+
},
|
|
383
|
+
// {
|
|
384
|
+
// _id: 1,
|
|
385
|
+
// host: `${options.mongoDbHost === 'mongodb-service' ? 'mongodb-1.' : ''}${options.mongoDbHost}:27017`,
|
|
386
|
+
// priority: 1,
|
|
387
|
+
// },
|
|
379
388
|
],
|
|
380
389
|
};
|
|
381
390
|
|
package/src/cli/index.js
CHANGED
|
@@ -118,6 +118,7 @@ program
|
|
|
118
118
|
.option('--mariadb', 'Initializes the cluster with a MariaDB statefulset.')
|
|
119
119
|
.option('--mysql', 'Initializes the cluster with a MySQL statefulset.')
|
|
120
120
|
.option('--mongodb', 'Initializes the cluster with a MongoDB statefulset.')
|
|
121
|
+
.option('--mongo-db-host <host>', 'Set custom mongo db host')
|
|
121
122
|
.option('--postgresql', 'Initializes the cluster with a PostgreSQL statefulset.')
|
|
122
123
|
.option('--mongodb4', 'Initializes the cluster with a MongoDB 4.4 service.')
|
|
123
124
|
.option('--valkey', 'Initializes the cluster with a Valkey service.')
|
package/src/cli/run.js
CHANGED
|
@@ -65,6 +65,27 @@ class UnderpostRun {
|
|
|
65
65
|
shellExec(`kubectl delete pod tf-gpu-test-pod`);
|
|
66
66
|
shellExec(`kubectl apply -f ${underpostRoot}/manifests/deployment/tensorflow/tf-gpu-test.yaml`);
|
|
67
67
|
},
|
|
68
|
+
'dev-cluster': (path, options = UnderpostRun.DEFAULT_OPTION) => {
|
|
69
|
+
const baseCommand = options.dev ? 'node bin' : 'underpost';
|
|
70
|
+
shellExec(`${baseCommand} cluster${options.dev ? ' --dev' : ''} --reset`);
|
|
71
|
+
shellExec(`${baseCommand} cluster${options.dev ? ' --dev' : ''}`);
|
|
72
|
+
shellExec(
|
|
73
|
+
`${baseCommand} cluster${options.dev ? ' --dev' : ''} --mongodb --mongo-db-host ${'127.0.0.1'} --pull-image`,
|
|
74
|
+
);
|
|
75
|
+
shellExec(`${baseCommand} cluster${options.dev ? ' --dev' : ''} --valkey --pull-image`);
|
|
76
|
+
shellExec(`${baseCommand} deploy --expose mongo`, { async: true });
|
|
77
|
+
shellExec(`${baseCommand} deploy --expose valkey`, { async: true });
|
|
78
|
+
},
|
|
79
|
+
'cyberia-ide': (path, options = UnderpostRun.DEFAULT_OPTION) => {
|
|
80
|
+
const baseCommand = options.dev ? 'node bin' : 'underpost';
|
|
81
|
+
shellExec(`${baseCommand} run ide /home/dd/cyberia-server`);
|
|
82
|
+
shellExec(`${baseCommand} run ide /home/dd/cyberia-client`);
|
|
83
|
+
},
|
|
84
|
+
'engine-ide': (path, options = UnderpostRun.DEFAULT_OPTION) => {
|
|
85
|
+
const baseCommand = options.dev ? 'node bin' : 'underpost';
|
|
86
|
+
shellExec(`${baseCommand} run ide /home/dd/engine`);
|
|
87
|
+
shellExec(`${baseCommand} run ide /home/dd/engine/engine-private`);
|
|
88
|
+
},
|
|
68
89
|
ide: (path, options = UnderpostRun.DEFAULT_OPTION) => {
|
|
69
90
|
const { underpostRoot } = options;
|
|
70
91
|
shellExec(`node ${underpostRoot}/bin/vs ${path}`);
|