underpost 3.2.9 → 3.2.10
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 +1 -0
- package/.github/workflows/pwa-microservices-template-test.ci.yml +1 -1
- package/.github/workflows/release.cd.yml +1 -0
- package/.vscode/settings.json +10 -5
- package/CHANGELOG.md +122 -1
- package/CLI-HELP.md +22 -7
- package/README.md +37 -8
- package/bin/build.js +26 -9
- package/bin/deploy.js +20 -21
- package/bin/file.js +31 -13
- package/bin/index.js +2 -1
- package/bin/vs.js +1 -1
- package/bump.config.js +26 -0
- package/conf.js +20 -4
- 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 +4 -2
- package/manifests/kind-config-dev.yaml +8 -0
- package/manifests/mongodb/pv-pvc.yaml +44 -8
- package/manifests/mongodb/statefulset.yaml +55 -68
- package/package.json +27 -12
- package/scripts/k3s-node-setup.sh +28 -9
- package/src/api/core/core.router.js +19 -14
- package/src/api/core/core.service.js +5 -5
- package/src/api/default/default.router.js +22 -18
- package/src/api/default/default.service.js +5 -5
- package/src/api/document/document.router.js +28 -23
- package/src/api/document/document.service.js +100 -23
- package/src/api/file/file.router.js +19 -13
- package/src/api/file/file.service.js +9 -7
- package/src/api/test/test.router.js +17 -12
- package/src/api/types.js +24 -0
- package/src/api/user/guest.service.js +5 -4
- package/src/api/user/user.router.js +297 -288
- package/src/api/user/user.service.js +100 -35
- package/src/cli/baremetal.js +20 -11
- package/src/cli/cluster.js +196 -55
- package/src/cli/db.js +59 -60
- package/src/cli/deploy.js +273 -159
- package/src/cli/fs.js +3 -1
- package/src/cli/index.js +16 -9
- package/src/cli/ipfs.js +4 -6
- package/src/cli/kubectl.js +4 -1
- package/src/cli/lxd.js +217 -135
- package/src/cli/release.js +289 -131
- package/src/cli/repository.js +58 -7
- package/src/cli/run.js +152 -25
- package/src/cli/test.js +9 -3
- package/src/client/Default.index.js +9 -3
- package/src/client/components/core/Auth.js +4 -0
- package/src/client/components/core/PanelForm.js +56 -52
- package/src/client/components/core/Worker.js +162 -363
- package/src/client/sw/core.sw.js +174 -112
- package/src/db/DataBaseProvider.js +120 -20
- package/src/db/mongo/MongoBootstrap.js +587 -0
- package/src/db/mongo/MongooseDB.js +126 -22
- package/src/index.js +1 -1
- package/src/runtime/express/Express.js +2 -2
- package/src/runtime/wp/Wp.js +8 -5
- package/src/server/auth.js +2 -2
- package/src/server/client-build-docs.js +1 -1
- package/src/server/client-build.js +94 -129
- package/src/server/conf.js +20 -65
- package/src/server/process.js +180 -19
- package/src/server/runtime.js +1 -1
- package/src/server/start.js +12 -4
- package/src/ws/IoInterface.js +16 -16
- package/src/ws/core/channels/core.ws.chat.js +11 -11
- package/src/ws/core/channels/core.ws.mailer.js +29 -29
- package/src/ws/core/channels/core.ws.stream.js +19 -19
- package/src/ws/core/core.ws.connection.js +8 -8
- package/src/ws/core/core.ws.server.js +6 -5
- package/src/ws/default/channels/default.ws.main.js +10 -10
- package/src/ws/default/default.ws.connection.js +4 -4
- package/src/ws/default/default.ws.server.js +4 -3
- package/src/client/ssr/email/DefaultRecoverEmail.js +0 -21
- package/src/client/ssr/email/DefaultVerifyEmail.js +0 -17
- /package/src/client/ssr/{offline → views}/Maintenance.js +0 -0
- /package/src/client/ssr/{offline → views}/NoNetworkConnection.js +0 -0
- /package/src/client/ssr/{pages → views}/Test.js +0 -0
package/conf.js
CHANGED
|
@@ -168,11 +168,25 @@ const DefaultConf = /**/ {
|
|
|
168
168
|
head: ['Seo', 'Pwa', 'Css', 'DefaultScripts', 'Production'],
|
|
169
169
|
body: ['CacheControl', 'DefaultSplashScreen', '404', '500', 'SwaggerDarkMode'],
|
|
170
170
|
mailer: { userVerifyEmail: 'DefaultVerifyEmail', userRecoverEmail: 'DefaultRecoverEmail' },
|
|
171
|
-
|
|
172
|
-
{
|
|
173
|
-
|
|
171
|
+
views: [
|
|
172
|
+
{
|
|
173
|
+
path: '/offline',
|
|
174
|
+
title: 'No Network Connection',
|
|
175
|
+
client: 'NoNetworkConnection',
|
|
176
|
+
head: [],
|
|
177
|
+
body: [],
|
|
178
|
+
offlineDefault: true,
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
path: '/maintenance',
|
|
182
|
+
title: 'Server Maintenance',
|
|
183
|
+
client: 'Maintenance',
|
|
184
|
+
head: [],
|
|
185
|
+
body: [],
|
|
186
|
+
maintenanceDefault: true,
|
|
187
|
+
},
|
|
188
|
+
{ path: '/test', title: 'Test', client: 'Test', head: [], body: [] },
|
|
174
189
|
],
|
|
175
|
-
pages: [{ path: '/test', title: 'Test', client: 'Test', head: [], body: [] }],
|
|
176
190
|
},
|
|
177
191
|
},
|
|
178
192
|
server: {
|
|
@@ -189,6 +203,8 @@ const DefaultConf = /**/ {
|
|
|
189
203
|
provider: 'env:DB_PROVIDER:mongoose',
|
|
190
204
|
host: 'env:DB_HOST:mongodb://127.0.0.1:27017',
|
|
191
205
|
name: 'env:DB_NAME:default',
|
|
206
|
+
replicaSet: 'env:DB_REPLICA_SET:rs0',
|
|
207
|
+
authSource: 'env:DB_AUTH_SOURCE:admin',
|
|
192
208
|
user: 'env:DB_USER:',
|
|
193
209
|
password: 'env:DB_PASSWORD:',
|
|
194
210
|
},
|
|
@@ -17,7 +17,7 @@ spec:
|
|
|
17
17
|
spec:
|
|
18
18
|
containers:
|
|
19
19
|
- name: dd-default-development-blue
|
|
20
|
-
image: underpost/underpost-engine:v3.2.
|
|
20
|
+
image: underpost/underpost-engine:v3.2.10
|
|
21
21
|
# resources:
|
|
22
22
|
# requests:
|
|
23
23
|
# memory: "124Ki"
|
|
@@ -98,7 +98,7 @@ spec:
|
|
|
98
98
|
spec:
|
|
99
99
|
containers:
|
|
100
100
|
- name: dd-default-development-green
|
|
101
|
-
image: underpost/underpost-engine:v3.2.
|
|
101
|
+
image: underpost/underpost-engine:v3.2.10
|
|
102
102
|
# resources:
|
|
103
103
|
# requests:
|
|
104
104
|
# memory: "124Ki"
|
|
@@ -20,7 +20,7 @@ spec:
|
|
|
20
20
|
spec:
|
|
21
21
|
containers:
|
|
22
22
|
- name: dd-test-development-blue
|
|
23
|
-
image: underpost/underpost-engine:v3.2.
|
|
23
|
+
image: underpost/underpost-engine:v3.2.10
|
|
24
24
|
imagePullPolicy: IfNotPresent
|
|
25
25
|
envFrom:
|
|
26
26
|
- secretRef:
|
|
@@ -34,6 +34,7 @@ spec:
|
|
|
34
34
|
underpost start --build --run dd-test development
|
|
35
35
|
|
|
36
36
|
|
|
37
|
+
|
|
37
38
|
---
|
|
38
39
|
apiVersion: v1
|
|
39
40
|
kind: Service
|
|
@@ -147,7 +148,7 @@ spec:
|
|
|
147
148
|
spec:
|
|
148
149
|
containers:
|
|
149
150
|
- name: dd-test-development-green
|
|
150
|
-
image: underpost/underpost-engine:v3.2.
|
|
151
|
+
image: underpost/underpost-engine:v3.2.10
|
|
151
152
|
imagePullPolicy: IfNotPresent
|
|
152
153
|
envFrom:
|
|
153
154
|
- secretRef:
|
|
@@ -161,6 +162,7 @@ spec:
|
|
|
161
162
|
underpost start --build --run dd-test development
|
|
162
163
|
|
|
163
164
|
|
|
165
|
+
|
|
164
166
|
---
|
|
165
167
|
apiVersion: v1
|
|
166
168
|
kind: Service
|
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
kind: Cluster
|
|
2
2
|
apiVersion: kind.x-k8s.io/v1alpha4
|
|
3
|
+
networking:
|
|
4
|
+
ipFamily: ipv4
|
|
3
5
|
nodes:
|
|
4
6
|
- role: control-plane
|
|
7
|
+
extraMounts:
|
|
8
|
+
- hostPath: /data/mongodb
|
|
9
|
+
containerPath: /data/mongodb
|
|
5
10
|
- role: worker
|
|
11
|
+
extraMounts:
|
|
12
|
+
- hostPath: /data/mongodb
|
|
13
|
+
containerPath: /data/mongodb
|
|
6
14
|
# extraPortMappings:
|
|
7
15
|
# - containerPort: 80
|
|
8
16
|
# hostPort: 80
|
|
@@ -1,23 +1,59 @@
|
|
|
1
1
|
apiVersion: v1
|
|
2
2
|
kind: PersistentVolume
|
|
3
3
|
metadata:
|
|
4
|
-
name: mongodb-pv
|
|
4
|
+
name: mongodb-pv-0
|
|
5
|
+
labels:
|
|
6
|
+
app: mongodb
|
|
5
7
|
spec:
|
|
6
8
|
capacity:
|
|
7
9
|
storage: 5Gi
|
|
8
10
|
accessModes:
|
|
9
11
|
- ReadWriteOnce
|
|
12
|
+
persistentVolumeReclaimPolicy: Retain
|
|
13
|
+
storageClassName: mongodb-storage-class
|
|
14
|
+
claimRef:
|
|
15
|
+
namespace: default
|
|
16
|
+
name: mongodb-storage-mongodb-0
|
|
10
17
|
hostPath:
|
|
11
|
-
path: /data/mongodb
|
|
18
|
+
path: /data/mongodb/v0
|
|
19
|
+
type: DirectoryOrCreate
|
|
12
20
|
---
|
|
13
21
|
apiVersion: v1
|
|
14
|
-
kind:
|
|
22
|
+
kind: PersistentVolume
|
|
23
|
+
metadata:
|
|
24
|
+
name: mongodb-pv-1
|
|
25
|
+
labels:
|
|
26
|
+
app: mongodb
|
|
27
|
+
spec:
|
|
28
|
+
capacity:
|
|
29
|
+
storage: 5Gi
|
|
30
|
+
accessModes:
|
|
31
|
+
- ReadWriteOnce
|
|
32
|
+
persistentVolumeReclaimPolicy: Retain
|
|
33
|
+
storageClassName: mongodb-storage-class
|
|
34
|
+
claimRef:
|
|
35
|
+
namespace: default
|
|
36
|
+
name: mongodb-storage-mongodb-1
|
|
37
|
+
hostPath:
|
|
38
|
+
path: /data/mongodb/v1
|
|
39
|
+
type: DirectoryOrCreate
|
|
40
|
+
---
|
|
41
|
+
apiVersion: v1
|
|
42
|
+
kind: PersistentVolume
|
|
15
43
|
metadata:
|
|
16
|
-
name: mongodb-
|
|
44
|
+
name: mongodb-pv-2
|
|
45
|
+
labels:
|
|
46
|
+
app: mongodb
|
|
17
47
|
spec:
|
|
18
|
-
|
|
48
|
+
capacity:
|
|
49
|
+
storage: 5Gi
|
|
19
50
|
accessModes:
|
|
20
51
|
- ReadWriteOnce
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
52
|
+
persistentVolumeReclaimPolicy: Retain
|
|
53
|
+
storageClassName: mongodb-storage-class
|
|
54
|
+
claimRef:
|
|
55
|
+
namespace: default
|
|
56
|
+
name: mongodb-storage-mongodb-2
|
|
57
|
+
hostPath:
|
|
58
|
+
path: /data/mongodb/v2
|
|
59
|
+
type: DirectoryOrCreate
|
|
@@ -4,7 +4,8 @@ metadata:
|
|
|
4
4
|
name: mongodb # Specifies the name of the statefulset
|
|
5
5
|
spec:
|
|
6
6
|
serviceName: 'mongodb-service' # Specifies the service to use
|
|
7
|
-
|
|
7
|
+
podManagementPolicy: OrderedReady # or Parallel
|
|
8
|
+
replicas: 3
|
|
8
9
|
selector:
|
|
9
10
|
matchLabels:
|
|
10
11
|
app: mongodb
|
|
@@ -13,80 +14,58 @@ spec:
|
|
|
13
14
|
labels:
|
|
14
15
|
app: mongodb
|
|
15
16
|
spec:
|
|
17
|
+
subdomain: mongodb-service
|
|
18
|
+
securityContext:
|
|
19
|
+
fsGroup: 999
|
|
20
|
+
initContainers:
|
|
21
|
+
- name: internal-keyfile-provisioner
|
|
22
|
+
image: docker.io/library/mongo:latest
|
|
23
|
+
securityContext:
|
|
24
|
+
runAsUser: 0
|
|
25
|
+
runAsGroup: 0
|
|
26
|
+
command:
|
|
27
|
+
- sh
|
|
28
|
+
- -c
|
|
29
|
+
- |
|
|
30
|
+
set -ex
|
|
31
|
+
mkdir -p /opt/mongodb
|
|
32
|
+
cp /tmp/raw-keyfile/mongodb-keyfile /opt/mongodb/mongodb-keyfile
|
|
33
|
+
chmod 400 /opt/mongodb/mongodb-keyfile
|
|
34
|
+
chown -R 999:999 /opt/mongodb
|
|
35
|
+
chown -R 999:999 /data/db
|
|
36
|
+
rm -f /data/db/mongod.lock
|
|
37
|
+
volumeMounts:
|
|
38
|
+
- name: raw-secret-keyfile-volume
|
|
39
|
+
mountPath: /tmp/raw-keyfile
|
|
40
|
+
- name: isolated-runtime-keyfile-volume
|
|
41
|
+
mountPath: /opt/mongodb
|
|
42
|
+
- name: mongodb-storage
|
|
43
|
+
mountPath: /data/db
|
|
16
44
|
containers:
|
|
17
45
|
- name: mongodb
|
|
18
46
|
image: docker.io/library/mongo:latest
|
|
19
47
|
command:
|
|
20
48
|
- mongod
|
|
49
|
+
args:
|
|
21
50
|
- '--replSet'
|
|
22
51
|
- 'rs0'
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
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'
|
|
52
|
+
- '--auth'
|
|
53
|
+
- '--clusterAuthMode'
|
|
54
|
+
- 'keyFile'
|
|
55
|
+
- '--keyFile'
|
|
56
|
+
- '/opt/mongodb/mongodb-keyfile'
|
|
40
57
|
- '--bind_ip_all'
|
|
41
|
-
|
|
42
|
-
# args:
|
|
43
|
-
# - |
|
|
44
|
-
# mongod --replSet rs0 --bind_ip_all &
|
|
45
|
-
# sleep 1000
|
|
46
|
-
# if mongosh --host mongodb-0.mongodb-service:27017 --eval "rs.status()" | grep -q "not yet initialized"; then
|
|
47
|
-
# mongosh --host mongodb-0.mongodb-service:27017 <<EOF
|
|
48
|
-
# use admin;
|
|
49
|
-
# rs.initiate({
|
|
50
|
-
# _id: "rs0",
|
|
51
|
-
# members: [
|
|
52
|
-
# { _id: 0, host: "mongodb-0.mongodb-service:27017", priority: 1 },
|
|
53
|
-
# { _id: 1, host: "mongodb-1.mongodb-service:27017", priority: 1 }
|
|
54
|
-
# ]
|
|
55
|
-
# });
|
|
56
|
-
# db.getSiblingDB("admin").createUser({
|
|
57
|
-
# user: process.env.MONGO_INITDB_ROOT_USERNAME,
|
|
58
|
-
# pwd: process.env.MONGO_INITDB_ROOT_PASSWORD,
|
|
59
|
-
# roles: [{ role: "userAdminAnyDatabase", db: "admin" }]
|
|
60
|
-
# });
|
|
61
|
-
# use default;
|
|
62
|
-
# db.createUser(
|
|
63
|
-
# {
|
|
64
|
-
# user: process.env.MONGO_INITDB_ROOT_USERNAME,
|
|
65
|
-
# pwd: process.env.MONGO_INITDB_ROOT_PASSWORD,
|
|
66
|
-
# roles: [
|
|
67
|
-
# { role: "read", db: "test" },
|
|
68
|
-
# { role: "readWrite", db: "default" }
|
|
69
|
-
# ]
|
|
70
|
-
# }
|
|
71
|
-
# );
|
|
72
|
-
# EOF
|
|
73
|
-
# fi
|
|
74
|
-
# wait
|
|
58
|
+
|
|
75
59
|
ports:
|
|
76
60
|
- containerPort: 27017
|
|
77
61
|
volumeMounts:
|
|
62
|
+
- name: isolated-runtime-keyfile-volume
|
|
63
|
+
mountPath: /opt/mongodb
|
|
78
64
|
- name: mongodb-storage
|
|
79
65
|
mountPath: /data/db
|
|
80
|
-
- name: keyfile
|
|
81
|
-
mountPath: /etc/mongodb-keyfile
|
|
82
|
-
readOnly: true
|
|
83
|
-
# - name: mongodb-configuration-file
|
|
84
|
-
# mountPath: /etc/mongod.conf
|
|
85
|
-
# subPath: mongod.conf
|
|
86
|
-
# readOnly: true
|
|
87
|
-
# - name: mongodb-config
|
|
88
|
-
# mountPath: /config
|
|
89
66
|
env:
|
|
67
|
+
- name: MONGO_REPLICA_SET_NAME
|
|
68
|
+
value: rs0
|
|
90
69
|
- name: MONGO_INITDB_ROOT_USERNAME
|
|
91
70
|
valueFrom:
|
|
92
71
|
secretKeyRef:
|
|
@@ -97,6 +76,18 @@ spec:
|
|
|
97
76
|
secretKeyRef:
|
|
98
77
|
name: mongodb-secret
|
|
99
78
|
key: password
|
|
79
|
+
readinessProbe:
|
|
80
|
+
tcpSocket:
|
|
81
|
+
port: 27017
|
|
82
|
+
initialDelaySeconds: 15
|
|
83
|
+
periodSeconds: 10
|
|
84
|
+
timeoutSeconds: 5
|
|
85
|
+
livenessProbe:
|
|
86
|
+
tcpSocket:
|
|
87
|
+
port: 27017
|
|
88
|
+
initialDelaySeconds: 30
|
|
89
|
+
periodSeconds: 20
|
|
90
|
+
timeoutSeconds: 5
|
|
100
91
|
resources:
|
|
101
92
|
requests:
|
|
102
93
|
cpu: '100m'
|
|
@@ -105,16 +96,12 @@ spec:
|
|
|
105
96
|
cpu: '500m'
|
|
106
97
|
memory: '512Mi'
|
|
107
98
|
volumes:
|
|
108
|
-
- name: keyfile
|
|
99
|
+
- name: raw-secret-keyfile-volume
|
|
109
100
|
secret:
|
|
110
101
|
secretName: mongodb-keyfile
|
|
111
102
|
defaultMode: 0400
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
# name: mongodb-config-file
|
|
115
|
-
# - name: mongodb-config
|
|
116
|
-
# configMap:
|
|
117
|
-
# name: mongodb-config
|
|
103
|
+
- name: isolated-runtime-keyfile-volume
|
|
104
|
+
emptyDir: {}
|
|
118
105
|
volumeClaimTemplates:
|
|
119
106
|
- metadata:
|
|
120
107
|
name: mongodb-storage
|
package/package.json
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
"type": "module",
|
|
3
3
|
"main": "src/index.js",
|
|
4
4
|
"name": "underpost",
|
|
5
|
-
"version": "3.2.
|
|
6
|
-
"description": "
|
|
5
|
+
"version": "3.2.10",
|
|
6
|
+
"description": "Underpost Platform — end-to-end CI/CD and application-delivery toolchain CLI. Covers bare metal, Kubernetes, K3s, kubeadm, LXD, container/image orchestration, secrets, databases, cron jobs, monitoring, SSH, runners, PWA + Workbox delivery, and release orchestration. Extensible via downstream CLIs.",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"start": "node --max-old-space-size=8192 src/server",
|
|
9
9
|
"build": "node bin client",
|
|
@@ -35,7 +35,21 @@
|
|
|
35
35
|
"url": "git+https://github.com/underpostnet/pwa-microservices-template.git"
|
|
36
36
|
},
|
|
37
37
|
"keywords": [
|
|
38
|
+
"underpost",
|
|
39
|
+
"underpost-platform",
|
|
40
|
+
"cli",
|
|
41
|
+
"toolchain",
|
|
42
|
+
"ci-cd",
|
|
43
|
+
"devops",
|
|
44
|
+
"kubernetes",
|
|
45
|
+
"k3s",
|
|
46
|
+
"kubeadm",
|
|
47
|
+
"lxd",
|
|
48
|
+
"bare-metal",
|
|
49
|
+
"container-orchestration",
|
|
50
|
+
"image-management",
|
|
38
51
|
"pwa",
|
|
52
|
+
"workbox",
|
|
39
53
|
"microservices",
|
|
40
54
|
"template",
|
|
41
55
|
"builder",
|
|
@@ -53,12 +67,13 @@
|
|
|
53
67
|
"dependencies": {
|
|
54
68
|
"@fortawesome/fontawesome-free": "^7.2.0",
|
|
55
69
|
"@fullcalendar/rrule": "^6.1.20",
|
|
56
|
-
"@grpc/grpc-js": "^1.
|
|
57
|
-
"@grpc/proto-loader": "^0.8.
|
|
70
|
+
"@grpc/grpc-js": "^1.14.4",
|
|
71
|
+
"@grpc/proto-loader": "^0.8.1",
|
|
58
72
|
"@neodrag/vanilla": "^2.3.1",
|
|
59
73
|
"adm-zip": "^0.5.17",
|
|
60
|
-
"ag-grid-community": "^35.
|
|
61
|
-
"axios": "^1.16.
|
|
74
|
+
"ag-grid-community": "^35.3.0",
|
|
75
|
+
"axios": "^1.16.1",
|
|
76
|
+
"bumpp": "^10.1.0",
|
|
62
77
|
"chai": "^6.2.2",
|
|
63
78
|
"clipboardy": "^5.3.1",
|
|
64
79
|
"cloudinary": "^2.10.0",
|
|
@@ -75,13 +90,13 @@
|
|
|
75
90
|
"escape-string-regexp": "^5.0.0",
|
|
76
91
|
"express": "^5.2.1",
|
|
77
92
|
"express-fileupload": "^1.4.3",
|
|
78
|
-
"express-rate-limit": "^8.
|
|
93
|
+
"express-rate-limit": "^8.5.2",
|
|
79
94
|
"express-slow-down": "^3.1.0",
|
|
80
95
|
"fast-json-stable-stringify": "^2.1.0",
|
|
81
96
|
"favicons": "^7.2.0",
|
|
82
97
|
"fs-extra": "^11.3.5",
|
|
83
98
|
"fullcalendar": "^6.1.15",
|
|
84
|
-
"helmet": "^8.
|
|
99
|
+
"helmet": "^8.2.0",
|
|
85
100
|
"html-minifier-terser": "^7.2.0",
|
|
86
101
|
"http-proxy-middleware": "^4.0.0",
|
|
87
102
|
"ignore-walk": "^9.0.0",
|
|
@@ -89,16 +104,16 @@
|
|
|
89
104
|
"json-colorizer": "^3.0.1",
|
|
90
105
|
"jsonwebtoken": "^9.0.3",
|
|
91
106
|
"mariadb": "^3.2.2",
|
|
92
|
-
"
|
|
93
|
-
"
|
|
107
|
+
"mocha": "^11.7.6",
|
|
108
|
+
"marked": "^18.0.4",
|
|
94
109
|
"mongoose": "^9.6.2",
|
|
95
110
|
"morgan": "^1.10.0",
|
|
96
|
-
"nodemailer": "^8.0.
|
|
111
|
+
"nodemailer": "^8.0.8",
|
|
97
112
|
"nodemon": "^3.0.1",
|
|
98
113
|
"peer": "^1.0.2",
|
|
99
114
|
"peerjs": "^1.5.5",
|
|
100
115
|
"prom-client": "^15.1.2",
|
|
101
|
-
"read": "^
|
|
116
|
+
"read": "^6.0.0",
|
|
102
117
|
"rrule": "^2.8.1",
|
|
103
118
|
"shelljs": "^0.10.0",
|
|
104
119
|
"sitemap": "^9.0.1",
|
|
@@ -8,6 +8,13 @@ set -e
|
|
|
8
8
|
# --worker Initialize as K3s worker node
|
|
9
9
|
# --control-ip=<ip> Control plane IP (required for --worker)
|
|
10
10
|
# --token=<token> K3s node token (required for --worker)
|
|
11
|
+
#
|
|
12
|
+
# DESIGN NOTES:
|
|
13
|
+
# - This script installs the underpost CLI globally via npm.
|
|
14
|
+
# - It then uses the global CLI binary for configuration and K3s setup.
|
|
15
|
+
# - Engine source replication (e.g. via --bootstrap-engine from the host)
|
|
16
|
+
# is a SEPARATE step. This script does NOT depend on /home/dd/engine
|
|
17
|
+
# being pre-pushed. Use --bootstrap-engine after --init-vm completes.
|
|
11
18
|
# ---------------------------------------------------------------------------
|
|
12
19
|
|
|
13
20
|
ROLE="control"
|
|
@@ -48,19 +55,31 @@ Installing underpost VM node...
|
|
|
48
55
|
|
|
49
56
|
npm install -g underpost
|
|
50
57
|
|
|
51
|
-
cd /home/dd/engine
|
|
52
|
-
|
|
53
58
|
echo "Applying host configuration..."
|
|
54
59
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
+
# Use the globally installed underpost CLI
|
|
61
|
+
# NOTE: --dev is used to match the host dev context
|
|
62
|
+
underpost cluster --dev --config
|
|
63
|
+
|
|
64
|
+
# Check if /home/dd/engine exists locally for engine-specific operations.
|
|
65
|
+
# This directory is populated by the host running --bootstrap-engine.
|
|
66
|
+
# If absent, the global underpost CLI handles all operations.
|
|
67
|
+
if [ -d /home/dd/engine ]; then
|
|
68
|
+
echo "Local engine source found at /home/dd/engine. Using local underpost."
|
|
69
|
+
cd /home/dd/engine
|
|
70
|
+
npm install
|
|
71
|
+
node bin run secret
|
|
72
|
+
else
|
|
73
|
+
echo "No local engine source at /home/dd/engine. Using global underpost CLI."
|
|
74
|
+
echo "Engine source can be replicated later with --bootstrap-engine from the host."
|
|
75
|
+
# The globally installed underpost handles secret generation via its own config
|
|
76
|
+
underpost secret underpost --init
|
|
77
|
+
fi
|
|
60
78
|
|
|
61
79
|
if [ "$ROLE" = "control" ]; then
|
|
62
80
|
echo "Initializing K3s control plane..."
|
|
63
|
-
|
|
81
|
+
# Use global underpost CLI for K3s setup
|
|
82
|
+
underpost cluster --dev --k3s
|
|
64
83
|
|
|
65
84
|
echo ""
|
|
66
85
|
echo "K3s control plane is ready."
|
|
@@ -86,4 +105,4 @@ elif [ "$ROLE" = "worker" ]; then
|
|
|
86
105
|
echo ""
|
|
87
106
|
echo "K3s worker node joined the cluster at https://${CONTROL_IP}:6443 successfully."
|
|
88
107
|
sudo systemctl status k3s-agent --no-pager
|
|
89
|
-
fi
|
|
108
|
+
fi
|
|
@@ -5,20 +5,25 @@ import express from 'express';
|
|
|
5
5
|
|
|
6
6
|
const logger = loggerFactory(import.meta);
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
router
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
8
|
+
class CoreRouter {
|
|
9
|
+
/**
|
|
10
|
+
* @param {import('../types.js').RouterOptions} options
|
|
11
|
+
* @returns {import('express').Router}
|
|
12
|
+
*/
|
|
13
|
+
static router(options) {
|
|
14
|
+
const router = express.Router();
|
|
15
|
+
router.post(`/:id`, options.authMiddleware, adminGuard, async (req, res) => await CoreController.post(req, res, options));
|
|
16
|
+
router.post(`/`, options.authMiddleware, adminGuard, async (req, res) => await CoreController.post(req, res, options));
|
|
17
|
+
router.get(`/:id`, options.authMiddleware, adminGuard, async (req, res) => await CoreController.get(req, res, options));
|
|
18
|
+
router.get(`/`, options.authMiddleware, adminGuard, async (req, res) => await CoreController.get(req, res, options));
|
|
19
|
+
router.put(`/:id`, options.authMiddleware, adminGuard, async (req, res) => await CoreController.put(req, res, options));
|
|
20
|
+
router.put(`/`, options.authMiddleware, adminGuard, async (req, res) => await CoreController.put(req, res, options));
|
|
21
|
+
router.delete(`/:id`, options.authMiddleware, adminGuard, async (req, res) => await CoreController.delete(req, res, options));
|
|
22
|
+
router.delete(`/`, options.authMiddleware, adminGuard, async (req, res) => await CoreController.delete(req, res, options));
|
|
23
|
+
return router;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
21
26
|
|
|
22
|
-
const ApiRouter = CoreRouter;
|
|
27
|
+
const ApiRouter = (options) => CoreRouter.router(options);
|
|
23
28
|
|
|
24
29
|
export { ApiRouter, CoreRouter };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DataBaseProviderService } from '../../db/DataBaseProvider.js';
|
|
2
2
|
import { loggerFactory } from '../../server/logger.js';
|
|
3
3
|
import { shellExec } from '../../server/process.js';
|
|
4
4
|
|
|
@@ -7,22 +7,22 @@ const logger = loggerFactory(import.meta);
|
|
|
7
7
|
class CoreService {
|
|
8
8
|
static post = async (req, res, options) => {
|
|
9
9
|
/** @type {import('./core.model.js').CoreModel} */
|
|
10
|
-
const Core =
|
|
10
|
+
const Core = DataBaseProviderService.getModel("Core", options);
|
|
11
11
|
return await new Core(req.body).save();
|
|
12
12
|
};
|
|
13
13
|
static get = async (req, res, options) => {
|
|
14
14
|
/** @type {import('./core.model.js').CoreModel} */
|
|
15
|
-
const Core =
|
|
15
|
+
const Core = DataBaseProviderService.getModel("Core", options);
|
|
16
16
|
return await Core.findById(req.params.id);
|
|
17
17
|
};
|
|
18
18
|
static put = async (req, res, options) => {
|
|
19
19
|
/** @type {import('./core.model.js').CoreModel} */
|
|
20
|
-
const Core =
|
|
20
|
+
const Core = DataBaseProviderService.getModel("Core", options);
|
|
21
21
|
return await Core.findByIdAndUpdate(req.params.id, req.body);
|
|
22
22
|
};
|
|
23
23
|
static delete = async (req, res, options) => {
|
|
24
24
|
/** @type {import('./core.model.js').CoreModel} */
|
|
25
|
-
const Core =
|
|
25
|
+
const Core = DataBaseProviderService.getModel("Core", options);
|
|
26
26
|
return await Core.findByIdAndDelete(req.params.id);
|
|
27
27
|
};
|
|
28
28
|
}
|
|
@@ -4,24 +4,28 @@ import express from 'express';
|
|
|
4
4
|
|
|
5
5
|
const logger = loggerFactory(import.meta);
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
router
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
async (req, res) => await DefaultController.
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
7
|
+
class DefaultRouter {
|
|
8
|
+
/**
|
|
9
|
+
* @param {import('../types.js').RouterOptions} options
|
|
10
|
+
* @returns {import('express').Router}
|
|
11
|
+
*/
|
|
12
|
+
static router(options) {
|
|
13
|
+
const router = express.Router();
|
|
14
|
+
router.post(`/:id`, async (req, res) => await DefaultController.post(req, res, options));
|
|
15
|
+
router.post(`/`, async (req, res) => await DefaultController.post(req, res, options));
|
|
16
|
+
router.get(`/:id`,
|
|
17
|
+
// options.authMiddleware,
|
|
18
|
+
async (req, res) => await DefaultController.get(req, res, options),
|
|
19
|
+
);
|
|
20
|
+
router.get(`/`, async (req, res) => await DefaultController.get(req, res, options));
|
|
21
|
+
router.put(`/:id`, async (req, res) => await DefaultController.put(req, res, options));
|
|
22
|
+
router.put(`/`, async (req, res) => await DefaultController.put(req, res, options));
|
|
23
|
+
router.delete(`/:id`, async (req, res) => await DefaultController.delete(req, res, options));
|
|
24
|
+
router.delete(`/`, async (req, res) => await DefaultController.delete(req, res, options));
|
|
25
|
+
return router;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
24
28
|
|
|
25
|
-
const ApiRouter = DefaultRouter;
|
|
29
|
+
const ApiRouter = (options) => DefaultRouter.router(options);
|
|
26
30
|
|
|
27
31
|
export { ApiRouter, DefaultRouter };
|