underpost 2.99.7 → 3.0.0
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/.env.development +2 -1
- package/.env.production +1 -0
- package/.env.test +2 -1
- package/.github/workflows/npmpkg.ci.yml +2 -1
- package/.github/workflows/publish.ci.yml +18 -34
- package/.vscode/extensions.json +8 -50
- package/.vscode/settings.json +0 -77
- package/CHANGELOG.md +91 -1
- package/{cli.md → CLI-HELP.md} +48 -41
- package/Dockerfile +15 -15
- package/README.md +8 -15
- package/bin/build.js +4 -15
- package/bin/deploy.js +4 -133
- package/bin/file.js +9 -48
- package/bin/zed.js +63 -2
- package/examples/static-page/ssr-components/CustomPage.js +1 -1
- package/jsdoc.json +1 -2
- 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 +2 -2
- package/manifests/deployment/fastapi/initial_data.sh +4 -52
- package/manifests/ipfs/configmap.yaml +57 -0
- package/manifests/ipfs/headless-service.yaml +35 -0
- package/manifests/ipfs/kustomization.yaml +8 -0
- package/manifests/ipfs/statefulset.yaml +149 -0
- package/manifests/ipfs/storage-class.yaml +9 -0
- package/package.json +5 -5
- package/scripts/k3s-node-setup.sh +89 -0
- package/scripts/lxd-vm-setup.sh +23 -0
- package/scripts/rocky-setup.sh +1 -13
- package/src/cli/baremetal.js +7 -9
- package/src/cli/cluster.js +72 -121
- package/src/cli/deploy.js +8 -5
- package/src/cli/index.js +31 -30
- package/src/cli/ipfs.js +184 -0
- package/src/cli/lxd.js +191 -236
- package/src/cli/repository.js +4 -1
- package/src/client/components/core/VanillaJs.js +0 -25
- package/src/client/services/user/user.management.js +0 -5
- package/src/client/services/user/user.service.js +1 -1
- package/src/db/mariadb/MariaDB.js +2 -2
- package/src/index.js +12 -1
- package/src/runtime/express/Dockerfile +15 -15
- package/src/runtime/lampp/Dockerfile +15 -15
- package/src/server/client-build-docs.js +26 -7
- package/src/server/conf.js +3 -20
- package/src/server/logger.js +22 -10
- package/.vscode/zed.keymap.json +0 -39
- package/.vscode/zed.settings.json +0 -20
- package/bin/cron.js +0 -47
- package/bin/db.js +0 -199
- package/bin/hwt.js +0 -49
- package/bin/util.js +0 -63
- package/manifests/lxd/underpost-setup.sh +0 -163
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
apiVersion: apps/v1
|
|
2
|
+
kind: StatefulSet
|
|
3
|
+
metadata:
|
|
4
|
+
name: ipfs-cluster
|
|
5
|
+
spec:
|
|
6
|
+
serviceName: ipfs-cluster
|
|
7
|
+
replicas: 1
|
|
8
|
+
selector:
|
|
9
|
+
matchLabels:
|
|
10
|
+
app: ipfs-cluster
|
|
11
|
+
template:
|
|
12
|
+
metadata:
|
|
13
|
+
labels:
|
|
14
|
+
app: ipfs-cluster
|
|
15
|
+
spec:
|
|
16
|
+
initContainers:
|
|
17
|
+
- name: configure-ipfs
|
|
18
|
+
image: ipfs/kubo:latest
|
|
19
|
+
imagePullPolicy: IfNotPresent
|
|
20
|
+
securityContext:
|
|
21
|
+
runAsUser: 0
|
|
22
|
+
command: ['sh', '/custom/configure-ipfs.sh']
|
|
23
|
+
volumeMounts:
|
|
24
|
+
- name: ipfs-storage
|
|
25
|
+
mountPath: /data/ipfs
|
|
26
|
+
- name: configure-script
|
|
27
|
+
mountPath: /custom
|
|
28
|
+
|
|
29
|
+
containers:
|
|
30
|
+
- name: ipfs
|
|
31
|
+
image: ipfs/kubo:latest
|
|
32
|
+
imagePullPolicy: IfNotPresent
|
|
33
|
+
env:
|
|
34
|
+
- name: IPFS_FD_MAX
|
|
35
|
+
value: '4096'
|
|
36
|
+
ports:
|
|
37
|
+
- name: swarm
|
|
38
|
+
protocol: TCP
|
|
39
|
+
containerPort: 4001
|
|
40
|
+
- name: swarm-udp
|
|
41
|
+
protocol: UDP
|
|
42
|
+
containerPort: 4001
|
|
43
|
+
- name: api
|
|
44
|
+
protocol: TCP
|
|
45
|
+
containerPort: 5001
|
|
46
|
+
- name: ws
|
|
47
|
+
protocol: TCP
|
|
48
|
+
containerPort: 8081
|
|
49
|
+
- name: http
|
|
50
|
+
protocol: TCP
|
|
51
|
+
containerPort: 8080
|
|
52
|
+
livenessProbe:
|
|
53
|
+
tcpSocket:
|
|
54
|
+
port: swarm
|
|
55
|
+
initialDelaySeconds: 30
|
|
56
|
+
timeoutSeconds: 5
|
|
57
|
+
periodSeconds: 15
|
|
58
|
+
volumeMounts:
|
|
59
|
+
- name: ipfs-storage
|
|
60
|
+
mountPath: /data/ipfs
|
|
61
|
+
- name: configure-script
|
|
62
|
+
mountPath: /custom
|
|
63
|
+
resources:
|
|
64
|
+
requests:
|
|
65
|
+
cpu: '100m'
|
|
66
|
+
memory: '256Mi'
|
|
67
|
+
limits:
|
|
68
|
+
cpu: '500m'
|
|
69
|
+
memory: '512Mi'
|
|
70
|
+
|
|
71
|
+
- name: ipfs-cluster
|
|
72
|
+
image: ipfs/ipfs-cluster:latest
|
|
73
|
+
imagePullPolicy: IfNotPresent
|
|
74
|
+
command: ['sh', '/custom/entrypoint.sh']
|
|
75
|
+
env:
|
|
76
|
+
- name: BOOTSTRAP_PEER_ID
|
|
77
|
+
valueFrom:
|
|
78
|
+
configMapKeyRef:
|
|
79
|
+
name: env-config
|
|
80
|
+
key: bootstrap-peer-id
|
|
81
|
+
- name: BOOTSTRAP_PEER_PRIV_KEY
|
|
82
|
+
valueFrom:
|
|
83
|
+
secretKeyRef:
|
|
84
|
+
name: ipfs-cluster-secret
|
|
85
|
+
key: bootstrap-peer-priv-key
|
|
86
|
+
- name: CLUSTER_SECRET
|
|
87
|
+
valueFrom:
|
|
88
|
+
secretKeyRef:
|
|
89
|
+
name: ipfs-cluster-secret
|
|
90
|
+
key: cluster-secret
|
|
91
|
+
- name: CLUSTER_MONITOR_PING_INTERVAL
|
|
92
|
+
value: '3m'
|
|
93
|
+
- name: SVC_NAME
|
|
94
|
+
valueFrom:
|
|
95
|
+
configMapKeyRef:
|
|
96
|
+
name: env-config
|
|
97
|
+
key: CLUSTER_SVC_NAME
|
|
98
|
+
ports:
|
|
99
|
+
- name: api-http
|
|
100
|
+
containerPort: 9094
|
|
101
|
+
protocol: TCP
|
|
102
|
+
- name: proxy-http
|
|
103
|
+
containerPort: 9095
|
|
104
|
+
protocol: TCP
|
|
105
|
+
- name: cluster-swarm
|
|
106
|
+
containerPort: 9096
|
|
107
|
+
protocol: TCP
|
|
108
|
+
livenessProbe:
|
|
109
|
+
tcpSocket:
|
|
110
|
+
port: cluster-swarm
|
|
111
|
+
initialDelaySeconds: 5
|
|
112
|
+
timeoutSeconds: 5
|
|
113
|
+
periodSeconds: 10
|
|
114
|
+
volumeMounts:
|
|
115
|
+
- name: cluster-storage
|
|
116
|
+
mountPath: /data/ipfs-cluster
|
|
117
|
+
- name: configure-script
|
|
118
|
+
mountPath: /custom
|
|
119
|
+
resources:
|
|
120
|
+
requests:
|
|
121
|
+
cpu: '100m'
|
|
122
|
+
memory: '128Mi'
|
|
123
|
+
limits:
|
|
124
|
+
cpu: '500m'
|
|
125
|
+
memory: '512Mi'
|
|
126
|
+
|
|
127
|
+
volumes:
|
|
128
|
+
- name: configure-script
|
|
129
|
+
configMap:
|
|
130
|
+
name: ipfs-cluster-set-bootstrap-conf
|
|
131
|
+
defaultMode: 0755
|
|
132
|
+
|
|
133
|
+
volumeClaimTemplates:
|
|
134
|
+
- metadata:
|
|
135
|
+
name: cluster-storage
|
|
136
|
+
spec:
|
|
137
|
+
storageClassName: ipfs-storage-class
|
|
138
|
+
accessModes: ['ReadWriteOnce']
|
|
139
|
+
resources:
|
|
140
|
+
requests:
|
|
141
|
+
storage: 1Gi
|
|
142
|
+
- metadata:
|
|
143
|
+
name: ipfs-storage
|
|
144
|
+
spec:
|
|
145
|
+
storageClassName: ipfs-storage-class
|
|
146
|
+
accessModes: ['ReadWriteOnce']
|
|
147
|
+
resources:
|
|
148
|
+
requests:
|
|
149
|
+
storage: 5Gi
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"type": "module",
|
|
3
3
|
"main": "src/index.js",
|
|
4
4
|
"name": "underpost",
|
|
5
|
-
"version": "
|
|
5
|
+
"version": "3.0.0",
|
|
6
6
|
"description": "pwa api rest template",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"start": "env-cmd -f .env.production node --max-old-space-size=8192 src/server",
|
|
@@ -76,13 +76,13 @@
|
|
|
76
76
|
"helmet": "^8.1.0",
|
|
77
77
|
"html-minifier-terser": "^7.2.0",
|
|
78
78
|
"http-proxy-middleware": "^2.0.6",
|
|
79
|
-
"ignore-walk": "^
|
|
79
|
+
"ignore-walk": "^8.0.0",
|
|
80
80
|
"iovalkey": "^0.2.1",
|
|
81
81
|
"json-colorizer": "^2.2.2",
|
|
82
82
|
"jsonwebtoken": "^9.0.2",
|
|
83
83
|
"mariadb": "^3.2.2",
|
|
84
84
|
"marked": "^12.0.2",
|
|
85
|
-
"mocha": "^
|
|
85
|
+
"mocha": "^11.3.0",
|
|
86
86
|
"mongoose": "^8.9.5",
|
|
87
87
|
"morgan": "^1.10.0",
|
|
88
88
|
"nodemailer": "^7.0.9",
|
|
@@ -92,12 +92,12 @@
|
|
|
92
92
|
"prom-client": "^15.1.2",
|
|
93
93
|
"read": "^2.1.0",
|
|
94
94
|
"rrule": "^2.8.1",
|
|
95
|
-
"shelljs": "^0.
|
|
95
|
+
"shelljs": "^0.10.0",
|
|
96
96
|
"sitemap": "^7.1.1",
|
|
97
97
|
"socket.io": "^4.8.0",
|
|
98
98
|
"sortablejs": "^1.15.0",
|
|
99
99
|
"split-file": "^2.3.0",
|
|
100
|
-
"swagger-autogen": "^2.
|
|
100
|
+
"swagger-autogen": "^2.9.2",
|
|
101
101
|
"swagger-ui-express": "^5.0.0",
|
|
102
102
|
"uglify-js": "^3.17.4",
|
|
103
103
|
"validator": "^13.11.0",
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
set -e
|
|
3
|
+
|
|
4
|
+
# ---------------------------------------------------------------------------
|
|
5
|
+
# Underpost K3s Node Setup
|
|
6
|
+
# Usage:
|
|
7
|
+
# --control Initialize as K3s control plane node (default)
|
|
8
|
+
# --worker Initialize as K3s worker node
|
|
9
|
+
# --control-ip=<ip> Control plane IP (required for --worker)
|
|
10
|
+
# --token=<token> K3s node token (required for --worker)
|
|
11
|
+
# ---------------------------------------------------------------------------
|
|
12
|
+
|
|
13
|
+
ROLE="control"
|
|
14
|
+
CONTROL_IP=""
|
|
15
|
+
K3S_TOKEN=""
|
|
16
|
+
|
|
17
|
+
for arg in "$@"; do
|
|
18
|
+
case $arg in
|
|
19
|
+
--worker) ROLE="worker" ;;
|
|
20
|
+
--control) ROLE="control" ;;
|
|
21
|
+
--control-ip=*) CONTROL_IP="${arg#*=}" ;;
|
|
22
|
+
--token=*) K3S_TOKEN="${arg#*=}" ;;
|
|
23
|
+
esac
|
|
24
|
+
done
|
|
25
|
+
# ---------------------------------------------------------------------------
|
|
26
|
+
# NVM and Node.js
|
|
27
|
+
# ---------------------------------------------------------------------------
|
|
28
|
+
echo "Installing NVM and Node.js v24.10.0..."
|
|
29
|
+
|
|
30
|
+
curl -o- https://cdn.jsdelivr.net/gh/nvm-sh/nvm@v0.40.1/install.sh | bash
|
|
31
|
+
|
|
32
|
+
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
|
|
33
|
+
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
|
|
34
|
+
|
|
35
|
+
nvm install 24.10.0
|
|
36
|
+
nvm use 24.10.0
|
|
37
|
+
|
|
38
|
+
echo "
|
|
39
|
+
██╗░░░██╗███╗░░██╗██████╗░███████╗██████╗░██████╗░░█████╗░░██████╗████████╗
|
|
40
|
+
██║░░░██║████╗░██║██╔══██╗██╔════╝██╔══██╗██╔══██╗██╔══██╗██╔════╝╚══██╔══╝
|
|
41
|
+
██║░░░██║██╔██╗██║██║░░██║█████╗░░██████╔╝██████╔╝██║░░██║╚█████╗░░░░██║░░░
|
|
42
|
+
██║░░░██║██║╚████║██║░░██║██╔══╝░░██╔══██╗██╔═══╝░██║░░██║░╚═══██╗░░░██║░░░
|
|
43
|
+
╚██████╔╝██║░╚███║██████╔╝███████╗██║░░██║██║░░░░░╚█████╔╝██████╔╝░░░██║░░░
|
|
44
|
+
░╚═════╝░╚═╝░░╚══╝╚═════╝░╚══════╝╚═╝░░╚═╝╚═╝░░░░░░╚════╝░╚═════╝░░░░╚═╝░░░
|
|
45
|
+
|
|
46
|
+
Installing underpost VM node...
|
|
47
|
+
"
|
|
48
|
+
|
|
49
|
+
npm install -g underpost
|
|
50
|
+
|
|
51
|
+
cd /home/dd/engine
|
|
52
|
+
|
|
53
|
+
echo "Applying host configuration..."
|
|
54
|
+
|
|
55
|
+
underpost install
|
|
56
|
+
|
|
57
|
+
node bin run secret
|
|
58
|
+
|
|
59
|
+
node bin cluster --dev --config
|
|
60
|
+
|
|
61
|
+
if [ "$ROLE" = "control" ]; then
|
|
62
|
+
echo "Initializing K3s control plane..."
|
|
63
|
+
node bin cluster --dev --k3s
|
|
64
|
+
|
|
65
|
+
echo ""
|
|
66
|
+
echo "K3s control plane is ready."
|
|
67
|
+
echo "Node token (share with workers to join this cluster):"
|
|
68
|
+
sudo cat /var/lib/rancher/k3s/server/node-token
|
|
69
|
+
echo ""
|
|
70
|
+
echo "Control plane IP addresses:"
|
|
71
|
+
ip -4 addr show scope global | grep inet | awk '{print $2}' | cut -d/ -f1
|
|
72
|
+
|
|
73
|
+
elif [ "$ROLE" = "worker" ]; then
|
|
74
|
+
if [ -z "$CONTROL_IP" ] || [ -z "$K3S_TOKEN" ]; then
|
|
75
|
+
echo "ERROR: --control-ip and --token are required for worker role."
|
|
76
|
+
echo "Usage: bash k3s-node-setup.sh --worker --control-ip=<ip> --token=<token>"
|
|
77
|
+
exit 1
|
|
78
|
+
fi
|
|
79
|
+
|
|
80
|
+
echo "Joining K3s cluster at https://${CONTROL_IP}:6443..."
|
|
81
|
+
curl -sfL https://get.k3s.io | \
|
|
82
|
+
K3S_URL="https://${CONTROL_IP}:6443" \
|
|
83
|
+
K3S_TOKEN="${K3S_TOKEN}" \
|
|
84
|
+
sh -s - agent
|
|
85
|
+
|
|
86
|
+
echo ""
|
|
87
|
+
echo "K3s worker node joined the cluster at https://${CONTROL_IP}:6443 successfully."
|
|
88
|
+
sudo systemctl status k3s-agent --no-pager
|
|
89
|
+
fi
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
|
|
2
|
+
echo "Expanding /dev/sda2 and resizing filesystem..."
|
|
3
|
+
|
|
4
|
+
if ! command -v parted &>/dev/null; then
|
|
5
|
+
sudo dnf install -y parted
|
|
6
|
+
fi
|
|
7
|
+
|
|
8
|
+
sudo parted /dev/sda ---pretend-input-tty <<EOF
|
|
9
|
+
unit s
|
|
10
|
+
resizepart 2 100%
|
|
11
|
+
Yes
|
|
12
|
+
quit
|
|
13
|
+
EOF
|
|
14
|
+
|
|
15
|
+
sudo resize2fs /dev/sda2
|
|
16
|
+
echo "Disk resized."
|
|
17
|
+
|
|
18
|
+
echo "Installing essential packages..."
|
|
19
|
+
sudo dnf install -y tar bzip2 git curl jq epel-release
|
|
20
|
+
sudo dnf -y update
|
|
21
|
+
|
|
22
|
+
echo "Loading br_netfilter module..."
|
|
23
|
+
sudo modprobe br_netfilter
|
package/scripts/rocky-setup.sh
CHANGED
|
@@ -103,16 +103,4 @@ echo "[+] Cleanup: remove unnecessary packages and old metadata"
|
|
|
103
103
|
dnf autoremove -y
|
|
104
104
|
dnf clean all
|
|
105
105
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
Installation complete.
|
|
109
|
-
- To allow SSH access (if this is a VM or server), open port 22 in firewalld:
|
|
110
|
-
sudo firewall-cmd --add-service=ssh --permanent && sudo firewall-cmd --reload
|
|
111
|
-
- If you installed Development Tools, you will have gcc, make, etc.
|
|
112
|
-
|
|
113
|
-
Examples:
|
|
114
|
-
sudo ./scripts/rocky-setup.sh --install-dev
|
|
115
|
-
INSTALL_DEV=1 sudo ./scripts/rocky-setup.sh
|
|
116
|
-
|
|
117
|
-
Customize PACKAGES=(...) inside this script according to your needs (docker, podman, kube, mssql-tools, etc.).
|
|
118
|
-
EOF
|
|
106
|
+
echo "[+] Setup complete! Rocky Linux is now configured with the recommended base packages."
|
package/src/cli/baremetal.js
CHANGED
|
@@ -534,9 +534,6 @@ rm -rf ${artifacts.join(' ')}`);
|
|
|
534
534
|
if (options.controlServerDbInstall === true) {
|
|
535
535
|
// Deploy the database provider and manage MAAS database.
|
|
536
536
|
shellExec(`node ${underpostRoot}/bin/deploy ${dbProviderId} install`);
|
|
537
|
-
shellExec(
|
|
538
|
-
`node ${underpostRoot}/bin/deploy pg-drop-db ${process.env.DB_PG_MAAS_NAME} ${process.env.DB_PG_MAAS_USER}`,
|
|
539
|
-
);
|
|
540
537
|
shellExec(`node ${underpostRoot}/bin/deploy maas-db`);
|
|
541
538
|
return;
|
|
542
539
|
}
|
|
@@ -1150,8 +1147,9 @@ rm -rf ${artifacts.join(' ')}`);
|
|
|
1150
1147
|
machine: machine ? machine.system_id : null,
|
|
1151
1148
|
});
|
|
1152
1149
|
|
|
1153
|
-
const { discovery, machine: discoveredMachine } =
|
|
1154
|
-
|
|
1150
|
+
const { discovery, machine: discoveredMachine } = await Underpost.baremetal.commissionMonitor(
|
|
1151
|
+
commissionMonitorPayload,
|
|
1152
|
+
);
|
|
1155
1153
|
if (discoveredMachine) machine = discoveredMachine;
|
|
1156
1154
|
}
|
|
1157
1155
|
},
|
|
@@ -2496,10 +2494,10 @@ fi
|
|
|
2496
2494
|
const discoverHostname = discovery.hostname
|
|
2497
2495
|
? discovery.hostname
|
|
2498
2496
|
: discovery.mac_organization
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2497
|
+
? discovery.mac_organization
|
|
2498
|
+
: discovery.domain
|
|
2499
|
+
? discovery.domain
|
|
2500
|
+
: `generic-host-${s4()}${s4()}`;
|
|
2503
2501
|
|
|
2504
2502
|
console.log(discoverHostname.bgBlue.bold.white);
|
|
2505
2503
|
console.log('ip target:'.green + ipAddress, 'ip discovered:'.green + discovery.ip);
|