underpost 2.8.522 → 2.8.531
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/bin/deploy.js +62 -63
- package/bin/index.js +13 -12
- package/docker-compose.yml +1 -1
- 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 +62 -0
- package/package.json +1 -1
- package/src/cli/cluster.js +10 -6
- package/src/cli/cron.js +1 -1
- package/src/cli/image.js +0 -17
- package/src/cli/script.js +19 -1
- package/src/cli/test.js +2 -2
- package/src/db/mongo/MongooseDB.js +2 -0
- package/src/index.js +1 -1
- package/src/server/backup.js +2 -2
- package/src/server/conf.js +4 -1
package/bin/deploy.js
CHANGED
|
@@ -672,80 +672,79 @@ try {
|
|
|
672
672
|
break;
|
|
673
673
|
}
|
|
674
674
|
|
|
675
|
-
case '
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
);
|
|
706
|
-
}
|
|
675
|
+
case 'version-build': {
|
|
676
|
+
const newVersion = process.argv[3];
|
|
677
|
+
const originPackageJson = JSON.parse(fs.readFileSync(`package.json`, 'utf8'));
|
|
678
|
+
const { version } = originPackageJson;
|
|
679
|
+
originPackageJson.version = newVersion;
|
|
680
|
+
fs.writeFileSync(`package.json`, JSON.stringify(originPackageJson, null, 4), 'utf8');
|
|
681
|
+
|
|
682
|
+
const originPackageLockJson = JSON.parse(fs.readFileSync(`package-lock.json`, 'utf8'));
|
|
683
|
+
originPackageLockJson.version = newVersion;
|
|
684
|
+
originPackageLockJson.packages[''].version = newVersion;
|
|
685
|
+
fs.writeFileSync(`package-lock.json`, JSON.stringify(originPackageLockJson, null, 4), 'utf8');
|
|
686
|
+
|
|
687
|
+
if (fs.existsSync(`./engine-private/conf`)) {
|
|
688
|
+
const files = await fs.readdir(`./engine-private/conf`, { recursive: true });
|
|
689
|
+
for (const relativePath of files) {
|
|
690
|
+
const filePah = `./engine-private/conf/${relativePath.replaceAll(`\\`, '/')}`;
|
|
691
|
+
if (filePah.split('/').pop() === 'package.json') {
|
|
692
|
+
const originPackage = JSON.parse(fs.readFileSync(filePah, 'utf8'));
|
|
693
|
+
originPackage.version = newVersion;
|
|
694
|
+
fs.writeFileSync(filePah, JSON.stringify(originPackage, null, 4), 'utf8');
|
|
695
|
+
}
|
|
696
|
+
if (filePah.split('/').pop() === 'deployment.yaml') {
|
|
697
|
+
fs.writeFileSync(
|
|
698
|
+
filePah,
|
|
699
|
+
fs
|
|
700
|
+
.readFileSync(filePah, 'utf8')
|
|
701
|
+
.replaceAll(`v${version}`, `v${newVersion}`)
|
|
702
|
+
.replaceAll(`engine.version: ${version}`, `engine.version: ${newVersion}`),
|
|
703
|
+
'utf8',
|
|
704
|
+
);
|
|
707
705
|
}
|
|
708
706
|
}
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
fs.writeFileSync(
|
|
710
|
+
`./docker-compose.yml`,
|
|
711
|
+
fs
|
|
712
|
+
.readFileSync(`./docker-compose.yml`, 'utf8')
|
|
713
|
+
.replaceAll(`engine.version: '${version}'`, `engine.version: '${newVersion}'`),
|
|
714
|
+
'utf8',
|
|
715
|
+
);
|
|
709
716
|
|
|
717
|
+
if (fs.existsSync(`./.github/workflows/docker-image.yml`))
|
|
710
718
|
fs.writeFileSync(
|
|
711
|
-
|
|
719
|
+
`./.github/workflows/docker-image.yml`,
|
|
712
720
|
fs
|
|
713
|
-
.readFileSync(
|
|
714
|
-
.replaceAll(`engine
|
|
721
|
+
.readFileSync(`./.github/workflows/docker-image.yml`, 'utf8')
|
|
722
|
+
.replaceAll(`underpost-engine:v${version}`, `underpost-engine:v${newVersion}`),
|
|
715
723
|
'utf8',
|
|
716
724
|
);
|
|
717
725
|
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
.replaceAll(`underpost-engine:v${version}`, `underpost-engine:v${newVersion}`),
|
|
724
|
-
'utf8',
|
|
725
|
-
);
|
|
726
|
+
fs.writeFileSync(
|
|
727
|
+
`./src/index.js`,
|
|
728
|
+
fs.readFileSync(`./src/index.js`, 'utf8').replaceAll(`${version}`, `${newVersion}`),
|
|
729
|
+
'utf8',
|
|
730
|
+
);
|
|
726
731
|
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
+
shellExec(`node bin/deploy update-dependencies`);
|
|
733
|
+
shellExec(`auto-changelog`);
|
|
734
|
+
shellExec(`node bin deploy dd --build-manifest --sync --info-router`);
|
|
735
|
+
shellExec(`node bin deploy dd production --build-manifest --sync --info-router`);
|
|
736
|
+
break;
|
|
737
|
+
}
|
|
732
738
|
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
shellExec(`underpost cmt . ci package-pwa-microservices-template 'update version ${newVersion}'`);
|
|
741
|
-
shellExec(
|
|
742
|
-
`underpost cmt ./engine-private ci package-pwa-microservices-template 'update version ${newVersion}'`,
|
|
743
|
-
);
|
|
744
|
-
shellExec(`underpost push . underpostnet/engine`);
|
|
745
|
-
shellExec(`cd ./engine-private && underpost push . underpostnet/engine-private`);
|
|
746
|
-
}, 1000);
|
|
747
|
-
}
|
|
739
|
+
case 'version-deploy': {
|
|
740
|
+
shellExec(`node bin/build dd conf`);
|
|
741
|
+
shellExec(`git add . && cd ./engine-private && git add .`);
|
|
742
|
+
shellExec(`node bin cmt . ci package-pwa-microservices-template`);
|
|
743
|
+
shellExec(`node bin cmt ./engine-private ci package-pwa-microservices-template`);
|
|
744
|
+
shellExec(`node bin push . underpostnet/engine`);
|
|
745
|
+
shellExec(`cd ./engine-private && node ../bin push . underpostnet/engine-private`);
|
|
748
746
|
break;
|
|
747
|
+
}
|
|
749
748
|
|
|
750
749
|
case 'update-authors': {
|
|
751
750
|
// #### Ordered by first contribution.
|
package/bin/index.js
CHANGED
|
@@ -2,20 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
import dotenv from 'dotenv';
|
|
4
4
|
import { Command } from 'commander';
|
|
5
|
-
import { loggerFactory } from '../src/server/logger.js';
|
|
6
5
|
import Underpost from '../src/index.js';
|
|
7
|
-
import {
|
|
6
|
+
import { getUnderpostRootPath, loadConf } from '../src/server/conf.js';
|
|
8
7
|
import fs from 'fs-extra';
|
|
9
8
|
import { commitData } from '../src/client/components/core/CommonJs.js';
|
|
10
9
|
import UnderpostScript from '../src/cli/script.js';
|
|
11
10
|
import UnderpostDB from '../src/cli/db.js';
|
|
12
11
|
import UnderpostCron from '../src/cli/cron.js';
|
|
13
12
|
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const logger = loggerFactory(import.meta);
|
|
13
|
+
const underpostRootPath = getUnderpostRootPath();
|
|
14
|
+
fs.existsSync(`${underpostRootPath}/.env`)
|
|
15
|
+
? dotenv.config({ path: `${underpostRootPath}/.env`, override: true })
|
|
16
|
+
: dotenv.config();
|
|
19
17
|
|
|
20
18
|
const program = new Command();
|
|
21
19
|
|
|
@@ -150,7 +148,7 @@ program
|
|
|
150
148
|
.command('install')
|
|
151
149
|
.description('Fast import underpost npm dependencies')
|
|
152
150
|
.action(() => {
|
|
153
|
-
fs.copySync(`${
|
|
151
|
+
fs.copySync(`${underpostRootPath}/node_modules`, './node_modules');
|
|
154
152
|
});
|
|
155
153
|
|
|
156
154
|
program
|
|
@@ -165,17 +163,20 @@ program
|
|
|
165
163
|
.command('script')
|
|
166
164
|
.argument('operator', `Options: ${Object.keys(UnderpostScript.API)}`)
|
|
167
165
|
.argument('<script-name>', 'Script name')
|
|
168
|
-
.argument('[script-value]', 'Literal command')
|
|
166
|
+
.argument('[script-value]', 'Literal command, or path')
|
|
167
|
+
.option('--itc', 'Inside container execution context')
|
|
168
|
+
.option('--ns <ns-name>', 'Options name space context')
|
|
169
|
+
.option('--pod-name <pod-name>')
|
|
169
170
|
.description(
|
|
170
171
|
'Supports a number of built-in underpost global scripts and their preset life cycle events as well as arbitrary scripts',
|
|
171
172
|
)
|
|
172
|
-
.action((...args) => Underpost.script[args[0]](args[1], args[2]));
|
|
173
|
+
.action((...args) => Underpost.script[args[0]](args[1], args[2], args[3]));
|
|
173
174
|
|
|
174
175
|
program
|
|
175
176
|
.command('cron')
|
|
176
177
|
.argument('[deploy-list]', 'Deploy id list, e.g. default-a,default-b')
|
|
177
178
|
.argument('[job-list]', `Deploy id list, e.g. ${Object.keys(UnderpostCron.JOB)}, for default all available jobs`)
|
|
178
|
-
.option('--
|
|
179
|
+
.option('--itc', 'Inside container execution context')
|
|
179
180
|
.option('--init', 'Init cron jobs for cron job default deploy id')
|
|
180
181
|
.description('Cron jobs management')
|
|
181
182
|
.action(Underpost.cron.callback);
|
|
@@ -184,7 +185,7 @@ program
|
|
|
184
185
|
.command('test')
|
|
185
186
|
.argument('[deploy-list]', 'Deploy id list, e.g. default-a,default-b')
|
|
186
187
|
.description('Manage Test, for default run current underpost default test')
|
|
187
|
-
.option('--
|
|
188
|
+
.option('--itc', 'Inside container execution context')
|
|
188
189
|
.option('--sh', 'Copy to clipboard, container entrypoint shell command')
|
|
189
190
|
.option('--logs', 'Display container logs')
|
|
190
191
|
.option('--pod-name <pod-name>')
|
package/docker-compose.yml
CHANGED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
apiVersion: v1
|
|
2
|
+
kind: PersistentVolume
|
|
3
|
+
metadata:
|
|
4
|
+
name: mongodb-pv
|
|
5
|
+
spec:
|
|
6
|
+
capacity:
|
|
7
|
+
storage: 5Gi
|
|
8
|
+
accessModes:
|
|
9
|
+
- ReadWriteOnce
|
|
10
|
+
hostPath:
|
|
11
|
+
path: /data/mongodb
|
|
12
|
+
---
|
|
13
|
+
apiVersion: v1
|
|
14
|
+
kind: PersistentVolumeClaim
|
|
15
|
+
metadata:
|
|
16
|
+
name: mongodb-pvc
|
|
17
|
+
spec:
|
|
18
|
+
storageClassName: ''
|
|
19
|
+
accessModes:
|
|
20
|
+
- ReadWriteOnce
|
|
21
|
+
resources:
|
|
22
|
+
requests:
|
|
23
|
+
storage: 5Gi
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
apiVersion: apps/v1
|
|
2
|
+
kind: Deployment
|
|
3
|
+
metadata:
|
|
4
|
+
name: mongodb-deployment
|
|
5
|
+
namespace: default
|
|
6
|
+
spec:
|
|
7
|
+
selector:
|
|
8
|
+
matchLabels:
|
|
9
|
+
app: mongodb
|
|
10
|
+
replicas: 1
|
|
11
|
+
template:
|
|
12
|
+
metadata:
|
|
13
|
+
labels:
|
|
14
|
+
app: mongodb
|
|
15
|
+
spec:
|
|
16
|
+
hostname: mongo
|
|
17
|
+
containers:
|
|
18
|
+
- name: mongodb
|
|
19
|
+
image: docker.io/library/mongo:4.4
|
|
20
|
+
command: ['mongod', '--replSet', 'rs0', '--bind_ip_all']
|
|
21
|
+
# -- bash
|
|
22
|
+
# mongo
|
|
23
|
+
# use admin
|
|
24
|
+
# rs.initiate()
|
|
25
|
+
ports:
|
|
26
|
+
- containerPort: 27017
|
|
27
|
+
|
|
28
|
+
volumeMounts:
|
|
29
|
+
- name: mongo-persistent-storage
|
|
30
|
+
mountPath: /data/db
|
|
31
|
+
|
|
32
|
+
resources:
|
|
33
|
+
requests:
|
|
34
|
+
memory: '500Mi'
|
|
35
|
+
cpu: '500m'
|
|
36
|
+
volumes:
|
|
37
|
+
- name: mongo-persistent-storage
|
|
38
|
+
persistentVolumeClaim:
|
|
39
|
+
claimName: mongodb-pvc
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
apiVersion: v1
|
|
43
|
+
kind: Service
|
|
44
|
+
metadata:
|
|
45
|
+
name: mongodb-service
|
|
46
|
+
namespace: default
|
|
47
|
+
spec:
|
|
48
|
+
clusterIP: None
|
|
49
|
+
selector:
|
|
50
|
+
app: mongodb
|
|
51
|
+
ports:
|
|
52
|
+
- protocol: TCP
|
|
53
|
+
port: 27017
|
|
54
|
+
# targetPort: 27017
|
|
55
|
+
# type: ClusterIP
|
|
56
|
+
|
|
57
|
+
# rs.initiate();
|
|
58
|
+
# use admin;
|
|
59
|
+
# db.createUser({user: "your_user",pwd: "your_password", roles: [{role: "userAdminAnyDatabase", db: "admin" },{ role: "readWriteAnyDatabase", db: "admin" }]});
|
|
60
|
+
# cfg = rs.conf();
|
|
61
|
+
# cfg.members[0].host = "127.0.0.1:27027";
|
|
62
|
+
# rs.reconfig(cfg);
|
package/package.json
CHANGED
package/src/cli/cluster.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { timer } from '../client/components/core/CommonJs.js';
|
|
2
|
-
import { cliSpinner } from '../server/conf.js';
|
|
2
|
+
import { cliSpinner, getNpmRootPath } from '../server/conf.js';
|
|
3
3
|
import { loggerFactory } from '../server/logger.js';
|
|
4
4
|
import { shellExec } from '../server/process.js';
|
|
5
5
|
import UnderpostDeploy from './deploy.js';
|
|
@@ -23,6 +23,8 @@ class UnderpostCluster {
|
|
|
23
23
|
nsUse: '',
|
|
24
24
|
},
|
|
25
25
|
) {
|
|
26
|
+
const npmRoot = getNpmRootPath();
|
|
27
|
+
const underpostRoot = `${npmRoot}/underpost`;
|
|
26
28
|
if (options.reset === true) return await UnderpostCluster.API.reset();
|
|
27
29
|
if (options.listPods === true) return console.table(UnderpostDeploy.API.getPods(podName ?? undefined));
|
|
28
30
|
|
|
@@ -72,13 +74,15 @@ class UnderpostCluster {
|
|
|
72
74
|
// shellExec(`cp /etc/kubernetes/admin.conf ~/.kube/config`);
|
|
73
75
|
shellExec(`sudo systemctl restart kubelet`);
|
|
74
76
|
shellExec(`sudo service docker restart`);
|
|
75
|
-
shellExec(`
|
|
77
|
+
shellExec(`sudo systemctl enable --now containerd.service`);
|
|
78
|
+
shellExec(`sudo systemctl restart containerd`);
|
|
79
|
+
shellExec(`cd ${underpostRoot}/manifests && kind create cluster --config kind-config.yaml`);
|
|
76
80
|
shellExec(`sudo chown $(id -u):$(id -g) $HOME/.kube/config**`);
|
|
77
81
|
} else logger.warn('Cluster already initialized');
|
|
78
82
|
|
|
79
83
|
if (options.full || options.valkey) {
|
|
80
84
|
shellExec(`kubectl delete statefulset service-valkey`);
|
|
81
|
-
shellExec(`kubectl apply -k
|
|
85
|
+
shellExec(`kubectl apply -k ${underpostRoot}/manifests/valkey`);
|
|
82
86
|
}
|
|
83
87
|
if (options.full || options.mariadb) {
|
|
84
88
|
shellExec(
|
|
@@ -88,7 +92,7 @@ class UnderpostCluster {
|
|
|
88
92
|
`sudo kubectl create secret generic github-secret --from-literal=GITHUB_TOKEN=${process.env.GITHUB_TOKEN}`,
|
|
89
93
|
);
|
|
90
94
|
shellExec(`kubectl delete statefulset mariadb-statefulset`);
|
|
91
|
-
shellExec(`kubectl apply -k
|
|
95
|
+
shellExec(`kubectl apply -k ${underpostRoot}/manifests/mariadb`);
|
|
92
96
|
}
|
|
93
97
|
if (options.full || options.mongodb) {
|
|
94
98
|
shellExec(
|
|
@@ -98,7 +102,7 @@ class UnderpostCluster {
|
|
|
98
102
|
`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`,
|
|
99
103
|
);
|
|
100
104
|
shellExec(`kubectl delete statefulset mongodb`);
|
|
101
|
-
shellExec(`kubectl apply -k
|
|
105
|
+
shellExec(`kubectl apply -k ${underpostRoot}/manifests/mongodb`);
|
|
102
106
|
|
|
103
107
|
await UnderpostTest.API.podStatusMonitor('mongodb-1');
|
|
104
108
|
|
|
@@ -135,7 +139,7 @@ class UnderpostCluster {
|
|
|
135
139
|
|
|
136
140
|
const letsEncName = 'letsencrypt-prod';
|
|
137
141
|
shellExec(`sudo kubectl delete ClusterIssuer ${letsEncName}`);
|
|
138
|
-
shellExec(`sudo kubectl apply -f
|
|
142
|
+
shellExec(`sudo kubectl apply -f ${underpostRoot}/manifests/${letsEncName}.yaml`);
|
|
139
143
|
}
|
|
140
144
|
},
|
|
141
145
|
reset() {
|
package/src/cli/cron.js
CHANGED
|
@@ -46,7 +46,7 @@ class UnderpostCron {
|
|
|
46
46
|
callback: async function (
|
|
47
47
|
deployList = 'default',
|
|
48
48
|
jobList = Object.keys(UnderpostCron.JOB),
|
|
49
|
-
options = {
|
|
49
|
+
options = { itc: false, init: false },
|
|
50
50
|
) {
|
|
51
51
|
if (options.init === true) {
|
|
52
52
|
await Underpost.test.setUpInfo();
|
package/src/cli/image.js
CHANGED
|
@@ -54,23 +54,6 @@ class UnderpostImage {
|
|
|
54
54
|
{
|
|
55
55
|
const lamppPublicPath = '/xampp/htdocs/online';
|
|
56
56
|
shellExec(`sudo mkdir -p ${lamppPublicPath}`);
|
|
57
|
-
|
|
58
|
-
{
|
|
59
|
-
shellExec(
|
|
60
|
-
`cd ${lamppPublicPath} && git clone https://${process.env.GITHUB_TOKEN}@github.com/${process.env.DD_LAMPP_REPO_0}`,
|
|
61
|
-
);
|
|
62
|
-
|
|
63
|
-
shellExec(`cd ${lamppPublicPath} && sudo ${process.env.DD_LAMPP_SCRIPT_0}`);
|
|
64
|
-
|
|
65
|
-
shellExec(
|
|
66
|
-
`sudo sed -i -e "s@define( 'DB_HOST', 'localhost' );@define( 'DB_HOST', '${process.env.MARIADB_HOST}' );@g" ${lamppPublicPath}/${process.env.DD_LAMPP_REPO_0_FOLDER}/wp-config.php`,
|
|
67
|
-
);
|
|
68
|
-
}
|
|
69
|
-
{
|
|
70
|
-
shellExec(
|
|
71
|
-
`cd ${lamppPublicPath} && git clone https://${process.env.GITHUB_TOKEN}@github.com/${process.env.DD_LAMPP_REPO_1}`,
|
|
72
|
-
);
|
|
73
|
-
}
|
|
74
57
|
}
|
|
75
58
|
break;
|
|
76
59
|
|
package/src/cli/script.js
CHANGED
|
@@ -2,6 +2,7 @@ import { getNpmRootPath } from '../server/conf.js';
|
|
|
2
2
|
import { loggerFactory } from '../server/logger.js';
|
|
3
3
|
import { shellExec } from '../server/process.js';
|
|
4
4
|
import fs from 'fs-extra';
|
|
5
|
+
import UnderpostDeploy from './deploy.js';
|
|
5
6
|
|
|
6
7
|
const logger = loggerFactory(import.meta);
|
|
7
8
|
|
|
@@ -13,8 +14,25 @@ class UnderpostScript {
|
|
|
13
14
|
packageJson.scripts[key] = value;
|
|
14
15
|
fs.writeFileSync(`${npmRoot}/package.json`, JSON.stringify(packageJson, null, 4));
|
|
15
16
|
},
|
|
16
|
-
run(key) {
|
|
17
|
+
run(key, value, options) {
|
|
17
18
|
const npmRoot = `${getNpmRootPath()}/underpost`;
|
|
19
|
+
const packageJson = JSON.parse(fs.readFileSync(`${npmRoot}/package.json`, 'utf8'));
|
|
20
|
+
if (options.itc === true) {
|
|
21
|
+
value = packageJson.scripts[key];
|
|
22
|
+
if (fs.existsSync(`${value}`)) {
|
|
23
|
+
const podScriptPath = `/${value.split('/').pop()}`;
|
|
24
|
+
const nameSpace = options.ns && typeof options.ns === 'string' ? options.ns : 'default';
|
|
25
|
+
const podMatch = options.podName && typeof options.podName === 'string' ? options.podName : key;
|
|
26
|
+
|
|
27
|
+
for (const pod of UnderpostDeploy.API.getPods(podMatch)) {
|
|
28
|
+
shellExec(`sudo kubectl cp ${value} ${nameSpace}/${pod.NAME}:${podScriptPath}`);
|
|
29
|
+
const cmd = `cd / && node ${podScriptPath}`;
|
|
30
|
+
shellExec(`sudo kubectl exec -i ${pod.NAME} -- sh -c "${cmd}"`);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
18
36
|
shellExec(`cd ${npmRoot} && npm run ${key}`);
|
|
19
37
|
},
|
|
20
38
|
get(key) {
|
package/src/cli/test.js
CHANGED
|
@@ -29,7 +29,7 @@ class UnderpostTest {
|
|
|
29
29
|
actionInitLog();
|
|
30
30
|
shellExec(`cd ${getNpmRootPath()}/underpost && npm run test`);
|
|
31
31
|
},
|
|
32
|
-
async callback(deployList = '', options = {
|
|
32
|
+
async callback(deployList = '', options = { itc: false, sh: false, logs: false }) {
|
|
33
33
|
if (
|
|
34
34
|
options.podName &&
|
|
35
35
|
typeof options.podName === 'string' &&
|
|
@@ -50,7 +50,7 @@ class UnderpostTest {
|
|
|
50
50
|
for (const _deployId of deployList.split(',')) {
|
|
51
51
|
const deployId = _deployId.trim();
|
|
52
52
|
if (!deployId) continue;
|
|
53
|
-
if (options.
|
|
53
|
+
if (options.itc === true)
|
|
54
54
|
switch (deployId) {
|
|
55
55
|
case 'dd-lampp':
|
|
56
56
|
{
|
|
@@ -90,6 +90,8 @@ const MongooseDB = {
|
|
|
90
90
|
// sudo yum erase $(rpm -qa | grep mongodb)
|
|
91
91
|
// remove service
|
|
92
92
|
// sudo systemctl reset-failed
|
|
93
|
+
// MongoDB 5.0+ requires a CPU with AVX support
|
|
94
|
+
// check: grep avx /proc/cpuinfo
|
|
93
95
|
}
|
|
94
96
|
logger.info('install legacy 4.4');
|
|
95
97
|
shellExec(`wget -qO - https://www.mongodb.org/static/pgp/server-4.4.asc | sudo apt-key add -`);
|
package/src/index.js
CHANGED
package/src/server/backup.js
CHANGED
|
@@ -9,7 +9,7 @@ dotenv.config();
|
|
|
9
9
|
const logger = loggerFactory(import.meta);
|
|
10
10
|
|
|
11
11
|
class BackUp {
|
|
12
|
-
static callback = async function (deployList, options = {
|
|
12
|
+
static callback = async function (deployList, options = { itc: false }) {
|
|
13
13
|
if ((!deployList || deployList === 'dd') && fs.existsSync(`./engine-private/deploy/dd.router`))
|
|
14
14
|
deployList = fs.readFileSync(`./engine-private/deploy/dd.router`, 'utf8');
|
|
15
15
|
|
|
@@ -25,7 +25,7 @@ class BackUp {
|
|
|
25
25
|
const deployId = _deployId.trim();
|
|
26
26
|
if (!deployId) continue;
|
|
27
27
|
|
|
28
|
-
if (options.
|
|
28
|
+
if (!(options.itc === true)) {
|
|
29
29
|
shellExec(`underpost db --export ${deployId}`);
|
|
30
30
|
continue;
|
|
31
31
|
}
|
package/src/server/conf.js
CHANGED
|
@@ -995,7 +995,7 @@ const Cmd = {
|
|
|
995
995
|
syncPorts: (deployGroupId) => `node bin/deploy sync-env-port ${deployGroupId}`,
|
|
996
996
|
cron: (deployList, jobList, name, expression, options) =>
|
|
997
997
|
`pm2 start ./bin/index.js --no-autorestart --instances 1 --cron "${expression}" --name ${name} -- cron ${
|
|
998
|
-
options?.
|
|
998
|
+
options?.itc ? `--itc ` : ''
|
|
999
999
|
}${deployList} ${jobList}`,
|
|
1000
1000
|
};
|
|
1001
1001
|
|
|
@@ -1073,6 +1073,8 @@ const getNpmRootPath = () =>
|
|
|
1073
1073
|
silent: true,
|
|
1074
1074
|
}).trim();
|
|
1075
1075
|
|
|
1076
|
+
const getUnderpostRootPath = () => `${getNpmRootPath()}/underpost`;
|
|
1077
|
+
|
|
1076
1078
|
const writeEnv = (envPath, envObj) =>
|
|
1077
1079
|
fs.writeFileSync(
|
|
1078
1080
|
envPath,
|
|
@@ -1118,5 +1120,6 @@ export {
|
|
|
1118
1120
|
buildPortProxyRouter,
|
|
1119
1121
|
splitFileFactory,
|
|
1120
1122
|
getNpmRootPath,
|
|
1123
|
+
getUnderpostRootPath,
|
|
1121
1124
|
writeEnv,
|
|
1122
1125
|
};
|