@underpostnet/underpost 2.95.3 → 2.95.7

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.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)
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.7)](https://socket.dev/npm/package/underpost/overview/2.95.7) [![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.3
69
+ ## underpost ci/cd cli v2.95.7
70
70
 
71
71
  ### Usage: `underpost [options] [command]`
72
72
  ```
package/bin/deploy.js CHANGED
@@ -27,6 +27,7 @@ import { buildClient } from '../src/server/client-build.js';
27
27
  import colors from 'colors';
28
28
  import { program } from '../src/cli/index.js';
29
29
  import { timer } from '../src/client/components/core/CommonJs.js';
30
+ import Underpost from '../src/index.js';
30
31
 
31
32
  colors.enable();
32
33
 
@@ -364,23 +365,10 @@ try {
364
365
  break;
365
366
  }
366
367
 
367
- case 'clean-core-repo': {
368
- shellCd(`/home/dd/engine`);
369
- shellExec(`git reset`);
370
- shellExec(`git checkout .`);
371
- shellExec(`git clean -f -d`);
372
- shellCd(`/home/dd/engine/engine-private`);
373
- shellExec(`git reset`);
374
- shellExec(`git checkout .`);
375
- shellExec(`git clean -f -d`);
376
- shellCd(`/home/dd/engine`);
377
- break;
378
- }
379
-
380
368
  case 'version-build': {
381
369
  dotenv.config({ path: `./engine-private/conf/dd-cron/.env.production`, override: true });
382
370
  shellCd(`/home/dd/engine`);
383
- shellExec(`node bin/deploy clean-core-repo`);
371
+ Underpost.repo.clean({ paths: ['/home/dd/engine', '/home/dd/engine/engine-private '] });
384
372
  shellExec(`node bin pull . ${process.env.GITHUB_USERNAME}/engine`);
385
373
  shellExec(`node bin run kill 4001`);
386
374
  shellExec(`node bin run kill 4002`);
@@ -399,7 +387,7 @@ try {
399
387
  break;
400
388
  }
401
389
  shellCd(`/home/dd/engine`);
402
- shellExec(`node bin/deploy clean-core-repo`);
390
+ Underpost.repo.clean({ paths: ['/home/dd/engine', '/home/dd/engine/engine-private '] });
403
391
  const originPackageJson = JSON.parse(fs.readFileSync(`package.json`, 'utf8'));
404
392
  const newVersion = process.argv[3] ?? originPackageJson.version;
405
393
  const node = process.argv[4] ?? 'kind-control-plane';
@@ -483,14 +471,6 @@ try {
483
471
  break;
484
472
  }
485
473
 
486
- case 'private': {
487
- shellExec(`node bin/deploy sync-deploy-envs`);
488
- shellExec(`node bin/build dd conf`);
489
- shellExec(`cd ./engine-private && git add . && node ../bin cmt . build`);
490
- shellExec(`cd ./engine-private && node ../bin push . ${process.env.GITHUB_USERNAME}/engine-private`);
491
- break;
492
- }
493
-
494
474
  case 'version-deploy': {
495
475
  dotenv.config({ path: `./engine-private/conf/dd-cron/.env.production`, override: true });
496
476
  shellExec(
@@ -1046,15 +1026,15 @@ nvidia/gpu-operator \
1046
1026
  case 'update-static-guide': {
1047
1027
  fs.writeFileSync(
1048
1028
  `src/client/public/nexodev/docs/references/Static Site Generator Quick Reference.md`,
1049
- fs.readFileSync(`examples/QUICK-REFERENCE.md`, 'utf8'),
1029
+ fs.readFileSync(`examples/static-page/QUICK-REFERENCE.md`, 'utf8'),
1050
1030
  );
1051
1031
  fs.writeFileSync(
1052
1032
  `src/client/public/nexodev/docs/references/Static Site Generator Examples.md`,
1053
- fs.readFileSync(`examples/README.md`, 'utf8'),
1033
+ fs.readFileSync(`examples/static-page/README.md`, 'utf8'),
1054
1034
  );
1055
1035
  fs.writeFileSync(
1056
1036
  `src/client/public/nexodev/docs/references/Static Generator Guide.md`,
1057
- fs.readFileSync(`examples/STATIC-GENERATOR-GUIDE.md`, 'utf8'),
1037
+ fs.readFileSync(`examples/static-page/STATIC-GENERATOR-GUIDE.md`, 'utf8'),
1058
1038
  );
1059
1039
  break;
1060
1040
  }
package/cli.md CHANGED
@@ -1,4 +1,4 @@
1
- ## underpost ci/cd cli v2.95.3
1
+ ## underpost ci/cd cli v2.95.7
2
2
 
3
3
  ### Usage: `underpost [options] [command]`
4
4
  ```
@@ -563,8 +563,6 @@ Options:
563
563
  --import Imports container backups from specified repositories.
564
564
  --export Exports container backups to specified repositories.
565
565
  --pod-name <pod-name> Comma-separated list of pod names or patterns (supports wildcards like "mariadb-*").
566
- --node-name <node-name> Comma-separated list of node names to filter pods by their node placement.
567
- --label-selector <selector> Kubernetes label selector for filtering pods (e.g., "app=mariadb").
568
566
  --all-pods Target all matching pods instead of just the first one.
569
567
  --primary-pod Automatically detect and use MongoDB primary pod (MongoDB only).
570
568
  --stats Display database statistics (collection/table names with document/row counts).
@@ -640,16 +638,20 @@ Manages cron jobs, including initialization, execution, and configuration
640
638
  updates.
641
639
 
642
640
  Arguments:
643
- deploy-list A comma-separated list of deployment IDs (e.g.,
644
- "default-a,default-b").
645
- job-list A comma-separated list of job IDs. Options: callback,
646
- getRelatedDeployId. Defaults to all available jobs.
641
+ deploy-list A comma-separated list of deployment IDs (e.g.,
642
+ "default-a,default-b").
643
+ job-list A comma-separated list of job IDs. Options:
644
+ callback, initCronJobs, updatePackageScripts,
645
+ getRelatedDeployIdList. Defaults to all available
646
+ jobs.
647
647
 
648
648
  Options:
649
- --itc Executes cron jobs within the container execution context.
650
- --init Initializes cron jobs for the default deployment ID.
651
- --git Uploads cron job configurations to GitHub.
652
- -h, --help display help for command
649
+ --init-pm2-cronjobs Initializes PM2 cron jobs from configuration for
650
+ the specified deployment IDs.
651
+ --git Uploads cron job configurations to GitHub.
652
+ --update-package-scripts Updates package.json start scripts for each
653
+ deploy-id configuration.
654
+ -h, --help display help for command
653
655
 
654
656
  ```
655
657
 
@@ -914,8 +916,6 @@ Options:
914
916
  command to the clipboard.
915
917
  --cloud-init-update Updates cloud init for a workflow id config
916
918
  architecture.
917
- --cloud-init-reset Resets cloud init for a workflow id config
918
- architecture.
919
919
  --logs <log-id> Displays logs for log id: dhcp, cloud,
920
920
  machine, cloud-config.
921
921
  --dev Sets the development context environment for
package/conf.js CHANGED
@@ -211,7 +211,10 @@ const DefaultConf = /**/ {
211
211
  },
212
212
  cron: {
213
213
  records: { A: [{ host: 'example.com', dns: 'dondominio', api_key: '???', user: '???' }] },
214
- jobs: { dns: { expression: '* * * * *', enabled: true }, backups: { expression: '0 1 * * *', enabled: true } },
214
+ jobs: {
215
+ dns: { expression: '* * * * *', enabled: true, instances: 1 },
216
+ backups: { expression: '0 1 * * *', enabled: true, instances: 1 },
217
+ },
215
218
  },
216
219
  }; /**/
217
220
 
@@ -479,21 +479,3 @@ underpost static --config-file ./config.json
479
479
  ]
480
480
  }
481
481
  ```
482
-
483
- ## Documentation Links
484
-
485
- - [Complete Guide](./STATIC-GENERATOR-GUIDE.md)
486
- - [Example Config](./static-config-example.json)
487
- - [Custom Component Example](./ssr-components/CustomPage.js)
488
- - [Examples README](./README.md)
489
-
490
- ## Tips
491
-
492
- ✅ Use config files for complex setups
493
- ✅ Minify in production
494
- ✅ Use async/defer for scripts
495
- ✅ Include structured data for SEO
496
- ✅ Test on multiple devices
497
- ✅ Validate your JSON configs
498
- ✅ Use semantic HTML in components
499
- ✅ Include accessibility attributes
@@ -10,7 +10,7 @@ This directory contains comprehensive examples and documentation for the Underpo
10
10
 
11
11
  ### Configuration Examples
12
12
 
13
- - **[static-config-example.json](./static-config-example.json)** - Fully documented configuration file template with all available options
13
+ - **[static-config-example.json](./static-page/static-config-example.json)** - Fully documented configuration file template with all available options
14
14
 
15
15
  ### SSR Component Examples
16
16
 
@@ -68,7 +68,7 @@ underpost static \
68
68
 
69
69
  ```bash
70
70
  underpost static \
71
- --page ./examples/ssr-components/CustomPage.js \
71
+ --page ./examples/static-page/ssr-components/CustomPage.js \
72
72
  --output-path ./dist/landing.html \
73
73
  --title "Welcome to My App" \
74
74
  --description "The best app for your needs" \
@@ -83,7 +83,7 @@ Use the provided `static-config-example.json`:
83
83
 
84
84
  ```bash
85
85
  # Copy the example
86
- cp ./examples/static-config-example.json ./my-config.json
86
+ cp ./examples/static-page/static-config-example.json ./my-config.json
87
87
 
88
88
  # Edit with your settings
89
89
  nano ./my-config.json
@@ -404,44 +404,3 @@ for (const page of pages) {
404
404
  });
