@underpostnet/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 +1 -15
- package/bin/deploy.js +4 -133
- package/bin/file.js +5 -24
- 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
package/bin/util.js
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import fs from 'fs-extra';
|
|
2
|
-
import * as dir from 'path';
|
|
3
|
-
|
|
4
|
-
import { loggerFactory } from '../src/server/logger.js';
|
|
5
|
-
import { pbcopy } from '../src/server/process.js';
|
|
6
|
-
import { buildKindPorts } from '../src/server/conf.js';
|
|
7
|
-
|
|
8
|
-
const logger = loggerFactory(import.meta);
|
|
9
|
-
|
|
10
|
-
logger.info('argv', process.argv);
|
|
11
|
-
|
|
12
|
-
const operator = process.argv[2];
|
|
13
|
-
|
|
14
|
-
try {
|
|
15
|
-
// let cmd;
|
|
16
|
-
switch (operator) {
|
|
17
|
-
case 'log':
|
|
18
|
-
console.log(fs.readFileSync(process.argv[3], 'utf8'));
|
|
19
|
-
break;
|
|
20
|
-
|
|
21
|
-
case 'delete-empty-folder':
|
|
22
|
-
function cleanEmptyFoldersRecursively(folder) {
|
|
23
|
-
if (!fs.existsSync(folder)) {
|
|
24
|
-
logger.warn('Does not exist', folder);
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
const isDir = fs.statSync(folder).isDirectory();
|
|
28
|
-
if (!isDir) return;
|
|
29
|
-
|
|
30
|
-
let files = fs.readdirSync(folder);
|
|
31
|
-
if (files.length > 0) {
|
|
32
|
-
files.forEach(function (file) {
|
|
33
|
-
const fullPath = dir.join(folder, file);
|
|
34
|
-
cleanEmptyFoldersRecursively(fullPath);
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
// re-evaluate files; after deleting subfolder
|
|
38
|
-
// we may have parent folder empty now
|
|
39
|
-
files = fs.readdirSync(folder);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
if (files.length === 0) {
|
|
43
|
-
console.log('removing: ', folder);
|
|
44
|
-
try {
|
|
45
|
-
fs.rmdirSync(folder);
|
|
46
|
-
} catch (error) {
|
|
47
|
-
logger.error(error);
|
|
48
|
-
}
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
cleanEmptyFoldersRecursively('./');
|
|
53
|
-
break;
|
|
54
|
-
|
|
55
|
-
case 'build-ports': {
|
|
56
|
-
pbcopy(buildKindPorts(process.argv[3], process.argv[4]));
|
|
57
|
-
}
|
|
58
|
-
default:
|
|
59
|
-
break;
|
|
60
|
-
}
|
|
61
|
-
} catch (error) {
|
|
62
|
-
logger.error(error, error.stack);
|
|
63
|
-
}
|
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
|
|
3
|
-
# Exit immediately if a command exits with a non-zero status.
|
|
4
|
-
set -e
|
|
5
|
-
|
|
6
|
-
echo "Starting Underpost Kubernetes Node Setup for Production (Kubeadm/K3s Use Case)..."
|
|
7
|
-
|
|
8
|
-
# --- Disk Partition Resizing (Keep as is, seems functional) ---
|
|
9
|
-
echo "Expanding /dev/sda2 partition and resizing filesystem..."
|
|
10
|
-
|
|
11
|
-
# Check if parted is installed
|
|
12
|
-
if ! command -v parted &>/dev/null; then
|
|
13
|
-
echo "parted not found, installing..."
|
|
14
|
-
sudo dnf install -y parted
|
|
15
|
-
fi
|
|
16
|
-
|
|
17
|
-
# Get start sector of /dev/sda2
|
|
18
|
-
START_SECTOR=$(sudo parted /dev/sda -ms unit s print | awk -F: '/^2:/{print $2}' | sed 's/s//')
|
|
19
|
-
|
|
20
|
-
# Resize the partition
|
|
21
|
-
# Using 'sudo' for parted commands
|
|
22
|
-
sudo parted /dev/sda ---pretend-input-tty <<EOF
|
|
23
|
-
unit s
|
|
24
|
-
resizepart 2 100%
|
|
25
|
-
Yes
|
|
26
|
-
quit
|
|
27
|
-
EOF
|
|
28
|
-
|
|
29
|
-
# Resize the filesystem
|
|
30
|
-
sudo resize2fs /dev/sda2
|
|
31
|
-
|
|
32
|
-
echo "Disk and filesystem resized successfully."
|
|
33
|
-
|
|
34
|
-
# --- Essential System Package Installation ---
|
|
35
|
-
echo "Installing essential system packages..."
|
|
36
|
-
sudo dnf install -y tar bzip2 git epel-release
|
|
37
|
-
|
|
38
|
-
# Perform a system update to ensure all packages are up-to-date
|
|
39
|
-
sudo dnf -y update
|
|
40
|
-
|
|
41
|
-
# --- NVM and Node.js Installation ---
|
|
42
|
-
echo "Installing NVM and Node.js v24.10.0..."
|
|
43
|
-
curl -o- https://cdn.jsdelivr.net/gh/nvm-sh/nvm@v0.40.1/install.sh | bash
|
|
44
|
-
|
|
45
|
-
# Load nvm for the current session
|
|
46
|
-
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
|
|
47
|
-
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
|
|
48
|
-
|
|
49
|
-
nvm install 24.10.0
|
|
50
|
-
nvm use 24.10.0
|
|
51
|
-
|
|
52
|
-
echo "
|
|
53
|
-
██╗░░░██╗███╗░░██╗██████╗░███████╗██████╗░██████╗░░█████╗░░██████╗████████╗
|
|
54
|
-
██║░░░██║████╗░██║██╔══██╗██╔════╝██╔══██╗██╔══██╗██╔══██╗██╔════╝╚══██╔══╝
|
|
55
|
-
██║░░░██║██╔██╗██║██║░░██║█████╗░░██████╔╝██████╔╝██║░░██║╚█████╗░░░░██║░░░
|
|
56
|
-
██║░░░██║██║╚████║██║░░██║██╔══╝░░██╔══██╗██╔═══╝░██║░░██║░╚═══██╗░░░██║░░░
|
|
57
|
-
╚██████╔╝██║░╚███║██████╔╝███████╗██║░░██║██║░░░░░╚█████╔╝██████╔╝░░░██║░░░
|
|
58
|
-
░╚═════╝░╚═╝░░╚══╝╚═════╝░╚══════╝╚═╝░░╚═╝╚═╝░░░░░░╚════╝░╚═════╝░░░░╚═╝░░░
|
|
59
|
-
|
|
60
|
-
Installing underpost k8s node...
|
|
61
|
-
"
|
|
62
|
-
|
|
63
|
-
# Install underpost globally
|
|
64
|
-
npm install -g underpost
|
|
65
|
-
|
|
66
|
-
# Ensure underpost executable is in PATH and has execute permissions
|
|
67
|
-
# Adjusting this for global npm install which usually handles permissions
|
|
68
|
-
# If you still face issues, ensure /root/.nvm/versions/node/v24.10.0/bin is in your PATH
|
|
69
|
-
# For global installs, it's usually handled automatically.
|
|
70
|
-
# chmod +x /root/.nvm/versions/node/v24.10.0/bin/underpost # This might not be necessary for global npm installs
|
|
71
|
-
|
|
72
|
-
# --- Kernel Module for Bridge Filtering ---
|
|
73
|
-
# This is crucial for Kubernetes networking (CNI)
|
|
74
|
-
echo "Loading br_netfilter kernel module..."
|
|
75
|
-
sudo modprobe br_netfilter
|
|
76
|
-
|
|
77
|
-
# --- Initial Host Setup for Kubernetes Prerequisites ---
|
|
78
|
-
# This calls the initHost method in cluster.js to install Docker, Podman, Kind, Kubeadm, Helm.
|
|
79
|
-
echo "Running initial host setup for Kubernetes prerequisites..."
|
|
80
|
-
# Ensure the current directory is where 'underpost' expects its root, or use absolute paths.
|
|
81
|
-
# Assuming 'underpost root' correctly points to the base directory of your project.
|
|
82
|
-
cd "$(underpost root)/underpost"
|
|
83
|
-
underpost cluster --init-host
|
|
84
|
-
|
|
85
|
-
# --- Argument Parsing for Kubeadm/Kind/K3s/Worker ---
|
|
86
|
-
USE_KUBEADM=false
|
|
87
|
-
USE_KIND=false # Not the primary focus for this request, but keeping the logic
|
|
88
|
-
USE_K3S=false # New K3s option
|
|
89
|
-
USE_WORKER=false
|
|
90
|
-
|
|
91
|
-
for arg in "$@"; do
|
|
92
|
-
case "$arg" in
|
|
93
|
-
--kubeadm)
|
|
94
|
-
USE_KUBEADM=true
|
|
95
|
-
;;
|
|
96
|
-
--kind)
|
|
97
|
-
USE_KIND=true
|
|
98
|
-
;;
|
|
99
|
-
--k3s) # New K3s argument
|
|
100
|
-
USE_K3S=true
|
|
101
|
-
;;
|
|
102
|
-
--worker)
|
|
103
|
-
USE_WORKER=true
|
|
104
|
-
;;
|
|
105
|
-
esac
|
|
106
|
-
done
|
|
107
|
-
|
|
108
|
-
echo "USE_KUBEADM = $USE_KUBEADM"
|
|
109
|
-
echo "USE_KIND = $USE_KIND"
|
|
110
|
-
echo "USE_K3S = $USE_K3S" # Display K3s flag status
|
|
111
|
-
echo "USE_WORKER = $USE_WORKER"
|
|
112
|
-
|
|
113
|
-
# --- Kubernetes Cluster Initialization Logic ---
|
|
114
|
-
|
|
115
|
-
# Apply host configuration (SELinux, Containerd, Sysctl, and now firewalld disabling)
|
|
116
|
-
echo "Applying Kubernetes host configuration (SELinux, Containerd, Sysctl, Firewalld)..."
|
|
117
|
-
underpost cluster --config
|
|
118
|
-
|
|
119
|
-
if $USE_KUBEADM; then
|
|
120
|
-
if $USE_WORKER; then
|
|
121
|
-
echo "Running worker node setup for kubeadm..."
|
|
122
|
-
# For worker nodes, the 'underpost cluster --worker' command will handle joining
|
|
123
|
-
# the cluster. The join command itself needs to be provided from the control plane.
|
|
124
|
-
# This script assumes the join command will be executed separately or passed in.
|
|
125
|
-
# Example: underpost cluster --worker --join-command "kubeadm join ..."
|
|
126
|
-
# For now, this just runs the worker-specific config.
|
|
127
|
-
underpost cluster --worker
|
|
128
|
-
underpost cluster --chown
|
|
129
|
-
echo "Worker node setup initiated. You will need to manually join this worker to your control plane."
|
|
130
|
-
echo "On your control plane, run 'kubeadm token create --print-join-command' and execute the output here."
|
|
131
|
-
else
|
|
132
|
-
echo "Running control plane setup with kubeadm..."
|
|
133
|
-
# This will initialize the kubeadm control plane and install Calico
|
|
134
|
-
underpost cluster --kubeadm
|
|
135
|
-
echo "Kubeadm control plane initialized. Check cluster status with 'kubectl get nodes'."
|
|
136
|
-
fi
|
|
137
|
-
elif $USE_K3S; then # New K3s initialization block
|
|
138
|
-
if $USE_WORKER; then
|
|
139
|
-
echo "Running worker node setup for K3s..."
|
|
140
|
-
# For K3s worker nodes, the 'underpost cluster --worker' command will handle joining
|
|
141
|
-
# the cluster. The K3s join command (k3s agent --server ...) needs to be provided.
|
|
142
|
-
underpost cluster --worker --k3s
|
|
143
|
-
underpost cluster --chown
|
|
144
|
-
echo "K3s Worker node setup initiated. You will need to manually join this worker to your control plane."
|
|
145
|
-
echo "On your K3s control plane, get the K3S_TOKEN from /var/lib/rancher/k3s/server/node-token"
|
|
146
|
-
echo "and the K3S_URL (e.g., https://<control-plane-ip>:6443)."
|
|
147
|
-
echo "Then execute: K3S_URL=${K3S_URL} K3S_TOKEN=${K3S_TOKEN} curl -sfL https://get.k3s.io | sh -"
|
|
148
|
-
else
|
|
149
|
-
echo "Running control plane setup with K3s..."
|
|
150
|
-
underpost cluster --k3s
|
|
151
|
-
echo "K3s control plane initialized. Check cluster status with 'kubectl get nodes'."
|
|
152
|
-
fi
|
|
153
|
-
elif $USE_KIND; then
|
|
154
|
-
echo "Running control node with kind..."
|
|
155
|
-
underpost cluster
|
|
156
|
-
echo "Kind cluster initialized. Check cluster status with 'kubectl get nodes'."
|
|
157
|
-
else
|
|
158
|
-
echo "No specific cluster role (--kubeadm, --kind, --k3s, --worker) specified. Please provide one."
|
|
159
|
-
exit 1
|
|
160
|
-
fi
|
|
161
|
-
|
|
162
|
-
echo "Underpost Kubernetes Node Setup completed."
|
|
163
|
-
echo "Remember to verify cluster health with 'kubectl get nodes' and 'kubectl get pods --all-namespaces'."
|