underpost 2.89.45 → 2.90.1
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.production +2 -0
- package/README.md +3 -2
- package/bin/build.js +4 -0
- package/cli.md +73 -42
- package/manifests/deployment/dd-default-development/deployment.yaml +2 -2
- package/manifests/deployment/dd-test-development/deployment.yaml +8 -24
- package/manifests/lxd/underpost-setup.sh +1 -1
- package/package.json +1 -1
- package/scripts/nvim.sh +1 -1
- package/src/cli/cluster.js +7 -21
- package/src/cli/db.js +34 -10
- package/src/cli/deploy.js +280 -116
- package/src/cli/index.js +27 -2
- package/src/cli/monitor.js +1 -1
- package/src/cli/run.js +216 -12
- package/src/cli/static.js +84 -0
- package/src/client/components/core/CalendarCore.js +1 -7
- package/src/client/components/core/Modal.js +2 -2
- package/src/client/components/core/Panel.js +1 -1
- package/src/client/components/core/PanelForm.js +1 -5
- package/src/client/components/default/MenuDefault.js +5 -30
- package/src/index.js +10 -1
- package/src/server/client-build.js +9 -33
- package/src/server/json-schema.js +0 -77
package/.env.production
CHANGED
package/README.md
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
|
|
19
19
|
<!-- badges -->
|
|
20
20
|
|
|
21
|
-
[](https://github.com/underpostnet/engine/actions/workflows/docker-image.yml) [](https://github.com/underpostnet/engine/actions/workflows/coverall.ci.yml) [](https://www.npmjs.com/package/underpost) [](https://github.com/underpostnet/engine/actions/workflows/docker-image.yml) [](https://github.com/underpostnet/engine/actions/workflows/coverall.ci.yml) [](https://www.npmjs.com/package/underpost) [](https://socket.dev/npm/package/underpost/overview/2.90.1) [](https://coveralls.io/github/underpostnet/engine?branch=master) [](https://www.npmjs.org/package/underpost) [](https://www.npmjs.com/package/underpost)
|
|
22
22
|
|
|
23
23
|
<!-- end-badges -->
|
|
24
24
|
|
|
@@ -66,7 +66,7 @@ Run dev client server
|
|
|
66
66
|
npm run dev
|
|
67
67
|
```
|
|
68
68
|
<!-- -->
|
|
69
|
-
## underpost ci/cd cli v2.
|
|
69
|
+
## underpost ci/cd cli v2.90.1
|
|
70
70
|
|
|
71
71
|
### Usage: `underpost [options] [command]`
|
|
72
72
|
```
|
|
@@ -82,6 +82,7 @@ Commands:
|
|
|
82
82
|
cmt [options] [path] [commit-type] [module-tag] [message] Manages commits to a GitHub repository, supporting various commit types and options.
|
|
83
83
|
push [options] <path> <uri> Pushes committed changes from a local repository to a remote GitHub repository.
|
|
84
84
|
env [deploy-id] [env] [subConf] Sets environment variables and configurations related to a specific deployment ID.
|
|
85
|
+
static [options] Manages static build of page, bundles, and documentation.
|
|
85
86
|
config [options] <operator> [key] [value] Manages Underpost configurations using various operators.
|
|
86
87
|
root Displays the root path of the npm installation.
|
|
87
88
|
ip [options] Displays the current public machine IP addresses.
|
package/bin/build.js
CHANGED
|
@@ -172,6 +172,10 @@ const { DefaultConf } = await import(`../conf.${confName}.js`);
|
|
|
172
172
|
fs.copyFileSync(`./src/api/object-layer/README.md`, `${basePath}/README.md`);
|
|
173
173
|
fs.copySync(`./hardhat`, `${basePath}/hardhat`);
|
|
174
174
|
fs.copySync(`./hardhat/white-paper.md`, `${basePath}/white-paper.md`);
|
|
175
|
+
fs.copySync(
|
|
176
|
+
`./src/client/ssr/pages/CyberiaServerMetrics.js`,
|
|
177
|
+
`${basePath}/src/client/ssr/pages/CyberiaServerMetrics.js`,
|
|
178
|
+
);
|
|
175
179
|
default:
|
|
176
180
|
break;
|
|
177
181
|
}
|
package/cli.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
## underpost ci/cd cli v2.
|
|
1
|
+
## underpost ci/cd cli v2.90.1
|
|
2
2
|
|
|
3
3
|
### Usage: `underpost [options] [command]`
|
|
4
4
|
```
|
|
@@ -14,6 +14,7 @@ Commands:
|
|
|
14
14
|
cmt [options] [path] [commit-type] [module-tag] [message] Manages commits to a GitHub repository, supporting various commit types and options.
|
|
15
15
|
push [options] <path> <uri> Pushes committed changes from a local repository to a remote GitHub repository.
|
|
16
16
|
env [deploy-id] [env] [subConf] Sets environment variables and configurations related to a specific deployment ID.
|
|
17
|
+
static [options] Manages static build of page, bundles, and documentation.
|
|
17
18
|
config [options] <operator> [key] [value] Manages Underpost configurations using various operators.
|
|
18
19
|
root Displays the root path of the npm installation.
|
|
19
20
|
ip [options] Displays the current public machine IP addresses.
|
|
@@ -194,6 +195,33 @@ Options:
|
|
|
194
195
|
```
|
|
195
196
|
|
|
196
197
|
|
|
198
|
+
### `static` :
|
|
199
|
+
```
|
|
200
|
+
Usage: underpost static [options]
|
|
201
|
+
|
|
202
|
+
Manages static build of page, bundles, and documentation.
|
|
203
|
+
|
|
204
|
+
Options:
|
|
205
|
+
--page <ssr-component-path> Build custom static pages.
|
|
206
|
+
--title <title> Sets a custom title for the static page.
|
|
207
|
+
--output-path <output-path> Sets the output path for the generated static
|
|
208
|
+
page.
|
|
209
|
+
--deploy-id <deploy-id> Build static assets for a specific deployment
|
|
210
|
+
ID.
|
|
211
|
+
--build Triggers the static build process for the
|
|
212
|
+
specified deployment ID.
|
|
213
|
+
--build-host <build-host> Sets a custom build host for static documents or
|
|
214
|
+
assets.
|
|
215
|
+
--build-path <build-path> Sets a custom build path for static documents or
|
|
216
|
+
assets.
|
|
217
|
+
--env <env> Sets the environment for the static build (e.g.,
|
|
218
|
+
"development", "production").
|
|
219
|
+
--dev Sets the development cli context
|
|
220
|
+
-h, --help display help for command
|
|
221
|
+
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
|
|
197
225
|
### `config` :
|
|
198
226
|
```
|
|
199
227
|
Usage: underpost config [options] <operator> [key] [value]
|
|
@@ -293,10 +321,6 @@ Options:
|
|
|
293
321
|
cluster configuration.
|
|
294
322
|
--list-pods Displays detailed information about all
|
|
295
323
|
pods.
|
|
296
|
-
--info-capacity Displays the current total machine
|
|
297
|
-
capacity information.
|
|
298
|
-
--info-capacity-pod Displays the current machine capacity
|
|
299
|
-
information per pod.
|
|
300
324
|
--pull-image Sets an optional associated image to
|
|
301
325
|
pull during initialization.
|
|
302
326
|
--init-host Installs necessary Kubernetes node CLI
|
|
@@ -668,45 +692,52 @@ Options:
|
|
|
668
692
|
Runs a script from the specified path.
|
|
669
693
|
|
|
670
694
|
Arguments:
|
|
671
|
-
runner-id
|
|
672
|
-
path
|
|
695
|
+
runner-id The runner ID to run. Options: spark-template, rmi, kill, secret, underpost-config, gpu-env, tf-gpu-test, dev-cluster, metadata, svc-ls, svc-rm, ssh-cluster-info, dev-hosts-expose, dev-hosts-restore, cluster-build, template-deploy, template-deploy-image, clean, pull, release-deploy, ssh-deploy, ide, sync, tz, cron, get-proxy, instance-promote, instance, ls-deployments, ls-images, host-update, dd-container, ip-info, monitor, db-client, git-conf, promote, metrics, cluster, deploy, dev, service, sh, log, release-cmt, sync-replica, tf-vae-test, deploy-job.
|
|
696
|
+
path The absolute or relative directory path where the script is located.
|
|
673
697
|
|
|
674
698
|
Options:
|
|
675
|
-
--command <command-array>
|
|
676
|
-
--args <args-array>
|
|
677
|
-
--dev
|
|
678
|
-
--build
|
|
679
|
-
--replicas <replicas>
|
|
680
|
-
--pod-name <pod-name>
|
|
681
|
-
--node-name <node-name>
|
|
682
|
-
--port <port>
|
|
683
|
-
--etc-hosts
|
|
684
|
-
--volume-host-path <volume-host-path>
|
|
685
|
-
--volume-mount-path <volume-mount-path>
|
|
686
|
-
--volume-type <volume-type>
|
|
687
|
-
--image-name <image-name>
|
|
688
|
-
--container-name <container-name>
|
|
689
|
-
--namespace <namespace>
|
|
690
|
-
--tty
|
|
691
|
-
--stdin
|
|
692
|
-
--restart-policy <policy>
|
|
693
|
-
--runtime-class-name <name>
|
|
694
|
-
--image-pull-policy <policy>
|
|
695
|
-
--api-version <version>
|
|
696
|
-
--labels <labels>
|
|
697
|
-
--claim-name <name>
|
|
698
|
-
--kind <kind-type>
|
|
699
|
-
--kubeadm
|
|
700
|
-
--k3s
|
|
701
|
-
--force
|
|
702
|
-
--tls
|
|
703
|
-
--reset
|
|
704
|
-
--terminal
|
|
705
|
-
--dev-proxy-port-offset <port-offset>
|
|
706
|
-
--host-network
|
|
707
|
-
--
|
|
708
|
-
--
|
|
709
|
-
-
|
|
699
|
+
--command <command-array> Array of commands to run.
|
|
700
|
+
--args <args-array> Array of arguments to pass to the command.
|
|
701
|
+
--dev Sets the development context environment for the script.
|
|
702
|
+
--build Set builder context runner
|
|
703
|
+
--replicas <replicas> Sets a custom number of replicas for deployment.
|
|
704
|
+
--pod-name <pod-name> Optional: Specifies the pod name for execution.
|
|
705
|
+
--node-name <node-name> Optional: Specifies the node name for execution.
|
|
706
|
+
--port <port> Optional: Specifies the port for execution.
|
|
707
|
+
--etc-hosts Enables etc-hosts context for the runner execution.
|
|
708
|
+
--volume-host-path <volume-host-path> Optional: Specifies the volume host path for test execution.
|
|
709
|
+
--volume-mount-path <volume-mount-path> Optional: Specifies the volume mount path for test execution.
|
|
710
|
+
--volume-type <volume-type> Optional: Specifies the volume type for test execution.
|
|
711
|
+
--image-name <image-name> Optional: Specifies the image name for test execution.
|
|
712
|
+
--container-name <container-name> Optional: Specifies the container name for test execution.
|
|
713
|
+
--namespace <namespace> Optional: Specifies the namespace for test execution.
|
|
714
|
+
--tty Enables TTY for the container in deploy-job.
|
|
715
|
+
--stdin Keeps STDIN open for the container in deploy-job.
|
|
716
|
+
--restart-policy <policy> Sets the restart policy for the job in deploy-job.
|
|
717
|
+
--runtime-class-name <name> Sets the runtime class name for the job in deploy-job.
|
|
718
|
+
--image-pull-policy <policy> Sets the image pull policy for the job in deploy-job.
|
|
719
|
+
--api-version <version> Sets the API version for the job manifest in deploy-job.
|
|
720
|
+
--labels <labels> Optional: Specifies a comma-separated list of key-value pairs for labels (e.g., "app=my-app,env=prod").
|
|
721
|
+
--claim-name <name> Optional: Specifies the claim name for volume mounting in deploy-job.
|
|
722
|
+
--kind <kind-type> Specifies the kind of Kubernetes resource (e.g., Job, Deployment) for deploy-job.
|
|
723
|
+
--kubeadm Flag to indicate Kubeadm cluster type context
|
|
724
|
+
--k3s Flag to indicate K3s cluster type context
|
|
725
|
+
--force Forces operation, overriding any warnings or conflicts.
|
|
726
|
+
--tls Enables TLS for the runner execution.
|
|
727
|
+
--reset Resets the runner state before execution.
|
|
728
|
+
--terminal Enables terminal mode for interactive script execution.
|
|
729
|
+
--dev-proxy-port-offset <port-offset> Sets a custom port offset for development proxy.
|
|
730
|
+
--host-network Enables host network mode for the runner execution.
|
|
731
|
+
--requests-memory <requests-memory> Requests memory limit for the runner execution.
|
|
732
|
+
--requests-cpu <requests-cpu> Requests CPU limit for the runner execution.
|
|
733
|
+
--limits-memory <limits-memory> Sets memory limit for the runner execution.
|
|
734
|
+
--limits-cpu <limits-cpu> Sets CPU limit for the runner execution.
|
|
735
|
+
--resource-template-id <resource-template-id > Specifies a resource template ID for the runner execution.
|
|
736
|
+
--etcHosts Enables /etc/hosts management for the runner execution.
|
|
737
|
+
--expose Enables service exposure for the runner execution.
|
|
738
|
+
--conf-server-path <conf-server-path> Sets a custom configuration server path.
|
|
739
|
+
--underpost-root <underpost-root> Sets a custom Underpost root path.
|
|
740
|
+
-h, --help display help for command
|
|
710
741
|
|
|
711
742
|
```
|
|
712
743
|
|
|
@@ -17,7 +17,7 @@ spec:
|
|
|
17
17
|
spec:
|
|
18
18
|
containers:
|
|
19
19
|
- name: dd-default-development-blue
|
|
20
|
-
image: localhost/rockylinux9-underpost:v2.
|
|
20
|
+
image: localhost/rockylinux9-underpost:v2.90.1
|
|
21
21
|
# resources:
|
|
22
22
|
# requests:
|
|
23
23
|
# memory: "124Ki"
|
|
@@ -100,7 +100,7 @@ spec:
|
|
|
100
100
|
spec:
|
|
101
101
|
containers:
|
|
102
102
|
- name: dd-default-development-green
|
|
103
|
-
image: localhost/rockylinux9-underpost:v2.
|
|
103
|
+
image: localhost/rockylinux9-underpost:v2.90.1
|
|
104
104
|
# resources:
|
|
105
105
|
# requests:
|
|
106
106
|
# memory: "124Ki"
|
|
@@ -18,22 +18,14 @@ spec:
|
|
|
18
18
|
spec:
|
|
19
19
|
containers:
|
|
20
20
|
- name: dd-test-development-blue
|
|
21
|
-
image: localhost/rockylinux9-underpost:v2.
|
|
22
|
-
|
|
23
|
-
# requests:
|
|
24
|
-
# memory: "96294Ki"
|
|
25
|
-
# cpu: "75m"
|
|
26
|
-
# limits:
|
|
27
|
-
# memory: "1540709Ki"
|
|
28
|
-
# cpu: "1200m"
|
|
21
|
+
image: localhost/rockylinux9-underpost:v2.90.1
|
|
22
|
+
|
|
29
23
|
command:
|
|
30
24
|
- /bin/sh
|
|
31
25
|
- -c
|
|
32
26
|
- >
|
|
33
|
-
npm install -g npm@11.2.0 &&
|
|
34
|
-
|
|
35
|
-
underpost secret underpost --create-from-file /etc/config/.env.development &&
|
|
36
|
-
underpost start --build --run dd-test development
|
|
27
|
+
npm install -g npm@11.2.0 && npm install -g underpost && underpost secret underpost --create-from-file /etc/config/.env.development && underpost start --build --run dd-test development
|
|
28
|
+
|
|
37
29
|
|
|
38
30
|
volumeMounts:
|
|
39
31
|
- name: config-volume-dd-test-development-blue
|
|
@@ -111,22 +103,14 @@ spec:
|
|
|
111
103
|
spec:
|
|
112
104
|
containers:
|
|
113
105
|
- name: dd-test-development-green
|
|
114
|
-
image: localhost/rockylinux9-underpost:v2.
|
|
115
|
-
|
|
116
|
-
# requests:
|
|
117
|
-
# memory: "96294Ki"
|
|
118
|
-
# cpu: "75m"
|
|
119
|
-
# limits:
|
|
120
|
-
# memory: "1540709Ki"
|
|
121
|
-
# cpu: "1200m"
|
|
106
|
+
image: localhost/rockylinux9-underpost:v2.90.1
|
|
107
|
+
|
|
122
108
|
command:
|
|
123
109
|
- /bin/sh
|
|
124
110
|
- -c
|
|
125
111
|
- >
|
|
126
|
-
npm install -g npm@11.2.0 &&
|
|
127
|
-
|
|
128
|
-
underpost secret underpost --create-from-file /etc/config/.env.development &&
|
|
129
|
-
underpost start --build --run dd-test development
|
|
112
|
+
npm install -g npm@11.2.0 && npm install -g underpost && underpost secret underpost --create-from-file /etc/config/.env.development && underpost start --build --run dd-test development
|
|
113
|
+
|
|
130
114
|
|
|
131
115
|
volumeMounts:
|
|
132
116
|
- name: config-volume-dd-test-development-green
|
|
@@ -40,7 +40,7 @@ sudo dnf -y update
|
|
|
40
40
|
|
|
41
41
|
# --- NVM and Node.js Installation ---
|
|
42
42
|
echo "Installing NVM and Node.js v24.10.0..."
|
|
43
|
-
curl -o- https://
|
|
43
|
+
curl -o- https://cdn.jsdelivr.net/gh/nvm-sh/nvm@v0.40.1/install.sh | bash
|
|
44
44
|
|
|
45
45
|
# Load nvm for the current session
|
|
46
46
|
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
|
package/package.json
CHANGED
package/scripts/nvim.sh
CHANGED
|
@@ -12,7 +12,7 @@ mkdir -p ~/.local/share/nvim/site/autoload
|
|
|
12
12
|
|
|
13
13
|
# Install vim-plug for Neovim
|
|
14
14
|
curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs \
|
|
15
|
-
|
|
15
|
+
https://cdn.jsdelivr.net/gh/junegunn/vim-plug@master/plug.vim
|
|
16
16
|
|
|
17
17
|
# Create an init.vim with nvim-tree.lua + web-devicons + gruvbox (theme)
|
|
18
18
|
cat > ~/.config/nvim/init.vim <<'EOF'
|
package/src/cli/cluster.js
CHANGED
|
@@ -117,10 +117,6 @@ class UnderpostCluster {
|
|
|
117
117
|
const npmRoot = getNpmRootPath();
|
|
118
118
|
const underpostRoot = options?.dev === true ? '.' : `${npmRoot}/underpost`;
|
|
119
119
|
|
|
120
|
-
// Information gathering options
|
|
121
|
-
if (options.infoCapacityPod === true) return logger.info('', UnderpostDeploy.API.resourcesFactory());
|
|
122
|
-
if (options.infoCapacity === true)
|
|
123
|
-
return logger.info('', UnderpostCluster.API.getResourcesCapacity(options.kubeadm || options.k3s)); // Adjust for k3s
|
|
124
120
|
if (options.listPods === true) return console.table(UnderpostDeploy.API.get(podName ?? undefined));
|
|
125
121
|
// Set default namespace if not specified
|
|
126
122
|
if (!options.namespace) options.namespace = 'default';
|
|
@@ -235,10 +231,10 @@ class UnderpostCluster {
|
|
|
235
231
|
// Install Calico CNI
|
|
236
232
|
logger.info('Installing Calico CNI...');
|
|
237
233
|
shellExec(
|
|
238
|
-
`sudo kubectl create -f https://
|
|
234
|
+
`sudo kubectl create -f https://cdn.jsdelivr.net/gh/projectcalico/calico@v3.29.3/manifests/tigera-operator.yaml`,
|
|
239
235
|
);
|
|
240
236
|
shellExec(
|
|
241
|
-
`kubectl create -f https://
|
|
237
|
+
`kubectl create -f https://cdn.jsdelivr.net/gh/projectcalico/calico@v3.29.3/manifests/custom-resources.yaml`,
|
|
242
238
|
);
|
|
243
239
|
shellExec(`sudo kubectl apply -f ${underpostRoot}/manifests/kubeadm-calico-config.yaml`);
|
|
244
240
|
|
|
@@ -248,7 +244,7 @@ class UnderpostCluster {
|
|
|
248
244
|
// Install local-path-provisioner for dynamic PVCs (optional but recommended)
|
|
249
245
|
logger.info('Installing local-path-provisioner...');
|
|
250
246
|
shellExec(
|
|
251
|
-
`kubectl apply -f https://
|
|
247
|
+
`kubectl apply -f https://cdn.jsdelivr.net/gh/rancher/local-path-provisioner@master/deploy/local-path-storage.yaml`,
|
|
252
248
|
);
|
|
253
249
|
} else {
|
|
254
250
|
// Kind cluster initialization (if not using kubeadm or k3s)
|
|
@@ -314,18 +310,6 @@ EOF
|
|
|
314
310
|
${yaml}
|
|
315
311
|
EOF
|
|
316
312
|
`);
|
|
317
|
-
|
|
318
|
-
// https://grafana.com/docs/grafana-cloud/monitor-infrastructure/kubernetes-monitoring/configuration/config-other-methods/prometheus/prometheus-operator/
|
|
319
|
-
// shellExec(
|
|
320
|
-
// `kubectl create -f https://raw.githubusercontent.com/prometheus-operator/prometheus-operator/master/bundle.yaml`,
|
|
321
|
-
// );
|
|
322
|
-
// shellExec(`kubectl apply -f ${underpostRoot}/manifests/prometheus/prometheus-cr.yaml`);
|
|
323
|
-
// shellExec(`kubectl rollout status sts prometheus-prometheus -n default`);
|
|
324
|
-
// shellExec(`kubectl apply -f ${underpostRoot}/manifests/prometheus/prometheus-server.yaml`);
|
|
325
|
-
// shellExec(`helm repo add prometheus-community https://prometheus-community.github.io/helm-charts`);
|
|
326
|
-
// shellExec(`helm repo update`);
|
|
327
|
-
// shellExec(`helm install prometheus prometheus-community/prometheus`);
|
|
328
|
-
// shellExec(`kubectl rollout status deployment prometheus-server -n default`);
|
|
329
313
|
}
|
|
330
314
|
|
|
331
315
|
if (options.full === true || options.valkey === true) {
|
|
@@ -455,7 +439,9 @@ EOF
|
|
|
455
439
|
}
|
|
456
440
|
|
|
457
441
|
if (options.full === true || options.contour === true) {
|
|
458
|
-
shellExec(
|
|
442
|
+
shellExec(
|
|
443
|
+
`kubectl apply -f https://cdn.jsdelivr.net/gh/projectcontour/contour@release-1.33/examples/render/contour.yaml`,
|
|
444
|
+
);
|
|
459
445
|
if (options.kubeadm === true) {
|
|
460
446
|
// Envoy service might need NodePort for kubeadm
|
|
461
447
|
shellExec(
|
|
@@ -786,7 +772,7 @@ EOF`);
|
|
|
786
772
|
shellExec(`sudo yum install -y kubelet kubeadm kubectl --disableexcludes=kubernetes`);
|
|
787
773
|
|
|
788
774
|
// Install Helm
|
|
789
|
-
shellExec(`curl -fsSL -o get_helm.sh https://
|
|
775
|
+
shellExec(`curl -fsSL -o get_helm.sh https://cdn.jsdelivr.net/gh/helm/helm@main/scripts/get-helm-3`);
|
|
790
776
|
shellExec(`chmod 700 get_helm.sh`);
|
|
791
777
|
shellExec(`./get_helm.sh`);
|
|
792
778
|
shellExec(`chmod +x /usr/local/bin/helm`);
|
package/src/cli/db.js
CHANGED
|
@@ -147,18 +147,20 @@ class UnderpostDB {
|
|
|
147
147
|
for (const podNameData of [podNames[0]]) {
|
|
148
148
|
const podName = podNameData.NAME;
|
|
149
149
|
if (options.import === true) {
|
|
150
|
-
shellExec(`sudo kubectl exec -i ${podName} -- sh -c "rm -rf /${dbName}.sql"`);
|
|
150
|
+
shellExec(`sudo kubectl exec -n ${nameSpace} -i ${podName} -- sh -c "rm -rf /${dbName}.sql"`);
|
|
151
151
|
shellExec(`sudo kubectl cp ${_toSqlPath} ${nameSpace}/${podName}:/${dbName}.sql`);
|
|
152
152
|
const cmd = `mariadb -u ${user} -p${password} ${dbName} < /${dbName}.sql`;
|
|
153
153
|
shellExec(
|
|
154
|
-
`kubectl exec -i ${podName} -- ${serviceName} -p${password} -e 'CREATE DATABASE ${dbName};'`,
|
|
154
|
+
`kubectl exec -n ${nameSpace} -i ${podName} -- ${serviceName} -p${password} -e 'CREATE DATABASE ${dbName};'`,
|
|
155
155
|
);
|
|
156
|
-
shellExec(`sudo kubectl exec -i ${podName} -- sh -c "${cmd}"`);
|
|
156
|
+
shellExec(`sudo kubectl exec -n ${nameSpace} -i ${podName} -- sh -c "${cmd}"`);
|
|
157
157
|
}
|
|
158
158
|
if (options.export === true) {
|
|
159
|
-
shellExec(
|
|
159
|
+
shellExec(
|
|
160
|
+
`sudo kubectl exec -n ${nameSpace} -i ${podName} -- sh -c "rm -rf ${sqlContainerPath}"`,
|
|
161
|
+
);
|
|
160
162
|
const cmd = `mariadb-dump --user=${user} --password=${password} --lock-tables ${dbName} > ${sqlContainerPath}`;
|
|
161
|
-
shellExec(`sudo kubectl exec -i ${podName} -- sh -c "${cmd}"`);
|
|
163
|
+
shellExec(`sudo kubectl exec -n ${nameSpace} -i ${podName} -- sh -c "${cmd}"`);
|
|
162
164
|
shellExec(
|
|
163
165
|
`sudo kubectl cp ${nameSpace}/${podName}:${sqlContainerPath} ${
|
|
164
166
|
options.outPath ? options.outPath : _toNewSqlPath
|
|
@@ -179,7 +181,7 @@ class UnderpostDB {
|
|
|
179
181
|
// `mongodb-0`;
|
|
180
182
|
for (const podNameData of [podNames[0]]) {
|
|
181
183
|
const podName = podNameData.NAME;
|
|
182
|
-
shellExec(`sudo kubectl exec -i ${podName} -- sh -c "rm -rf /${dbName}"`);
|
|
184
|
+
shellExec(`sudo kubectl exec -n ${nameSpace} -i ${podName} -- sh -c "rm -rf /${dbName}"`);
|
|
183
185
|
shellExec(
|
|
184
186
|
`sudo kubectl cp ${
|
|
185
187
|
options.outPath ? options.outPath : _toBsonPath
|
|
@@ -188,7 +190,7 @@ class UnderpostDB {
|
|
|
188
190
|
const cmd = `mongorestore -d ${dbName} /${dbName}${options.drop ? ' --drop' : ''}${
|
|
189
191
|
options.preserveUUID ? ' --preserveUUID' : ''
|
|
190
192
|
}`;
|
|
191
|
-
shellExec(`sudo kubectl exec -i ${podName} -- sh -c "${cmd}"`);
|
|
193
|
+
shellExec(`sudo kubectl exec -n ${nameSpace} -i ${podName} -- sh -c "${cmd}"`);
|
|
192
194
|
}
|
|
193
195
|
}
|
|
194
196
|
if (options.export === true) {
|
|
@@ -198,13 +200,16 @@ class UnderpostDB {
|
|
|
198
200
|
: UnderpostDeploy.API.get('mongo'); // `backup-access`;
|
|
199
201
|
for (const podNameData of [podNames[0]]) {
|
|
200
202
|
const podName = podNameData.NAME;
|
|
201
|
-
shellExec(`sudo kubectl exec -i ${podName} -- sh -c "rm -rf /${dbName}"`);
|
|
203
|
+
shellExec(`sudo kubectl exec -n ${nameSpace} -i ${podName} -- sh -c "rm -rf /${dbName}"`);
|
|
202
204
|
if (options.collections)
|
|
203
205
|
for (const collection of options.collections.split(','))
|
|
204
206
|
shellExec(
|
|
205
|
-
`sudo kubectl exec -i ${podName} -- sh -c "mongodump -d ${dbName} --collection ${collection} -o /"`,
|
|
207
|
+
`sudo kubectl exec -n ${nameSpace} -i ${podName} -- sh -c "mongodump -d ${dbName} --collection ${collection} -o /"`,
|
|
206
208
|
);
|
|
207
|
-
else
|
|
209
|
+
else
|
|
210
|
+
shellExec(
|
|
211
|
+
`sudo kubectl exec -n ${nameSpace} -i ${podName} -- sh -c "mongodump -d ${dbName} -o /"`,
|
|
212
|
+
);
|
|
208
213
|
shellExec(
|
|
209
214
|
`sudo kubectl cp ${nameSpace}/${podName}:/${dbName} ${
|
|
210
215
|
options.outPath ? options.outPath : _toNewBsonPath
|
|
@@ -311,6 +316,25 @@ class UnderpostDB {
|
|
|
311
316
|
}
|
|
312
317
|
}
|
|
313
318
|
}
|
|
319
|
+
if (fs.existsSync(`./engine-private/conf/${deployId}/conf.instances.json`)) {
|
|
320
|
+
const confInstances = JSON.parse(
|
|
321
|
+
fs.readFileSync(`./engine-private/conf/${deployId}/conf.instances.json`, 'utf8'),
|
|
322
|
+
);
|
|
323
|
+
for (const instance of confInstances) {
|
|
324
|
+
const { id, host, path, fromPort, metadata } = instance;
|
|
325
|
+
const { runtime } = metadata;
|
|
326
|
+
const body = {
|
|
327
|
+
deployId,
|
|
328
|
+
host,
|
|
329
|
+
path,
|
|
330
|
+
port: fromPort,
|
|
331
|
+
client: id,
|
|
332
|
+
runtime,
|
|
333
|
+
};
|
|
334
|
+
logger.info('Instance save', body);
|
|
335
|
+
await new Instance(body).save();
|
|
336
|
+
}
|
|
337
|
+
}
|
|
314
338
|
}
|
|
315
339
|
} catch (error) {
|
|
316
340
|
logger.error(error, error.stack);
|