405
405
  }
406
406
  ```
407
-
408
- ## Troubleshooting
409
-
410
- ### Component Not Found
411
-
412
- **Error:** `Page component does not exist`
413
-
414
- **Solution:** Verify the path is correct and the file exists
415
-
416
- ### Invalid JSON
417
-
418
- **Error:** `Error loading config file: Unexpected token`
419
-
420
- **Solution:** Validate your JSON using a linter or online validator
421
-
422
- ### Missing Metadata
423
-
424
- **Warning:** No metadata generated
425
-
426
- **Solution:** Ensure metadata object is properly configured in your config
427
-
428
- ## Getting Help
429
-
430
- - Read the [Complete Guide](./STATIC-GENERATOR-GUIDE.md)
431
- - Check the [example config](./static-config-example.json)
432
- - Review the [custom page example](./ssr-components/CustomPage.js)
433
- - Check the main project documentation
434
-
435
- ## Contributing
436
-
437
- To add new examples:
438
-
439
- 1. Create your example file
440
- 2. Add comprehensive comments
441
- 3. Update this README
442
- 4. Test your example thoroughly
443
- 5. Submit a pull request
444
-
445
- ## License
446
-
447
- Part of the Underpost framework. See main project license.
@@ -748,30 +748,6 @@ const config = ConfigLoader.load('./config.json');
748
748
  ConfigLoader.save('./config.json', configObject);
749
749
  ```
