underpost 2.95.1 → 2.95.3

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/README.md CHANGED
@@ -18,7 +18,7 @@
18
18
 
19
19
  <!-- badges -->
20
20
 
21
- [![Node.js CI](https://github.com/underpostnet/engine/actions/workflows/docker-image.ci.yml/badge.svg?branch=master)](https://github.com/underpostnet/engine/actions/workflows/docker-image.yml) [![Test](https://github.com/underpostnet/engine/actions/workflows/coverall.ci.yml/badge.svg?branch=master)](https://github.com/underpostnet/engine/actions/workflows/coverall.ci.yml) [![Downloads](https://img.shields.io/npm/dm/underpost.svg)](https://www.npmjs.com/package/underpost) [![Socket Badge](https://socket.dev/api/badge/npm/package/underpost/2.95.1)](https://socket.dev/npm/package/underpost/overview/2.95.1) [![Coverage Status](https://coveralls.io/repos/github/underpostnet/engine/badge.svg?branch=master)](https://coveralls.io/github/underpostnet/engine?branch=master) [![Version](https://img.shields.io/npm/v/underpost.svg)](https://www.npmjs.org/package/underpost) [![License](https://img.shields.io/npm/l/underpost.svg)](https://www.npmjs.com/package/underpost)
21
+ [![Node.js CI](https://github.com/underpostnet/engine/actions/workflows/docker-image.ci.yml/badge.svg?branch=master)](https://github.com/underpostnet/engine/actions/workflows/docker-image.yml) [![Test](https://github.com/underpostnet/engine/actions/workflows/coverall.ci.yml/badge.svg?branch=master)](https://github.com/underpostnet/engine/actions/workflows/coverall.ci.yml) [![Downloads](https://img.shields.io/npm/dm/underpost.svg)](https://www.npmjs.com/package/underpost) [![Socket Badge](https://socket.dev/api/badge/npm/package/underpost/2.95.3)](https://socket.dev/npm/package/underpost/overview/2.95.3) [![Coverage Status](https://coveralls.io/repos/github/underpostnet/engine/badge.svg?branch=master)](https://coveralls.io/github/underpostnet/engine?branch=master) [![Version](https://img.shields.io/npm/v/underpost.svg)](https://www.npmjs.org/package/underpost) [![License](https://img.shields.io/npm/l/underpost.svg)](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.95.1
69
+ ## underpost ci/cd cli v2.95.3
70
70
 
71
71
  ### Usage: `underpost [options] [command]`
72
72
  ```
package/cli.md CHANGED
@@ -1,4 +1,4 @@
1
- ## underpost ci/cd cli v2.95.1
1
+ ## underpost ci/cd cli v2.95.3
2
2
 
3
3
  ### Usage: `underpost [options] [command]`
4
4
  ```
@@ -573,6 +573,7 @@ Options:
573
573
  --drop Drops the specified databases or collections before importing.
574
574
  --preserveUUID Preserves UUIDs during database import operations.
575
575
  --git Enables Git integration for backup version control (clone, pull, commit, push to GitHub).
576
+ --force-clone Forces cloning of the Git repository, overwriting local changes.
576
577
  --hosts <hosts> Comma-separated list of database hosts to filter operations.
577
578
  --paths <paths> Comma-separated list of paths to filter database operations.
578
579
  --ns <ns-name> Kubernetes namespace context for database operations (defaults to "default").
@@ -17,7 +17,7 @@ spec:
17
17
  spec:
18
18
  containers:
19
19
  - name: dd-default-development-blue
20
- image: localhost/rockylinux9-underpost:v2.95.1
20
+ image: localhost/rockylinux9-underpost:v2.95.3
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.95.1
103
+ image: localhost/rockylinux9-underpost:v2.95.3
104
104
  # resources:
105
105
  # requests:
106
106
  # memory: "124Ki"
@@ -18,7 +18,7 @@ spec:
18
18
  spec:
19
19
  containers:
20
20
  - name: dd-test-development-blue
21
- image: localhost/rockylinux9-underpost:v2.95.1
21
+ image: localhost/rockylinux9-underpost:v2.95.3
22
22
 
23
23
  command:
24
24
  - /bin/sh
@@ -103,7 +103,7 @@ spec:
103
103
  spec:
104
104
  containers:
105
105
  - name: dd-test-development-green
106
- image: localhost/rockylinux9-underpost:v2.95.1
106
+ image: localhost/rockylinux9-underpost:v2.95.3
107
107
 
108
108
  command:
109
109
  - /bin/sh
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "type": "module",
3
3
  "main": "src/index.js",
4
4
  "name": "underpost",
5
- "version": "2.95.1",
5
+ "version": "2.95.3",
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",
package/src/cli/db.js CHANGED
@@ -25,13 +25,6 @@ const logger = loggerFactory(import.meta);
25
25
  */
26
26
  const MAX_BACKUP_RETENTION = 5;
27
27
 
28
- /**
29
- * Timeout for kubectl operations in milliseconds
30
- * @constant {number} KUBECTL_TIMEOUT
31
- * @memberof UnderpostDB
32
- */
33
- const KUBECTL_TIMEOUT = 300000; // 5 minutes
34
-
35
28
  /**
36
29
  * @typedef {Object} DatabaseOptions
37
30
  * @memberof UnderpostDB
@@ -51,6 +44,7 @@ const KUBECTL_TIMEOUT = 300000; // 5 minutes
51
44
  * @property {boolean} [allPods=false] - Flag to target all matching pods
52
45
  * @property {boolean} [primaryPod=false] - Flag to automatically detect and use MongoDB primary pod
53
46
  * @property {boolean} [stats=false] - Flag to display collection/table statistics
47
+ * @property {boolean} [forceClone=false] - Flag to force remove and re-clone cron backup repository
54
48
  */
55
49
 
56
50
  /**
@@ -253,9 +247,10 @@ class UnderpostDB {
253
247
  * @param {string} params.repoName - Repository name
254
248
  * @param {string} params.operation - Operation (clone, pull, commit, push)
255
249
  * @param {string} [params.message=''] - Commit message
250
+ * @param {boolean} [params.forceClone=false] - Force remove and re-clone repository
256
251
  * @returns {boolean} Success status
257
252
  */
258
- _manageGitRepo({ repoName, operation, message = '' }) {
253
+ _manageGitRepo({ repoName, operation, message = '', forceClone = false }) {
259
254
  try {
260
255
  const username = process.env.GITHUB_USERNAME;
261
256
  if (!username) {
@@ -267,6 +262,10 @@ class UnderpostDB {
267
262
 
268
263
  switch (operation) {
269
264
  case 'clone':
265
+ if (forceClone && fs.existsSync(repoPath)) {
266
+ logger.info(`Force clone enabled, removing existing repository: ${repoName}`);
267
+ fs.removeSync(repoPath);
268
+ }
270
269
  if (!fs.existsSync(repoPath)) {
271
270
  shellExec(`cd .. && underpost clone ${username}/${repoName}`);
272
271
  logger.info(`Cloned repository: ${repoName}`);
@@ -803,6 +802,7 @@ class UnderpostDB {
803
802
  primaryPod: false,
804
803
  stats: false,
805
804
  macroRollbackExport: 1,
805
+ forceClone: false,
806
806
  },
807
807
  ) {
808
808
  const newBackupTimestamp = new Date().getTime();
@@ -865,12 +865,12 @@ class UnderpostDB {
865
865
 
866
866
  // Handle Git operations
867
867
  if (options.git === true) {
868
- UnderpostDB.API._manageGitRepo({ repoName, operation: 'clone' });
868
+ UnderpostDB.API._manageGitRepo({ repoName, operation: 'clone', forceClone: options.forceClone });
869
869
  UnderpostDB.API._manageGitRepo({ repoName, operation: 'pull' });
870
870
  }
871
871
 
872
872
  if (options.macroRollbackExport) {
873
- UnderpostDB.API._manageGitRepo({ repoName, operation: 'clone' });
873
+ UnderpostDB.API._manageGitRepo({ repoName, operation: 'clone', forceClone: options.forceClone });
874
874
  UnderpostDB.API._manageGitRepo({ repoName, operation: 'pull' });
875
875
 
876
876
  const nCommits = parseInt(options.macroRollbackExport);
package/src/cli/index.js CHANGED
@@ -427,6 +427,7 @@ program
427
427
  .option('--drop', 'Drops the specified databases or collections before importing.')
428
428
  .option('--preserveUUID', 'Preserves UUIDs during database import operations.')
429
429
  .option('--git', 'Enables Git integration for backup version control (clone, pull, commit, push to GitHub).')
430
+ .option('--force-clone', 'Forces cloning of the Git repository, overwriting local changes.')
430
431
  .option('--hosts <hosts>', 'Comma-separated list of database hosts to filter operations.')
431
432
  .option('--paths <paths>', 'Comma-separated list of paths to filter database operations.')
432
433
  .option('--ns <ns-name>', 'Kubernetes namespace context for database operations (defaults to "default").')
package/src/cli/run.js CHANGED
@@ -638,7 +638,7 @@ cd /home/dd/engine
638
638
  sudo -n -- /bin/bash -lc "${[
639
639
  `${baseCommand} run${baseClusterCommand} stop${path ? ` ${path}` : ''}`,
640
640
  ` --deploy-id ${options.deployId}${options.instanceId ? ` --instance-id ${options.instanceId}` : ''}`,
641
- ` --namespace ${options.namespace}`,
641
+ ` --namespace ${options.namespace}${options.hosts ? ` --hosts ${options.hosts}` : ''}`,
642
642
  ].join('')}"
643
643
  EOF
644
644
  `);
package/src/index.js CHANGED
@@ -36,7 +36,7 @@ class Underpost {
36
36
  * @type {String}
37
37
  * @memberof Underpost
38
38
  */
39
- static version = 'v2.95.1';
39
+ static version = 'v2.95.3';
40
40
  /**
41
41
  * Repository cli API
42
42
  * @static