underpost 2.8.31 → 2.8.41
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 +10 -7
- package/.github/workflows/pwa-microservices-template.page.yml +10 -3
- package/.vscode/extensions.json +9 -0
- package/.vscode/settings.json +10 -4
- package/AUTHORS.md +16 -5
- package/CHANGELOG.md +8 -0
- package/Dockerfile +19 -26
- package/README.md +1 -1
- package/bin/build.js +278 -0
- package/bin/db.js +2 -24
- package/bin/deploy.js +59 -49
- package/bin/file.js +3 -2
- package/bin/index.js +34 -41
- package/bin/util.js +9 -89
- package/bin/vs.js +22 -0
- package/conf.js +27 -143
- package/docker-compose.yml +1 -1
- package/manifests/core/kustomization.yaml +11 -0
- package/manifests/kind-config.yaml +12 -0
- package/manifests/letsencrypt-prod.yaml +15 -0
- package/package.json +4 -33
- package/src/api/user/user.model.js +7 -2
- package/src/client/components/core/CalendarCore.js +3 -0
- package/src/client/components/core/CommonJs.js +25 -0
- package/src/client/components/core/Modal.js +5 -5
- package/src/client/components/core/Panel.js +3 -1
- package/src/client/components/core/Translate.js +16 -4
- package/src/client/components/core/Validator.js +9 -1
- package/src/client/services/default/default.management.js +4 -2
- package/src/index.js +8 -1
- package/src/runtime/lampp/Lampp.js +1 -13
- package/src/runtime/xampp/Xampp.js +0 -13
- package/src/server/auth.js +3 -3
- package/src/server/client-build.js +3 -13
- package/src/server/conf.js +294 -27
- package/src/server/dns.js +2 -3
- package/src/server/logger.js +10 -5
- package/src/server/network.js +0 -36
- package/src/server/process.js +1 -1
- package/src/server/project.js +39 -0
- package/src/server/proxy.js +4 -26
- package/src/server/runtime.js +6 -7
- package/manifests/test/underpost-engine-pod.yaml +0 -108
- package/src/server/prompt-optimizer.js +0 -28
- /package/manifests/{underpost-engine-backup-access.yaml → core/underpost-engine-backup-access.yaml} +0 -0
- /package/manifests/{underpost-engine-backup-pv-pvc.yaml → core/underpost-engine-backup-pv-pvc.yaml} +0 -0
- /package/manifests/{underpost-engine-headless-service.yaml → core/underpost-engine-headless-service.yaml} +0 -0
- /package/manifests/{underpost-engine-mongodb-backup-cronjob.yaml → core/underpost-engine-mongodb-backup-cronjob.yaml} +0 -0
- /package/manifests/{test → core}/underpost-engine-mongodb-configmap.yaml +0 -0
- /package/manifests/{underpost-engine-pv-pvc.yaml → core/underpost-engine-pv-pvc.yaml} +0 -0
- /package/manifests/{underpost-engine-statefulset.yaml → core/underpost-engine-statefulset.yaml} +0 -0
- /package/manifests/{test → deployment}/mongo-express.yaml +0 -0
- /package/manifests/{test → deployment}/phpmyadmin.yaml +0 -0
|
@@ -19,6 +19,7 @@ jobs:
|
|
|
19
19
|
id-token: write
|
|
20
20
|
steps:
|
|
21
21
|
- uses: actions/checkout@v3
|
|
22
|
+
|
|
22
23
|
- uses: actions/setup-node@v4
|
|
23
24
|
with:
|
|
24
25
|
node-version: '22.x'
|
|
@@ -32,10 +33,10 @@ jobs:
|
|
|
32
33
|
git config --global credential.helper ""
|
|
33
34
|
git config credential.helper ""
|
|
34
35
|
git config --global user.name 'underpostnet'
|
|
35
|
-
git config --global user.email '
|
|
36
|
+
git config --global user.email 'development@underpost.net'
|
|
36
37
|
git config --global credential.interactive always
|
|
37
38
|
git config user.name 'underpostnet'
|
|
38
|
-
git config user.email '
|
|
39
|
+
git config user.email 'development@underpost.net'
|
|
39
40
|
git config credential.interactive always
|
|
40
41
|
|
|
41
42
|
- name: Clone github package repository
|
|
@@ -59,6 +60,7 @@ jobs:
|
|
|
59
60
|
id-token: write
|
|
60
61
|
steps:
|
|
61
62
|
- uses: actions/checkout@v3
|
|
63
|
+
|
|
62
64
|
- uses: actions/setup-node@v4
|
|
63
65
|
with:
|
|
64
66
|
node-version: '22.x'
|
|
@@ -86,25 +88,26 @@ jobs:
|
|
|
86
88
|
|
|
87
89
|
- name: Clone github package repository
|
|
88
90
|
run: |
|
|
89
|
-
git clone https://github.com/underpostnet/pwa-microservices-template-ghpkg.git
|
|
91
|
+
git clone --bare https://github.com/underpostnet/pwa-microservices-template-ghpkg.git
|
|
90
92
|
rm -rf ./.git
|
|
91
|
-
cp -a
|
|
92
|
-
rm -rf ./pwa-microservices-template-ghpkg
|
|
93
|
+
cp -rf -a ./pwa-microservices-template-ghpkg.git ./.git
|
|
94
|
+
rm -rf ./pwa-microservices-template-ghpkg.git
|
|
93
95
|
|
|
94
96
|
- name: Set git credentials
|
|
95
97
|
run: |
|
|
96
98
|
git config --global credential.helper ""
|
|
97
99
|
git config credential.helper ""
|
|
98
100
|
git config --global user.name 'underpostnet'
|
|
99
|
-
git config --global user.email '
|
|
101
|
+
git config --global user.email 'development@underpost.net'
|
|
100
102
|
git config --global credential.interactive always
|
|
101
103
|
git config user.name 'underpostnet'
|
|
102
|
-
git config user.email '
|
|
104
|
+
git config user.email 'development@underpost.net'
|
|
103
105
|
git config credential.interactive always
|
|
104
106
|
|
|
105
107
|
- name: Push to github package repository
|
|
106
108
|
run: |
|
|
107
109
|
pwd
|
|
110
|
+
git init
|
|
108
111
|
git status
|
|
109
112
|
git remote set-url origin git@github.com:underpostnet/pwa-microservices-template-ghpkg.git
|
|
110
113
|
git add .
|
|
@@ -32,6 +32,10 @@ jobs:
|
|
|
32
32
|
steps:
|
|
33
33
|
- name: Checkout
|
|
34
34
|
uses: actions/checkout@v4
|
|
35
|
+
# with:
|
|
36
|
+
# lfs: true
|
|
37
|
+
# - name: Checkout LFS objects
|
|
38
|
+
# run: git lfs checkout
|
|
35
39
|
- uses: actions/setup-node@v4
|
|
36
40
|
with:
|
|
37
41
|
node-version: '22.x'
|
|
@@ -39,9 +43,12 @@ jobs:
|
|
|
39
43
|
- name: Build the site
|
|
40
44
|
run: |
|
|
41
45
|
npm install
|
|
42
|
-
node bin/deploy update-default-conf
|
|
43
|
-
|
|
44
|
-
|
|
46
|
+
node bin/deploy update-default-conf ghpkg
|
|
47
|
+
env-cmd -f .env.production node bin/deploy build-full-client github-pages underpostnet.github.io /pwa-microservices-template-ghpkg
|
|
48
|
+
# git lfs install
|
|
49
|
+
# git lfs track
|
|
50
|
+
# git lfs ls-files
|
|
51
|
+
# git lfs pull
|
|
45
52
|
- name: Setup Pages
|
|
46
53
|
uses: actions/configure-pages@v5
|
|
47
54
|
- name: Upload artifact
|
package/.vscode/extensions.json
CHANGED
|
@@ -2,7 +2,16 @@
|
|
|
2
2
|
"recommendations": [
|
|
3
3
|
"antiantisepticeye.vscode-color-picker",
|
|
4
4
|
"bashmish.es6-string-css",
|
|
5
|
+
"eamodio.gitlens",
|
|
5
6
|
"esbenp.prettier-vscode",
|
|
7
|
+
"foxundermoon.shell-format",
|
|
8
|
+
"github.vscode-github-actions",
|
|
9
|
+
"mintlify.document",
|
|
10
|
+
"ms-python.black-formatter",
|
|
11
|
+
"ms-python.debugpy",
|
|
12
|
+
"ms-python.python",
|
|
13
|
+
"ms-python.vscode-pylance",
|
|
14
|
+
"streetsidesoftware.code-spell-checker",
|
|
6
15
|
"tabnine.tabnine-vscode",
|
|
7
16
|
"tobermory.es6-string-html"
|
|
8
17
|
]
|
package/.vscode/settings.json
CHANGED
|
@@ -48,6 +48,7 @@
|
|
|
48
48
|
"Microdata",
|
|
49
49
|
"minami",
|
|
50
50
|
"MMORPG",
|
|
51
|
+
"mongosh",
|
|
51
52
|
"mysqldump",
|
|
52
53
|
"neodrag",
|
|
53
54
|
"nexodev",
|
|
@@ -69,9 +70,6 @@
|
|
|
69
70
|
"xfwd",
|
|
70
71
|
"youtu"
|
|
71
72
|
],
|
|
72
|
-
"[dockerfile]": {
|
|
73
|
-
"editor.defaultFormatter": "ms-azuretools.vscode-docker"
|
|
74
|
-
},
|
|
75
73
|
"[php]": {
|
|
76
74
|
"editor.defaultFormatter": "bmewburn.vscode-intelephense-client"
|
|
77
75
|
},
|
|
@@ -107,5 +105,13 @@
|
|
|
107
105
|
},
|
|
108
106
|
"[solidity]": {
|
|
109
107
|
"editor.defaultFormatter": "JuanBlanco.solidity"
|
|
110
|
-
}
|
|
108
|
+
},
|
|
109
|
+
"[dockerfile]": {
|
|
110
|
+
"editor.defaultFormatter": "foxundermoon.shell-format"
|
|
111
|
+
},
|
|
112
|
+
"[ignore]": {
|
|
113
|
+
"editor.defaultFormatter": "foxundermoon.shell-format"
|
|
114
|
+
},
|
|
115
|
+
"docwriter.progress.trackTypes": true,
|
|
116
|
+
"docwriter.hotkey.mac": "⌘ + ."
|
|
111
117
|
}
|
package/AUTHORS.md
CHANGED
|
@@ -1,10 +1,21 @@
|
|
|
1
1
|
# Authors
|
|
2
2
|
|
|
3
|
-
#### Ordered by first contribution.
|
|
4
3
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
Author: fcoverdugoa <52893447+underpostnet@users.noreply.github.com>
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
Author: fcoverdugoa <fcoverdugoa@underpost.net>
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
Author: fcoverdugo <fcoverdugoa@underpost.net>
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
Author: underpost.net <52893447+underpostnet@users.noreply.github.com>
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
Author: underpostnet <fcoverdugoa@underpost.net>
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
9
20
|
|
|
10
21
|
#### Generated by [underpost.net](https://underpost.net)
|
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,14 @@ 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.31](https://github.com/underpostnet/engine/compare/v2.8.1...v2.8.31)
|
|
8
|
+
|
|
9
|
+
> 5 February 2025
|
|
10
|
+
|
|
11
|
+
- build(clipboardy): 🛠 add cli copy paste [`18acbde`](https://github.com/underpostnet/engine/commit/18acbded151da88499a3a0f1c1bfdbdef2abfc6b)
|
|
12
|
+
- HealthcareAppointmentService advance [`228257c`](https://github.com/underpostnet/engine/commit/228257c0aa2d875014e72f2550bb44aa6b009bed)
|
|
13
|
+
- healthcare appoiment service advance [`207a299`](https://github.com/underpostnet/engine/commit/207a299ffc815870a574524907d5b6b3d9924f1a)
|
|
14
|
+
|
|
7
15
|
#### [v2.8.1](https://github.com/underpostnet/engine/compare/v2.8.0...v2.8.1)
|
|
8
16
|
|
|
9
17
|
> 20 January 2025
|
package/Dockerfile
CHANGED
|
@@ -9,39 +9,33 @@ WORKDIR /code
|
|
|
9
9
|
# Set root password to root, format is 'user:password'.
|
|
10
10
|
RUN echo 'root:root' | chpasswd
|
|
11
11
|
|
|
12
|
-
RUN apt-get update --fix-missing
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
12
|
+
RUN apt-get update --fix-missing
|
|
13
|
+
RUN apt-get upgrade -y
|
|
14
|
+
# install sudo
|
|
15
|
+
RUN apt-get -y install sudo
|
|
16
|
+
# net-tools provides netstat commands
|
|
17
|
+
RUN apt-get -y install curl net-tools
|
|
18
|
+
RUN apt-get -yq install openssh-server supervisor
|
|
19
|
+
# Few handy utilities which are nice to have
|
|
20
|
+
RUN apt-get -y install nano vim less --no-install-recommends
|
|
21
|
+
RUN apt-get clean
|
|
22
22
|
|
|
23
23
|
# install ssh
|
|
24
|
-
RUN mkdir -p /var/run/sshd
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
RUN mkdir -p /var/run/sshd
|
|
25
|
+
# Allow root login via password
|
|
26
|
+
RUN sed -ri 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/g' /etc/ssh/sshd_config
|
|
27
27
|
|
|
28
28
|
# copy supervisor config file to start openssh-server
|
|
29
29
|
COPY supervisord-openssh-server.conf /etc/supervisor/conf.d/supervisord-openssh-server.conf
|
|
30
30
|
|
|
31
31
|
# install open ssl git and others tools
|
|
32
|
-
RUN apt-get install -yq --no-install-recommends
|
|
33
|
-
libssl-dev \
|
|
34
|
-
curl \
|
|
35
|
-
wget \
|
|
36
|
-
git \
|
|
37
|
-
gnupg
|
|
32
|
+
RUN apt-get install -yq --no-install-recommends libssl-dev curl wget git gnupg
|
|
38
33
|
|
|
39
34
|
# install nodejs https://github.com/nodesource/distributions/blob/master/README.md#deb
|
|
40
|
-
RUN curl -fsSL https://deb.nodesource.com/setup_22.x | bash -
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
npm --version
|
|
35
|
+
RUN curl -fsSL https://deb.nodesource.com/setup_22.x | bash -
|
|
36
|
+
RUN apt-get install -y nodejs build-essential
|
|
37
|
+
RUN node --version
|
|
38
|
+
RUN npm --version
|
|
45
39
|
|
|
46
40
|
# local test
|
|
47
41
|
|
|
@@ -55,7 +49,6 @@ RUN curl -fsSL https://deb.nodesource.com/setup_22.x | bash - && \
|
|
|
55
49
|
# EXPOSE 4000-4004
|
|
56
50
|
# CMD [ "npm", "run", "dev" ]
|
|
57
51
|
|
|
58
|
-
|
|
59
52
|
# EXPOSE 3000-3004
|
|
60
53
|
# CMD [ "npm", "start" ]
|
|
61
54
|
|
|
@@ -73,4 +66,4 @@ EXPOSE 22 80 443 3306 27017
|
|
|
73
66
|
# EXPOSE 22
|
|
74
67
|
EXPOSE 4000-4004
|
|
75
68
|
|
|
76
|
-
CMD [ "node", "./startup.cjs" ]
|
|
69
|
+
CMD [ "node", "./startup.cjs" ]
|
package/README.md
CHANGED
|
@@ -16,7 +16,7 @@ template
|
|
|
16
16
|
|
|
17
17
|
<div align="center">
|
|
18
18
|
|
|
19
|
-
<a target="_top" href='https://www.npmjs.com/package/npm/v/
|
|
19
|
+
<a target="_top" href='https://www.npmjs.com/package/npm/v/11.1.0' ><img alt='npm' src='https://img.shields.io/badge/npm v11.1.0-100000?style=flat&logo=npm&logoColor=white&labelColor=CB3837&color=727273'/></a> <a target="_top" href='https://nodejs.org/download/release/v22.9.0/' ><img alt='nodedotjs' src='https://img.shields.io/badge/node v23.8.0-100000?style=flat&logo=nodedotjs&logoColor=white&labelColor=5FA04E&color=727273'/></a> <a target="_top" href='https://pgp.mongodb.com/' ><img alt='mongodb' src='https://img.shields.io/badge/mongodb_server v7.0-100000?style=flat&logo=mongodb&logoColor=white&labelColor=47A248&color=727273'/></a>
|
|
20
20
|
|
|
21
21
|
</div>
|
|
22
22
|
|
package/bin/build.js
ADDED
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
import fs from 'fs-extra';
|
|
2
|
+
import { loggerFactory } from '../src/server/logger.js';
|
|
3
|
+
import { shellExec } from '../src/server/process.js';
|
|
4
|
+
import dotenv from 'dotenv';
|
|
5
|
+
import { getCapVariableName } from '../src/client/components/core/CommonJs.js';
|
|
6
|
+
import { buildProxyRouter, buildPortProxyRouter, Config, getPathsSSR, buildKindPorts } from '../src/server/conf.js';
|
|
7
|
+
|
|
8
|
+
const baseConfPath = './engine-private/conf/dd-cron/.env.production';
|
|
9
|
+
if (fs.existsSync(baseConfPath)) dotenv.config({ path: baseConfPath, override: true });
|
|
10
|
+
|
|
11
|
+
const logger = loggerFactory(import.meta);
|
|
12
|
+
|
|
13
|
+
// (async () => {
|
|
14
|
+
// return;
|
|
15
|
+
// const files = await fs.readdir(`./src`);
|
|
16
|
+
// for (const relativePath of files) {
|
|
17
|
+
// }
|
|
18
|
+
// })();
|
|
19
|
+
|
|
20
|
+
const confName = process.argv[2];
|
|
21
|
+
const basePath = '../pwa-microservices-template';
|
|
22
|
+
const repoName = `engine-${confName.split('dd-')[1]}-private`;
|
|
23
|
+
const repoNameBackUp = `engine-${confName.split('dd-')[1]}-cron-backups`;
|
|
24
|
+
const gitUrl = `https://${process.env.GITHUB_TOKEN}@github.com/underpostnet/${repoName}.git`;
|
|
25
|
+
const gitBackUpUrl = `https://${process.env.GITHUB_TOKEN}@github.com/underpostnet/${repoNameBackUp}.git`;
|
|
26
|
+
|
|
27
|
+
logger.info('', {
|
|
28
|
+
confName,
|
|
29
|
+
// gitUrl,
|
|
30
|
+
repoName,
|
|
31
|
+
repoNameBackUp,
|
|
32
|
+
basePath,
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
if (process.argv.includes('info')) process.exit(0);
|
|
36
|
+
|
|
37
|
+
if (process.argv.includes('proxy')) {
|
|
38
|
+
const env = process.argv.includes('development') ? 'development' : 'production';
|
|
39
|
+
process.env.NODE_ENV = env;
|
|
40
|
+
process.env.PORT = process.env.NODE_ENV === 'development' ? 4000 : 3000;
|
|
41
|
+
process.argv[2] = 'proxy';
|
|
42
|
+
process.argv[3] = fs.readFileSync('./engine-private/deploy/dd-router', 'utf8').trim();
|
|
43
|
+
|
|
44
|
+
await Config.build();
|
|
45
|
+
process.env.NODE_ENV = 'production';
|
|
46
|
+
const router = buildPortProxyRouter(443, buildProxyRouter());
|
|
47
|
+
const confServer = JSON.parse(fs.readFileSync(`./engine-private/conf/${confName}/conf.server.json`, 'utf8'));
|
|
48
|
+
const confHosts = Object.keys(confServer);
|
|
49
|
+
|
|
50
|
+
for (const host of Object.keys(router)) {
|
|
51
|
+
if (!confHosts.find((_host) => host.match(_host))) {
|
|
52
|
+
delete router[host];
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const ports = Object.values(router).map((p) => p.split(':')[2]);
|
|
57
|
+
|
|
58
|
+
const fromPort = ports[0];
|
|
59
|
+
const toPort = ports[ports.length - 1];
|
|
60
|
+
|
|
61
|
+
logger.info('port range', { fromPort, toPort, router });
|
|
62
|
+
|
|
63
|
+
const deploymentYamlFilePath = `./engine-private/conf/${confName}/build/${env}/deployment.yaml`;
|
|
64
|
+
|
|
65
|
+
const deploymentYamlParts = fs.readFileSync(deploymentYamlFilePath, 'utf8').split('ports:');
|
|
66
|
+
deploymentYamlParts[1] =
|
|
67
|
+
buildKindPorts(fromPort, toPort) +
|
|
68
|
+
` type: LoadBalancer
|
|
69
|
+
`;
|
|
70
|
+
|
|
71
|
+
fs.writeFileSync(
|
|
72
|
+
deploymentYamlFilePath,
|
|
73
|
+
deploymentYamlParts.join(`ports:
|
|
74
|
+
`),
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
let proxyYaml = '';
|
|
78
|
+
let secretYaml = '';
|
|
79
|
+
|
|
80
|
+
for (const host of Object.keys(confServer)) {
|
|
81
|
+
if (env === 'production')
|
|
82
|
+
secretYaml += `
|
|
83
|
+
---
|
|
84
|
+
apiVersion: cert-manager.io/v1
|
|
85
|
+
kind: Certificate
|
|
86
|
+
metadata:
|
|
87
|
+
name: ${host}
|
|
88
|
+
spec:
|
|
89
|
+
commonName: ${host}
|
|
90
|
+
dnsNames:
|
|
91
|
+
- ${host}
|
|
92
|
+
issuerRef:
|
|
93
|
+
name: letsencrypt-prod
|
|
94
|
+
kind: ClusterIssuer
|
|
95
|
+
secretName: ${host}`;
|
|
96
|
+
|
|
97
|
+
const pathPortConditions = [];
|
|
98
|
+
for (const path of Object.keys(confServer[host])) {
|
|
99
|
+
const { peer } = confServer[host][path];
|
|
100
|
+
const port = parseInt(router[`${host}${path === '/' ? '' : path}`].split(':')[2]);
|
|
101
|
+
// logger.info('', { host, port, path });
|
|
102
|
+
pathPortConditions.push({
|
|
103
|
+
port,
|
|
104
|
+
path,
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
if (peer) {
|
|
108
|
+
// logger.info('', { host, port: port + 1, path: '/peer' });
|
|
109
|
+
pathPortConditions.push({
|
|
110
|
+
port: port + 1,
|
|
111
|
+
path: '/peer',
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
// logger.info('', { host, pathPortConditions });
|
|
116
|
+
proxyYaml += `
|
|
117
|
+
---
|
|
118
|
+
apiVersion: projectcontour.io/v1
|
|
119
|
+
kind: HTTPProxy
|
|
120
|
+
metadata:
|
|
121
|
+
name: ${host}
|
|
122
|
+
spec:
|
|
123
|
+
virtualhost:
|
|
124
|
+
fqdn: ${host}${
|
|
125
|
+
env === 'development'
|
|
126
|
+
? ''
|
|
127
|
+
: `
|
|
128
|
+
tls:
|
|
129
|
+
secretName: ${host}`
|
|
130
|
+
}
|
|
131
|
+
routes:`;
|
|
132
|
+
for (const conditionObj of pathPortConditions) {
|
|
133
|
+
const { path, port } = conditionObj;
|
|
134
|
+
proxyYaml += `
|
|
135
|
+
- conditions:
|
|
136
|
+
- prefix: ${path}
|
|
137
|
+
enableWebsockets: true
|
|
138
|
+
services:
|
|
139
|
+
- name: ${confName}-${env}-service
|
|
140
|
+
port: ${port}`;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
const yamlPath = `./engine-private/conf/${confName}/build/${env}/proxy.yaml`;
|
|
144
|
+
fs.writeFileSync(yamlPath, proxyYaml, 'utf8');
|
|
145
|
+
if (env === 'production') {
|
|
146
|
+
const yamlPath = `./engine-private/conf/${confName}/build/${env}/secret.yaml`;
|
|
147
|
+
fs.writeFileSync(yamlPath, secretYaml, 'utf8');
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
process.exit(0);
|
|
151
|
+
}
|
|
152
|
+
if (process.argv.includes('conf')) {
|
|
153
|
+
if (!fs.existsSync(`../${repoName}`)) {
|
|
154
|
+
shellExec(`cd .. && git clone ${gitUrl}`, { silent: true });
|
|
155
|
+
} else {
|
|
156
|
+
shellExec(`cd ../${repoName} && git pull`);
|
|
157
|
+
}
|
|
158
|
+
const toPath = `../${repoName}/conf/${confName}`;
|
|
159
|
+
fs.removeSync(toPath);
|
|
160
|
+
fs.mkdirSync(toPath, { recursive: true });
|
|
161
|
+
fs.copySync(`./engine-private/conf/${confName}`, toPath);
|
|
162
|
+
shellExec(
|
|
163
|
+
`cd ../${repoName}` +
|
|
164
|
+
` && git add .` +
|
|
165
|
+
` && git commit -m "ci(engine-core-conf): ⚙️ Update ${confName} conf"` +
|
|
166
|
+
` && git push`,
|
|
167
|
+
);
|
|
168
|
+
process.exit(0);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
if (process.argv.includes('cron-backups')) {
|
|
172
|
+
if (!fs.existsSync(`../${repoNameBackUp}`)) {
|
|
173
|
+
shellExec(`cd .. && git clone ${gitBackUpUrl}`, { silent: true });
|
|
174
|
+
} else {
|
|
175
|
+
shellExec(`cd ../${repoNameBackUp} && git pull`);
|
|
176
|
+
}
|
|
177
|
+
const serverConf = JSON.parse(fs.readFileSync(`./engine-private/conf/${confName}/conf.server.json`, 'utf8'));
|
|
178
|
+
for (const host of Object.keys(serverConf)) {
|
|
179
|
+
for (let path of Object.keys(serverConf[host])) {
|
|
180
|
+
path = path.replaceAll('/', '-');
|
|
181
|
+
const toPath = `../${repoNameBackUp}/${host}${path}`;
|
|
182
|
+
const fromPath = `./engine-private/cron-backups/${host}${path}`;
|
|
183
|
+
if (fs.existsSync(fromPath)) {
|
|
184
|
+
if (fs.existsSync(toPath)) fs.removeSync(toPath);
|
|
185
|
+
logger.info('Build', { fromPath, toPath });
|
|
186
|
+
fs.copySync(fromPath, toPath);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
shellExec(
|
|
191
|
+
`cd ../${repoNameBackUp}` +
|
|
192
|
+
` && git add .` +
|
|
193
|
+
` && git commit -m "ci(engine-core-cron-backups): ⚙️ Update ${confName} cron backups"` +
|
|
194
|
+
` && git push`,
|
|
195
|
+
);
|
|
196
|
+
process.exit(0);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
if (process.argv.includes('test')) {
|
|
200
|
+
fs.mkdirSync(`${basePath}/engine-private/conf`, { recursive: true });
|
|
201
|
+
fs.copySync(`./engine-private/conf/${confName}`, `${basePath}/engine-private/conf/${confName}`);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
const { DefaultConf } = await import(`../conf.${confName}.js`);
|
|
205
|
+
|
|
206
|
+
{
|
|
207
|
+
for (const host of Object.keys(DefaultConf.server)) {
|
|
208
|
+
for (const path of Object.keys(DefaultConf.server[host])) {
|
|
209
|
+
const { apis, ws } = DefaultConf.server[host][path];
|
|
210
|
+
if (apis)
|
|
211
|
+
for (const api of apis) {
|
|
212
|
+
{
|
|
213
|
+
const originPath = `./src/api/${api}`;
|
|
214
|
+
logger.info(`Build`, originPath);
|
|
215
|
+
fs.copySync(originPath, `${basePath}/src/api/${api}`);
|
|
216
|
+
}
|
|
217
|
+
{
|
|
218
|
+
const originPath = `./src/client/services/${api}`;
|
|
219
|
+
logger.info(`Build`, originPath);
|
|
220
|
+
fs.copySync(originPath, `${basePath}/src/client/services/${api}`);
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
if (ws && ws !== 'core' && ws !== 'default') {
|
|
225
|
+
fs.copySync(`./src/ws/${ws}`, `${basePath}/src/ws/${ws}`);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
{
|
|
232
|
+
for (const client of Object.keys(DefaultConf.client)) {
|
|
233
|
+
const capName = getCapVariableName(client);
|
|
234
|
+
for (const component of Object.keys(DefaultConf.client[client].components)) {
|
|
235
|
+
const originPath = `./src/client/components/${component}`;
|
|
236
|
+
if (fs.existsSync(originPath)) {
|
|
237
|
+
logger.info(`Build`, originPath);
|
|
238
|
+
fs.copySync(originPath, `${basePath}/src/client/components/${component}`);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
{
|
|
242
|
+
const originPath = `./src/client/${capName}.index.js`;
|
|
243
|
+
if (fs.existsSync(originPath)) {
|
|
244
|
+
logger.info(`Build`, originPath);
|
|
245
|
+
fs.copyFileSync(originPath, `${basePath}/src/client/${capName}.index.js`);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
{
|
|
249
|
+
const originPath = `./src/client/public/${client}`;
|
|
250
|
+
if (fs.existsSync(originPath)) {
|
|
251
|
+
logger.info(`Build`, originPath);
|
|
252
|
+
fs.copySync(originPath, `${basePath}/src/client/public/${client}`);
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
{
|
|
259
|
+
for (const client of Object.keys(DefaultConf.ssr)) {
|
|
260
|
+
const ssrPaths = getPathsSSR(DefaultConf.ssr[client]);
|
|
261
|
+
for (const originPath of ssrPaths) {
|
|
262
|
+
if (fs.existsSync(originPath)) {
|
|
263
|
+
logger.info(`Build`, originPath);
|
|
264
|
+
fs.copySync(originPath, `${basePath}/${originPath}`);
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
fs.copyFileSync(`./conf.${confName}.js`, `${basePath}/conf.js`);
|
|
270
|
+
fs.copyFileSync(
|
|
271
|
+
`./.github/workflows/engine.${confName.split('dd-')[1]}.ci.yml`,
|
|
272
|
+
`${basePath}/.github/workflows/engine.${confName.split('dd-')[1]}.ci.yml`,
|
|
273
|
+
);
|
|
274
|
+
|
|
275
|
+
const packageJson = JSON.parse(fs.readFileSync(`${basePath}/package.json`, 'utf8'));
|
|
276
|
+
packageJson.name = repoName;
|
|
277
|
+
fs.writeFileSync(`${basePath}/package.json`, JSON.stringify(packageJson, null, 4), 'utf8');
|
|
278
|
+
}
|
package/bin/db.js
CHANGED
|
@@ -4,10 +4,9 @@ import { loggerFactory } from '../src/server/logger.js';
|
|
|
4
4
|
import { MariaDB } from '../src/db/mariadb/MariaDB.js';
|
|
5
5
|
import { Xampp } from '../src/runtime/xampp/Xampp.js';
|
|
6
6
|
import { Lampp } from '../src/runtime/lampp/Lampp.js';
|
|
7
|
-
import { getCapVariableName, getRestoreCronCmd, loadConf } from '../src/server/conf.js';
|
|
7
|
+
import { getCapVariableName, getRestoreCronCmd, loadConf, splitFileFactory } from '../src/server/conf.js';
|
|
8
8
|
import { DataBaseProvider } from '../src/db/DataBaseProvider.js';
|
|
9
9
|
import { hashPassword } from '../src/server/auth.js';
|
|
10
|
-
import splitFile from 'split-file';
|
|
11
10
|
|
|
12
11
|
const logger = loggerFactory(import.meta);
|
|
13
12
|
|
|
@@ -101,28 +100,7 @@ try {
|
|
|
101
100
|
|
|
102
101
|
cmd = `mysqldump -u ${user} -p${password} ${name} > ${cmdBackupPath}`;
|
|
103
102
|
shellExec(cmd);
|
|
104
|
-
|
|
105
|
-
const maxSizeInBytes = 1024 * 1024 * 50; // 50 mb
|
|
106
|
-
const fileSizeInBytes = stats.size;
|
|
107
|
-
if (fileSizeInBytes > maxSizeInBytes) {
|
|
108
|
-
await new Promise((resolve) => {
|
|
109
|
-
splitFile
|
|
110
|
-
.splitFileBySize(cmdBackupPath, maxSizeInBytes) // 50 mb
|
|
111
|
-
.then((names) => {
|
|
112
|
-
fs.writeFileSync(
|
|
113
|
-
`${cmdBackupPath.split('/').slice(0, -1).join('/')}/${name}-parths.json`,
|
|
114
|
-
JSON.stringify(names, null, 4),
|
|
115
|
-
'utf8',
|
|
116
|
-
);
|
|
117
|
-
resolve();
|
|
118
|
-
})
|
|
119
|
-
.catch((err) => {
|
|
120
|
-
console.log('Error: ', err);
|
|
121
|
-
resolve();
|
|
122
|
-
});
|
|
123
|
-
});
|
|
124
|
-
fs.removeSync(cmdBackupPath);
|
|
125
|
-
}
|
|
103
|
+
await splitFileFactory(name, cmdBackupPath);
|
|
126
104
|
}
|
|
127
105
|
break;
|
|
128
106
|
case 'import':
|