underpost 2.8.85 → 2.8.87

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.
Files changed (70) hide show
  1. package/.env.development +7 -2
  2. package/.env.production +7 -2
  3. package/.env.test +7 -2
  4. package/.github/workflows/pwa-microservices-template-page.cd.yml +1 -1
  5. package/.github/workflows/release.cd.yml +37 -0
  6. package/README.md +7 -24
  7. package/bin/build.js +1 -0
  8. package/bin/db.js +1 -3
  9. package/bin/deploy.js +43 -368
  10. package/bin/file.js +16 -3
  11. package/bin/util.js +1 -56
  12. package/cli.md +46 -21
  13. package/conf.js +3 -3
  14. package/manifests/deployment/{dd-template-development → dd-default-development}/deployment.yaml +16 -16
  15. package/manifests/deployment/{dd-template-development → dd-default-development}/proxy.yaml +3 -3
  16. package/manifests/deployment/mongo-express/deployment.yaml +12 -12
  17. package/manifests/grafana/deployment.yaml +57 -0
  18. package/manifests/grafana/kustomization.yaml +7 -0
  19. package/manifests/grafana/pvc.yaml +12 -0
  20. package/manifests/grafana/service.yaml +14 -0
  21. package/manifests/maas/nvim.sh +91 -0
  22. package/manifests/maas/ssh-cluster-info.sh +14 -0
  23. package/manifests/prometheus/deployment.yaml +82 -0
  24. package/package.json +3 -12
  25. package/src/api/file/file.service.js +28 -8
  26. package/src/api/user/user.router.js +31 -5
  27. package/src/api/user/user.service.js +11 -38
  28. package/src/cli/cluster.js +45 -25
  29. package/src/cli/cron.js +12 -45
  30. package/src/cli/db.js +149 -19
  31. package/src/cli/deploy.js +41 -110
  32. package/src/cli/fs.js +1 -0
  33. package/src/cli/index.js +24 -7
  34. package/src/cli/monitor.js +1 -4
  35. package/src/cli/repository.js +15 -6
  36. package/src/cli/run.js +94 -16
  37. package/src/client/Default.index.js +0 -2
  38. package/src/client/components/core/Account.js +6 -2
  39. package/src/client/components/core/Content.js +11 -7
  40. package/src/client/components/core/Css.js +5 -1
  41. package/src/client/components/core/CssCore.js +12 -0
  42. package/src/client/components/core/FullScreen.js +19 -28
  43. package/src/client/components/core/Input.js +7 -1
  44. package/src/client/components/core/LogIn.js +3 -0
  45. package/src/client/components/core/LogOut.js +1 -1
  46. package/src/client/components/core/Modal.js +32 -43
  47. package/src/client/components/core/ObjectLayerEngine.js +229 -4
  48. package/src/client/components/core/ObjectLayerEngineModal.js +441 -0
  49. package/src/client/components/core/Recover.js +5 -2
  50. package/src/client/components/core/Scroll.js +65 -120
  51. package/src/client/components/core/SignUp.js +1 -0
  52. package/src/client/components/core/ToggleSwitch.js +15 -1
  53. package/src/client/components/core/VanillaJs.js +48 -2
  54. package/src/client/components/default/MenuDefault.js +2 -2
  55. package/src/client/components/default/RoutesDefault.js +3 -3
  56. package/src/client/public/default/assets/mailer/api-user-default-avatar.png +0 -0
  57. package/src/index.js +1 -1
  58. package/src/mailer/MailerProvider.js +37 -0
  59. package/src/server/client-build-docs.js +1 -1
  60. package/src/server/client-build-live.js +1 -1
  61. package/src/server/client-build.js +4 -12
  62. package/src/server/client-dev-server.js +1 -1
  63. package/src/server/client-icons.js +6 -78
  64. package/src/server/conf.js +83 -408
  65. package/src/server/proxy.js +2 -3
  66. package/src/server/runtime.js +1 -2
  67. package/src/server/start.js +5 -5
  68. package/test/api.test.js +3 -2
  69. package/docker-compose.yml +0 -67
  70. package/prometheus.yml +0 -36
