underpost 2.99.7 → 2.99.8
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/npmpkg.ci.yml +2 -1
- package/.github/workflows/publish.ci.yml +4 -0
- package/CHANGELOG.md +25 -1
- package/Dockerfile +15 -15
- package/README.md +8 -15
- package/bin/file.js +4 -19
- package/cli.md +1 -1
- package/examples/static-page/ssr-components/CustomPage.js +1 -1
- package/manifests/cronjobs/dd-cron/dd-cron-backup.yaml +1 -1
- package/manifests/cronjobs/dd-cron/dd-cron-dns.yaml +1 -1
- package/manifests/deployment/dd-default-development/deployment.yaml +2 -2
- package/manifests/deployment/dd-test-development/deployment.yaml +2 -2
- package/package.json +1 -1
- package/src/db/mariadb/MariaDB.js +2 -2
- package/src/index.js +1 -1
- package/src/runtime/express/Dockerfile +15 -15
- package/src/runtime/lampp/Dockerfile +15 -15
- package/src/server/conf.js +2 -19
- package/bin/cron.js +0 -47
- package/bin/db.js +0 -199
- package/bin/hwt.js +0 -49
- package/bin/util.js +0 -63
|
@@ -37,7 +37,8 @@ jobs:
|
|
|
37
37
|
- name: Capture commit message
|
|
38
38
|
run: |
|
|
39
39
|
FULL_MSG="${{ github.event.head_commit.message }}"
|
|
40
|
-
|
|
40
|
+
REST="$(echo "$FULL_MSG" | tail -n +2 | awk 'NR==1{first=$0; has_first=1; next} NR==2{print first " " $0; has_first=0; next} {print} END{if(has_first) print first}')"
|
|
41
|
+
LAST_COMMIT_MESSAGE="${REST:-$FULL_MSG}"
|
|
41
42
|
echo "LAST_COMMIT_MESSAGE<<EOF" >> $GITHUB_ENV
|
|
42
43
|
echo "$LAST_COMMIT_MESSAGE" >> $GITHUB_ENV
|
|
43
44
|
echo "EOF" >> $GITHUB_ENV
|
|
@@ -12,6 +12,8 @@ jobs:
|
|
|
12
12
|
id-token: write
|
|
13
13
|
steps:
|
|
14
14
|
- uses: actions/checkout@v4
|
|
15
|
+
with:
|
|
16
|
+
ref: ${{ github.ref }}
|
|
15
17
|
- uses: actions/setup-node@v4
|
|
16
18
|
with:
|
|
17
19
|
node-version: '24.x'
|
|
@@ -43,6 +45,8 @@ jobs:
|
|
|
43
45
|
id-token: write
|
|
44
46
|
steps:
|
|
45
47
|
- uses: actions/checkout@v4
|
|
48
|
+
with:
|
|
49
|
+
ref: ${{ github.ref }}
|
|
46
50
|
- uses: actions/setup-node@v4
|
|
47
51
|
with:
|
|
48
52
|
node-version: '24.x'
|
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,30 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
## 2026-02-
|
|
3
|
+
## 2026-02-19
|
|
4
|
+
|
|
5
|
+
### github-actions
|
|
6
|
+
|
|
7
|
+
- Fix last commit message in npmpkg workflow ([6dd0f484](https://github.com/underpostnet/engine/commit/6dd0f48452fd9810eeb3f535d8859d7e92a418fd))
|
|
8
|
+
- Fix MariaDB import in CI workflows ([2002c11f](https://github.com/underpostnet/engine/commit/2002c11f312293be00c6434e4ba64a81a370e1df))
|
|
9
|
+
- Fix GitHub Actions commit message ([e36c4fb6](https://github.com/underpostnet/engine/commit/e36c4fb6592d17e4d3ffca1e8eede90105a5847b))
|
|
10
|
+
|
|
11
|
+
### dockerfile
|
|
12
|
+
|
|
13
|
+
- Underpost image dockerfiles file formats and clean comment ([6e22157c](https://github.com/underpostnet/engine/commit/6e22157c3d276aab9dc328165e7bc686a339663b))
|
|
14
|
+
|
|
15
|
+
### conf
|
|
16
|
+
|
|
17
|
+
- Fix repository README logic builder ([d88c5317](https://github.com/underpostnet/engine/commit/d88c5317e32b18b8d180d028e4ef9388ce6db78a))
|
|
18
|
+
|
|
19
|
+
### db
|
|
20
|
+
|
|
21
|
+
- Fix MariaDB import ([6edf3719](https://github.com/underpostnet/engine/commit/6edf3719bf4ee71ebe30fb1e7e5a9767aaefe352))
|
|
22
|
+
|
|
23
|
+
### cli-static
|
|
24
|
+
|
|
25
|
+
- Fix module js doc path ([6b10a929](https://github.com/underpostnet/engine/commit/6b10a9295422425863ef24f6eb7d76c67b248385))
|
|
26
|
+
|
|
27
|
+
## New release v:2.99.7 (2026-02-17)
|
|
4
28
|
|
|
5
29
|
### cli-ssh
|
|
6
30
|
|
package/Dockerfile
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
FROM rockylinux:9
|
|
2
2
|
|
|
3
|
-
#
|
|
3
|
+
# Update and install required packages
|
|
4
4
|
RUN dnf -y update && \
|
|
5
5
|
dnf -y install epel-release && \
|
|
6
6
|
dnf -y install --allowerasing \
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
7
|
+
bzip2 \
|
|
8
|
+
sudo \
|
|
9
|
+
curl \
|
|
10
|
+
net-tools \
|
|
11
|
+
openssh-server \
|
|
12
|
+
nano \
|
|
13
|
+
vim-enhanced \
|
|
14
|
+
less \
|
|
15
|
+
openssl-devel \
|
|
16
|
+
wget \
|
|
17
|
+
git \
|
|
18
|
+
gnupg2 \
|
|
19
|
+
libnsl \
|
|
20
|
+
perl && \
|
|
21
21
|
dnf clean all
|
|
22
22
|
|
|
23
23
|
|
package/README.md
CHANGED
|
@@ -10,17 +10,13 @@
|
|
|
10
10
|
|
|
11
11
|
<div align="center">
|
|
12
12
|
|
|
13
|
-
<a target="_top" href='https://rockylinux.org/
|
|
13
|
+
<a target="_top" href='https://download.rockylinux.org/pub/rocky/9/'><img alt='rockylinux' src='https://img.shields.io/badge/Rocky Linux v9.6-100000?style=flat&logo=rockylinux&logoColor=white&labelColor=10b981&color=727273'/></a> <a target="_top" href='https://www.npmjs.com/package/npm?activeTab=versions'><img alt='npm' src='https://img.shields.io/badge/npm v11.6.2-100000?style=flat&logo=npm&logoColor=white&labelColor=CB3837&color=727273'/></a> <a target="_top" href='https://nodejs.org/download/release'><img alt='nodedotjs' src='https://img.shields.io/badge/node v24.10.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>
|
|
14
14
|
|
|
15
15
|
</div>
|
|
16
16
|
|
|
17
17
|
<div align="center">
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
[](https://github.com/underpostnet/engine/actions/workflows/docker-image.yml) [](https://github.com/underpostnet/engine/actions/workflows/coverall.ci.yml) [](https://www.npmjs.com/package/underpost) [](https://socket.dev/npm/package/underpost/overview/2.99.7) [](https://coveralls.io/github/underpostnet/engine?branch=master) [](https://www.npmjs.org/package/underpost) [](https://www.npmjs.com/package/underpost)
|
|
22
|
-
|
|
23
|
-
<!-- end-badges -->
|
|
19
|
+
[](https://github.com/underpostnet/engine/actions/workflows/docker-image.yml) [](https://github.com/underpostnet/engine/actions/workflows/coverall.ci.yml) [](https://www.npmjs.com/package/underpost) [](https://socket.dev/npm/package/underpost/overview/2.99.8) [](https://coveralls.io/github/underpostnet/engine?branch=master) [](https://www.npmjs.org/package/underpost) [](https://www.npmjs.com/package/underpost)
|
|
24
20
|
|
|
25
21
|
</div>
|
|
26
22
|
|
|
@@ -32,10 +28,6 @@
|
|
|
32
28
|
|
|
33
29
|
</div>
|
|
34
30
|
|
|
35
|
-
<!-- #### Optional version environments -->
|
|
36
|
-
<!-- https://kapasia-dev-ed.my.site.com/Badges4Me/s/ -->
|
|
37
|
-
<!-- https://simpleicons.org/ -->
|
|
38
|
-
|
|
39
31
|
## Create a new project
|
|
40
32
|
|
|
41
33
|
```bash
|
|
@@ -46,7 +38,7 @@ npm install -g underpost
|
|
|
46
38
|
underpost new app-name
|
|
47
39
|
```
|
|
48
40
|
|
|
49
|
-
After template installation, the server will be running on
|
|
41
|
+
After template installation, the server will be running on <a target="_top" href="http://localhost:4001">http://localhost:4001</a>
|
|
50
42
|
|
|
51
43
|
## Usage
|
|
52
44
|
|
|
@@ -65,8 +57,10 @@ Run dev client server
|
|
|
65
57
|
```bash
|
|
66
58
|
npm run dev
|
|
67
59
|
```
|
|
68
|
-
|
|
69
|
-
|
|
60
|
+
|
|
61
|
+
<a target="_top" href="https://www.nexodev.org/docs?cid=src">See Docs here.</a>
|
|
62
|
+
|
|
63
|
+
## underpost ci/cd cli v2.99.8
|
|
70
64
|
|
|
71
65
|
### Usage: `underpost [options] [command]`
|
|
72
66
|
```
|
|
@@ -105,5 +99,4 @@ Commands:
|
|
|
105
99
|
|
|
106
100
|
```
|
|
107
101
|
|
|
108
|
-
<a target="_top" href="https://github.com/underpostnet/pwa-microservices-template/blob/master/cli.md">See
|
|
109
|
-
|
|
102
|
+
<a target="_top" href="https://github.com/underpostnet/pwa-microservices-template/blob/master/cli.md">See CLI Docs here.</a>
|
package/bin/file.js
CHANGED
|
@@ -101,7 +101,6 @@ try {
|
|
|
101
101
|
'./manifests/deployment/dd-template-development',
|
|
102
102
|
'./src/server/object-layer.js',
|
|
103
103
|
'./src/server/atlas-sprite-sheet-generator.js',
|
|
104
|
-
'bin/web3.js',
|
|
105
104
|
'bin/cyberia.js',
|
|
106
105
|
]) {
|
|
107
106
|
if (fs.existsSync(deletePath)) fs.removeSync('../pwa-microservices-template/' + deletePath);
|
|
@@ -164,25 +163,11 @@ try {
|
|
|
164
163
|
JSON.stringify(templatePackageLockJson, null, 4),
|
|
165
164
|
'utf8',
|
|
166
165
|
);
|
|
167
|
-
const badges = fs
|
|
168
|
-
.readFileSync(`./README.md`, 'utf8')
|
|
169
|
-
.split(`<!-- badges -->`)[1]
|
|
170
|
-
.split(`<!-- end-badges -->`)[0];
|
|
171
|
-
let originMd = fs.readFileSync(`../pwa-microservices-template/README.md`, 'utf8');
|
|
172
|
-
|
|
173
|
-
originMd =
|
|
174
|
-
originMd.split(`<!-- badges -->`)[0] +
|
|
175
|
-
`<!-- badges -->` +
|
|
176
|
-
badges +
|
|
177
|
-
`<!-- end-badges -->` +
|
|
178
|
-
originMd.split(`<!-- end-badges -->`)[1];
|
|
179
|
-
|
|
180
|
-
const splitKeyword = '## underpost ci/cd cli';
|
|
181
166
|
fs.writeFileSync(
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
167
|
+
'../pwa-microservices-template/README.md',
|
|
168
|
+
fs
|
|
169
|
+
.readFileSync('./README.md', 'utf8')
|
|
170
|
+
.replace('<!-- template-title -->', '#### Base template for pwa/api-rest projects.'),
|
|
186
171
|
'utf8',
|
|
187
172
|
);
|
|
188
173
|
}
|
package/cli.md
CHANGED
|
@@ -17,7 +17,7 @@ spec:
|
|
|
17
17
|
spec:
|
|
18
18
|
containers:
|
|
19
19
|
- name: dd-default-development-blue
|
|
20
|
-
image: localhost/rockylinux9-underpost:v2.99.
|
|
20
|
+
image: localhost/rockylinux9-underpost:v2.99.8
|
|
21
21
|
# resources:
|
|
22
22
|
# requests:
|
|
23
23
|
# memory: "124Ki"
|
|
@@ -100,7 +100,7 @@ spec:
|
|
|
100
100
|
spec:
|
|
101
101
|
containers:
|
|
102
102
|
- name: dd-default-development-green
|
|
103
|
-
image: localhost/rockylinux9-underpost:v2.99.
|
|
103
|
+
image: localhost/rockylinux9-underpost:v2.99.8
|
|
104
104
|
# resources:
|
|
105
105
|
# requests:
|
|
106
106
|
# memory: "124Ki"
|
|
@@ -18,7 +18,7 @@ spec:
|
|
|
18
18
|
spec:
|
|
19
19
|
containers:
|
|
20
20
|
- name: dd-test-development-blue
|
|
21
|
-
image: localhost/rockylinux9-underpost:v2.99.
|
|
21
|
+
image: localhost/rockylinux9-underpost:v2.99.8
|
|
22
22
|
|
|
23
23
|
command:
|
|
24
24
|
- /bin/sh
|
|
@@ -103,7 +103,7 @@ spec:
|
|
|
103
103
|
spec:
|
|
104
104
|
containers:
|
|
105
105
|
- name: dd-test-development-green
|
|
106
|
-
image: localhost/rockylinux9-underpost:v2.99.
|
|
106
|
+
image: localhost/rockylinux9-underpost:v2.99.8
|
|
107
107
|
|
|
108
108
|
command:
|
|
109
109
|
- /bin/sh
|
package/package.json
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { createPool } from 'mariadb';
|
|
2
2
|
|
|
3
3
|
import { loggerFactory } from '../../server/logger.js';
|
|
4
4
|
|
|
@@ -32,7 +32,7 @@ class MariaDBService {
|
|
|
32
32
|
*/
|
|
33
33
|
async query(options) {
|
|
34
34
|
const { host, port, user, password, query } = options;
|
|
35
|
-
const pool =
|
|
35
|
+
const pool = createPool({
|
|
36
36
|
host: 'host' in options ? host : '127.0.0.1',
|
|
37
37
|
port: 'port' in options ? port : 3306,
|
|
38
38
|
user: 'user' in options ? user : 'root',
|
package/src/index.js
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
FROM rockylinux:9
|
|
2
2
|
|
|
3
|
-
#
|
|
3
|
+
# Update and install required packages
|
|
4
4
|
RUN dnf -y update && \
|
|
5
5
|
dnf -y install epel-release && \
|
|
6
6
|
dnf -y install --allowerasing \
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
7
|
+
bzip2 \
|
|
8
|
+
sudo \
|
|
9
|
+
curl \
|
|
10
|
+
net-tools \
|
|
11
|
+
openssh-server \
|
|
12
|
+
nano \
|
|
13
|
+
vim-enhanced \
|
|
14
|
+
less \
|
|
15
|
+
openssl-devel \
|
|
16
|
+
wget \
|
|
17
|
+
git \
|
|
18
|
+
gnupg2 \
|
|
19
|
+
libnsl \
|
|
20
|
+
perl && \
|
|
21
21
|
dnf clean all
|
|
22
22
|
|
|
23
23
|
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
FROM rockylinux:9
|
|
2
2
|
|
|
3
|
-
#
|
|
3
|
+
# Update and install required packages
|
|
4
4
|
RUN dnf -y update && \
|
|
5
5
|
dnf -y install epel-release && \
|
|
6
6
|
dnf -y install --allowerasing \
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
7
|
+
bzip2 \
|
|
8
|
+
sudo \
|
|
9
|
+
curl \
|
|
10
|
+
net-tools \
|
|
11
|
+
openssh-server \
|
|
12
|
+
nano \
|
|
13
|
+
vim-enhanced \
|
|
14
|
+
less \
|
|
15
|
+
openssl-devel \
|
|
16
|
+
wget \
|
|
17
|
+
git \
|
|
18
|
+
gnupg2 \
|
|
19
|
+
libnsl \
|
|
20
|
+
perl && \
|
|
21
21
|
dnf clean all
|
|
22
22
|
|
|
23
23
|
# --- Download and install XAMPP
|
package/src/server/conf.js
CHANGED
|
@@ -1336,25 +1336,8 @@ const buildCliDoc = (program, oldVersion, newVersion) => {
|
|
|
1336
1336
|
md = md.replaceAll(oldVersion, newVersion);
|
|
1337
1337
|
fs.writeFileSync(`./src/client/public/nexodev/docs/references/Command Line Interface.md`, md, 'utf8');
|
|
1338
1338
|
fs.writeFileSync(`./cli.md`, md, 'utf8');
|
|
1339
|
-
const
|
|
1340
|
-
|
|
1341
|
-
fs.writeFileSync(
|
|
1342
|
-
'./README.md',
|
|
1343
|
-
(
|
|
1344
|
-
readme[0] +
|
|
1345
|
-
readmeSplit +
|
|
1346
|
-
`
|
|
1347
|
-
|
|
1348
|
-
` +
|
|
1349
|
-
baseOptions +
|
|
1350
|
-
`
|
|
1351
|
-
|
|
1352
|
-
<a target="_top" href="https://github.com/${process.env.GITHUB_USERNAME}/pwa-microservices-template/blob/master/cli.md">See complete CLI Docs here.</a>
|
|
1353
|
-
|
|
1354
|
-
`
|
|
1355
|
-
).replaceAll(oldVersion, newVersion),
|
|
1356
|
-
'utf8',
|
|
1357
|
-
);
|
|
1339
|
+
const readme = fs.readFileSync(`./README.md`, 'utf8');
|
|
1340
|
+
fs.writeFileSync('./README.md', readme.replaceAll(oldVersion, newVersion), 'utf8');
|
|
1358
1341
|
};
|
|
1359
1342
|
|
|
1360
1343
|
/**
|
package/bin/cron.js
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { BackUpManagement } from '../src/server/backup.js';
|
|
2
|
-
import { Cmd } from '../src/server/conf.js';
|
|
3
|
-
import { Dns } from '../src/server/dns.js';
|
|
4
|
-
import { loggerFactory } from '../src/server/logger.js';
|
|
5
|
-
import { netWorkCron, saveRuntimeCron } from '../src/server/network.js';
|
|
6
|
-
import { shellExec } from '../src/server/process.js';
|
|
7
|
-
import fs from 'fs-extra';
|
|
8
|
-
|
|
9
|
-
const logger = loggerFactory(import.meta);
|
|
10
|
-
|
|
11
|
-
await logger.setUpInfo();
|
|
12
|
-
|
|
13
|
-
switch (process.argv[2]) {
|
|
14
|
-
case 'backups':
|
|
15
|
-
{
|
|
16
|
-
await BackUpManagement.Init({ deployId: process.argv[3] });
|
|
17
|
-
}
|
|
18
|
-
break;
|
|
19
|
-
case 'dns':
|
|
20
|
-
{
|
|
21
|
-
await Dns.InitIpDaemon({ deployId: process.argv[3] });
|
|
22
|
-
}
|
|
23
|
-
break;
|
|
24
|
-
|
|
25
|
-
case 'run': {
|
|
26
|
-
const confCronConfig = JSON.parse(fs.readFileSync(`./engine-private/conf/${process.argv[3]}/conf.cron.json`));
|
|
27
|
-
if (confCronConfig.jobs && Object.keys(confCronConfig.jobs).length > 0) {
|
|
28
|
-
shellExec(`node bin/deploy conf ${process.argv[3]} production`);
|
|
29
|
-
for (const job of Object.keys(confCronConfig.jobs)) {
|
|
30
|
-
if (confCronConfig.jobs[job].enabled) {
|
|
31
|
-
shellExec(Cmd.cron(process.argv[3], job, confCronConfig.jobs[job].expression));
|
|
32
|
-
netWorkCron.push({
|
|
33
|
-
deployId: process.argv[3],
|
|
34
|
-
jobId: job,
|
|
35
|
-
expression: confCronConfig.jobs[job].expression,
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
await saveRuntimeCron();
|
|
41
|
-
if (fs.existsSync(`./tmp/await-deploy`)) fs.remove(`./tmp/await-deploy`);
|
|
42
|
-
break;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
default:
|
|
46
|
-
break;
|
|
47
|
-
}
|
package/bin/db.js
DELETED
|
@@ -1,199 +0,0 @@
|
|
|
1
|
-
import fs from 'fs-extra';
|
|
2
|
-
import { shellExec } from '../src/server/process.js';
|
|
3
|
-
import { loggerFactory } from '../src/server/logger.js';
|
|
4
|
-
import { MariaDB } from '../src/db/mariadb/MariaDB.js';
|
|
5
|
-
import { Lampp } from '../src/runtime/lampp/Lampp.js';
|
|
6
|
-
import { getCapVariableName, loadConf, splitFileFactory } from '../src/server/conf.js';
|
|
7
|
-
import { DataBaseProvider } from '../src/db/DataBaseProvider.js';
|
|
8
|
-
import { hashPassword } from '../src/server/auth.js';
|
|
9
|
-
|
|
10
|
-
const logger = loggerFactory(import.meta);
|
|
11
|
-
|
|
12
|
-
logger.info('argv', process.argv);
|
|
13
|
-
|
|
14
|
-
const [exe, dir, hostPath = '', operator, deployId, arg0, arg1, arg2] = process.argv;
|
|
15
|
-
const [host, _path = ''] = hostPath.split('/');
|
|
16
|
-
const path = `/${_path}`;
|
|
17
|
-
|
|
18
|
-
try {
|
|
19
|
-
let cmd;
|
|
20
|
-
if (deployId) loadConf(deployId);
|
|
21
|
-
const confServer = JSON.parse(fs.readFileSync(`./conf/conf.server.json`, 'utf8'));
|
|
22
|
-
const { runtime, db, git, client, directory } = confServer[host][path];
|
|
23
|
-
const { provider, name, user, password = '', backupPath = '' } = db;
|
|
24
|
-
// logger.info('database', confServer[host][`/${path}`].db);
|
|
25
|
-
switch (provider) {
|
|
26
|
-
case 'mariadb':
|
|
27
|
-
// Login:
|
|
28
|
-
// mysql -u root -h localhost -p
|
|
29
|
-
|
|
30
|
-
// Get Users:
|
|
31
|
-
// SELECT user,authentication_string,plugin,host FROM mysql.user;
|
|
32
|
-
|
|
33
|
-
// Get DB User:
|
|
34
|
-
// SELECT User, Db, Host from mysql.db;
|
|
35
|
-
|
|
36
|
-
// Change password:
|
|
37
|
-
// ALTER USER 'root'@'127.0.0.1' IDENTIFIED BY 'NEW_PASSWORD';
|
|
38
|
-
// ALTER USER 'root'@'localhost' IDENTIFIED BY 'NEW_PASSWORD';
|
|
39
|
-
// ALTER USER 'root'@'::1' IDENTIFIED BY 'NEW_PASSWORD';
|
|
40
|
-
|
|
41
|
-
// Get all user privileges:
|
|
42
|
-
// select * from information_schema.user_privileges;
|
|
43
|
-
|
|
44
|
-
// Expose public server:
|
|
45
|
-
// '/etc/mysql/my.cnf' Change lines:
|
|
46
|
-
// bind-address = 127.0.0.1 -> bind-address = 0.0.0.0
|
|
47
|
-
// skip-networking -> #skip-networking
|
|
48
|
-
|
|
49
|
-
// Create user:
|
|
50
|
-
// DROP USER 'username'@'%';
|
|
51
|
-
// CREATE USER 'username'@'%' IDENTIFIED BY 'password';
|
|
52
|
-
|
|
53
|
-
// Set DB user:
|
|
54
|
-
// FLUSH PRIVILEGES;
|
|
55
|
-
// ON databasename.*
|
|
56
|
-
// TO 'username'@'%'
|
|
57
|
-
// IDENTIFIED BY 'newpassword';
|
|
58
|
-
// FLUSH PRIVILEGES;
|
|
59
|
-
|
|
60
|
-
// Set admin:
|
|
61
|
-
// FLUSH PRIVILEGES;
|
|
62
|
-
// GRANT ALL PRIVILEGES ON *.* TO 'username'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;
|
|
63
|
-
// FLUSH PRIVILEGES;
|
|
64
|
-
|
|
65
|
-
switch (operator) {
|
|
66
|
-
case 'show-all':
|
|
67
|
-
await MariaDB.query({ user, password, query: `SHOW DATABASES` });
|
|
68
|
-
break;
|
|
69
|
-
case 'show':
|
|
70
|
-
await MariaDB.query({ user, password, query: `SHOW TABLES FROM ${name}` });
|
|
71
|
-
break;
|
|
72
|
-
case 'create':
|
|
73
|
-
await MariaDB.query({ user, password, query: `CREATE DATABASE ${name}` });
|
|
74
|
-
break;
|
|
75
|
-
case 'delete':
|
|
76
|
-
await MariaDB.query({ user, password, query: `DROP DATABASE IF EXISTS ${name}` });
|
|
77
|
-
break;
|
|
78
|
-
case 'select':
|
|
79
|
-
{
|
|
80
|
-
const pageSize = 10;
|
|
81
|
-
const pageNumber = 1;
|
|
82
|
-
await MariaDB.query({
|
|
83
|
-
user,
|
|
84
|
-
password,
|
|
85
|
-
query: `SELECT ${arg0} FROM ${name}.${arg1} LIMIT ${pageSize} OFFSET ${(pageNumber - 1) * pageSize}`,
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
break;
|
|
89
|
-
case 'count': {
|
|
90
|
-
await MariaDB.query({
|
|
91
|
-
user,
|
|
92
|
-
password,
|
|
93
|
-
query: `SELECT COUNT(*) AS total FROM ${name}.${arg0}`,
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
case 'export':
|
|
97
|
-
{
|
|
98
|
-
const cmdBackupPath = `${arg0 ? `${arg0}/${name}.sql` : backupPath}`;
|
|
99
|
-
|
|
100
|
-
cmd = `mysqldump -u ${user} -p${password} ${name} > ${cmdBackupPath}`;
|
|
101
|
-
shellExec(cmd);
|
|
102
|
-
await splitFileFactory(name, cmdBackupPath);
|
|
103
|
-
}
|
|
104
|
-
break;
|
|
105
|
-
case 'import':
|
|
106
|
-
break;
|
|
107
|
-
|
|
108
|
-
case 'init-lampp-service':
|
|
109
|
-
await Lampp.initService();
|
|
110
|
-
break;
|
|
111
|
-
case 'remote-client-access':
|
|
112
|
-
{
|
|
113
|
-
// https://docs.anaconda.com/miniconda/install/#quick-command-line-install
|
|
114
|
-
// https://mariadb.com/kb/en/configuring-mariadb-for-remote-client-access/
|
|
115
|
-
// conf: /opt/lampp/etc
|
|
116
|
-
// conf: /etc/mysql/my.cnf
|
|
117
|
-
// conf: /etc/mysql/mariadb.conf.d/50-server.cnf
|
|
118
|
-
// cli: /opt/lampp/bin/mysql
|
|
119
|
-
// cli: mysql -h 127.0.0.1
|
|
120
|
-
// select db: use db0;
|
|
121
|
-
}
|
|
122
|
-
break;
|
|
123
|
-
default:
|
|
124
|
-
break;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
break;
|
|
128
|
-
|
|
129
|
-
case 'mongoose':
|
|
130
|
-
// MongoDB App Services CLI
|
|
131
|
-
switch (operator) {
|
|
132
|
-
case 'update':
|
|
133
|
-
{
|
|
134
|
-
await DataBaseProvider.load({ apis: [arg0], host, path, db });
|
|
135
|
-
const models = DataBaseProvider.instance[`${host}${path}`].mongoose.models[getCapVariableName(arg0)];
|
|
136
|
-
|
|
137
|
-
const select = JSON.parse(arg1.replaceAll("'", `"`));
|
|
138
|
-
const update = JSON.parse(arg2.replaceAll("'", `"`));
|
|
139
|
-
|
|
140
|
-
console.log({ models, select, update });
|
|
141
|
-
|
|
142
|
-
switch (arg0) {
|
|
143
|
-
case 'user':
|
|
144
|
-
if (update.password) update.password = hashPassword(update.password);
|
|
145
|
-
|
|
146
|
-
default:
|
|
147
|
-
break;
|
|
148
|
-
}
|
|
149
|
-
let doc = await models.findOne(select);
|
|
150
|
-
if (doc) {
|
|
151
|
-
doc = await models.findByIdAndUpdate(doc._id, update, {
|
|
152
|
-
runValidators: true,
|
|
153
|
-
});
|
|
154
|
-
logger.info(`successfully updated doc`, doc._doc);
|
|
155
|
-
await DataBaseProvider.instance[`${host}${path}`].mongoose.close();
|
|
156
|
-
} else throw new Error(`no doc found`);
|
|
157
|
-
}
|
|
158
|
-
break;
|
|
159
|
-
case 'show-all':
|
|
160
|
-
// show dbs
|
|
161
|
-
break;
|
|
162
|
-
case 'show':
|
|
163
|
-
break;
|
|
164
|
-
case 'create':
|
|
165
|
-
break;
|
|
166
|
-
case 'delete':
|
|
167
|
-
{
|
|
168
|
-
await DataBaseProvider.load({ apis: [arg0], host, path, db });
|
|
169
|
-
const models = DataBaseProvider.instance[`${host}${path}`].mongoose.models[getCapVariableName(arg0)];
|
|
170
|
-
await models.collection.drop();
|
|
171
|
-
logger.info(`successfully drop collection`, arg0);
|
|
172
|
-
await DataBaseProvider.instance[`${host}${path}`].mongoose.close();
|
|
173
|
-
}
|
|
174
|
-
break;
|
|
175
|
-
case 'export':
|
|
176
|
-
// mongodump -d <database_name> -o <directory_backup>
|
|
177
|
-
shellExec(`mongodump -d ${name} -o ${arg0 ? arg0 : `./engine-private/mongodb-backup/`}`);
|
|
178
|
-
break;
|
|
179
|
-
case 'import':
|
|
180
|
-
// mongorestore -d <database_name> <directory_backup>
|
|
181
|
-
break;
|
|
182
|
-
case 'init-service':
|
|
183
|
-
break;
|
|
184
|
-
default:
|
|
185
|
-
break;
|
|
186
|
-
}
|
|
187
|
-
break;
|
|
188
|
-
|
|
189
|
-
default:
|
|
190
|
-
break;
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
// logger.info(`Run the following command`, cmd);
|
|
194
|
-
// await ncp.copy(cmd);
|
|
195
|
-
// await read({ prompt: 'Command copy to clipboard, press enter to continue.\n' });
|
|
196
|
-
// throw new Error(``);
|
|
197
|
-
} catch (error) {
|
|
198
|
-
logger.error(error, error.stack);
|
|
199
|
-
}
|
package/bin/hwt.js
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import fs from 'fs-extra';
|
|
2
|
-
|
|
3
|
-
import { loggerFactory } from '../src/server/logger.js';
|
|
4
|
-
|
|
5
|
-
const logger = loggerFactory(import.meta);
|
|
6
|
-
|
|
7
|
-
logger.info('argv', process.argv);
|
|
8
|
-
|
|
9
|
-
const [exe, dir, operator, templateId, publicPath] = process.argv;
|
|
10
|
-
|
|
11
|
-
// engine for 'html-website-templates'
|
|
12
|
-
|
|
13
|
-
try {
|
|
14
|
-
switch (operator) {
|
|
15
|
-
case 'set-base':
|
|
16
|
-
{
|
|
17
|
-
switch (parseInt(templateId)) {
|
|
18
|
-
// Horizontal Scroll One Page Template Website
|
|
19
|
-
case 0:
|
|
20
|
-
{
|
|
21
|
-
fs.writeFile(
|
|
22
|
-
`${publicPath}/index.html`,
|
|
23
|
-
fs
|
|
24
|
-
.readFileSync(`${publicPath}/index.html`, 'utf8')
|
|
25
|
-
.replace(`<ul class="menu">`, `<ul class="menu hidden">`)
|
|
26
|
-
.replaceAll(`<section class="slide fade-6 kenBurns">`, `<section class="fade-6 kenBurns hidden">`)
|
|
27
|
-
.replace(`<section class="fade-6 kenBurns hidden">`, `<section class="slide fade-6 kenBurns">`)
|
|
28
|
-
.replaceAll(
|
|
29
|
-
`<nav class="panel bottom forceMobileView">`,
|
|
30
|
-
`<nav class="panel bottom forceMobileView hidden">`,
|
|
31
|
-
),
|
|
32
|
-
|
|
33
|
-
'utf8',
|
|
34
|
-
);
|
|
35
|
-
}
|
|
36
|
-
break;
|
|
37
|
-
|
|
38
|
-
default:
|
|
39
|
-
break;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
break;
|
|
43
|
-
|
|
44
|
-
default:
|
|
45
|
-
break;
|
|
46
|
-
}
|
|
47
|
-
} catch (error) {
|
|
48
|
-
logger.error(error, error.stack);
|
|
49
|
-
}
|
package/bin/util.js
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import fs from 'fs-extra';
|
|
2
|
-
import * as dir from 'path';
|
|
3
|
-
|
|
4
|
-
import { loggerFactory } from '../src/server/logger.js';
|
|
5
|
-
import { pbcopy } from '../src/server/process.js';
|
|
6
|
-
import { buildKindPorts } from '../src/server/conf.js';
|
|
7
|
-
|
|
8
|
-
const logger = loggerFactory(import.meta);
|
|
9
|
-
|
|
10
|
-
logger.info('argv', process.argv);
|
|
11
|
-
|
|
12
|
-
const operator = process.argv[2];
|
|
13
|
-
|
|
14
|
-
try {
|
|
15
|
-
// let cmd;
|
|
16
|
-
switch (operator) {
|
|
17
|
-
case 'log':
|
|
18
|
-
console.log(fs.readFileSync(process.argv[3], 'utf8'));
|
|
19
|
-
break;
|
|
20
|
-
|
|
21
|
-
case 'delete-empty-folder':
|
|
22
|
-
function cleanEmptyFoldersRecursively(folder) {
|
|
23
|
-
if (!fs.existsSync(folder)) {
|
|
24
|
-
logger.warn('Does not exist', folder);
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
const isDir = fs.statSync(folder).isDirectory();
|
|
28
|
-
if (!isDir) return;
|
|
29
|
-
|
|
30
|
-
let files = fs.readdirSync(folder);
|
|
31
|
-
if (files.length > 0) {
|
|
32
|
-
files.forEach(function (file) {
|
|
33
|
-
const fullPath = dir.join(folder, file);
|
|
34
|
-
cleanEmptyFoldersRecursively(fullPath);
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
// re-evaluate files; after deleting subfolder
|
|
38
|
-
// we may have parent folder empty now
|
|
39
|
-
files = fs.readdirSync(folder);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
if (files.length === 0) {
|
|
43
|
-
console.log('removing: ', folder);
|
|
44
|
-
try {
|
|
45
|
-
fs.rmdirSync(folder);
|
|
46
|
-
} catch (error) {
|
|
47
|
-
logger.error(error);
|
|
48
|
-
}
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
cleanEmptyFoldersRecursively('./');
|
|
53
|
-
break;
|
|
54
|
-
|
|
55
|
-
case 'build-ports': {
|
|
56
|
-
pbcopy(buildKindPorts(process.argv[3], process.argv[4]));
|
|
57
|
-
}
|
|
58
|
-
default:
|
|
59
|
-
break;
|
|
60
|
-
}
|
|
61
|
-
} catch (error) {
|
|
62
|
-
logger.error(error, error.stack);
|
|
63
|
-
}
|