underpost 2.8.0 → 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 +20 -4
- 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 +168 -157
- package/bin/file.js +59 -16
- package/bin/hwt.js +0 -10
- package/bin/index.js +201 -61
- package/bin/ssl.js +19 -11
- package/bin/util.js +24 -101
- package/bin/vs.js +26 -2
- package/conf.js +30 -132
- 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 -134
- 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/Account.js +4 -2
- package/src/client/components/core/Auth.js +24 -6
- 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 +2 -1
- package/src/client/components/core/CssCore.js +8 -4
- package/src/client/components/core/Docs.js +1 -1
- package/src/client/components/core/DropDown.js +5 -1
- package/src/client/components/core/Input.js +22 -6
- package/src/client/components/core/JoyStick.js +8 -5
- package/src/client/components/core/LoadingAnimation.js +8 -1
- package/src/client/components/core/Modal.js +47 -18
- package/src/client/components/core/Panel.js +93 -31
- package/src/client/components/core/PanelForm.js +27 -19
- package/src/client/components/core/Scroll.js +1 -0
- package/src/client/components/core/SignUp.js +4 -1
- package/src/client/components/core/Translate.js +61 -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/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 +15 -8
- 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 -2
- 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 +26 -6
- package/src/db/mongo/MongooseDB.js +29 -1
- package/src/index.js +91 -17
- 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 +41 -50
- package/src/server/client-formatted.js +6 -3
- package/src/server/client-icons.js +1 -1
- package/src/server/conf.js +207 -57
- package/src/server/dns.js +30 -55
- package/src/server/downloader.js +0 -8
- package/src/server/logger.js +22 -15
- 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 +3 -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/conf.js
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
import dotenv from 'dotenv';
|
|
2
|
+
|
|
3
|
+
dotenv.config();
|
|
4
|
+
|
|
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',
|
|
@@ -75,58 +79,16 @@ const DefaultConf = {
|
|
|
75
79
|
],
|
|
76
80
|
},
|
|
77
81
|
views: [
|
|
78
|
-
{
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
ssr: 'Default',
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
path: '/settings',
|
|
92
|
-
client: 'Default',
|
|
93
|
-
ssr: 'Default',
|
|
94
|
-
},
|
|
95
|
-
{
|
|
96
|
-
path: '/log-in',
|
|
97
|
-
client: 'Default',
|
|
98
|
-
ssr: 'Default',
|
|
99
|
-
},
|
|
100
|
-
{
|
|
101
|
-
path: '/sign-up',
|
|
102
|
-
client: 'Default',
|
|
103
|
-
ssr: 'Default',
|
|
104
|
-
},
|
|
105
|
-
{
|
|
106
|
-
path: '/log-out',
|
|
107
|
-
client: 'Default',
|
|
108
|
-
ssr: 'Default',
|
|
109
|
-
},
|
|
110
|
-
{
|
|
111
|
-
path: '/account',
|
|
112
|
-
client: 'Default',
|
|
113
|
-
ssr: 'Default',
|
|
114
|
-
},
|
|
115
|
-
{
|
|
116
|
-
path: '/docs',
|
|
117
|
-
client: 'Default',
|
|
118
|
-
ssr: 'Default',
|
|
119
|
-
},
|
|
120
|
-
{
|
|
121
|
-
path: '/recover',
|
|
122
|
-
client: 'Default',
|
|
123
|
-
ssr: 'Default',
|
|
124
|
-
},
|
|
125
|
-
{
|
|
126
|
-
path: '/default-management',
|
|
127
|
-
client: 'Default',
|
|
128
|
-
ssr: 'Default',
|
|
129
|
-
},
|
|
82
|
+
{ path: '/', title: 'Home', client: 'Default', ssr: 'Default' },
|
|
83
|
+
{ path: '/home', title: 'Home', client: 'Default', ssr: 'Default' },
|
|
84
|
+
{ path: '/settings', client: 'Default', ssr: 'Default' },
|
|
85
|
+
{ path: '/log-in', client: 'Default', ssr: 'Default' },
|
|
86
|
+
{ path: '/sign-up', client: 'Default', ssr: 'Default' },
|
|
87
|
+
{ path: '/log-out', client: 'Default', ssr: 'Default' },
|
|
88
|
+
{ path: '/account', client: 'Default', ssr: 'Default' },
|
|
89
|
+
{ path: '/docs', client: 'Default', ssr: 'Default' },
|
|
90
|
+
{ path: '/recover', client: 'Default', ssr: 'Default' },
|
|
91
|
+
{ path: '/default-management', client: 'Default', ssr: 'Default' },
|
|
130
92
|
{ client: 'Default', ssr: 'Default', path: '/404', title: '404 Not Found' },
|
|
131
93
|
{ client: 'Default', ssr: 'Default', path: '/500', title: '500 Server Error' },
|
|
132
94
|
],
|
|
@@ -137,24 +99,15 @@ const DefaultConf = {
|
|
|
137
99
|
import_name: '@neodrag/vanilla',
|
|
138
100
|
import_name_build: '/dist/@neodrag-vanilla/index.js',
|
|
139
101
|
},
|
|
140
|
-
{
|
|
141
|
-
folder: './node_modules/@fortawesome/fontawesome-free',
|
|
142
|
-
public_folder: '/dist/fontawesome',
|
|
143
|
-
},
|
|
102
|
+
{ folder: './node_modules/@fortawesome/fontawesome-free', public_folder: '/dist/fontawesome' },
|
|
144
103
|
{
|
|
145
104
|
folder: './node_modules/sortablejs/modular',
|
|
146
105
|
public_folder: '/dist/sortablejs',
|
|
147
106
|
import_name: 'sortablejs',
|
|
148
107
|
import_name_build: '/dist/sortablejs/sortable.complete.esm.js',
|
|
149
108
|
},
|
|
150
|
-
{
|
|
151
|
-
|
|
152
|
-
public_folder: '/dist/validator',
|
|
153
|
-
},
|
|
154
|
-
{
|
|
155
|
-
folder: './node_modules/@loadingio/css-spinner/entries',
|
|
156
|
-
public_folder: '/dist/loadingio',
|
|
157
|
-
},
|
|
109
|
+
{ folder: './node_modules/validator', public_folder: '/dist/validator' },
|
|
110
|
+
{ folder: './node_modules/@loadingio/css-spinner/entries', public_folder: '/dist/loadingio' },
|
|
158
111
|
{
|
|
159
112
|
import_name: 'ag-grid-community',
|
|
160
113
|
import_name_build: '/dist/ag-grid-community/ag-grid-community.auto.complete.esm.min.js',
|
|
@@ -169,10 +122,7 @@ const DefaultConf = {
|
|
|
169
122
|
import_name: 'socket.io/client-dist/socket.io.esm.min.js',
|
|
170
123
|
import_name_build: '/dist/socket.io/socket.io.esm.min.js',
|
|
171
124
|
},
|
|
172
|
-
{
|
|
173
|
-
folder: './node_modules/peerjs/dist',
|
|
174
|
-
public_folder: '/dist/peerjs',
|
|
175
|
-
},
|
|
125
|
+
{ folder: './node_modules/peerjs/dist', public_folder: '/dist/peerjs' },
|
|
176
126
|
],
|
|
177
127
|
services: ['default', 'core', 'user', 'test', 'file'],
|
|
178
128
|
},
|
|
@@ -181,28 +131,12 @@ const DefaultConf = {
|
|
|
181
131
|
Default: {
|
|
182
132
|
head: ['Seo', 'Pwa', 'Css', 'DefaultScripts', 'Production'],
|
|
183
133
|
body: ['CacheControl', 'DefaultSplashScreen', '404', '500'],
|
|
184
|
-
mailer: {
|
|
185
|
-
userVerifyEmail: 'DefaultVerifyEmail',
|
|
186
|
-
userRecoverEmail: 'DefaultRecoverEmail',
|
|
187
|
-
},
|
|
134
|
+
mailer: { userVerifyEmail: 'DefaultVerifyEmail', userRecoverEmail: 'DefaultRecoverEmail' },
|
|
188
135
|
offline: [
|
|
189
|
-
{
|
|
190
|
-
|
|
191
|
-
title: 'No Network Connection',
|
|
192
|
-
client: 'NoNetworkConnection',
|
|
193
|
-
head: [],
|
|
194
|
-
body: [],
|
|
195
|
-
},
|
|
196
|
-
],
|
|
197
|
-
pages: [
|
|
198
|
-
{
|
|
199
|
-
path: '/test',
|
|
200
|
-
title: 'Test',
|
|
201
|
-
client: 'Test',
|
|
202
|
-
head: [],
|
|
203
|
-
body: [],
|
|
204
|
-
},
|
|
136
|
+
{ path: '/offline', title: 'No Network Connection', client: 'NoNetworkConnection', head: [], body: [] },
|
|
137
|
+
{ path: '/maintenance', title: 'Server Maintenance', client: 'Maintenance', head: [], body: [] },
|
|
205
138
|
],
|
|
139
|
+
pages: [{ path: '/test', title: 'Test', client: 'Test', head: [], body: [] }],
|
|
206
140
|
},
|
|
207
141
|
},
|
|
208
142
|
server: {
|
|
@@ -220,24 +154,14 @@ const DefaultConf = {
|
|
|
220
154
|
ws: 'core',
|
|
221
155
|
peer: true,
|
|
222
156
|
proxy: [80, 443],
|
|
223
|
-
db: {
|
|
224
|
-
provider: 'mongoose',
|
|
225
|
-
host: 'mongodb://127.0.0.1:27017',
|
|
226
|
-
name: 'default',
|
|
227
|
-
},
|
|
157
|
+
db: { provider: 'mongoose', host: 'mongodb://127.0.0.1:27017', name: 'default' },
|
|
228
158
|
mailer: {
|
|
229
|
-
sender: {
|
|
230
|
-
email: 'noreply@default.net',
|
|
231
|
-
name: 'Default',
|
|
232
|
-
},
|
|
159
|
+
sender: { email: 'noreply@default.net', name: 'Default' },
|
|
233
160
|
transport: {
|
|
234
161
|
host: 'smtp.default.com',
|
|
235
162
|
port: 465,
|
|
236
163
|
secure: true,
|
|
237
|
-
auth: {
|
|
238
|
-
user: 'noreply@default.net',
|
|
239
|
-
pass: '',
|
|
240
|
-
},
|
|
164
|
+
auth: { user: 'noreply@default.net', pass: '' },
|
|
241
165
|
},
|
|
242
166
|
},
|
|
243
167
|
},
|
|
@@ -255,35 +179,9 @@ const DefaultConf = {
|
|
|
255
179
|
},
|
|
256
180
|
},
|
|
257
181
|
cron: {
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
},
|
|
261
|
-
records: {
|
|
262
|
-
A: [
|
|
263
|
-
{
|
|
264
|
-
host: 'example.com',
|
|
265
|
-
dns: 'dondominio',
|
|
266
|
-
api_key: '???',
|
|
267
|
-
user: '???',
|
|
268
|
-
},
|
|
269
|
-
],
|
|
270
|
-
},
|
|
271
|
-
backups: [
|
|
272
|
-
{
|
|
273
|
-
deployGroupId: 'default-group',
|
|
274
|
-
},
|
|
275
|
-
],
|
|
276
|
-
jobs: {
|
|
277
|
-
dns: {
|
|
278
|
-
expression: '* * * * *',
|
|
279
|
-
enabled: true,
|
|
280
|
-
},
|
|
281
|
-
backups: {
|
|
282
|
-
expression: '0 1 * * *',
|
|
283
|
-
enabled: true,
|
|
284
|
-
},
|
|
285
|
-
},
|
|
182
|
+
records: { A: [{ host: 'example.com', dns: 'dondominio', api_key: '???', user: '???' }] },
|
|
183
|
+
jobs: { dns: { expression: '* * * * *', enabled: true }, backups: { expression: '0 1 * * *', enabled: true } },
|
|
286
184
|
},
|
|
287
|
-
};
|
|
185
|
+
}; /**/
|
|
288
186
|
|
|
289
187
|
export { DefaultConf };
|
package/docker-compose.yml
CHANGED
|
@@ -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,12 @@
|
|
|
1
|
+
kind: Cluster
|
|
2
|
+
apiVersion: kind.x-k8s.io/v1alpha4
|
|
3
|
+
nodes:
|
|
4
|
+
- role: control-plane
|
|
5
|
+
- role: worker
|
|
6
|
+
# extraPortMappings:
|
|
7
|
+
# - containerPort: 80
|
|
8
|
+
# hostPort: 80
|
|
9
|
+
# listenAddress: '0.0.0.0'
|
|
10
|
+
# - containerPort: 443
|
|
11
|
+
# hostPort: 443
|
|
12
|
+
# listenAddress: '0.0.0.0'
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
apiVersion: cert-manager.io/v1
|
|
2
|
+
kind: ClusterIssuer
|
|
3
|
+
metadata:
|
|
4
|
+
name: letsencrypt-prod
|
|
5
|
+
namespace: cert-manager
|
|
6
|
+
spec:
|
|
7
|
+
acme:
|
|
8
|
+
email: development@underpost.net
|
|
9
|
+
privateKeySecretRef:
|
|
10
|
+
name: letsencrypt-prod
|
|
11
|
+
server: https://acme-v02.api.letsencrypt.org/directory
|
|
12
|
+
solvers:
|
|
13
|
+
- http01:
|
|
14
|
+
ingress:
|
|
15
|
+
class: contour
|
|
@@ -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,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,42 @@
|
|
|
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 --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
|
+
restartPolicy: Never
|
|
26
|
+
volumes:
|
|
27
|
+
- name: backup-storage
|
|
28
|
+
persistentVolumeClaim:
|
|
29
|
+
claimName: backup-pvc
|
|
30
|
+
# 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)
|
|
31
|
+
|
|
32
|
+
# env:
|
|
33
|
+
# - name: MONGO_INITDB_ROOT_USERNAME
|
|
34
|
+
# valueFrom:
|
|
35
|
+
# secretKeyRef:
|
|
36
|
+
# name: mongodb-secret
|
|
37
|
+
# key: username
|
|
38
|
+
# - name: MONGO_INITDB_ROOT_PASSWORD
|
|
39
|
+
# valueFrom:
|
|
40
|
+
# secretKeyRef:
|
|
41
|
+
# name: mongodb-secret
|
|
42
|
+
# key: password
|
|
@@ -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,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,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
|