package/bin/deploy.js CHANGED
@@ -17,31 +17,18 @@ import {
17
17
  addWsConf,
18
18
  buildWsSrc,
19
19
  cloneSrcComponents,
20
- getDeployGroupId,
21
- deployRun,
22
20
  getDataDeploy,
23
21
  buildReplicaId,
24
22
  Cmd,
25
- restoreMacroDb,
26
- fixDependencies,
27
- setUpProxyMaintenanceServer,
28
23
  writeEnv,
29
- getUnderpostRootPath,
30
24
  buildCliDoc,
31
25
  } from '../src/server/conf.js';
32
26
  import { buildClient } from '../src/server/client-build.js';
33
- import { range, s4, setPad, timer, uniqueArray } from '../src/client/components/core/CommonJs.js';
34
- import { MongooseDB } from '../src/db/mongo/MongooseDB.js';
35
- import { Lampp } from '../src/runtime/lampp/Lampp.js';
36
27
  import { DefaultConf } from '../conf.js';
37
- import { JSONweb } from '../src/server/client-formatted.js';
38
-
39
- import { Xampp } from '../src/runtime/xampp/Xampp.js';
40
- import { ejs } from '../src/server/json-schema.js';
41
- import { getLocalIPv4Address, ip } from '../src/server/dns.js';
42
- import { Downloader } from '../src/server/downloader.js';
43
28
  import colors from 'colors';
44
29
  import { program } from '../src/cli/index.js';
30
+ import { getLocalIPv4Address, ip } from '../src/server/dns.js';
31
+ import { timer } from '../src/client/components/core/CommonJs.js';
45
32
 
46
33
  colors.enable();
47
34
 
@@ -53,18 +40,6 @@ const [exe, dir, operator] = process.argv;
53
40
 
