underpost 2.8.521 → 2.8.522
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/CHANGELOG.md +24 -0
- package/bin/deploy.js +12 -10
- package/bin/hwt.js +0 -10
- package/bin/util.js +0 -7
- package/docker-compose.yml +1 -1
- package/package.json +1 -1
- package/src/db/mongo/MongooseDB.js +15 -1
- package/src/index.js +1 -1
- package/src/server/conf.js +0 -9
- package/src/server/dns.js +37 -44
- package/src/server/downloader.js +0 -8
- package/test/api.test.js +0 -8
- package/manifests/core/kustomization.yaml +0 -11
- package/manifests/core/underpost-engine-backup-access.yaml +0 -16
- package/manifests/core/underpost-engine-backup-pv-pvc.yaml +0 -22
- package/manifests/core/underpost-engine-headless-service.yaml +0 -10
- package/manifests/core/underpost-engine-mongodb-backup-cronjob.yaml +0 -40
- package/manifests/core/underpost-engine-mongodb-configmap.yaml +0 -26
- package/manifests/core/underpost-engine-pv-pvc.yaml +0 -23
- package/manifests/core/underpost-engine-statefulset.yaml +0 -91
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,30 @@ 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.521](https://github.com/underpostnet/engine/compare/v2.8.51...v2.8.521)
|
|
8
|
+
|
|
9
|
+
> 4 March 2025
|
|
10
|
+
|
|
11
|
+
- ci(package-pwa-microservices-template): ⚙️ Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs) [`5878342`](https://github.com/underpostnet/engine/commit/587834206f07a508b3e12ff5b5727c5979c06499)
|
|
12
|
+
- ci(package-pwa-microservices-template): ⚙️ update version 2.8.521 [`5fada73`](https://github.com/underpostnet/engine/commit/5fada73abf960567f4ecdc01062a987f4d7b4e79)
|
|
13
|
+
- fix(cli): 🐛 run prod img [`94743ef`](https://github.com/underpostnet/engine/commit/94743efe2cf214f0dbcf4db9f0b83ecf50b396f5)
|
|
14
|
+
|
|
15
|
+
#### [v2.8.51](https://github.com/underpostnet/engine/compare/v2.8.46...v2.8.51)
|
|
16
|
+
|
|
17
|
+
> 4 March 2025
|
|
18
|
+
|
|
19
|
+
- ci: ⚙️ add dd-core-development yamls [`a236466`](https://github.com/underpostnet/engine/commit/a2364666f5ddc0e824fa8b68b203bb9e021cca0c)
|
|
20
|
+
- refactor(cli): 📦 cron jobs management refactor [`8c28689`](https://github.com/underpostnet/engine/commit/8c28689cd514ee0e30a38be22ca3dbd292aa3a8a)
|
|
21
|
+
- ci(package-pwa-microservices-template): ⚙️ Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs) [`dd3557b`](https://github.com/underpostnet/engine/commit/dd3557bc52724d9231a0a13a320108758b6a84d2)
|
|
22
|
+
|
|
23
|
+
#### [v2.8.46](https://github.com/underpostnet/engine/compare/v2.8.44...v2.8.46)
|
|
24
|
+
|
|
25
|
+
> 28 February 2025
|
|
26
|
+
|
|
27
|
+
- refactor(add cli module directory): 📦 A code change that neither fixes a bug nor adds a feature [`56eea01`](https://github.com/underpostnet/engine/commit/56eea0121489998945c1b2040c3fc53cf6ee295c)
|
|
28
|
+
- refactor(bin): 📦 static API method access [`dcac59e`](https://github.com/underpostnet/engine/commit/dcac59e0cc3fb3e7eeef490d7ded3adb921f4e7a)
|
|
29
|
+
- ci(package-pwa-microservices-template): ⚙️ update version 2.8.45 [`11795eb`](https://github.com/underpostnet/engine/commit/11795eb2b57243530bfd027774005a83edbdee3b)
|
|
30
|
+
|
|
7
31
|
#### [v2.8.44](https://github.com/underpostnet/engine/compare/v2.8.42...v2.8.44)
|
|
8
32
|
|
|
9
33
|
> 18 February 2025
|
package/bin/deploy.js
CHANGED
|
@@ -732,16 +732,18 @@ try {
|
|
|
732
732
|
|
|
733
733
|
shellExec(`node bin/deploy update-dependencies`);
|
|
734
734
|
shellExec(`auto-changelog`);
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
735
|
+
setTimeout(() => {
|
|
736
|
+
shellExec(`underpost deploy dd --build-manifest --sync --info-router`);
|
|
737
|
+
shellExec(`underpost deploy dd production --build-manifest --sync --info-router`);
|
|
738
|
+
shellExec(`node bin/build dd conf`);
|
|
739
|
+
shellExec(`git add . && cd ./engine-private && git add .`);
|
|
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);
|
|
745
747
|
}
|
|
746
748
|
break;
|
|
747
749
|
|
package/bin/hwt.js
CHANGED
|
@@ -1,19 +1,9 @@
|
|
|
1
1
|
import fs from 'fs-extra';
|
|
2
|
-
import axios from 'axios';
|
|
3
|
-
import https from 'https';
|
|
4
2
|
|
|
5
|
-
import dotenv from 'dotenv';
|
|
6
|
-
import { shellCd, shellExec } from '../src/server/process.js';
|
|
7
3
|
import { loggerFactory } from '../src/server/logger.js';
|
|
8
4
|
|
|
9
5
|
const logger = loggerFactory(import.meta);
|
|
10
6
|
|
|
11
|
-
const httpsAgent = new https.Agent({
|
|
12
|
-
rejectUnauthorized: false,
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
axios.defaults.httpsAgent = httpsAgent;
|
|
16
|
-
|
|
17
7
|
logger.info('argv', process.argv);
|
|
18
8
|
|
|
19
9
|
const [exe, dir, operator, templateId, publicPath] = process.argv;
|
package/bin/util.js
CHANGED
|
@@ -2,8 +2,6 @@ import fs from 'fs-extra';
|
|
|
2
2
|
import si from 'systeminformation';
|
|
3
3
|
import * as dir from 'path';
|
|
4
4
|
import { svg } from 'font-awesome-assets';
|
|
5
|
-
import axios from 'axios';
|
|
6
|
-
import https from 'https';
|
|
7
5
|
|
|
8
6
|
import { loggerFactory } from '../src/server/logger.js';
|
|
9
7
|
import { pbcopy, shellExec } from '../src/server/process.js';
|
|
@@ -12,11 +10,6 @@ import { FileFactory } from '../src/api/file/file.service.js';
|
|
|
12
10
|
import { faBase64Png, getBufferPngText } from '../src/server/client-icons.js';
|
|
13
11
|
import keyword_extractor from 'keyword-extractor';
|
|
14
12
|
|
|
15
|
-
const httpsAgent = new https.Agent({
|
|
16
|
-
rejectUnauthorized: false,
|
|
17
|
-
});
|
|
18
|
-
axios.defaults.httpsAgent = httpsAgent;
|
|
19
|
-
|
|
20
13
|
const logger = loggerFactory(import.meta);
|
|
21
14
|
|
|
22
15
|
logger.info('argv', process.argv);
|
package/docker-compose.yml
CHANGED
package/package.json
CHANGED
|
@@ -79,7 +79,17 @@ const MongooseDB = {
|
|
|
79
79
|
if (process.argv.includes('rocky')) {
|
|
80
80
|
// https://github.com/mongodb/mongodb-selinux
|
|
81
81
|
// https://www.mongodb.com/docs/v7.0/tutorial/install-mongodb-enterprise-on-red-hat/
|
|
82
|
-
|
|
82
|
+
// https://www.mongodb.com/docs/v6.0/tutorial/install-mongodb-on-red-hat/
|
|
83
|
+
// https://www.mongodb.com/docs/v4.4/tutorial/install-mongodb-on-red-hat/
|
|
84
|
+
// dnf install selinux-policy-devel
|
|
85
|
+
// git clone https://github.com/mongodb/mongodb-selinux
|
|
86
|
+
// cd mongodb-selinux
|
|
87
|
+
// make
|
|
88
|
+
// sudo make install
|
|
89
|
+
// yum list installed | grep mongo
|
|
90
|
+
// sudo yum erase $(rpm -qa | grep mongodb)
|
|
91
|
+
// remove service
|
|
92
|
+
// sudo systemctl reset-failed
|
|
83
93
|
}
|
|
84
94
|
logger.info('install legacy 4.4');
|
|
85
95
|
shellExec(`wget -qO - https://www.mongodb.org/static/pgp/server-4.4.asc | sudo apt-key add -`);
|
|
@@ -112,9 +122,13 @@ const MongooseDB = {
|
|
|
112
122
|
shellExec(`sudo systemctl unmask mongod`);
|
|
113
123
|
shellExec(`sudo pkill -f mongod`);
|
|
114
124
|
shellExec(`sudo systemctl enable mongod.service`);
|
|
125
|
+
|
|
115
126
|
shellExec(`sudo chown -R mongodb:mongodb /var/lib/mongodb`);
|
|
116
127
|
shellExec(`sudo chown mongodb:mongodb /tmp/mongodb-27017.sock`);
|
|
117
128
|
|
|
129
|
+
shellExec(`sudo chown -R mongod:mongod /var/lib/mongodb`);
|
|
130
|
+
shellExec(`sudo chown mongod:mongod /tmp/mongodb-27017.sock`);
|
|
131
|
+
|
|
118
132
|
logger.info('run server');
|
|
119
133
|
shellExec(`sudo service mongod restart`);
|
|
120
134
|
|
package/src/index.js
CHANGED
package/src/server/conf.js
CHANGED
|
@@ -19,17 +19,8 @@ import { DefaultConf } from '../../conf.js';
|
|
|
19
19
|
import read from 'read';
|
|
20
20
|
import splitFile from 'split-file';
|
|
21
21
|
import axios from 'axios';
|
|
22
|
-
import https from 'https';
|
|
23
22
|
import { ssrFactory } from './client-formatted.js';
|
|
24
23
|
|
|
25
|
-
// axios.defaults.baseURL = BASE_URL;
|
|
26
|
-
|
|
27
|
-
// const httpsAgent = new https.Agent({
|
|
28
|
-
// rejectUnauthorized: false,
|
|
29
|
-
// });
|
|
30
|
-
|
|
31
|
-
// axios.defaults.httpsAgent = httpsAgent;
|
|
32
|
-
|
|
33
24
|
colors.enable();
|
|
34
25
|
|
|
35
26
|
dotenv.config();
|
package/src/server/dns.js
CHANGED
|
@@ -1,17 +1,10 @@
|
|
|
1
1
|
import axios from 'axios';
|
|
2
2
|
import dotenv from 'dotenv';
|
|
3
3
|
import fs from 'fs';
|
|
4
|
-
import https from 'https';
|
|
5
4
|
import validator from 'validator';
|
|
6
5
|
import { ip } from './network.js';
|
|
7
6
|
import { loggerFactory } from './logger.js';
|
|
8
|
-
import
|
|
9
|
-
|
|
10
|
-
const httpsAgent = new https.Agent({
|
|
11
|
-
rejectUnauthorized: false,
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
axios.defaults.httpsAgent = httpsAgent;
|
|
7
|
+
import UnderpostRootEnv from '../cli/env.js';
|
|
15
8
|
|
|
16
9
|
dotenv.config();
|
|
17
10
|
|
|
@@ -30,47 +23,47 @@ class Dns {
|
|
|
30
23
|
// Forward the router's TCP/UDP ports to the LAN device's IP address
|
|
31
24
|
for (const _deployId of deployList.split(',')) {
|
|
32
25
|
const deployId = _deployId.trim();
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
26
|
+
const privateCronConfPath = `./engine-private/conf/${deployId}/conf.cron.json`;
|
|
27
|
+
const confCronPath = fs.existsSync(privateCronConfPath) ? privateCronConfPath : './conf/conf.cron.json';
|
|
28
|
+
const confCronData = JSON.parse(fs.readFileSync(confCronPath, 'utf8'));
|
|
36
29
|
|
|
37
|
-
|
|
30
|
+
let testIp;
|
|
38
31
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
const currentIp =
|
|
46
|
-
? fs.readFileSync(`./engine-private/deploy/${ipFileName}`, 'utf8')
|
|
47
|
-
: undefined;
|
|
32
|
+
try {
|
|
33
|
+
testIp = await ip.public.ipv4();
|
|
34
|
+
} catch (error) {
|
|
35
|
+
logger.error(error, { testIp, stack: error.stack });
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const currentIp = UnderpostRootEnv.API.get('ip');
|
|
48
39
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
40
|
+
if (testIp && typeof testIp === 'string' && validator.isIP(testIp) && currentIp !== testIp) {
|
|
41
|
+
logger.info(`new ip`, testIp);
|
|
42
|
+
for (const recordType of Object.keys(confCronData.records)) {
|
|
43
|
+
switch (recordType) {
|
|
44
|
+
case 'A':
|
|
45
|
+
for (const dnsProvider of confCronData.records[recordType]) {
|
|
46
|
+
if (typeof Dns.services.updateIp[dnsProvider.dns] === 'function')
|
|
47
|
+
await Dns.services.updateIp[dnsProvider.dns]({ ...dnsProvider, ip: testIp });
|
|
48
|
+
}
|
|
49
|
+
break;
|
|
59
50
|
|
|
60
|
-
|
|
61
|
-
|
|
51
|
+
default:
|
|
52
|
+
break;
|
|
53
|
+
}
|
|
62
54
|
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
55
|
+
try {
|
|
56
|
+
const ipUrlTest = `https://${process.env.DEFAULT_DEPLOY_HOST}`;
|
|
57
|
+
const response = await axios.get(ipUrlTest);
|
|
58
|
+
const verifyIp = response.request.socket.remoteAddress;
|
|
59
|
+
logger.info(ipUrlTest + ' verify ip', verifyIp);
|
|
60
|
+
if (verifyIp === testIp) {
|
|
61
|
+
logger.info('ip updated successfully', testIp);
|
|
62
|
+
UnderpostRootEnv.API.set('ip', testIp);
|
|
63
|
+
} else logger.error('ip not updated', testIp);
|
|
64
|
+
} catch (error) {
|
|
65
|
+
logger.error(error, error.stack);
|
|
66
|
+
logger.error('ip not updated', testIp);
|
|
74
67
|
}
|
|
75
68
|
}
|
|
76
69
|
}
|
package/src/server/downloader.js
CHANGED
|
@@ -2,16 +2,8 @@ import axios from 'axios';
|
|
|
2
2
|
import fs from 'fs';
|
|
3
3
|
import { loggerFactory } from './logger.js';
|
|
4
4
|
import dotenv from 'dotenv';
|
|
5
|
-
import https from 'https';
|
|
6
|
-
|
|
7
5
|
dotenv.config();
|
|
8
6
|
|
|
9
|
-
const httpsAgent = new https.Agent({
|
|
10
|
-
rejectUnauthorized: false,
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
axios.defaults.httpsAgent = httpsAgent;
|
|
14
|
-
|
|
15
7
|
const logger = loggerFactory(import.meta);
|
|
16
8
|
|
|
17
9
|
const Downloader = (url, fullPath, options = { method: 'get', responseType: 'stream' }) =>
|
package/test/api.test.js
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
import axios from 'axios';
|
|
4
4
|
import dotenv from 'dotenv';
|
|
5
|
-
import https from 'https';
|
|
6
5
|
|
|
7
6
|
import { expect } from 'chai';
|
|
8
7
|
import { loggerFactory } from '../src/server/logger.js';
|
|
@@ -20,13 +19,6 @@ const BASE_URL =
|
|
|
20
19
|
? `http://localhost:${PORT}/${process.env.BASE_API}`
|
|
21
20
|
: `https://www.nexodev.org/api`;
|
|
22
21
|
|
|
23
|
-
axios.defaults.baseURL = BASE_URL;
|
|
24
|
-
|
|
25
|
-
const httpsAgent = new https.Agent({
|
|
26
|
-
rejectUnauthorized: false,
|
|
27
|
-
});
|
|
28
|
-
axios.defaults.httpsAgent = httpsAgent;
|
|
29
|
-
|
|
30
22
|
describe(`GET 'Test' API Request `, async () => {
|
|
31
23
|
{
|
|
32
24
|
const url = `${BASE_URL}/test/youtube-id/?url=https://www.youtube.com/watch?v=o4f42SbyDMk`;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
# kubectl apply -k core/.
|
|
3
|
-
apiVersion: kustomize.config.k8s.io/v1beta1
|
|
4
|
-
kind: Kustomization
|
|
5
|
-
resources:
|
|
6
|
-
- underpost-engine-pv-pvc.yaml
|
|
7
|
-
- underpost-engine-headless-service.yaml
|
|
8
|
-
- underpost-engine-statefulset.yaml
|
|
9
|
-
- underpost-engine-backup-pv-pvc.yaml
|
|
10
|
-
- underpost-engine-mongodb-backup-cronjob.yaml
|
|
11
|
-
- underpost-engine-backup-access.yaml
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
apiVersion: v1
|
|
2
|
-
kind: Pod
|
|
3
|
-
metadata:
|
|
4
|
-
name: backup-access
|
|
5
|
-
spec:
|
|
6
|
-
containers:
|
|
7
|
-
- name: busybox
|
|
8
|
-
image: busybox
|
|
9
|
-
command: ['sh', '-c', 'sleep 3600']
|
|
10
|
-
volumeMounts:
|
|
11
|
-
- name: backup-storage
|
|
12
|
-
mountPath: /backup
|
|
13
|
-
volumes:
|
|
14
|
-
- name: backup-storage
|
|
15
|
-
persistentVolumeClaim:
|
|
16
|
-
claimName: backup-pvc
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
apiVersion: v1
|
|
2
|
-
kind: PersistentVolume
|
|
3
|
-
metadata:
|
|
4
|
-
name: backup-pv
|
|
5
|
-
spec:
|
|
6
|
-
capacity:
|
|
7
|
-
storage: 5Gi
|
|
8
|
-
accessModes:
|
|
9
|
-
- ReadWriteOnce
|
|
10
|
-
hostPath:
|
|
11
|
-
path: /mnt/backup
|
|
12
|
-
---
|
|
13
|
-
apiVersion: v1
|
|
14
|
-
kind: PersistentVolumeClaim
|
|
15
|
-
metadata:
|
|
16
|
-
name: backup-pvc
|
|
17
|
-
spec:
|
|
18
|
-
accessModes:
|
|
19
|
-
- ReadWriteOnce
|
|
20
|
-
resources:
|
|
21
|
-
requests:
|
|
22
|
-
storage: 5Gi
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
apiVersion: batch/v1
|
|
2
|
-
kind: CronJob
|
|
3
|
-
metadata:
|
|
4
|
-
name: mongodb-backup
|
|
5
|
-
spec:
|
|
6
|
-
schedule: '*/5 * * * *' # Runs backup every five minutes
|
|
7
|
-
jobTemplate:
|
|
8
|
-
spec:
|
|
9
|
-
template:
|
|
10
|
-
spec:
|
|
11
|
-
containers:
|
|
12
|
-
- name: mongodump
|
|
13
|
-
image: docker.io/library/mongo:latest
|
|
14
|
-
command:
|
|
15
|
-
- sh
|
|
16
|
-
- -c
|
|
17
|
-
- |
|
|
18
|
-
# Perform backup
|
|
19
|
-
mongodump -u $MONGO_INITDB_ROOT_USERNAME -p $MONGO_INITDB_ROOT_PASSWORD --host=mongodb-service --port=27017 --out=/backup/$(date +\%Y-\%m-\%dT\%H-\%M-\%S)
|
|
20
|
-
# Remove backups older than 7 days
|
|
21
|
-
find /backup -type d -mtime +7 -exec rm -rf {} +
|
|
22
|
-
volumeMounts:
|
|
23
|
-
- name: backup-storage
|
|
24
|
-
mountPath: /backup
|
|
25
|
-
env:
|
|
26
|
-
- name: MONGO_INITDB_ROOT_USERNAME
|
|
27
|
-
valueFrom:
|
|
28
|
-
secretKeyRef:
|
|
29
|
-
name: mongodb-secret
|
|
30
|
-
key: username
|
|
31
|
-
- name: MONGO_INITDB_ROOT_PASSWORD
|
|
32
|
-
valueFrom:
|
|
33
|
-
secretKeyRef:
|
|
34
|
-
name: mongodb-secret
|
|
35
|
-
key: password
|
|
36
|
-
restartPolicy: Never
|
|
37
|
-
volumes:
|
|
38
|
-
- name: backup-storage
|
|
39
|
-
persistentVolumeClaim:
|
|
40
|
-
claimName: backup-pvc
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
# origin conf: /etc/mongod.conf
|
|
2
|
-
apiVersion: v1
|
|
3
|
-
kind: ConfigMap
|
|
4
|
-
metadata:
|
|
5
|
-
name: mongodb-config-file
|
|
6
|
-
namespace: default
|
|
7
|
-
data:
|
|
8
|
-
mongod.conf: |
|
|
9
|
-
storage:
|
|
10
|
-
dbPath: /data/db
|
|
11
|
-
systemLog:
|
|
12
|
-
destination: file
|
|
13
|
-
logAppend: true
|
|
14
|
-
path: /var/log/mongodb/mongod.log
|
|
15
|
-
replication:
|
|
16
|
-
replSetName: rs0
|
|
17
|
-
net:
|
|
18
|
-
bindIp: 127.0.0.1
|
|
19
|
-
port: 27017
|
|
20
|
-
processManagement:
|
|
21
|
-
fork: true
|
|
22
|
-
setParameter:
|
|
23
|
-
enableLocalhostAuthBypass: false
|
|
24
|
-
security:
|
|
25
|
-
authorization: enabled
|
|
26
|
-
keyFile: /etc/mongodb-keyfile
|
|
@@ -1,23 +0,0 @@
|
|
|
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
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
apiVersion: apps/v1
|
|
2
|
-
kind: StatefulSet
|
|
3
|
-
metadata:
|
|
4
|
-
name: mongodb # Specifies the name of the statefulset
|
|
5
|
-
spec:
|
|
6
|
-
serviceName: 'mongodb-service' # Specifies the service to use
|
|
7
|
-
replicas: 2
|
|
8
|
-
selector:
|
|
9
|
-
matchLabels:
|
|
10
|
-
app: mongodb
|
|
11
|
-
template:
|
|
12
|
-
metadata:
|
|
13
|
-
labels:
|
|
14
|
-
app: mongodb
|
|
15
|
-
spec:
|
|
16
|
-
containers:
|
|
17
|
-
- name: mongodb
|
|
18
|
-
image: docker.io/library/mongo:latest
|
|
19
|
-
command:
|
|
20
|
-
- mongod
|
|
21
|
-
- '--replSet'
|
|
22
|
-
- 'rs0'
|
|
23
|
-
# - '--config'
|
|
24
|
-
# - '-f'
|
|
25
|
-
# - '/etc/mongod.conf'
|
|
26
|
-
# - '--auth'
|
|
27
|
-
# - '--clusterAuthMode'
|
|
28
|
-
# - 'keyFile'
|
|
29
|
-
# - '--keyFile'
|
|
30
|
-
# - '/etc/mongodb-keyfile'
|
|
31
|
-
# - '--interleave'
|
|
32
|
-
# - 'all'
|
|
33
|
-
# - '--wiredTigerCacheSizeGB'
|
|
34
|
-
# - '0.25'
|
|
35
|
-
# - '--setParameter'
|
|
36
|
-
# - 'authenticationMechanisms=SCRAM-SHA-1'
|
|
37
|
-
# - '--fork'
|
|
38
|
-
- '--logpath'
|
|
39
|
-
- '/var/log/mongodb/mongod.log'
|
|
40
|
-
- '--bind_ip_all'
|
|
41
|
-
ports:
|
|
42
|
-
- containerPort: 27017
|
|
43
|
-
volumeMounts:
|
|
44
|
-
- name: mongodb-storage
|
|
45
|
-
mountPath: /data/db
|
|
46
|
-
- name: keyfile
|
|
47
|
-
mountPath: /etc/mongodb-keyfile
|
|
48
|
-
readOnly: true
|
|
49
|
-
# - name: mongodb-configuration-file
|
|
50
|
-
# mountPath: /etc/mongod.conf
|
|
51
|
-
# subPath: mongod.conf
|
|
52
|
-
# readOnly: true
|
|
53
|
-
# - name: mongodb-config
|
|
54
|
-
# mountPath: /config
|
|
55
|
-
env:
|
|
56
|
-
- name: MONGO_INITDB_ROOT_USERNAME
|
|
57
|
-
valueFrom:
|
|
58
|
-
secretKeyRef:
|
|
59
|
-
name: mongodb-secret
|
|
60
|
-
key: username
|
|
61
|
-
- name: MONGO_INITDB_ROOT_PASSWORD
|
|
62
|
-
valueFrom:
|
|
63
|
-
secretKeyRef:
|
|
64
|
-
name: mongodb-secret
|
|
65
|
-
key: password
|
|
66
|
-
resources:
|
|
67
|
-
requests:
|
|
68
|
-
cpu: '100m'
|
|
69
|
-
memory: '256Mi'
|
|
70
|
-
limits:
|
|
71
|
-
cpu: '500m'
|
|
72
|
-
memory: '512Mi'
|
|
73
|
-
volumes:
|
|
74
|
-
- name: keyfile
|
|
75
|
-
secret:
|
|
76
|
-
secretName: mongodb-keyfile
|
|
77
|
-
defaultMode: 0400
|
|
78
|
-
# - name: mongodb-configuration-file
|
|
79
|
-
# configMap:
|
|
80
|
-
# name: mongodb-config-file
|
|
81
|
-
# - name: mongodb-config
|
|
82
|
-
# configMap:
|
|
83
|
-
# name: mongodb-config
|
|
84
|
-
volumeClaimTemplates:
|
|
85
|
-
- metadata:
|
|
86
|
-
name: mongodb-storage
|
|
87
|
-
spec:
|
|
88
|
-
accessModes: ['ReadWriteOnce']
|
|
89
|
-
resources:
|
|
90
|
-
requests:
|
|
91
|
-
storage: 5Gi
|