@underpostnet/underpost 2.98.3 → 2.99.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.
@@ -7,11 +7,9 @@
7
7
  import { getNpmRootPath } from '../server/conf.js';
8
8
  import { loggerFactory } from '../server/logger.js';
9
9
  import { shellExec } from '../server/process.js';
10
- import UnderpostBaremetal from './baremetal.js';
11
- import UnderpostDeploy from './deploy.js';
12
- import UnderpostTest from './test.js';
13
10
  import os from 'os';
14
11
  import fs from 'fs-extra';
12
+ import Underpost from '../index.js';
15
13
 
16
14
  const logger = loggerFactory(import.meta);
17
15
 
@@ -103,21 +101,21 @@ class UnderpostCluster {
103
101
  },
104
102
  ) {
105
103
  // Handles initial host setup (installing docker, podman, kind, kubeadm, helm)
106
- if (options.initHost === true) return UnderpostCluster.API.initHost();
104
+ if (options.initHost === true) return Underpost.cluster.initHost();
107
105
 
108
106
  // Handles initial host setup (installing docker, podman, kind, kubeadm, helm)
109
- if (options.uninstallHost === true) return UnderpostCluster.API.uninstallHost();
107
+ if (options.uninstallHost === true) return Underpost.cluster.uninstallHost();
110
108
 
111
109
  // Applies general host configuration (SELinux, containerd, sysctl)
112
- if (options.config === true) return UnderpostCluster.API.config();
110
+ if (options.config === true) return Underpost.cluster.config();
113
111
 
114
112
  // Sets up kubectl configuration for the current user
115
- if (options.chown === true) return UnderpostCluster.API.chown();
113
+ if (options.chown === true) return Underpost.cluster.chown();
116
114
 
117
115
  const npmRoot = getNpmRootPath();
118
116
  const underpostRoot = options?.dev === true ? '.' : `${npmRoot}/underpost`;
119
117
 
120
- if (options.listPods === true) return console.table(UnderpostDeploy.API.get(podName ?? undefined));
118
+ if (options.listPods === true) return console.table(Underpost.deploy.get(podName ?? undefined));
121
119
  // Set default namespace if not specified
122
120
  if (!options.namespace) options.namespace = 'default';
123
121
 
@@ -143,22 +141,22 @@ class UnderpostCluster {
143
141
 
144
142
  // Reset Kubernetes cluster components (Kind/Kubeadm/K3s) and container runtimes
145
143
  if (options.reset === true)
146
- return await UnderpostCluster.API.safeReset({
144
+ return await Underpost.cluster.safeReset({
147
145
  underpostRoot,
148
146
  removeVolumeHostPaths: options.removeVolumeHostPaths,
149
147
  });
150
148
 
151
149
  // Check if a cluster (Kind, Kubeadm, or K3s) is already initialized
152
- const alreadyKubeadmCluster = UnderpostDeploy.API.get('calico-kube-controllers')[0];
153
- const alreadyKindCluster = UnderpostDeploy.API.get('kube-apiserver-kind-control-plane')[0];
150
+ const alreadyKubeadmCluster = Underpost.deploy.get('calico-kube-controllers')[0];
151
+ const alreadyKindCluster = Underpost.deploy.get('kube-apiserver-kind-control-plane')[0];
154
152
  // K3s pods often contain 'svclb-traefik' in the kube-system namespace
155
- const alreadyK3sCluster = UnderpostDeploy.API.get('svclb-traefik')[0];
153
+ const alreadyK3sCluster = Underpost.deploy.get('svclb-traefik')[0];
156
154
 
157
155
  // --- Kubeadm/Kind/K3s Cluster Initialization ---
158
156
  // This block handles the initial setup of the Kubernetes cluster (control plane or worker).
159
157
  // It prevents re-initialization if a cluster is already detected.
160
158
  if (!options.worker && !alreadyKubeadmCluster && !alreadyKindCluster && !alreadyK3sCluster) {
161
- UnderpostCluster.API.config();
159
+ Underpost.cluster.config();
162
160
  if (options.k3s === true) {
163
161
  logger.info('Initializing K3s control plane...');
164
162
  // Install K3s
@@ -173,7 +171,7 @@ class UnderpostCluster {
173
171
 
174
172
  // Configure kubectl for the current user for K3s *before* checking readiness
175
173
  // This ensures kubectl can find the K3s kubeconfig immediately after K3s installation.
176
- UnderpostCluster.API.chown('k3s');
174
+ Underpost.cluster.chown('k3s');
177
175
 
178
176
  // Wait for K3s to be ready
179
177
  logger.info('Waiting for K3s to be ready...');
@@ -226,7 +224,7 @@ class UnderpostCluster {
226
224
  `sudo kubeadm init --pod-network-cidr=${podNetworkCidr} --control-plane-endpoint="${controlPlaneEndpoint}"`,
227
225
  );
228
226
  // Configure kubectl for the current user
229
- UnderpostCluster.API.chown('kubeadm'); // Pass 'kubeadm' to chown
227
+ Underpost.cluster.chown('kubeadm'); // Pass 'kubeadm' to chown
230
228
 
231
229
  // Install Calico CNI
232
230
  logger.info('Installing Calico CNI...');
@@ -254,7 +252,7 @@ class UnderpostCluster {
254
252
  options?.dev === true ? '-dev' : ''
255
253
  }.yaml`,
256
254
  );
257
- UnderpostCluster.API.chown('kind'); // Pass 'kind' to chown
255
+ Underpost.cluster.chown('kind'); // Pass 'kind' to chown
258
256
  }
259
257
  } else if (options.worker === true) {
260
258
  // Worker node specific configuration (kubeadm join command needs to be executed separately)
@@ -321,7 +319,7 @@ EOF
321
319
  }
322
320
  shellExec(`kubectl delete statefulset valkey-service -n ${options.namespace} --ignore-not-found`);
323
321
  shellExec(`kubectl apply -k ${underpostRoot}/manifests/valkey -n ${options.namespace}`);
324
- await UnderpostTest.API.statusMonitor('valkey-service', 'Running', 'pods', 1000, 60);
322
+ await Underpost.test.statusMonitor('valkey-service', 'Running', 'pods', 1000, 60 * 10);
325
323
  }
326
324
  if (options.full === true || options.mariadb === true) {
327
325
  shellExec(
@@ -380,7 +378,7 @@ EOF
380
378
 
381
379
  const deploymentName = 'mongodb-deployment';
382
380
 
383
- const successInstance = await UnderpostTest.API.statusMonitor(deploymentName);
381
+ const successInstance = await Underpost.test.statusMonitor(deploymentName);
384
382
 
385
383
  if (successInstance) {
386
384
  if (!options.mongoDbHost) options.mongoDbHost = 'mongodb-service';
@@ -389,7 +387,7 @@ EOF
389
387
  members: [{ _id: 0, host: `${options.mongoDbHost}:27017` }],
390
388
  };
391
389
 
392
- const [pod] = UnderpostDeploy.API.get(deploymentName);
390
+ const [pod] = Underpost.deploy.get(deploymentName);
393
391
 
394
392
  shellExec(
395
393
  `sudo kubectl exec -i ${pod.NAME} -- mongo --quiet \
@@ -416,7 +414,7 @@ EOF
416
414
  shellExec(`kubectl apply -f ${underpostRoot}/manifests/mongodb/storage-class.yaml -n ${options.namespace}`);
417
415
  shellExec(`kubectl apply -k ${underpostRoot}/manifests/mongodb -n ${options.namespace}`);
418
416
 
419
- const successInstance = await UnderpostTest.API.statusMonitor('mongodb-0', 'Running', 'pods', 1000, 60 * 10);
417
+ const successInstance = await Underpost.test.statusMonitor('mongodb-0', 'Running', 'pods', 1000, 60 * 10);
420
418
 
421
419
  if (successInstance) {
422
420
  if (!options.mongoDbHost) options.mongoDbHost = 'mongodb-0.mongodb-service';
@@ -449,7 +447,7 @@ EOF
449
447
  }
450
448
 
451
449
  if (options.full === true || options.certManager === true) {
452
- if (!UnderpostDeploy.API.get('cert-manager').find((p) => p.STATUS === 'Running')) {
450
+ if (!Underpost.deploy.get('cert-manager').find((p) => p.STATUS === 'Running')) {
453
451
  shellExec(`helm repo add jetstack https://charts.jetstack.io --force-update`);
454
452
  shellExec(
455
453
  `helm install cert-manager jetstack/cert-manager \
@@ -686,7 +684,7 @@ net.ipv4.ip_forward = 1' | sudo tee ${iptableConfPath}`,
686
684
  // Phase 6: Reload daemon and finalize
687
685
  logger.info('Phase 7/7: Reloading the system daemon and finalizing...');
688
686
  // shellExec('sudo systemctl daemon-reload');
689
- UnderpostCluster.API.config();
687
+ Underpost.cluster.config();
690
688
  logger.info('Safe and complete reset finished. The system is ready for a new cluster initialization.');
691
689
  } catch (error) {
692
690
  logger.error(`Error during reset: ${error.message}`);
@@ -705,7 +703,7 @@ net.ipv4.ip_forward = 1' | sudo tee ${iptableConfPath}`,
705
703
  const resources = {};
706
704
  const nodeName = node
707
705
  ? node
708
- : UnderpostDeploy.API.get('kind-control-plane', 'node').length > 0
706
+ : Underpost.deploy.get('kind-control-plane', 'node').length > 0
709
707
  ? 'kind-control-plane'
710
708
  : os.hostname();
711
709
  const info = shellExec(`kubectl describe node ${nodeName} | grep -E '(Allocatable:|Capacity:)' -A 6`, {
@@ -738,7 +736,7 @@ net.ipv4.ip_forward = 1' | sudo tee ${iptableConfPath}`,
738
736
  * @memberof UnderpostCluster
739
737
  */
740
738
  initHost() {
741
- const archData = UnderpostBaremetal.API.getHostArch();
739
+ const archData = Underpost.baremetal.getHostArch();
742
740
  logger.info('Installing essential host-level prerequisites for Kubernetes...', archData);
743
741
 
744
742
  // Install base rocky setup and updates
package/src/cli/db.js CHANGED
@@ -10,12 +10,9 @@ import { mergeFile, splitFileFactory } from '../server/conf.js';
10
10
  import { loggerFactory } from '../server/logger.js';
11
11
  import { shellExec } from '../server/process.js';
12
12
  import fs from 'fs-extra';
13
- import os from 'os';
14
- import UnderpostDeploy from './deploy.js';
15
- import UnderpostCron from './cron.js';
16
13
  import { DataBaseProvider } from '../db/DataBaseProvider.js';
17
14
  import { loadReplicas, pathPortAssignmentFactory } from '../server/conf.js';
18
-
15
+ import Underpost from '../index.js';
19
16
  const logger = loggerFactory(import.meta);
20
17
 
21
18
  /**
@@ -100,8 +97,8 @@ class UnderpostDB {
100
97
  const { podNames, namespace = 'default', deployId } = criteria;
101
98
 
102
99
  try {
103
- // Get all pods using UnderpostDeploy.API.get
104
- let pods = UnderpostDeploy.API.get(deployId || '', 'pods', namespace);
100
+ // Get all pods using Underpost.deploy.get
101
+ let pods = Underpost.deploy.get(deployId || '', 'pods', namespace);
105
102
 
106
103
  // Filter by pod names if specified
107
104
  if (podNames) {
@@ -158,7 +155,7 @@ class UnderpostDB {
158
155
  _copyToPod({ sourcePath, podName, namespace, destPath }) {
159
156
  try {
160
157
  const command = `sudo kubectl cp ${sourcePath} ${namespace}/${podName}:${destPath}`;
161
- UnderpostDB.API._executeKubectl(command, { context: `copy to pod ${podName}` });
158
+ Underpost.db._executeKubectl(command, { context: `copy to pod ${podName}` });
162
159
  return true;
163
160
  } catch (error) {
164
161
  logger.error('Failed to copy file to pod', { sourcePath, podName, destPath, error: error.message });
@@ -180,7 +177,7 @@ class UnderpostDB {
180
177
  _copyFromPod({ podName, namespace, sourcePath, destPath }) {
181
178
  try {
182
179
  const command = `sudo kubectl cp ${namespace}/${podName}:${sourcePath} ${destPath}`;
183
- UnderpostDB.API._executeKubectl(command, { context: `copy from pod ${podName}` });
180
+ Underpost.db._executeKubectl(command, { context: `copy from pod ${podName}` });
184
181
  return true;
185
182
  } catch (error) {
186
183
  logger.error('Failed to copy file from pod', { podName, sourcePath, destPath, error: error.message });
@@ -201,7 +198,7 @@ class UnderpostDB {
201
198
  _execInPod({ podName, namespace, command }) {
202
199
  try {
203
200
  const kubectlCmd = `sudo kubectl exec -n ${namespace} -i ${podName} -- sh -c "${command}"`;
204
- return UnderpostDB.API._executeKubectl(kubectlCmd, { context: `exec in pod ${podName}` });
201
+ return Underpost.db._executeKubectl(kubectlCmd, { context: `exec in pod ${podName}` });
205
202
  } catch (error) {
206
203
  logger.error('Failed to execute command in pod', { podName, command, error: error.message });
207
204
  throw error;
@@ -348,7 +345,7 @@ class UnderpostDB {
348
345
  logger.info('Importing MariaDB database', { podName, dbName });
349
346
 
350
347
  // Remove existing SQL file in container
351
- UnderpostDB.API._execInPod({
348
+ Underpost.db._execInPod({
352
349
  podName,
353
350
  namespace,
354
351
  command: `rm -rf ${containerSqlPath}`,
@@ -356,7 +353,7 @@ class UnderpostDB {
356
353
 
357
354
  // Copy SQL file to pod
358
355
  if (
359
- !UnderpostDB.API._copyToPod({
356
+ !Underpost.db._copyToPod({
360
357
  sourcePath: sqlPath,
361
358
  podName,
362
359
  namespace,
@@ -367,14 +364,14 @@ class UnderpostDB {
367
364
  }
368
365
 
369
366
  // Create database if it doesn't exist
370
- UnderpostDB.API._executeKubectl(
367
+ Underpost.db._executeKubectl(
371
368
  `kubectl exec -n ${namespace} -i ${podName} -- mariadb -p${password} -e 'CREATE DATABASE IF NOT EXISTS ${dbName};'`,
372
369
  { context: `create database ${dbName}` },
373
370
  );
374
371
 
375
372
  // Import SQL file
376
373
  const importCmd = `mariadb -u ${user} -p${password} ${dbName} < ${containerSqlPath}`;
377
- UnderpostDB.API._execInPod({ podName, namespace, command: importCmd });
374
+ Underpost.db._execInPod({ podName, namespace, command: importCmd });
378
375
 
379
376
  logger.info('Successfully imported MariaDB database', { podName, dbName });
380
377
  return true;
@@ -405,7 +402,7 @@ class UnderpostDB {
405
402
  logger.info('Exporting MariaDB database', { podName, dbName });
406
403
 
407
404
  // Remove existing SQL file in container
408
- UnderpostDB.API._execInPod({
405
+ Underpost.db._execInPod({
409
406
  podName,
410
407
  namespace,
411
408
  command: `rm -rf ${containerSqlPath}`,
@@ -413,11 +410,11 @@ class UnderpostDB {
413
410
 
414
411
  // Dump database
415
412
  const dumpCmd = `mariadb-dump --user=${user} --password=${password} --lock-tables ${dbName} > ${containerSqlPath}`;
416
- UnderpostDB.API._execInPod({ podName, namespace, command: dumpCmd });
413
+ Underpost.db._execInPod({ podName, namespace, command: dumpCmd });
417
414
 
418
415
  // Copy SQL file from pod
419
416
  if (
420
- !UnderpostDB.API._copyFromPod({
417
+ !Underpost.db._copyFromPod({
421
418
  podName,
422
419
  namespace,
423
420
  sourcePath: containerSqlPath,
@@ -461,7 +458,7 @@ class UnderpostDB {
461
458
  logger.info('Importing MongoDB database', { podName, dbName });
462
459
 
463
460
  // Remove existing BSON directory in container
464
- UnderpostDB.API._execInPod({
461
+ Underpost.db._execInPod({
465
462
  podName,
466
463
  namespace,
467
464
  command: `rm -rf ${containerBsonPath}`,
@@ -469,7 +466,7 @@ class UnderpostDB {
469
466
 
470
467
  // Copy BSON directory to pod
471
468
  if (
472
- !UnderpostDB.API._copyToPod({
469
+ !Underpost.db._copyToPod({
473
470
  sourcePath: bsonPath,
474
471
  podName,
475
472
  namespace,
@@ -483,7 +480,7 @@ class UnderpostDB {
483
480
  const restoreCmd = `mongorestore -d ${dbName} ${containerBsonPath}${drop ? ' --drop' : ''}${
484
481
  preserveUUID ? ' --preserveUUID' : ''
485
482
  }`;
486
- UnderpostDB.API._execInPod({ podName, namespace, command: restoreCmd });
483
+ Underpost.db._execInPod({ podName, namespace, command: restoreCmd });
487
484
 
488
485
  logger.info('Successfully imported MongoDB database', { podName, dbName });
489
486
  return true;
@@ -513,7 +510,7 @@ class UnderpostDB {
513
510
  logger.info('Exporting MongoDB database', { podName, dbName, collections });
514
511
 
515
512
  // Remove existing BSON directory in container
516
- UnderpostDB.API._execInPod({
513
+ Underpost.db._execInPod({
517
514
  podName,
518
515
  namespace,
519
516
  command: `rm -rf ${containerBsonPath}`,
@@ -524,16 +521,16 @@ class UnderpostDB {
524
521
  const collectionList = collections.split(',').map((c) => c.trim());
525
522
  for (const collection of collectionList) {
526
523
  const dumpCmd = `mongodump -d ${dbName} --collection ${collection} -o /`;
527
- UnderpostDB.API._execInPod({ podName, namespace, command: dumpCmd });
524
+ Underpost.db._execInPod({ podName, namespace, command: dumpCmd });
528
525
  }
529
526
  } else {
530
527
  const dumpCmd = `mongodump -d ${dbName} -o /`;
531
- UnderpostDB.API._execInPod({ podName, namespace, command: dumpCmd });
528
+ Underpost.db._execInPod({ podName, namespace, command: dumpCmd });
532
529
  }
533
530
 
534
531
  // Copy BSON directory from pod
535
532
  if (
536
- !UnderpostDB.API._copyFromPod({
533
+ !Underpost.db._copyFromPod({
537
534
  podName,
538
535
  namespace,
539
536
  sourcePath: containerBsonPath,
@@ -799,7 +796,7 @@ class UnderpostDB {
799
796
  // Handle clean-fs-collection operation
800
797
  if (options.cleanFsCollection || options.cleanFsDryRun) {
801
798
  logger.info('Starting File collection cleanup operation', { deployList });
802
- await UnderpostDB.API.cleanFsCollection(deployList, {
799
+ await Underpost.db.cleanFsCollection(deployList, {
803
800
  hosts: options.hosts,
804
801
  paths: options.paths,
805
802
  dryRun: options.cleanFsDryRun,
@@ -815,7 +812,7 @@ class UnderpostDB {
815
812
  });
816
813
 
817
814
  if (options.primaryPodEnsure) {
818
- const primaryPodName = UnderpostDB.API.getMongoPrimaryPodName({ namespace, podName: options.primaryPodEnsure });
815
+ const primaryPodName = Underpost.db.getMongoPrimaryPodName({ namespace, podName: options.primaryPodEnsure });
819
816
  if (!primaryPodName) {
820
817
  const baseCommand = options.dev ? 'node bin' : 'underpost';
821
818
  const baseClusterCommand = options.dev ? ' --dev' : '';
@@ -874,15 +871,15 @@ class UnderpostDB {
874
871
  if (!processedRepos.has(repoName)) {
875
872
  logger.info('Processing Git operations for repository', { repoName, deployId });
876
873
  if (options.git === true) {
877
- UnderpostDB.API._manageGitRepo({ repoName, operation: 'clone', forceClone: options.forceClone });
878
- UnderpostDB.API._manageGitRepo({ repoName, operation: 'pull' });
874
+ Underpost.db._manageGitRepo({ repoName, operation: 'clone', forceClone: options.forceClone });
875
+ Underpost.db._manageGitRepo({ repoName, operation: 'pull' });
879
876
  }
880
877
 
881
878
  if (options.macroRollbackExport) {
882
879
  // Only clone if not already done by git option above
883
880
  if (options.git !== true) {
884
- UnderpostDB.API._manageGitRepo({ repoName, operation: 'clone', forceClone: options.forceClone });
885
- UnderpostDB.API._manageGitRepo({ repoName, operation: 'pull' });
881
+ Underpost.db._manageGitRepo({ repoName, operation: 'clone', forceClone: options.forceClone });
882
+ Underpost.db._manageGitRepo({ repoName, operation: 'pull' });
886
883
  }
887
884
 
888
885
  const nCommits = parseInt(options.macroRollbackExport);
@@ -947,7 +944,7 @@ class UnderpostDB {
947
944
  logger.info('Processing database', { hostFolder, provider, dbName, deployId });
948
945
 
949
946
  const backUpPath = `../${repoName}/${hostFolder}`;
950
- const backupInfo = UnderpostDB.API._manageBackupTimestamps(
947
+ const backupInfo = Underpost.db._manageBackupTimestamps(
951
948
  backUpPath,
952
949
  newBackupTimestamp,
953
950
  options.export === true,
@@ -980,15 +977,11 @@ class UnderpostDB {
980
977
  deployId: provider === 'mariadb' ? 'mariadb' : 'mongo',
981
978
  };
982
979
 
983
- targetPods = UnderpostDB.API._getFilteredPods(podCriteria);
980
+ targetPods = Underpost.db._getFilteredPods(podCriteria);
984
981
 
985
982
  // Fallback to default if no custom pods specified
986
983
  if (targetPods.length === 0 && !options.podName) {
987
- const defaultPods = UnderpostDeploy.API.get(
988
- provider === 'mariadb' ? 'mariadb' : 'mongo',
989
- 'pods',
990
- namespace,
991
- );
984
+ const defaultPods = Underpost.deploy.get(provider === 'mariadb' ? 'mariadb' : 'mongo', 'pods', namespace);
992
985
  console.log('defaultPods', defaultPods);
993
986
  targetPods = defaultPods;
994
987
  }
@@ -1007,7 +1000,7 @@ class UnderpostDB {
1007
1000
  podsToProcess = [];
1008
1001
  } else {
1009
1002
  const firstPod = targetPods[0].NAME;
1010
- const primaryPodName = UnderpostDB.API.getMongoPrimaryPodName({ namespace, podName: firstPod });
1003
+ const primaryPodName = Underpost.db.getMongoPrimaryPodName({ namespace, podName: firstPod });
1011
1004
 
1012
1005
  if (primaryPodName) {
1013
1006
  const primaryPod = targetPods.find((p) => p.NAME === primaryPodName);
@@ -1040,7 +1033,7 @@ class UnderpostDB {
1040
1033
  switch (provider) {
1041
1034
  case 'mariadb': {
1042
1035
  if (options.stats === true) {
1043
- const stats = UnderpostDB.API._getMariaDBStats({
1036
+ const stats = Underpost.db._getMariaDBStats({
1044
1037
  podName: pod.NAME,
1045
1038
  namespace,
1046
1039
  dbName,
@@ -1048,12 +1041,12 @@ class UnderpostDB {
1048
1041
  password,
1049
1042
  });
1050
1043
  if (stats) {
1051
- UnderpostDB.API._displayStats({ provider, dbName, stats });
1044
+ Underpost.db._displayStats({ provider, dbName, stats });
1052
1045
  }
1053
1046
  }
1054
1047
 
1055
1048
  if (options.import === true) {
1056
- UnderpostDB.API._importMariaDB({
1049
+ Underpost.db._importMariaDB({
1057
1050
  pod,
1058
1051
  namespace,
1059
1052
  dbName,
@@ -1065,7 +1058,7 @@ class UnderpostDB {
1065
1058
 
1066
1059
  if (options.export === true) {
1067
1060
  const outputPath = options.outPath || toNewSqlPath;
1068
- await UnderpostDB.API._exportMariaDB({
1061
+ await Underpost.db._exportMariaDB({
1069
1062
  pod,
1070
1063
  namespace,
1071
1064
  dbName,
@@ -1079,19 +1072,19 @@ class UnderpostDB {
1079
1072
 
1080
1073
  case 'mongoose': {
1081
1074
  if (options.stats === true) {
1082
- const stats = UnderpostDB.API._getMongoStats({
1075
+ const stats = Underpost.db._getMongoStats({
1083
1076
  podName: pod.NAME,
1084
1077
  namespace,
1085
1078
  dbName,
1086
1079
  });
1087
1080
  if (stats) {
1088
- UnderpostDB.API._displayStats({ provider, dbName, stats });
1081
+ Underpost.db._displayStats({ provider, dbName, stats });
1089
1082
  }
1090
1083
  }
1091
1084
 
1092
1085
  if (options.import === true) {
1093
1086
  const bsonPath = options.outPath || toBsonPath;
1094
- UnderpostDB.API._importMongoDB({
1087
+ Underpost.db._importMongoDB({
1095
1088
  pod,
1096
1089
  namespace,
1097
1090
  dbName,
@@ -1103,7 +1096,7 @@ class UnderpostDB {
1103
1096
 
1104
1097
  if (options.export === true) {
1105
1098
  const outputPath = options.outPath || toNewBsonPath;
1106
- UnderpostDB.API._exportMongoDB({
1099
+ Underpost.db._exportMongoDB({
1107
1100
  pod,
1108
1101
  namespace,
1109
1102
  dbName,
@@ -1130,8 +1123,8 @@ class UnderpostDB {
1130
1123
  const commitMessage = `${new Date(newBackupTimestamp).toLocaleDateString()} ${new Date(
1131
1124
  newBackupTimestamp,
1132
1125
  ).toLocaleTimeString()}`;
1133
- UnderpostDB.API._manageGitRepo({ repoName, operation: 'commit', message: commitMessage });
1134
- UnderpostDB.API._manageGitRepo({ repoName, operation: 'push' });
1126
+ Underpost.db._manageGitRepo({ repoName, operation: 'commit', message: commitMessage });
1127
+ Underpost.db._manageGitRepo({ repoName, operation: 'push' });
1135
1128
  processedRepos.add(`${repoName}-committed`);
1136
1129
  }
1137
1130
  }
@@ -1202,7 +1195,7 @@ class UnderpostDB {
1202
1195
  }
1203
1196
 
1204
1197
  const confServer = loadReplicas(deployId, JSON.parse(fs.readFileSync(confServerPath, 'utf8')));
1205
- const router = await UnderpostDeploy.API.routerFactory(deployId, env);
1198
+ const router = await Underpost.deploy.routerFactory(deployId, env);
1206
1199
  const pathPortAssignmentData = await pathPortAssignmentFactory(deployId, router, confServer);
1207
1200
 
1208
1201
  for (const host of Object.keys(confServer)) {
@@ -1296,7 +1289,7 @@ class UnderpostDB {
1296
1289
  for (const jobId of Object.keys(confCron.jobs)) {
1297
1290
  const body = {
1298
1291
  jobId,
1299
- deployId: UnderpostCron.API.getRelatedDeployIdList(jobId),
1292
+ deployId: Underpost.cron.getRelatedDeployIdList(jobId),
1300
1293
  expression: confCron.jobs[jobId].expression,
1301
1294
  enabled: confCron.jobs[jobId].enabled,
1302
1295
  };
@@ -1573,7 +1566,7 @@ class UnderpostDB {
1573
1566
 
1574
1567
  if (options.generate === true) {
1575
1568
  logger.info('Generating cluster metadata');
1576
- await UnderpostDB.API.clusterMetadataFactory(deployId, host, path);
1569
+ await Underpost.db.clusterMetadataFactory(deployId, host, path);
1577
1570
  }
1578
1571
 
1579
1572
  if (options.instances === true) {