54
41
  try {
55
42
  switch (operator) {
56
- case 'save':
57
- {
58
- const deployId = process.argv[3];
59
- const folder = `./engine-private/conf/${deployId}`;
60
- if (fs.existsSync(folder)) fs.removeSync(folder);
61
- await Config.build({ folder });
62
- fs.writeFileSync(`${folder}/.env.production`, fs.readFileSync('./.env.production', 'utf8'), 'utf8');
63
- fs.writeFileSync(`${folder}/.env.development`, fs.readFileSync('./.env.development', 'utf8'), 'utf8');
64
- fs.writeFileSync(`${folder}/.env.test`, fs.readFileSync('./.env.test', 'utf8'), 'utf8');
65
- fs.writeFileSync(`${folder}/package.json`, fs.readFileSync('./package.json', 'utf8'), 'utf8');
66
- }
67
- break;
68
43
  case 'add-nodejs-app-client-conf':
69
44
  {
70
45
  const toOptions = {
@@ -218,7 +193,7 @@ try {
218
193
  case 'build-full-client':
219
194
  {
220
195
  dotenv.config({ override: true });
221
- if (!process.argv[3]) process.argv[3] = 'default';
196
+ if (!process.argv[3]) process.argv[3] = 'dd-default';
222
197
  const { deployId, folder } = loadConf(process.argv[3]);
223
198
 
224
199
  let argHost = process.argv[4] ? process.argv[4].split(',') : [];
@@ -258,176 +233,6 @@ try {
258
233
  }
259
234
  break;
260
235
 
261
- case 'xampp': {
262
- const directory = 'c:/xampp/htdocs';
263
- const host = 'localhost';
264
- const port = 80;
265
- Xampp.removeRouter();
266
- Xampp.appendRouter(` Listen ${port}
267
- <VirtualHost *:${port}>
268
- DocumentRoot "${directory}"
269
- ServerName ${host}:${port}
270
-
271
- <Directory "${directory}">
272
- Options Indexes FollowSymLinks MultiViews
273
- AllowOverride All
274
- Require all granted
275
- </Directory>
276
-
277
- </VirtualHost>
278
- `);
279
- if (Xampp.enabled() && Xampp.router) Xampp.initService({ daemon: true });
280
- break;
281
- }
282
-
283
- case 'adminer': {
284
- const directory = '/home/dd/engine/public/adminer';
285
- // const host = '127.0.0.1';
286
- const host = 'localhost';
287
- const port = 80;
288
- if (!process.argv.includes('server')) {
289
- if (fs.existsSync(directory)) fs.removeSync(directory);
290
- fs.mkdirSync(directory, { recursive: true });
291
- shellExec(`cd ${directory} && wget https://www.adminer.org/latest.php -O adminer.php`);
292
- }
293
- Lampp.removeRouter();
294
- Lampp.appendRouter(` Listen ${port}
295
- <VirtualHost *:${port}>
296
- DocumentRoot "${directory}"
297
- ServerName ${host}:${port}
298
-
299
- <Directory "${directory}">
300
- Options Indexes FollowSymLinks MultiViews
301
- AllowOverride All
302
- Require all granted
303
- </Directory>
304
-
305
- </VirtualHost>
306
- `);
307
- if (Lampp.enabled() && Lampp.router) Lampp.initService({ daemon: true });
308
- shellExec(`open /opt/lampp/apache2/conf/httpd.conf`);
309
- break;
310
- }
311
-
312
- case 'pma':
313
- {
314
- const directory = '/home/dd/engine/public/phpmyadmin';
315
- // const host = '127.0.0.1';
316
- const host = 'localhost';
317
- const port = 80;
318
- // data config path: /etc/phpmyadmin
319
-
320
- // The config.inc.php file is not required, and only needed for custom configurations
321
-
322
- // phpmyadmin will first refer to ./libraries/config.default.php to retrieve the default values.
323
-
324
- // If for some reason you need to modify the default values, and the ./config.inc.php
325
- // file doesn't exist, you will need to create one as per the Installation documentation.
326
-
327
- // You will also need to configure pmadb for some of phpmyadmin's special features such as bookmarks.
328
-
329
- // CREATE USER 'pma'@'localhost' IDENTIFIED VIA mysql_native_password USING 'pmapass';
330
- // GRANT SELECT, INSERT, UPDATE, DELETE ON `<pma_db>`.* TO 'pma'@'localhost';
331
-
332
- if (!process.argv.includes('server')) {
333
- // if (fs.existsSync(directory)) fs.removeSync(directory);
334
- shellExec(`sudo apt install phpmyadmin php-mbstring php-zip php-gd php-json php-curl`);
335
- shellExec(`sudo phpenmod mbstring`);
336
- shellExec(
337
- `cd /usr/share/phpmyadmin && git init && git add . && git commit -m "Base phpMyAdmin implementation"`,
338
- );
339
- }
340
-
341
- // if (!fs.existsSync(directory)) fs.mkdirSync(directory, { recursive: true });
342
- // if (!fs.existsSync('./public/phpmyadmin/phpmyadmin'))
343
- // fs.copySync('/usr/share/phpmyadmin', './public/phpmyadmin/phpmyadmin');
344
-
345
- Lampp.removeRouter();
346
- Lampp.appendRouter(` Listen ${port} `);
347
- if (Lampp.enabled() && Lampp.router) Lampp.initService({ daemon: true });
348
- // shellExec(`open /opt/lampp/apache2/conf/httpd.conf`);
349
-
350
- // Create a link in /var/www like this:
351
-
352
- // sudo ln -s /usr/share/phpmyadmin /var/www/
353
-
354
- // Note: since 14.04 you may want to use /var/www/html/ instead of /var/www/
355
-
356
- // If that's not working for you, you need to include PHPMyAdmin inside apache configuration.
357
-
358
- // Open apache.conf using your favorite editor, mine is vim :)
359
-
360
- // sudo vim /etc/apache2/apache2.conf
361
-
362
- // Then add the following line:
363
-
364
- // Include /etc/phpmyadmin/apache.conf
365
-
366
- // For Ubuntu 15.04 and 16.04
367
-
368
- // sudo ln -s /etc/phpmyadmin/apache.conf /etc/apache2/conf-available/phpmyadmin.conf
369
- // sudo a2enconf phpmyadmin.conf
370
- // sudo service apache2 reload
371
- break;
372
- Lampp.appendRouter(` Listen ${port}
373
-
374
- <VirtualHost *:${port}>
375
- DocumentRoot "${directory}"
376
- ServerName ${host}:${port}
377
-
378
- <Directory "${directory}">
379
- Options Indexes FollowSymLinks MultiViews
380
- AllowOverride All
381
- Require all granted
382
- </Directory>
383
-
384
- </VirtualHost>`);
385
- // phpMyAdmin default Apache configuration:
386
- Lampp.appendRouter(`
387
-
388
- Listen ${port}
389
-
390
- Alias /phpmyadmin /usr/share/phpmyadmin
391
-
392
- <Directory /usr/share/phpmyadmin>
393
- Options Indexes FollowSymLinks
394
- DirectoryIndex index.php
395
-
396
- <IfModule mod_php5.c>
397
- AddType application/x-httpd-php .php
398
-
399
- php_flag magic_quotes_gpc Off
400
- php_flag track_vars On
401
- php_flag register_globals Off
402
- php_value include_path .
403
- </IfModule>
404
-
405
- </Directory>
406
-
407
- # Authorize for setup
408
- <Directory /usr/share/phpmyadmin/setup>
409
- <IfModule mod_authn_file.c>
410
- AuthType Basic
411
- AuthName "phpMyAdmin Setup"
412
- AuthUserFile /etc/phpmyadmin/htpasswd.setup
413
- </IfModule>
414
- Require valid-user
415
- </Directory>
416
-
417
- # Disallow web access to directories that don't need it
418
- <Directory /usr/share/phpmyadmin/libraries>
419
- Order Deny,Allow
420
- Deny from All
421
- </Directory>
422
- <Directory /usr/share/phpmyadmin/setup/lib>
423
- Order Deny,Allow
424
- Deny from All
425
- </Directory>
426
-
427
- `);
428
- }
429
- break;
430
-
431
236
  case 'update-dependencies':
432
237
  const files = await fs.readdir(`./engine-private/conf`, { recursive: true });
433
238
  const originPackage = JSON.parse(fs.readFileSync(`./package.json`, 'utf8'));
@@ -442,64 +247,6 @@ try {
442
247
  }
443
248
  break;
444
249
 
445
- case 'run-macro':
446
- {
447
- if (fs.existsSync(`./tmp/await-deploy`)) fs.remove(`./tmp/await-deploy`);
448
- const dataDeploy = getDataDeploy({
449
- deployGroupId: process.argv[3],
450
- buildSingleReplica: true,
451
- deployIdConcat: ['dd-proxy', 'dd-cron'],
452
- });
453
- if (!process.argv[4]) await setUpProxyMaintenanceServer({ deployGroupId: process.argv[3] });
454
- await deployRun(process.argv[4] ? dataDeploy.filter((d) => d.deployId.match(process.argv[4])) : dataDeploy);
455
- }
456
- break;
457
-
458
- case 'build-macro':
459
- {
460
- const dataDeploy = getDataDeploy({ deployGroupId: process.argv[3], buildSingleReplica: true });
461
- for (const deploy of dataDeploy) {
462
- if (!process.argv[4] || (process.argv[4] && process.argv[4] === deploy.deployId)) {
463
- shellExec(Cmd.conf(deploy.deployId));
464
- shellExec(Cmd.build(deploy.deployId));
465
- }
466
- }
467
- }
468
- break;
469
- case 'macro': {
470
- shellExec(`git checkout .`);
471
- shellExec(`node bin/deploy build-macro ${process.argv.slice(3).join(' ')}`);
472
- shellExec(`git checkout .`);
473
- shellExec(`node bin/deploy run-macro ${process.argv.slice(3).join(' ')}`);
474
- break;
475
- }
476
-
477
- case 'keep-server': {
478
- await setUpProxyMaintenanceServer({ deployGroupId: process.argv[3] });
479
- break;
480
- }
481
- case 'prometheus':
482
- case 'prom':
483
- {
484
- const rangePort = [1, 20];
485
- const promConfigPath = `./engine-private/prometheus/prometheus-service-config.yml`;
486
- const rawConfig = fs
487
- .readFileSync(promConfigPath, 'utf8')
488
- .replaceAll(
489
- `['']`,
490
- JSON.stringify(range(...rangePort).map((i) => `host.docker.internal:30${setPad(i, '0', 2)}`)).replaceAll(
491
- `"`,
492
- `'`,
493
- ),
494
- );
495
- console.log(rawConfig);
496
-
497
- fs.writeFileSync(promConfigPath, rawConfig, 'utf8');
498
-
499
- shellExec(`docker-compose -f engine-private/prometheus/prometheus-service.yml up -d`);
500
- }
501
- break;
502
-
503
250
  case 'sync-env-port':
504
251
  const dataDeploy = getDataDeploy({ deployGroupId: process.argv[3], disableSyncEnvPort: true });
505
252
  const dataEnv = [
@@ -512,23 +259,20 @@ try {
512
259
  for (const deployIdObj of dataDeploy) {
513
260
  const { deployId, replicaHost } = deployIdObj;
514
261
  if (replicaHost && !singleReplicaHosts.includes(replicaHost)) singleReplicaHosts.push(replicaHost);
515
- const proxyInstance = deployId.match('proxy') || deployId.match('cron');
516
262
  const baseConfPath = fs.existsSync(`./engine-private/replica/${deployId}`)
517
263
  ? `./engine-private/replica`
518
264
  : `./engine-private/conf`;
519
265
  for (const envInstanceObj of dataEnv) {
520
266
  const envPath = `${baseConfPath}/${deployId}/.env.${envInstanceObj.env}`;
521
267
  const envObj = dotenv.parse(fs.readFileSync(envPath, 'utf8'));
522
- envObj.PORT = proxyInstance
523
- ? envInstanceObj.port
524
- : envInstanceObj.port + port - singleReplicaHosts.length - (replicaHost ? 1 : 0);
268
+ envObj.PORT = envInstanceObj.port + port - singleReplicaHosts.length - (replicaHost ? 1 : 0);
525
269
 
526
270
  writeEnv(envPath, envObj);
527
271
  }
528
272
  const serverConf = loadReplicas(
529
273
  JSON.parse(fs.readFileSync(`${baseConfPath}/${deployId}/conf.server.json`, 'utf8')),
530
274
  );
531
- if (!proxyInstance) for (const host of Object.keys(serverConf)) port += Object.keys(serverConf[host]).length;
275
+ for (const host of Object.keys(serverConf)) port += Object.keys(serverConf[host]).length;
532
276
  }
533
277
  break;
534
278
 
@@ -584,9 +328,6 @@ try {
584
328
  }
585
329
  break;
586
330
  }
587
- case 'build-macro-replica':
588
- getDataDeploy({ deployGroupId: process.argv[3], buildSingleReplica: true });
589
- break;
590
331
 
591
332
  case 'rename-package': {
592
333
  const name = process.argv[3];
@@ -613,7 +354,7 @@ try {
613
354
  break;
614
355
  }
615
356
 
616
- case 'version-build': {
357
+ case 'clean-core-repo': {
617
358
  shellCd(`/home/dd/engine`);
618
359
  shellExec(`git reset`);
619
360
  shellExec(`git checkout .`);
@@ -623,8 +364,26 @@ try {
623
364
  shellExec(`git checkout .`);
624
365
  shellExec(`git clean -f -d`);
625
366
  shellCd(`/home/dd/engine`);
367
+ break;
368
+ }
369
+
370
+ case 'version-build': {
371
+ shellExec(`node bin run kill 4001`);
372
+ shellExec(`node bin run kill 4002`);
373
+ shellExec(`node bin run kill 4003`);
374
+ shellExec(`npm run update-template`);
375
+ shellExec(`cd ../pwa-microservices-template && npm run build && timeout 5s npm run dev`, {
376
+ async: true,
377
+ });
378
+ await timer(5500);
379
+ const templateRunnerResult = fs.readFileSync(`../pwa-microservices-template/logs/start.js/all.log`, 'utf8');
380
+ logger.info('Test template runner result');
381
+ console.log(templateRunnerResult);
382
+ shellExec(`node bin/deploy clean-core-repo`);
383
+ shellCd(`/home/dd/engine`);
626
384
  const originPackageJson = JSON.parse(fs.readFileSync(`package.json`, 'utf8'));
627
385
  const newVersion = process.argv[3] ?? originPackageJson.version;
386
+ const node = process.argv[4] ?? 'kind-control-plane';
628
387
  const { version } = originPackageJson;
629
388
  originPackageJson.version = newVersion;
630
389
  fs.writeFileSync(`package.json`, JSON.stringify(originPackageJson, null, 4), 'utf8');
@@ -657,16 +416,9 @@ try {
657
416
  }
658
417
 
659
418
  fs.writeFileSync(
660
- `./docker-compose.yml`,
419
+ `./manifests/deployment/dd-default-development/deployment.yaml`,
661
420
  fs
662
- .readFileSync(`./docker-compose.yml`, 'utf8')
663
- .replaceAll(`engine.version: '${version}'`, `engine.version: '${newVersion}'`),
664
- 'utf8',
665
- );
666
- fs.writeFileSync(
667
- `./manifests/deployment/dd-template-development/deployment.yaml`,
668
- fs
669
- .readFileSync(`./manifests/deployment/dd-template-development/deployment.yaml`, 'utf8')
421
+ .readFileSync(`./manifests/deployment/dd-default-development/deployment.yaml`, 'utf8')
670
422
  .replaceAll(`underpost:v${version}`, `underpost:v${newVersion}`),
671
423
  'utf8',
672
424
  );
@@ -689,8 +441,23 @@ try {
689
441
  shellExec(`node bin/deploy update-dependencies`);
690
442
  shellExec(`auto-changelog`);
691
443
  shellExec(`node bin/build dd`);
692
- shellExec(`node bin deploy --kubeadm --build-manifest --sync --info-router --replicas 1 dd`);
693
- shellExec(`node bin deploy --kubeadm --build-manifest --sync --info-router --replicas 1 dd production`);
444
+ shellExec(
445
+ `node bin deploy --kubeadm --build-manifest --sync --info-router --replicas 1 --node ${node} dd production`,
446
+ );
447
+ for (const deployId of fs.readFileSync(`./engine-private/deploy/dd.router`, 'utf8').split(`,`)) {
448
+ fs.copySync(
449
+ `./engine-private/conf/${deployId}/build/development/deployment.yaml`,
450
+ `./manifests/deployment/${deployId}-development/deployment.yaml`,
451
+ );
452
+ fs.copySync(
453
+ `./engine-private/conf/${deployId}/build/development/proxy.yaml`,
454
+ `./manifests/deployment/${deployId}-development/proxy.yaml`,
455
+ );
456
+ }
457
+ shellExec(`sudo rm -rf ./engine-private/conf/dd-default`);
458
+ shellExec(`node bin new --deploy-id dd-default`);
459
+ console.log(fs.existsSync(`./engine-private/conf/dd-default`));
460
+ shellExec(`sudo rm -rf ./engine-private/conf/dd-default`);
694
461
  break;
695
462
  }
696
463
 
@@ -723,25 +490,6 @@ ${shellExec(`git log | grep Author: | sort -u`, { stdout: true }).split(`\n`).jo
723
490
  break;
724
491
  }
725
492
 
726
- case 'restore-macro-db':
727
- {
728
- const deployGroupId = process.argv[3];
729
- const deployId = process.argv[4];
730
- await restoreMacroDb(deployGroupId, deployId);
731
- }
732
-
733
- break;
734
-
735
- case 'mongo': {
736
- await MongooseDB.server();
737
- break;
738
- }
739
-
740
- case 'lampp': {
741
- await Lampp.install();
742
- break;
743
- }
744
-
745
493
  case 'heb': {
746
494
  // https://besu.hyperledger.org/
747
495
  // https://github.com/hyperledger/besu/archive/refs/tags/24.9.1.tar.gz
@@ -777,11 +525,6 @@ ${shellExec(`git log | grep Author: | sort -u`, { stdout: true }).split(`\n`).jo
777
525
  break;
778
526
  }
779
527
 
780
- case 'fix-deps': {
781
- await fixDependencies();
782
- break;
783
- }
784
-
785
528
  case 'update-default-conf': {
786
529
  const defaultServer = DefaultConf.server['default.net']['/'];
787
530
  let confName = process.argv[3];
@@ -984,74 +727,6 @@ EOF`);
984
727
  break;
985
728
  }
986
729
 
987
- case 'valkey': {
988
- if (!process.argv.includes('server')) {
989
- if (process.argv.includes('rocky')) {
990
- // shellExec(`yum install -y https://repo.percona.com/yum/percona-release-latest.noarch.rpm`);
991
- // shellExec(`sudo percona-release enable valkey experimental`);
992
- shellExec(`sudo dnf install valkey`);
993
- shellExec(`chown -R valkey:valkey /etc/valkey`);
994
- shellExec(`chown -R valkey:valkey /var/lib/valkey`);
995
- shellExec(`chown -R valkey:valkey /var/log/valkey`);
996
- shellExec(`sudo systemctl enable valkey.service`);
997
- shellExec(`sudo systemctl start valkey`);
998
- shellExec(`valkey-cli ping`);
999
- } else {
1000
- shellExec(`cd /home/dd && git clone https://github.com/valkey-io/valkey.git`);
1001
- shellExec(`cd /home/dd/valkey && make`);
1002
- shellExec(`apt install valkey-tools`); // valkey-cli
1003
- }
1004
- }
1005
- if (process.argv.includes('rocky')) {
1006
- shellExec(`sudo systemctl stop valkey`);
1007
- shellExec(`sudo systemctl start valkey`);
1008
- } else shellExec(`cd /home/dd/valkey && ./src/valkey-server`);
1009
-
1010
- break;
1011
- }
1012
-
1013
- case 'valkey-service': {
1014
- shellExec(`pm2 start bin/deploy.js --node-args=\"--max-old-space-size=8192\" --name valkey -- valkey server`);
1015
- break;
1016
- }
1017
-
1018
- case 'update-instances': {
1019
- shellExec(`node bin deploy dd production --sync --build-manifest --info-router --dashboard-update`);
1020
- shellExec(`node bin cron --dashboard-update --init`);
1021
- const deployId = 'dd-core';
1022
- const host = 'www.nexodev.org';
1023
- const path = '/';
1024
-
1025
- {
1026
- const outputPath = './engine-private/instances';
1027
- if (fs.existsSync(outputPath)) fs.mkdirSync(outputPath, { recursive: true });
1028
- const collection = 'instances';
1029
- if (process.argv.includes('export'))
1030
- shellExec(
1031
- `node bin db --export --collections ${collection} --out-path ${outputPath} --hosts ${host} --paths '${path}' ${deployId}`,
1032
- );
1033
- if (process.argv.includes('import'))
1034
- shellExec(
1035
- `node bin db --import --drop --preserveUUID --out-path ${outputPath} --hosts ${host} --paths '${path}' ${deployId}`,
1036
- );
1037
- }
1038
- {
1039
- const outputPath = './engine-private/crons';
1040
- if (fs.existsSync(outputPath)) fs.mkdirSync(outputPath, { recursive: true });
1041
- const collection = 'crons';
1042
- if (process.argv.includes('export'))
1043
- shellExec(
1044
- `node bin db --export --collections ${collection} --out-path ${outputPath} --hosts ${host} --paths '${path}' ${deployId}`,
1045
- );
1046
- if (process.argv.includes('import'))
1047
- shellExec(
1048
- `node bin db --import --drop --preserveUUID --out-path ${outputPath} --hosts ${host} --paths '${path}' ${deployId}`,
1049
- );
1050
- }
1051
-
1052
- break;
1053
- }
1054
-
1055
730
  case 'cli-docs': {
1056
731
  buildCliDoc(program, process.argv[3], process.argv[4]);
1057
732
  break;
package/bin/file.js CHANGED
@@ -55,7 +55,17 @@ try {
55
55
 
56
56
  console.log('copy paths', result);
57
57
 
58
- if (type !== 'update-template') fs.removeSync(toPath);
58
+ if (type === 'update-template') {
59
+ if (!fs.existsSync(toPath)) shellExec(`cd .. && underpost clone underpostnet/pwa-microservices-template`);
60
+ else {
61
+ shellExec(`cd ${toPath} && git reset && git checkout . && git clean -f -d`);
62
+ shellExec(`underpost pull ${toPath} underpostnet/pwa-microservices-template`);
63
+ shellExec(`sudo rm -rf ${toPath}/engine-private`);
64
+ shellExec(`sudo rm -rf ${toPath}/logs`);
65
+ }
66
+ } else {
67
+ fs.removeSync(toPath);
68
+ }
59
69
 
60
70
  for (const copyPath of result) {
61
71
  const folder = getDirname(`${toPath}/${copyPath}`);
@@ -83,8 +93,10 @@ try {
83
93
  './manifests/deployment/dd-lampp-development',
84
94
  './manifests/deployment/dd-cyberia-development',
85
95
  './manifests/deployment/dd-core-development',
96
+ './manifests/deployment/dd-template-development',
86
97
  'bin/web3.js',
87
98
  'bin/cyberia.js',
99
+ 'bin/cyberia0.js',
88
100
  ]) {
89
101
  if (fs.existsSync(deletePath)) fs.removeSync('../pwa-microservices-template/' + deletePath);
90
102
  }
@@ -98,6 +110,7 @@ try {
98
110
  `./.github/workflows/npmpkg.ci.yml`,
99
111
  `./.github/workflows/ghpkg.ci.yml`,
100
112
  `./.github/workflows/publish.ci.yml`,
113
+ `./.github/workflows/release.cd.yml`,
101
114
  ])
102
115
  fs.copyFileSync(_path, `../pwa-microservices-template/${_path}`);
103
116
 
@@ -115,8 +128,8 @@ try {
115
128
  templatePackageJson.scripts = originPackageJson.scripts;
116
129
  templatePackageJson.name = name;
117
130
  templatePackageJson.description = description;
118
- templatePackageJson.scripts.dev = dev;
119
- templatePackageJson.scripts.build = build;
131
+ // templatePackageJson.scripts.dev = dev;
132
+ // templatePackageJson.scripts.build = build;
120
133
  templatePackageJson.keywords = uniqueArray(
121
134
  ['pwa', 'microservices', 'template', 'builder'].concat(templatePackageJson.keywords),
122
135
  );
package/bin/util.js CHANGED
@@ -1,14 +1,10 @@
1
1
  import fs from 'fs-extra';
2
2
  import si from 'systeminformation';
3
3
  import * as dir from 'path';
4
- import { svg } from 'font-awesome-assets';
5
4
 
6
5
  import { loggerFactory } from '../src/server/logger.js';
7
- import { pbcopy, shellExec } from '../src/server/process.js';
6
+ import { pbcopy } from '../src/server/process.js';
8
7
  import { buildKindPorts } from '../src/server/conf.js';
9
- import { FileFactory } from '../src/api/file/file.service.js';
10
- import { faBase64Png, getBufferPngText } from '../src/server/client-icons.js';
11
- import keyword_extractor from 'keyword-extractor';
12
8
 
13
9
  const logger = loggerFactory(import.meta);
14
10
 
@@ -73,57 +69,6 @@ try {
73
69
  cleanEmptyFoldersRecursively('./');
74
70
  break;
75
71
 
76
- case 'text-to-image': {
77
- const buffer = await getBufferPngText({
78
- text: process.argv[3],
79
- textColor: process.argv[4],
80
- bgColor: process.argv[5],
81
- size: process.argv[6],
82
- debugFilename: process.argv[7],
83
- });
84
- fs.writeFileSync(`./text-to-image.png`, buffer);
85
- break;
86
- }
87
- case 'fa-image':
88
- const faId = process.argv[3] ? process.argv[3] : 'user';
89
- const color = process.argv[4] ? process.argv[4] : '#5f5f5f';
90
- const path = process.argv[5] ? process.argv[5] : './';
91
-
92
- {
93
- fs.writeFileSync(`./tmp/${faId}.svg`, svg(faId, color), 'utf8');
94
- const data = fs.readFileSync(`./tmp/${faId}.svg`);
95
- console.log(FileFactory.svg(data, `${faId}.svg`));
96
- fs.removeSync(`${path}${faId}.svg`);
97
- }
98
- {
99
- fs.writeFileSync(`${path}${faId}.png`, Buffer.from(faBase64Png(faId, 100, 100, color), 'base64'));
100
- }
101
-
102
- break;
103
-
104
- case 'b64-image':
105
- fs.writeFileSync('b64-image', `data:image/jpg;base64,${fs.readFileSync(process.argv[3]).toString('base64')}`);
106
- break;
107
-
108
- case 'get-keys': {
109
- const sentence = fs.existsSync('./_')
110
- ? fs.readFileSync('./_', 'utf8')
111
- : process.argv[3]
112
- ? process.argv[3]
113
- : 'President Obama woke up Monday facing a Congressional defeat that many in both parties believed could hobble his presidency.';
114
-
115
- // Extract the keywords
116
- const extraction_result = keyword_extractor.extract(sentence, {
117
- language: 'english',
118
- remove_digits: true,
119
- // return_changed_case: true,
120
- // remove_duplicates: false,
121
- });
122
-
123
- console.log(extraction_result.join(', '));
124
- break;
125
- }
126
-
127
72
  case 'build-ports': {
128
73
  pbcopy(buildKindPorts(process.argv[3], process.argv[4]));
129
74
  }