underpost 2.8.1 → 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/.dockerignore +1 -0
- package/.github/workflows/ghpkg.yml +19 -49
- package/.github/workflows/npmpkg.yml +67 -0
- package/.github/workflows/publish.yml +5 -5
- package/.github/workflows/pwa-microservices-template.page.yml +12 -4
- package/.github/workflows/pwa-microservices-template.test.yml +2 -2
- package/.vscode/extensions.json +17 -71
- package/.vscode/settings.json +18 -3
- package/AUTHORS.md +16 -5
- package/CHANGELOG.md +103 -3
- package/Dockerfile +24 -66
- package/README.md +1 -28
- package/bin/build.js +186 -0
- package/bin/db.js +2 -24
- package/bin/deploy.js +169 -144
- package/bin/file.js +59 -16
- package/bin/hwt.js +0 -10
- package/bin/index.js +201 -60
- package/bin/ssl.js +19 -11
- package/bin/util.js +9 -104
- package/bin/vs.js +26 -2
- package/conf.js +29 -138
- package/docker-compose.yml +1 -1
- package/manifests/deployment/mongo-express/deployment.yaml +60 -0
- package/manifests/deployment/phpmyadmin/deployment.yaml +54 -0
- package/manifests/kind-config-dev.yaml +12 -0
- package/manifests/kind-config.yaml +12 -0
- package/manifests/letsencrypt-prod.yaml +15 -0
- package/manifests/mariadb/config.yaml +10 -0
- package/manifests/mariadb/kustomization.yaml +9 -0
- package/manifests/mariadb/pv.yaml +12 -0
- package/manifests/mariadb/pvc.yaml +10 -0
- package/manifests/mariadb/secret.yaml +8 -0
- package/manifests/mariadb/service.yaml +10 -0
- package/manifests/mariadb/statefulset.yaml +55 -0
- package/manifests/mongodb/backup-access.yaml +16 -0
- package/manifests/mongodb/backup-cronjob.yaml +42 -0
- package/manifests/mongodb/backup-pv-pvc.yaml +22 -0
- package/manifests/mongodb/configmap.yaml +26 -0
- package/manifests/mongodb/headless-service.yaml +10 -0
- package/manifests/mongodb/kustomization.yaml +11 -0
- package/manifests/mongodb/pv-pvc.yaml +23 -0
- package/manifests/mongodb/statefulset.yaml +125 -0
- package/manifests/mongodb-4.4/kustomization.yaml +7 -0
- package/manifests/mongodb-4.4/pv-pvc.yaml +23 -0
- package/manifests/mongodb-4.4/service-deployment.yaml +63 -0
- package/manifests/valkey/kustomization.yaml +7 -0
- package/manifests/valkey/service.yaml +17 -0
- package/manifests/valkey/statefulset.yaml +39 -0
- package/package.json +133 -136
- package/src/api/core/core.service.js +1 -1
- package/src/api/user/user.model.js +16 -3
- package/src/api/user/user.service.js +1 -1
- package/src/cli/cluster.js +202 -0
- package/src/cli/cron.js +90 -0
- package/src/cli/db.js +212 -0
- package/src/cli/deploy.js +318 -0
- package/src/cli/env.js +52 -0
- package/src/cli/fs.js +149 -0
- package/src/cli/image.js +148 -0
- package/src/cli/repository.js +125 -0
- package/src/cli/script.js +53 -0
- package/src/cli/secrets.js +37 -0
- package/src/cli/test.js +118 -0
- package/src/client/components/core/Auth.js +22 -4
- package/src/client/components/core/CalendarCore.js +127 -50
- package/src/client/components/core/CommonJs.js +282 -19
- package/src/client/components/core/Css.js +1 -0
- package/src/client/components/core/CssCore.js +8 -4
- package/src/client/components/core/Docs.js +1 -2
- package/src/client/components/core/DropDown.js +5 -1
- package/src/client/components/core/Input.js +22 -6
- package/src/client/components/core/LoadingAnimation.js +8 -1
- package/src/client/components/core/Modal.js +40 -12
- package/src/client/components/core/Panel.js +92 -31
- package/src/client/components/core/PanelForm.js +25 -23
- package/src/client/components/core/Scroll.js +1 -0
- package/src/client/components/core/Translate.js +47 -9
- package/src/client/components/core/Validator.js +9 -1
- package/src/client/components/core/VanillaJs.js +0 -9
- package/src/client/components/core/Worker.js +34 -31
- package/src/client/services/core/core.service.js +15 -10
- package/src/client/services/default/default.management.js +4 -2
- 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 +29 -1
- package/src/index.js +85 -19
- 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/backup.js +49 -93
- package/src/server/client-build.js +36 -46
- package/src/server/client-formatted.js +6 -3
- package/src/server/conf.js +204 -54
- package/src/server/dns.js +30 -55
- package/src/server/downloader.js +0 -8
- package/src/server/logger.js +15 -10
- package/src/server/network.js +17 -43
- package/src/server/process.js +25 -2
- package/src/server/proxy.js +4 -26
- package/src/server/runtime.js +30 -30
- package/src/server/ssl.js +1 -1
- package/src/server/valkey.js +2 -0
- package/test/api.test.js +0 -8
- package/src/dns.js +0 -22
- package/src/server/prompt-optimizer.js +0 -28
- package/startup.js +0 -11
package/Dockerfile
CHANGED
|
@@ -2,89 +2,47 @@ ARG BASE_DEBIAN=buster
|
|
|
2
2
|
|
|
3
3
|
FROM debian:${BASE_DEBIAN}
|
|
4
4
|
|
|
5
|
-
ENV DEBIAN_FRONTEND
|
|
5
|
+
ENV DEBIAN_FRONTEND=noninteractive
|
|
6
6
|
|
|
7
|
-
WORKDIR /
|
|
7
|
+
WORKDIR /home/dd
|
|
8
8
|
|
|
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/
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
npm --version
|
|
35
|
+
RUN curl -fsSL https://deb.nodesource.com/setup_23.x | bash -
|
|
36
|
+
RUN apt-get install -y nodejs build-essential
|
|
37
|
+
RUN node --version
|
|
38
|
+
RUN npm --version
|
|
45
39
|
|
|
46
|
-
|
|
47
|
-
# install lampp
|
|
48
|
-
RUN curl -Lo xampp-linux-installer.run https://sourceforge.net/projects/xampp/files/XAMPP%20Linux/7.4.30/xampp-linux-x64-7.4.30-1-installer.run?from_af=true && \
|
|
49
|
-
chmod +x xampp-linux-installer.run && \
|
|
50
|
-
bash -c './xampp-linux-installer.run' && \
|
|
51
|
-
ln -sf /opt/lampp/lampp /usr/bin/lampp && \
|
|
52
|
-
# Enable XAMPP web interface(remove security checks)
|
|
53
|
-
sed -i.bak s'/Require local/Require all granted/g' /opt/lampp/etc/extra/httpd-xampp.conf && \
|
|
54
|
-
# Enable error display in php
|
|
55
|
-
sed -i.bak s'/display_errors=Off/display_errors=On/g' /opt/lampp/etc/php.ini && \
|
|
56
|
-
# Enable includes of several configuration files
|
|
57
|
-
mkdir /opt/lampp/apache2/conf.d && \
|
|
58
|
-
echo "IncludeOptional /opt/lampp/apache2/conf.d/*.conf" >> /opt/lampp/etc/httpd.conf && \
|
|
59
|
-
# Create a /www folder and a symbolic link to it in /opt/lampp/htdocs. It'll be accessible via http://localhost:[port]/www/
|
|
60
|
-
# This is convenient because it doesn't interfere with xampp, phpmyadmin or other tools in /opt/lampp/htdocs
|
|
61
|
-
# /opt/lampp/etc/httpd.conf
|
|
62
|
-
mkdir /www && \
|
|
63
|
-
ln -s /www /opt/lampp/htdocs
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
# Install mongodb necessary libs
|
|
67
|
-
RUN apt-get update && apt-get install -y apt-utils wget gnupg gnupg2 curl
|
|
68
|
-
|
|
69
|
-
# Install mongodb
|
|
70
|
-
RUN wget -qO - https://www.mongodb.org/static/pgp/server-4.2.asc | apt-key add -
|
|
71
|
-
RUN echo "deb [ arch=amd64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.2 multiverse" | tee /etc/apt/sources.list.d/mongodb-org-4.2.list
|
|
72
|
-
RUN apt-get update
|
|
73
|
-
RUN apt-get install -y mongodb-org
|
|
74
|
-
|
|
75
|
-
# BIND TO ALL ADAPTERS IN CONTAINER
|
|
76
|
-
RUN sed -i "s,\\(^[[:blank:]]*bindIp:\\) .*,\\1 0.0.0.0," /etc/mongod.conf
|
|
77
|
-
|
|
78
|
-
# Bundle app source
|
|
79
|
-
# COPY . .
|
|
80
|
-
|
|
81
|
-
# Install underpost cli
|
|
82
40
|
RUN npm install -g underpost
|
|
83
41
|
|
|
42
|
+
VOLUME [ "/home/dd/engine/logs" ]
|
|
84
43
|
|
|
85
|
-
|
|
44
|
+
EXPOSE 22
|
|
86
45
|
|
|
87
|
-
EXPOSE
|
|
88
|
-
EXPOSE 3000-3020
|
|
46
|
+
EXPOSE 4000-4004
|
|
89
47
|
|
|
90
|
-
CMD [ "
|
|
48
|
+
CMD [ "underpost", "new", "service" ]
|
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
|
|
|
@@ -67,30 +67,3 @@ Run dev client server
|
|
|
67
67
|
```bash
|
|
68
68
|
npm run dev
|
|
69
69
|
```
|
|
70
|
-
|
|
71
|
-
Run dev api server
|
|
72
|
-
|
|
73
|
-
```bash
|
|
74
|
-
npm run dev-api
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
Run on `pm2`
|
|
78
|
-
|
|
79
|
-
```bash
|
|
80
|
-
npm run pm2
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
Run on `docker-compose`
|
|
84
|
-
|
|
85
|
-
```bash
|
|
86
|
-
npm run start:docker
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
Run on `docker`
|
|
90
|
-
|
|
91
|
-
```bash
|
|
92
|
-
# build image
|
|
93
|
-
docker build . -t app-name
|
|
94
|
-
# run image
|
|
95
|
-
docker run --name app-name-instance -p 41061:3001 -p 41062:3002 app-name
|
|
96
|
-
```
|
package/bin/build.js
ADDED
|
@@ -0,0 +1,186 @@
|
|
|
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 { getPathsSSR } 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]}`;
|
|
23
|
+
const deployList = (confName === 'dd' ? fs.readFileSync(`./engine-private/deploy/dd.router`, 'utf8') : confName).split(
|
|
24
|
+
',',
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
logger.info('', {
|
|
28
|
+
confName,
|
|
29
|
+
repoName,
|
|
30
|
+
basePath,
|
|
31
|
+
deployList,
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
if (process.argv.includes('clean')) {
|
|
35
|
+
if (fs.existsSync(`${basePath}/images`)) fs.copySync(`${basePath}/images`, `./images`);
|
|
36
|
+
shellExec(`cd ${basePath} && git checkout .`);
|
|
37
|
+
shellExec(`cd ${basePath} && git clean -f -d`);
|
|
38
|
+
process.exit(0);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
if (process.argv.includes('conf')) {
|
|
42
|
+
for (const _confName of deployList) {
|
|
43
|
+
const _repoName = `engine-${_confName.split('dd-')[1]}`;
|
|
44
|
+
const privateRepoName = `${_repoName}-private`;
|
|
45
|
+
const privateGitUri = `${process.env.GITHUB_USERNAME}/${privateRepoName}`;
|
|
46
|
+
|
|
47
|
+
if (!fs.existsSync(`../${privateRepoName}`)) {
|
|
48
|
+
shellExec(`cd .. && underpost clone ${privateGitUri}`, { silent: true });
|
|
49
|
+
} else {
|
|
50
|
+
shellExec(`cd ../${privateRepoName} && underpost pull . ${privateGitUri}`);
|
|
51
|
+
}
|
|
52
|
+
const toPath = `../${privateRepoName}/conf/${_confName}`;
|
|
53
|
+
fs.removeSync(toPath);
|
|
54
|
+
fs.mkdirSync(toPath, { recursive: true });
|
|
55
|
+
fs.copySync(`./engine-private/conf/${_confName}`, toPath);
|
|
56
|
+
if (fs.existsSync(`./engine-private/replica`)) {
|
|
57
|
+
const replicas = await fs.readdir(`./engine-private/replica`);
|
|
58
|
+
for (const replica of replicas)
|
|
59
|
+
if (replica.match(_confName))
|
|
60
|
+
fs.copySync(`./engine-private/replica/${replica}`, `../${privateRepoName}/replica/${replica}`);
|
|
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
|
+
}
|
|
68
|
+
shellExec(
|
|
69
|
+
`cd ../${privateRepoName}` +
|
|
70
|
+
` && git add .` +
|
|
71
|
+
` && underpost cmt . ci engine-core-conf 'Update ${_confName} conf'` +
|
|
72
|
+
` && underpost push . ${privateGitUri}`,
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
process.exit(0);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
if (confName === 'dd') {
|
|
79
|
+
for (const _confName of deployList) {
|
|
80
|
+
shellExec(`node bin/build ${_confName}`);
|
|
81
|
+
}
|
|
82
|
+
process.exit(0);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const { DefaultConf } = await import(`../conf.${confName}.js`);
|
|
86
|
+
|
|
87
|
+
{
|
|
88
|
+
for (const host of Object.keys(DefaultConf.server)) {
|
|
89
|
+
for (const path of Object.keys(DefaultConf.server[host])) {
|
|
90
|
+
const { apis, ws } = DefaultConf.server[host][path];
|
|
91
|
+
if (apis)
|
|
92
|
+
for (const api of apis) {
|
|
93
|
+
{
|
|
94
|
+
const originPath = `./src/api/${api}`;
|
|
95
|
+
logger.info(`Build`, originPath);
|
|
96
|
+
fs.copySync(originPath, `${basePath}/src/api/${api}`);
|
|
97
|
+
}
|
|
98
|
+
{
|
|
99
|
+
const originPath = `./src/client/services/${api}`;
|
|
100
|
+
logger.info(`Build`, originPath);
|
|
101
|
+
fs.copySync(originPath, `${basePath}/src/client/services/${api}`);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
if (ws && ws !== 'core' && ws !== 'default') {
|
|
106
|
+
fs.copySync(`./src/ws/${ws}`, `${basePath}/src/ws/${ws}`);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
{
|
|
113
|
+
for (const client of Object.keys(DefaultConf.client)) {
|
|
114
|
+
const capName = getCapVariableName(client);
|
|
115
|
+
for (const component of Object.keys(DefaultConf.client[client].components)) {
|
|
116
|
+
const originPath = `./src/client/components/${component}`;
|
|
117
|
+
if (fs.existsSync(originPath)) {
|
|
118
|
+
logger.info(`Build`, originPath);
|
|
119
|
+
fs.copySync(originPath, `${basePath}/src/client/components/${component}`);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
{
|
|
123
|
+
const originPath = `./src/client/${capName}.index.js`;
|
|
124
|
+
if (fs.existsSync(originPath)) {
|
|
125
|
+
logger.info(`Build`, originPath);
|
|
126
|
+
fs.copyFileSync(originPath, `${basePath}/src/client/${capName}.index.js`);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
{
|
|
130
|
+
const originPath = `./src/client/public/${client}`;
|
|
131
|
+
if (fs.existsSync(originPath)) {
|
|
132
|
+
logger.info(`Build`, originPath);
|
|
133
|
+
fs.copySync(originPath, `${basePath}/src/client/public/${client}`);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
{
|
|
140
|
+
for (const client of Object.keys(DefaultConf.ssr)) {
|
|
141
|
+
const ssrPaths = getPathsSSR(DefaultConf.ssr[client]);
|
|
142
|
+
for (const originPath of ssrPaths) {
|
|
143
|
+
if (fs.existsSync(originPath)) {
|
|
144
|
+
logger.info(`Build`, originPath);
|
|
145
|
+
fs.copySync(originPath, `${basePath}/${originPath}`);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
shellExec(`node bin/deploy update-default-conf ${confName}`);
|
|
151
|
+
|
|
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
|
+
|
|
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
|
+
|
|
167
|
+
const packageJson = JSON.parse(fs.readFileSync(`${basePath}/package.json`, 'utf8'));
|
|
168
|
+
packageJson.name = repoName;
|
|
169
|
+
fs.writeFileSync(
|
|
170
|
+
`${basePath}/package.json`,
|
|
171
|
+
JSON.stringify(packageJson, null, 4).replaceAll('pwa-microservices-template', repoName),
|
|
172
|
+
'utf8',
|
|
173
|
+
);
|
|
174
|
+
|
|
175
|
+
fs.copySync(`./src/cli`, `${basePath}/src/cli`);
|
|
176
|
+
if (!fs.existsSync(`${basePath}/images`)) fs.mkdirSync(`${basePath}/images`);
|
|
177
|
+
|
|
178
|
+
const env = process.argv.includes('development') ? 'development' : 'production';
|
|
179
|
+
const deploymentsFiles = ['Dockerfile', 'proxy.yaml', 'deployment.yaml', 'secret.yaml'];
|
|
180
|
+
// remove engine-private of .dockerignore for local testing
|
|
181
|
+
for (const file of deploymentsFiles) {
|
|
182
|
+
if (fs.existsSync(`./manifests/deployment/${confName}-${env}/${file}`)) {
|
|
183
|
+
fs.copyFileSync(`./manifests/deployment/${confName}-${env}/${file}`, `${basePath}/${file}`);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
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':
|