@underpostnet/underpost 2.8.0 → 2.8.31
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 +4 -4
- package/.vscode/extensions.json +8 -71
- package/.vscode/settings.json +2 -1
- package/CHANGELOG.md +55 -3
- package/Dockerfile +22 -36
- package/README.md +0 -27
- package/bin/deploy.js +54 -28
- package/bin/file.js +30 -2
- package/bin/index.js +6 -18
- package/bin/ssl.js +19 -11
- package/bin/util.js +18 -0
- package/bin/vs.js +3 -2
- package/conf.js +17 -1
- package/docker-compose.yml +1 -1
- 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/test/mongo-express.yaml +60 -0
- package/manifests/test/phpmyadmin.yaml +54 -0
- package/manifests/test/underpost-engine-mongodb-configmap.yaml +26 -0
- package/manifests/test/underpost-engine-pod.yaml +108 -0
- package/manifests/underpost-engine-backup-access.yaml +16 -0
- package/manifests/underpost-engine-backup-pv-pvc.yaml +22 -0
- package/manifests/underpost-engine-headless-service.yaml +10 -0
- package/manifests/underpost-engine-mongodb-backup-cronjob.yaml +40 -0
- package/manifests/underpost-engine-pv-pvc.yaml +23 -0
- package/manifests/underpost-engine-statefulset.yaml +91 -0
- package/manifests/valkey/kustomization.yaml +7 -0
- package/manifests/valkey/underpost-engine-valkey-service.yaml +17 -0
- package/manifests/valkey/underpost-engine-valkey-statefulset.yaml +39 -0
- package/package.json +22 -12
- package/src/api/user/user.model.js +9 -1
- package/src/api/user/user.service.js +1 -1
- package/src/client/components/core/Account.js +4 -2
- package/src/client/components/core/Auth.js +2 -2
- package/src/client/components/core/CalendarCore.js +112 -49
- package/src/client/components/core/CommonJs.js +125 -19
- package/src/client/components/core/Css.js +1 -1
- package/src/client/components/core/CssCore.js +6 -0
- package/src/client/components/core/Docs.js +2 -1
- package/src/client/components/core/DropDown.js +5 -1
- package/src/client/components/core/Input.js +17 -3
- package/src/client/components/core/JoyStick.js +8 -5
- package/src/client/components/core/Modal.js +12 -6
- package/src/client/components/core/Panel.js +82 -24
- package/src/client/components/core/PanelForm.js +11 -19
- package/src/client/components/core/SignUp.js +4 -1
- package/src/client/components/core/Translate.js +44 -8
- package/src/client/public/default/plantuml/client-conf.svg +1 -1
- package/src/client/public/default/plantuml/server-conf.svg +1 -1
- package/src/client/public/default/plantuml/server-schema.svg +1 -1
- package/src/client/public/default/plantuml/ssr-conf.svg +1 -1
- package/src/client/public/default/plantuml/ssr-schema.svg +1 -1
- package/src/client/services/core/core.service.js +2 -0
- package/src/client/ssr/body/CacheControl.js +2 -1
- package/src/client/ssr/body/DefaultSplashScreen.js +3 -3
- package/src/client/ssr/offline/Maintenance.js +63 -0
- package/src/client/sw/default.sw.js +23 -3
- package/src/db/mongo/MongooseDB.js +13 -1
- package/src/index.js +8 -0
- package/src/server/client-build.js +5 -4
- package/src/server/client-icons.js +1 -1
- package/src/server/conf.js +5 -5
- package/src/server/logger.js +8 -6
- package/src/server/process.js +25 -2
- package/src/server/ssl.js +1 -1
- package/src/server/valkey.js +3 -0
- package/startup.cjs +12 -0
- package/startup.js +0 -11
package/bin/vs.js
CHANGED
|
@@ -6,13 +6,14 @@ switch (process.argv[2]) {
|
|
|
6
6
|
{
|
|
7
7
|
const extensions = JSON.parse(fs.readFileSync(`./.vscode/extensions.json`, 'utf8'));
|
|
8
8
|
extensions.recommendations.map((extension) => {
|
|
9
|
-
if (extension)
|
|
9
|
+
if (extension)
|
|
10
|
+
shellExec(`sudo code --user-data-dir="/root/.vscode-root" --no-sandbox --install-extension ${extension}`);
|
|
10
11
|
});
|
|
11
12
|
}
|
|
12
13
|
break;
|
|
13
14
|
case 'export':
|
|
14
15
|
{
|
|
15
|
-
shellExec(`code --list-extensions > vs-extensions.txt`);
|
|
16
|
+
shellExec(`sudo code --user-data-dir="/root/.vscode-root" --no-sandbox --list-extensions > vs-extensions.txt`);
|
|
16
17
|
fs.writeFileSync(
|
|
17
18
|
`./.vscode/extensions.json`,
|
|
18
19
|
JSON.stringify(
|
package/conf.js
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
|
+
import dotenv from 'dotenv';
|
|
2
|
+
|
|
3
|
+
dotenv.config();
|
|
4
|
+
|
|
1
5
|
const DefaultConf = {
|
|
2
6
|
client: {
|
|
3
7
|
default: {
|
|
4
8
|
metadata: {
|
|
5
9
|
title: 'Demo App',
|
|
6
|
-
backgroundImage: '
|
|
10
|
+
backgroundImage: 'assets/background/white0-min.jpg',
|
|
7
11
|
description: 'Web application',
|
|
8
12
|
keywords: ['web', 'app', 'spa', 'demo', 'github-pages'],
|
|
9
13
|
author: 'https://github.com/underpostnet',
|
|
@@ -193,6 +197,13 @@ const DefaultConf = {
|
|
|
193
197
|
head: [],
|
|
194
198
|
body: [],
|
|
195
199
|
},
|
|
200
|
+
{
|
|
201
|
+
path: '/maintenance',
|
|
202
|
+
title: 'Server Maintenance',
|
|
203
|
+
client: 'Maintenance',
|
|
204
|
+
head: [],
|
|
205
|
+
body: [],
|
|
206
|
+
},
|
|
196
207
|
],
|
|
197
208
|
pages: [
|
|
198
209
|
{
|
|
@@ -222,7 +233,12 @@ const DefaultConf = {
|
|
|
222
233
|
proxy: [80, 443],
|
|
223
234
|
db: {
|
|
224
235
|
provider: 'mongoose',
|
|
236
|
+
// mongodb://<username>:<password>@<pod-0-name>.<headless-service-name>.<namespace>.svc.cluster.local:27017
|
|
237
|
+
// ,<pod-1-name>.<headless-service-name>.<namespace>.svc.cluster.local:27017/<database-name>?replicaSet=rs0;
|
|
238
|
+
// <k8s-pod-name>.<k8s-internal-service-name>.<k8s-namespace>.<cluster-name>
|
|
239
|
+
// host: 'mongodb://mongodb-0.mongodb-service.default.svc.cluster.local:27017?replicaSet=rs0',
|
|
225
240
|
host: 'mongodb://127.0.0.1:27017',
|
|
241
|
+
// host: `mongodb://${process.env.MONGO_INITDB_ROOT_USERNAME}:${process.env.MONGO_INITDB_ROOT_PASSWORD}@mongodb-0.mongodb-service:27017`, // ?replicaSet=rs0
|
|
226
242
|
name: 'default',
|
|
227
243
|
},
|
|
228
244
|
mailer: {
|
package/docker-compose.yml
CHANGED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
apiVersion: apps/v1
|
|
2
|
+
kind: StatefulSet
|
|
3
|
+
metadata:
|
|
4
|
+
name: mariadb-statefulset
|
|
5
|
+
spec:
|
|
6
|
+
serviceName: mariadb
|
|
7
|
+
replicas: 1
|
|
8
|
+
selector:
|
|
9
|
+
matchLabels:
|
|
10
|
+
app: mariadb
|
|
11
|
+
template:
|
|
12
|
+
metadata:
|
|
13
|
+
labels:
|
|
14
|
+
app: mariadb
|
|
15
|
+
spec:
|
|
16
|
+
containers:
|
|
17
|
+
- name: mariadb
|
|
18
|
+
image: mariadb:latest
|
|
19
|
+
env:
|
|
20
|
+
- name: MYSQL_ROOT_PASSWORD
|
|
21
|
+
valueFrom:
|
|
22
|
+
secretKeyRef:
|
|
23
|
+
name: mariadb-secret
|
|
24
|
+
key: password
|
|
25
|
+
# - name: MYSQL_PASSWORD
|
|
26
|
+
# valueFrom:
|
|
27
|
+
# secretKeyRef:
|
|
28
|
+
# name: mariadb-secret
|
|
29
|
+
# key: password
|
|
30
|
+
# - name: MYSQL_USER
|
|
31
|
+
# valueFrom:
|
|
32
|
+
# secretKeyRef:
|
|
33
|
+
# name: mariadb-secret
|
|
34
|
+
# key: username
|
|
35
|
+
# - name: MYSQL_DATABASE
|
|
36
|
+
# value: default
|
|
37
|
+
ports:
|
|
38
|
+
- containerPort: 3306
|
|
39
|
+
volumeMounts:
|
|
40
|
+
- mountPath: /var/lib/mysql
|
|
41
|
+
name: mariadb-storage
|
|
42
|
+
# - mountPath: /etc/mysql/conf.d
|
|
43
|
+
# name: config-volume
|
|
44
|
+
# volumes:
|
|
45
|
+
# - name: config-volume
|
|
46
|
+
# configMap:
|
|
47
|
+
# name: mariadb-config
|
|
48
|
+
volumeClaimTemplates:
|
|
49
|
+
- metadata:
|
|
50
|
+
name: mariadb-storage
|
|
51
|
+
spec:
|
|
52
|
+
accessModes: ['ReadWriteOnce']
|
|
53
|
+
resources:
|
|
54
|
+
requests:
|
|
55
|
+
storage: 1Gi
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
apiVersion: apps/v1
|
|
2
|
+
kind: Deployment
|
|
3
|
+
metadata:
|
|
4
|
+
name: mongo-express
|
|
5
|
+
labels:
|
|
6
|
+
app: mongo-express
|
|
7
|
+
spec:
|
|
8
|
+
replicas: 1
|
|
9
|
+
selector:
|
|
10
|
+
matchLabels:
|
|
11
|
+
app: mongo-express
|
|
12
|
+
template:
|
|
13
|
+
metadata:
|
|
14
|
+
labels:
|
|
15
|
+
app: mongo-express
|
|
16
|
+
spec:
|
|
17
|
+
containers:
|
|
18
|
+
- name: mongo-express
|
|
19
|
+
image: mongo-express
|
|
20
|
+
ports:
|
|
21
|
+
- containerPort: 8081
|
|
22
|
+
env:
|
|
23
|
+
- name: ME_CONFIG_MONGODB_ADMINUSERNAME
|
|
24
|
+
valueFrom:
|
|
25
|
+
secretKeyRef:
|
|
26
|
+
name: mongodb-secret
|
|
27
|
+
key: username
|
|
28
|
+
- name: ME_CONFIG_MONGODB_ADMINPASSWORD
|
|
29
|
+
valueFrom:
|
|
30
|
+
secretKeyRef:
|
|
31
|
+
name: mongodb-secret
|
|
32
|
+
key: password
|
|
33
|
+
- name: ME_CONFIG_BASICAUTH_USERNAME
|
|
34
|
+
valueFrom:
|
|
35
|
+
secretKeyRef:
|
|
36
|
+
name: mongodb-secret
|
|
37
|
+
key: username
|
|
38
|
+
- name: ME_CONFIG_BASICAUTH_PASSWORD
|
|
39
|
+
valueFrom:
|
|
40
|
+
secretKeyRef:
|
|
41
|
+
name: mongodb-secret
|
|
42
|
+
key: password
|
|
43
|
+
- name: ME_CONFIG_MONGODB_SERVER
|
|
44
|
+
value: 'mongodb-0.mongodb-service'
|
|
45
|
+
- name: ME_CONFIG_MONGODB_ENABLE_ADMIN
|
|
46
|
+
value: 'true'
|
|
47
|
+
- name: ME_CONFIG_MONGODB_PORT
|
|
48
|
+
value: '27017'
|
|
49
|
+
---
|
|
50
|
+
apiVersion: v1
|
|
51
|
+
kind: Service
|
|
52
|
+
metadata:
|
|
53
|
+
name: mongo-express-service
|
|
54
|
+
spec:
|
|
55
|
+
selector:
|
|
56
|
+
app: mongo-express
|
|
57
|
+
ports:
|
|
58
|
+
- protocol: TCP
|
|
59
|
+
port: 8081
|
|
60
|
+
targetPort: 8081
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
apiVersion: apps/v1
|
|
2
|
+
kind: Deployment
|
|
3
|
+
metadata:
|
|
4
|
+
name: phpmyadmin-deployment
|
|
5
|
+
labels:
|
|
6
|
+
app: phpmyadmin
|
|
7
|
+
spec:
|
|
8
|
+
replicas: 1
|
|
9
|
+
selector:
|
|
10
|
+
matchLabels:
|
|
11
|
+
app: phpmyadmin
|
|
12
|
+
template:
|
|
13
|
+
metadata:
|
|
14
|
+
labels:
|
|
15
|
+
app: phpmyadmin
|
|
16
|
+
spec:
|
|
17
|
+
containers:
|
|
18
|
+
- name: phpmyadmin
|
|
19
|
+
image: phpmyadmin/phpmyadmin
|
|
20
|
+
ports:
|
|
21
|
+
- containerPort: 80
|
|
22
|
+
env:
|
|
23
|
+
- name: PMA_HOST
|
|
24
|
+
value: 'mariadb'
|
|
25
|
+
- name: PMA_PORT
|
|
26
|
+
value: '3306'
|
|
27
|
+
- name: PMA_USER
|
|
28
|
+
valueFrom:
|
|
29
|
+
secretKeyRef:
|
|
30
|
+
name: mariadb-secret
|
|
31
|
+
key: username
|
|
32
|
+
- name: PMA_PASSWORD
|
|
33
|
+
valueFrom:
|
|
34
|
+
secretKeyRef:
|
|
35
|
+
name: mariadb-secret
|
|
36
|
+
key: password
|
|
37
|
+
- name: UPLOAD_LIMIT
|
|
38
|
+
value: '300M'
|
|
39
|
+
- name: PMA_ARBITRARY
|
|
40
|
+
value: '1'
|
|
41
|
+
---
|
|
42
|
+
apiVersion: v1
|
|
43
|
+
kind: Service
|
|
44
|
+
metadata:
|
|
45
|
+
name: phpmyadmin-service
|
|
46
|
+
spec:
|
|
47
|
+
type: NodePort
|
|
48
|
+
selector:
|
|
49
|
+
app: phpmyadmin
|
|
50
|
+
ports:
|
|
51
|
+
- protocol: TCP
|
|
52
|
+
nodePort: 31008
|
|
53
|
+
port: 80
|
|
54
|
+
targetPort: 80
|
|
@@ -0,0 +1,26 @@
|
|
|
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
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
apiVersion: v1
|
|
2
|
+
kind: Pod
|
|
3
|
+
metadata:
|
|
4
|
+
annotations:
|
|
5
|
+
engine.version: 2.8.1
|
|
6
|
+
kompose.cmd: kompose convert
|
|
7
|
+
kompose.version: 1.35.0 (9532ceef3)
|
|
8
|
+
labels:
|
|
9
|
+
io.kompose.service: underpost-engine
|
|
10
|
+
name: underpost-engine
|
|
11
|
+
spec:
|
|
12
|
+
containers:
|
|
13
|
+
- image: localhost/underpost-engine:v2.8.31
|
|
14
|
+
imagePullPolicy: Never
|
|
15
|
+
name: underpost-engine
|
|
16
|
+
ports:
|
|
17
|
+
- containerPort: 22
|
|
18
|
+
protocol: TCP
|
|
19
|
+
- containerPort: 22
|
|
20
|
+
protocol: UDP
|
|
21
|
+
- containerPort: 4013
|
|
22
|
+
protocol: TCP
|
|
23
|
+
- containerPort: 4013
|
|
24
|
+
protocol: UDP
|
|
25
|
+
- containerPort: 4014
|
|
26
|
+
protocol: TCP
|
|
27
|
+
- containerPort: 4014
|
|
28
|
+
protocol: UDP
|
|
29
|
+
- containerPort: 4015
|
|
30
|
+
protocol: TCP
|
|
31
|
+
- containerPort: 4015
|
|
32
|
+
protocol: UDP
|
|
33
|
+
- containerPort: 4016
|
|
34
|
+
protocol: TCP
|
|
35
|
+
- containerPort: 4016
|
|
36
|
+
protocol: UDP
|
|
37
|
+
- containerPort: 4017
|
|
38
|
+
protocol: TCP
|
|
39
|
+
- containerPort: 4017
|
|
40
|
+
protocol: UDP
|
|
41
|
+
- containerPort: 4018
|
|
42
|
+
protocol: TCP
|
|
43
|
+
- containerPort: 4018
|
|
44
|
+
protocol: UDP
|
|
45
|
+
- containerPort: 4019
|
|
46
|
+
protocol: TCP
|
|
47
|
+
- containerPort: 4019
|
|
48
|
+
protocol: UDP
|
|
49
|
+
- containerPort: 4020
|
|
50
|
+
protocol: TCP
|
|
51
|
+
- containerPort: 4020
|
|
52
|
+
protocol: UDP
|
|
53
|
+
- containerPort: 4021
|
|
54
|
+
protocol: TCP
|
|
55
|
+
- containerPort: 4021
|
|
56
|
+
protocol: UDP
|
|
57
|
+
- containerPort: 4022
|
|
58
|
+
protocol: TCP
|
|
59
|
+
- containerPort: 4022
|
|
60
|
+
protocol: UDP
|
|
61
|
+
- containerPort: 4023
|
|
62
|
+
protocol: TCP
|
|
63
|
+
- containerPort: 4023
|
|
64
|
+
protocol: UDP
|
|
65
|
+
- containerPort: 4024
|
|
66
|
+
protocol: TCP
|
|
67
|
+
- containerPort: 4024
|
|
68
|
+
protocol: UDP
|
|
69
|
+
- containerPort: 4025
|
|
70
|
+
protocol: TCP
|
|
71
|
+
- containerPort: 4025
|
|
72
|
+
protocol: UDP
|
|
73
|
+
- containerPort: 4026
|
|
74
|
+
protocol: TCP
|
|
75
|
+
- containerPort: 4026
|
|
76
|
+
protocol: UDP
|
|
77
|
+
- containerPort: 4027
|
|
78
|
+
protocol: TCP
|
|
79
|
+
- containerPort: 4027
|
|
80
|
+
protocol: UDP
|
|
81
|
+
- containerPort: 4028
|
|
82
|
+
protocol: TCP
|
|
83
|
+
- containerPort: 4028
|
|
84
|
+
protocol: UDP
|
|
85
|
+
- containerPort: 4029
|
|
86
|
+
protocol: TCP
|
|
87
|
+
- containerPort: 4029
|
|
88
|
+
protocol: UDP
|
|
89
|
+
- containerPort: 4030
|
|
90
|
+
protocol: TCP
|
|
91
|
+
- containerPort: 4030
|
|
92
|
+
protocol: UDP
|
|
93
|
+
- containerPort: 4031
|
|
94
|
+
protocol: TCP
|
|
95
|
+
- containerPort: 4031
|
|
96
|
+
protocol: UDP
|
|
97
|
+
- containerPort: 4032
|
|
98
|
+
protocol: TCP
|
|
99
|
+
- containerPort: 4032
|
|
100
|
+
protocol: UDP
|
|
101
|
+
resources:
|
|
102
|
+
limits:
|
|
103
|
+
cpu: '2'
|
|
104
|
+
memory: '419430300'
|
|
105
|
+
requests:
|
|
106
|
+
cpu: 250m
|
|
107
|
+
memory: '20971520'
|
|
108
|
+
restartPolicy: OnFailure
|
|
@@ -0,0 +1,16 @@
|
|
|
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
|
|
@@ -0,0 +1,22 @@
|
|
|
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
|
|
@@ -0,0 +1,40 @@
|
|
|
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
|
|
@@ -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,91 @@
|
|
|
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
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
---
|
|
2
|
+
apiVersion: v1
|
|
3
|
+
kind: Service
|
|
4
|
+
metadata:
|
|
5
|
+
name: service-valkey
|
|
6
|
+
namespace: default
|
|
7
|
+
spec:
|
|
8
|
+
ports:
|
|
9
|
+
- port: 6379
|
|
10
|
+
targetPort: 6379
|
|
11
|
+
selector:
|
|
12
|
+
app: service-valkey
|
|
13
|
+
ipFamilyPolicy: PreferDualStack
|
|
14
|
+
ipFamilies:
|
|
15
|
+
- IPv4
|
|
16
|
+
# - IPv6
|
|
17
|
+
type: ClusterIP
|