750
750
 
751
- ---
752
-
753
- ## Troubleshooting
754
-
755
- ### Common Issues
756
-
757
- **Issue: Component not found**
758
- ```
759
- Error: Page component does not exist: ./src/client/ssr/body/Missing.js
760
- ```
761
- **Solution:** Verify the path to your SSR component file.
762
-
763
- **Issue: Output directory doesn't exist**
764
- ```
765
- Error: Output directory does not exist: ./dist/pages
766
- ```
767
- **Solution:** Create the directory first or use a different output path.
768
-
769
- **Issue: Invalid JSON in config file**
770
- ```
771
- Error: Error loading config file: Unexpected token
772
- ```
773
- **Solution:** Validate your JSON syntax using a linter.
774
-
775
751
  ### Debug Mode
776
752
 
777
753
  Use `--dev` flag for development mode with additional logging:
@@ -779,29 +755,3 @@ Use `--dev` flag for development mode with additional logging:
779
755
  ```bash
780
756
  underpost static --config-file ./config.json --dev
781
757
  ```
782
-
783
- ---
784
-
785
- ## Examples Repository
786
-
787
- See the `examples/` directory for complete working examples:
788
-
789
- - `static-config-example.json` - Comprehensive configuration example
790
- - Additional examples coming soon
791
-
792
- ---
793
-
794
- ## Contributing
795
-
796
- To contribute improvements to the static generator:
797
-
798
- 1. Add new features to `src/cli/static.js`
799
- 2. Update this documentation
800
- 3. Add examples to the `examples/` directory
801
- 4. Include JSDoc comments for all new functions
802
-
803
- ---
804
-
805
- ## License
806
-
807
- This is part of the Underpost framework. See main project license.
@@ -5,19 +5,6 @@
5
5
  * @description
6
6
  * This is an example SSR component demonstrating best practices for creating
7
7
  * custom static pages with the Underpost Static Site Generator.
8
- *
9
- * @example
10
- * // Usage with static generator
11
- * underpost static \
12
- * --page ./examples/ssr-components/CustomPage.js \
13
- * --output-path ./dist/custom.html
14
- *
15
- * @example
16
- * // Usage in configuration file
17
- * {
18
- * "page": "./examples/ssr-components/CustomPage.js",
19
- * "outputPath": "./dist/custom.html"
20
- * }
21
8
  */
22
9
 
23
10
  /**
@@ -1,5 +1,5 @@
1
1
  {
2
- "page": "./examples/ssr-components/CustomPage.js",
2
+ "page": "./examples/static-page/ssr-components/CustomPage.js",
3
3
  "outputPath": "./public/default.net/example.html",
4
4
  "env": "production",
5
5
  "minify": true,
@@ -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.3
20
+ image: localhost/rockylinux9-underpost:v2.95.7
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.3
103
+ image: localhost/rockylinux9-underpost:v2.95.7
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.3
21
+ image: localhost/rockylinux9-underpost:v2.95.7
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.3
106
+ image: localhost/rockylinux9-underpost:v2.95.7
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": "@underpostnet/underpost",
5
- "version": "2.95.3",
5
+ "version": "2.95.7",
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",
@@ -40,6 +40,7 @@ class UnderpostBaremetal {
40
40
  * @param {boolean} [options.controlServerUninstall=false] - Flag to uninstall the control server.
41
41
  * @param {boolean} [options.controlServerDbInstall=false] - Flag to install the control server's database.
42
42
  * @param {boolean} [options.controlServerDbUninstall=false] - Flag to uninstall the control server's database.
43
+ * @param {boolean} [options.cloudInitUpdate=false] - Flag to update cloud-init configuration on the baremetal machine.
43
44
  * @param {boolean} [options.commission=false] - Flag to commission the baremetal machine.
44
45
  * @param {boolean} [options.nfsBuild=false] - Flag to build the NFS root filesystem.
45
46
  * @param {boolean} [options.nfsMount=false] - Flag to mount the NFS root filesystem.
@@ -59,6 +60,7 @@ class UnderpostBaremetal {
59
60
  controlServerUninstall: false,
60
61
  controlServerDbInstall: false,
61
62
  controlServerDbUninstall: false,
63
+ cloudInitUpdate: false,
62
64
  commission: false,
63
65
  nfsBuild: false,
64
66
  nfsMount: false,
@@ -216,11 +218,6 @@ class UnderpostBaremetal {
216
218
  if (options.nfsBuild === true) {
217
219
  // Check if NFS is already mounted to avoid redundant builds.
218
220
  const { isMounted } = UnderpostBaremetal.API.nfsMountCallback({ hostname, workflowId });
219
- if (isMounted) {
220
- logger.warn('NFS root filesystem is mounted, skipping build.');
221
- return; // Exit if already mounted.
222
- }
223
- logger.info('NFS root filesystem is not mounted, building...');
224
221
 
225
222
  // Clean and create the NFS host path.
226
223
  shellExec(`sudo rm -rf ${nfsHostPath}/*`);
@@ -630,8 +627,13 @@ menuentry '${menuentryStr}' {
630
627
  const machine = {
631
628
  architecture: maas.image.architecture.match('amd') ? 'amd64/generic' : 'arm64/generic',
632
629
  mac_address: discovery.mac_address,
633
- hostname:
634
- discovery.hostname ?? discovery.mac_organization ?? discovery.domain ?? `generic-host-${s4()}${s4()}`,
630
+ hostname: discovery.hostname
631
+ ? discovery.hostname
632
+ : discovery.mac_organization
633
+ ? discovery.mac_organization
634
+ : discovery.domain
635
+ ? discovery.domain
636
+ : `generic-host-${s4()}${s4()}`,
635
637
  power_type: 'manual',
636
638
  mac_addresses: discovery.mac_address,
637
639
  ip: discovery.ip,
@@ -742,7 +744,7 @@ menuentry '${menuentryStr}' {
742
744
  shellExec(`sudo dnf install -y debootstrap`);
743
745
  shellExec(`sudo dnf install kernel-modules-extra-$(uname -r)`);
744
746
  // Reset QEMU user-static binfmt for proper cross-architecture execution.
745
- shellExec(`sudo podman run --rm --privileged multiarch/qemu-user-static --reset -p yes`);
747
+ shellExec(`sudo podman run --rm --privileged docker.io/multiarch/qemu-user-static:latest --reset -p yes`);
746
748
  // Mount binfmt_misc filesystem.
747
749
  shellExec(`sudo modprobe binfmt_misc`);
748
750
  shellExec(`sudo mount -t binfmt_misc binfmt_misc /proc/sys/fs/binfmt_misc`);
@@ -826,8 +828,8 @@ menuentry '${menuentryStr}' {
826
828
  break;
827
829
  }
828
830
  // Install GRUB EFI modules for both architectures to ensure compatibility.
829
- shellExec(`sudo dnf install grub2-efi-aa64-modules`);
830
- shellExec(`sudo dnf install grub2-efi-x64-modules`);
831
+ shellExec(`sudo dnf install -y grub2-efi-aa64-modules`);
832
+ shellExec(`sudo dnf install -y grub2-efi-x64-modules`);
831
833
  },
832
834
 
833
835
  /**
@@ -1044,6 +1046,8 @@ SOURCES`,
1044
1046
  `export DEBIAN_FRONTEND=noninteractive`, // Set non-interactive mode for Debian packages.
1045
1047
  `ln -fs /usr/share/zoneinfo/${timezone} /etc/localtime`, // Symlink timezone.
1046
1048
  `sudo dpkg-reconfigure --frontend noninteractive tzdata`, // Reconfigure timezone data.
1049
+ `sudo timedatectl set-timezone ${timezone}`, // Set timezone using timedatectl.
1050
+ `sudo timedatectl set-ntp true`, // Enable NTP synchronization.
1047
1051
 
1048
1052
  // Write the Chrony configuration file.
1049
1053
  `echo '
@@ -1092,6 +1096,11 @@ logdir /var/log/chrony
1092
1096
  // Enable, restart, and check status of Chrony service.
1093
1097
  `sudo systemctl enable --now ${alias}`,
1094
1098
  `sudo systemctl restart ${alias}`,
1099
+
1100
+ // Wait for chrony to synchronize
1101
+ `echo "Waiting for chrony to synchronize..."`,
1102
+ `for i in {1..30}; do chronyc tracking | grep -q "Leap status : Normal" && break || sleep 2; done`,
1103
+
1095
1104
  `sudo systemctl status ${alias}`,
1096
1105
 
1097
1106
  // Verify Chrony synchronization.
@@ -159,12 +159,18 @@ echo "sudo cloud-init modules --mode=final"`,
159
159
  logger.info('Build', `${nfsHostToolsPath}/test.sh`);
160
160
  fs.writeFileSync(
161
161
  `${nfsHostToolsPath}/test.sh`,
162
- `echo -e "\n=== Current date/time ==="
162
+ `echo -e "\necho -e "\n=== Registered users ==="
163
+ cut -d: -f1 /etc/passwd
164
+ === Current date/time ==="
163
165
  date '+%Y-%m-%d %H:%M:%S'
166
+ echo -e "\n=== Timezone Configuration ==="
167
+ timedatectl status
168
+ echo -e "\n=== Chrony Synchronization Status ==="
169
+ chronyc tracking
170
+ echo -e "\n=== Chrony Sources ==="
171
+ chronyc sources
164
172
  echo -e "\n=== Keyboard layout ==="
165
- cat /etc/default/keyboard
166
- echo -e "\n=== Registered users ==="
167
- cut -d: -f1 /etc/passwd`,
173
+ cat /etc/default/keyboard`,
168
174
  'utf8',
169
175
  );
170
176