underpost 2.8.84 → 2.8.86
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.development +1 -0
- package/.env.production +1 -0
- package/.env.test +1 -0
- package/.github/workflows/{ghpkg.yml → ghpkg.ci.yml} +1 -1
- package/.github/workflows/{npmpkg.yml → npmpkg.ci.yml} +1 -1
- package/.github/workflows/{publish.yml → publish.ci.yml} +1 -1
- package/.github/workflows/{pwa-microservices-template.page.yml → pwa-microservices-template-page.cd.yml} +2 -2
- package/.github/workflows/{pwa-microservices-template.test.yml → pwa-microservices-template-test.ci.yml} +1 -1
- package/.github/workflows/release.cd.yml +37 -0
- package/.vscode/settings.json +0 -1
- package/README.md +16 -10
- package/bin/build.js +15 -5
- package/bin/cyberia0.js +78 -0
- package/bin/db.js +1 -3
- package/bin/deploy.js +29 -431
- package/bin/file.js +26 -9
- package/cli.md +102 -61
- package/conf.js +1 -1
- package/manifests/deployment/{dd-template-development → dd-default-development}/deployment.yaml +16 -16
- package/manifests/deployment/{dd-template-development → dd-default-development}/proxy.yaml +3 -3
- package/manifests/grafana/deployment.yaml +57 -0
- package/manifests/grafana/kustomization.yaml +7 -0
- package/manifests/grafana/pvc.yaml +12 -0
- package/manifests/grafana/service.yaml +14 -0
- package/manifests/maas/gpu-diag.sh +1 -1
- package/manifests/maas/ssh-cluster-info.sh +14 -0
- package/manifests/prometheus/deployment.yaml +82 -0
- package/package.json +4 -7
- package/src/api/user/user.router.js +24 -1
- package/src/api/user/user.service.js +9 -38
- package/src/cli/cluster.js +83 -29
- package/src/cli/cron.js +12 -45
- package/src/cli/db.js +149 -0
- package/src/cli/deploy.js +40 -81
- package/src/cli/index.js +29 -6
- package/src/cli/monitor.js +9 -16
- package/src/cli/repository.js +12 -5
- package/src/cli/run.js +175 -7
- package/src/cli/ssh.js +32 -0
- package/src/client/Default.index.js +7 -5
- package/src/client/components/core/Account.js +7 -3
- package/src/client/components/core/Chat.js +1 -1
- package/src/client/components/core/CommonJs.js +24 -22
- package/src/client/components/core/Content.js +12 -12
- package/src/client/components/core/Css.js +262 -18
- package/src/client/components/core/CssCore.js +8 -8
- package/src/client/components/core/Docs.js +14 -61
- package/src/client/components/core/DropDown.js +137 -82
- package/src/client/components/core/EventsUI.js +92 -5
- package/src/client/components/core/Input.js +6 -1
- package/src/client/components/core/LoadingAnimation.js +8 -15
- package/src/client/components/core/LogIn.js +3 -0
- package/src/client/components/core/LogOut.js +1 -1
- package/src/client/components/core/Modal.js +601 -137
- package/src/client/components/core/NotificationManager.js +2 -2
- package/src/client/components/core/ObjectLayerEngine.js +638 -0
- package/src/client/components/core/Panel.js +158 -34
- package/src/client/components/core/PanelForm.js +12 -3
- package/src/client/components/core/Recover.js +6 -3
- package/src/client/components/core/Router.js +77 -17
- package/src/client/components/core/Scroll.js +65 -120
- package/src/client/components/core/SignUp.js +1 -0
- package/src/client/components/core/SocketIo.js +3 -3
- package/src/client/components/core/Translate.js +6 -2
- package/src/client/components/core/VanillaJs.js +48 -5
- package/src/client/components/core/Worker.js +3 -1
- package/src/client/components/default/CssDefault.js +17 -3
- package/src/client/components/default/MenuDefault.js +266 -47
- package/src/client/components/default/RoutesDefault.js +8 -14
- package/src/client/public/default/android-chrome-144x144.png +0 -0
- package/src/client/public/default/android-chrome-192x192.png +0 -0
- package/src/client/public/default/android-chrome-256x256.png +0 -0
- package/src/client/public/default/android-chrome-36x36.png +0 -0
- package/src/client/public/default/android-chrome-48x48.png +0 -0
- package/src/client/public/default/android-chrome-72x72.png +0 -0
- package/src/client/public/default/android-chrome-96x96.png +0 -0
- package/src/client/public/default/apple-touch-icon-114x114-precomposed.png +0 -0
- package/src/client/public/default/apple-touch-icon-114x114.png +0 -0
- package/src/client/public/default/apple-touch-icon-120x120-precomposed.png +0 -0
- package/src/client/public/default/apple-touch-icon-120x120.png +0 -0
- package/src/client/public/default/apple-touch-icon-144x144-precomposed.png +0 -0
- package/src/client/public/default/apple-touch-icon-144x144.png +0 -0
- package/src/client/public/default/apple-touch-icon-152x152-precomposed.png +0 -0
- package/src/client/public/default/apple-touch-icon-152x152.png +0 -0
- package/src/client/public/default/apple-touch-icon-180x180-precomposed.png +0 -0
- package/src/client/public/default/apple-touch-icon-180x180.png +0 -0
- package/src/client/public/default/apple-touch-icon-57x57-precomposed.png +0 -0
- package/src/client/public/default/apple-touch-icon-57x57.png +0 -0
- package/src/client/public/default/apple-touch-icon-60x60-precomposed.png +0 -0
- package/src/client/public/default/apple-touch-icon-60x60.png +0 -0
- package/src/client/public/default/apple-touch-icon-72x72-precomposed.png +0 -0
- package/src/client/public/default/apple-touch-icon-72x72.png +0 -0
- package/src/client/public/default/apple-touch-icon-76x76-precomposed.png +0 -0
- package/src/client/public/default/apple-touch-icon-76x76.png +0 -0
- package/src/client/public/default/apple-touch-icon-precomposed.png +0 -0
- package/src/client/public/default/apple-touch-icon.png +0 -0
- package/src/client/public/default/assets/background/dark.jpg +0 -0
- package/src/client/public/default/assets/background/dark.svg +557 -0
- package/src/client/public/default/assets/logo/base-icon.png +0 -0
- package/src/client/public/default/assets/logo/underpost.gif +0 -0
- package/src/client/public/default/assets/mailer/api-user-check.png +0 -0
- package/src/client/public/default/assets/mailer/api-user-invalid-token.png +0 -0
- package/src/client/public/default/assets/mailer/api-user-recover.png +0 -0
- package/src/client/public/default/favicon-16x16.png +0 -0
- package/src/client/public/default/favicon-32x32.png +0 -0
- package/src/client/public/default/favicon.ico +0 -0
- package/src/client/public/default/mstile-144x144.png +0 -0
- package/src/client/public/default/mstile-150x150.png +0 -0
- package/src/client/public/default/mstile-310x150.png +0 -0
- package/src/client/public/default/mstile-310x310.png +0 -0
- package/src/client/public/default/mstile-70x70.png +0 -0
- package/src/client/public/default/safari-pinned-tab.svg +24 -0
- package/src/client/ssr/body/DefaultSplashScreen.js +2 -2
- package/src/index.js +9 -1
- package/src/mailer/MailerProvider.js +37 -0
- package/src/monitor.js +24 -0
- package/src/runtime/lampp/Dockerfile +30 -39
- package/src/runtime/lampp/Lampp.js +11 -2
- package/src/server/client-build-docs.js +205 -0
- package/src/server/client-build-live.js +1 -1
- package/src/server/client-build.js +16 -166
- package/src/server/client-dev-server.js +1 -1
- package/src/server/conf.js +14 -277
- package/src/server/proxy.js +1 -2
- package/src/server/start.js +3 -3
- package/src/server/valkey.js +102 -41
- package/docker-compose.yml +0 -67
- package/prometheus.yml +0 -36
package/bin/deploy.js
CHANGED
|
@@ -17,31 +17,17 @@ 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';
|
|
45
31
|
|
|
46
32
|
colors.enable();
|
|
47
33
|
|
|
@@ -55,7 +41,8 @@ try {
|
|
|
55
41
|
switch (operator) {
|
|
56
42
|
case 'save':
|
|
57
43
|
{
|
|
58
|
-
|
|
44
|
+
let deployId = process.argv[3] ?? 'dd-default';
|
|
45
|
+
if (!deployId.startsWith('dd-')) deployId = 'dd-default';
|
|
59
46
|
const folder = `./engine-private/conf/${deployId}`;
|
|
60
47
|
if (fs.existsSync(folder)) fs.removeSync(folder);
|
|
61
48
|
await Config.build({ folder });
|
|
@@ -218,7 +205,7 @@ try {
|
|
|
218
205
|
case 'build-full-client':
|
|
219
206
|
{
|
|
220
207
|
dotenv.config({ override: true });
|
|
221
|
-
if (!process.argv[3]) process.argv[3] = 'default';
|
|
208
|
+
if (!process.argv[3]) process.argv[3] = 'dd-default';
|
|
222
209
|
const { deployId, folder } = loadConf(process.argv[3]);
|
|
223
210
|
|
|
224
211
|
let argHost = process.argv[4] ? process.argv[4].split(',') : [];
|
|
@@ -258,176 +245,6 @@ try {
|
|
|
258
245
|
}
|
|
259
246
|
break;
|
|
260
247
|
|
|
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
248
|
case 'update-dependencies':
|
|
432
249
|
const files = await fs.readdir(`./engine-private/conf`, { recursive: true });
|
|
433
250
|
const originPackage = JSON.parse(fs.readFileSync(`./package.json`, 'utf8'));
|
|
@@ -442,64 +259,6 @@ try {
|
|
|
442
259
|
}
|
|
443
260
|
break;
|
|
444
261
|
|
|
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
262
|
case 'sync-env-port':
|
|
504
263
|
const dataDeploy = getDataDeploy({ deployGroupId: process.argv[3], disableSyncEnvPort: true });
|
|
505
264
|
const dataEnv = [
|
|
@@ -531,74 +290,6 @@ try {
|
|
|
531
290
|
if (!proxyInstance) for (const host of Object.keys(serverConf)) port += Object.keys(serverConf[host]).length;
|
|
532
291
|
}
|
|
533
292
|
break;
|
|
534
|
-
case 'uml':
|
|
535
|
-
{
|
|
536
|
-
shellExec(`node bin/deploy fix-uml ${process.argv.slice(3).join(' ')}`);
|
|
537
|
-
shellExec(`node bin/deploy build-uml ${process.argv.slice(3).join(' ')}`);
|
|
538
|
-
}
|
|
539
|
-
break;
|
|
540
|
-
|
|
541
|
-
case 'fix-uml': {
|
|
542
|
-
// required: java jdk-11.0.1
|
|
543
|
-
|
|
544
|
-
// comment:
|
|
545
|
-
// '--add-opens=java.xml/com.sun.org.apache.xalan.internal.xsltc.trax="ALL-UNNAMED"'
|
|
546
|
-
// in plantuml.js src
|
|
547
|
-
|
|
548
|
-
// const deployId = process.argv[3];
|
|
549
|
-
// const clientId = process.argv[4];
|
|
550
|
-
// const folder = `./src/client/public/${clientId ? clientId : 'default'}/docs/plantuml`;
|
|
551
|
-
// const privateConfFolder = `./engine-private/conf/${deployId}`;
|
|
552
|
-
// const confData = !deployId
|
|
553
|
-
// ? Config.default
|
|
554
|
-
// : {
|
|
555
|
-
// client: JSON.parse(fs.readFileSync(`${privateConfFolder}/conf.client.json`, 'utf8')),
|
|
556
|
-
// ssr: JSON.parse(fs.readFileSync(`${privateConfFolder}/conf.ssr.json`, 'utf8')),
|
|
557
|
-
// server: JSON.parse(fs.readFileSync(`${privateConfFolder}/conf.server.json`, 'utf8')),
|
|
558
|
-
// cron: JSON.parse(fs.readFileSync(`${privateConfFolder}/conf.cron.json`, 'utf8')),
|
|
559
|
-
// };
|
|
560
|
-
|
|
561
|
-
fs.writeFileSync(
|
|
562
|
-
`./node_modules/plantuml/lib/plantuml.js`,
|
|
563
|
-
fs
|
|
564
|
-
.readFileSync(`./node_modules/plantuml/lib/plantuml.js`, 'utf8')
|
|
565
|
-
.replace(`'--add-opens=java.xml/com.sun.org.apache.xalan.internal.xsltc.trax="ALL-UNNAMED"'`, `//`),
|
|
566
|
-
);
|
|
567
|
-
}
|
|
568
|
-
case 'build-uml':
|
|
569
|
-
{
|
|
570
|
-
const plantuml = await import('plantuml');
|
|
571
|
-
const folder = process.argv[3] ? process.argv[3] : `./src/client/public/default/plantuml`;
|
|
572
|
-
const confData = Config.default;
|
|
573
|
-
|
|
574
|
-
if (!fs.existsSync(folder)) fs.mkdirSync(folder, { recursive: true });
|
|
575
|
-
|
|
576
|
-
for (const typeConf of Object.keys(confData)) {
|
|
577
|
-
logger.info(`generate ${typeConf} instance`);
|
|
578
|
-
try {
|
|
579
|
-
const svg = await plantuml(`
|
|
580
|
-
@startjson
|
|
581
|
-
${JSON.stringify(confData[typeConf])}
|
|
582
|
-
@endjson
|
|
583
|
-
`);
|
|
584
|
-
fs.writeFileSync(`${folder}/${typeConf}-conf.svg`, svg);
|
|
585
|
-
} catch (error) {
|
|
586
|
-
logger.error(error, error.stack);
|
|
587
|
-
}
|
|
588
|
-
logger.info(`generate ${typeConf} schema`);
|
|
589
|
-
try {
|
|
590
|
-
const svg = await plantuml(`
|
|
591
|
-
@startjson
|
|
592
|
-
${JSON.stringify(ejs(confData[typeConf]))}
|
|
593
|
-
@endjson
|
|
594
|
-
`);
|
|
595
|
-
fs.writeFileSync(`${folder}/${typeConf}-schema.svg`, svg);
|
|
596
|
-
} catch (error) {
|
|
597
|
-
logger.error(error, error.stack);
|
|
598
|
-
}
|
|
599
|
-
}
|
|
600
|
-
}
|
|
601
|
-
break;
|
|
602
293
|
|
|
603
294
|
case 'build-single-replica': {
|
|
604
295
|
const deployId = process.argv[3];
|
|
@@ -652,9 +343,6 @@ try {
|
|
|
652
343
|
}
|
|
653
344
|
break;
|
|
654
345
|
}
|
|
655
|
-
case 'build-macro-replica':
|
|
656
|
-
getDataDeploy({ deployGroupId: process.argv[3], buildSingleReplica: true });
|
|
657
|
-
break;
|
|
658
346
|
|
|
659
347
|
case 'rename-package': {
|
|
660
348
|
const name = process.argv[3];
|
|
@@ -681,7 +369,22 @@ try {
|
|
|
681
369
|
break;
|
|
682
370
|
}
|
|
683
371
|
|
|
372
|
+
case 'clean-core-repo': {
|
|
373
|
+
shellCd(`/home/dd/engine`);
|
|
374
|
+
shellExec(`git reset`);
|
|
375
|
+
shellExec(`git checkout .`);
|
|
376
|
+
shellExec(`git clean -f -d`);
|
|
377
|
+
shellCd(`/home/dd/engine/engine-private`);
|
|
378
|
+
shellExec(`git reset`);
|
|
379
|
+
shellExec(`git checkout .`);
|
|
380
|
+
shellExec(`git clean -f -d`);
|
|
381
|
+
shellCd(`/home/dd/engine`);
|
|
382
|
+
break;
|
|
383
|
+
}
|
|
384
|
+
|
|
684
385
|
case 'version-build': {
|
|
386
|
+
shellExec(`node bin/deploy clean-core-repo`);
|
|
387
|
+
shellCd(`/home/dd/engine`);
|
|
685
388
|
const originPackageJson = JSON.parse(fs.readFileSync(`package.json`, 'utf8'));
|
|
686
389
|
const newVersion = process.argv[3] ?? originPackageJson.version;
|
|
687
390
|
const { version } = originPackageJson;
|
|
@@ -716,16 +419,9 @@ try {
|
|
|
716
419
|
}
|
|
717
420
|
|
|
718
421
|
fs.writeFileSync(
|
|
719
|
-
`./
|
|
720
|
-
fs
|
|
721
|
-
.readFileSync(`./docker-compose.yml`, 'utf8')
|
|
722
|
-
.replaceAll(`engine.version: '${version}'`, `engine.version: '${newVersion}'`),
|
|
723
|
-
'utf8',
|
|
724
|
-
);
|
|
725
|
-
fs.writeFileSync(
|
|
726
|
-
`./manifests/deployment/dd-template-development/deployment.yaml`,
|
|
422
|
+
`./manifests/deployment/dd-default-development/deployment.yaml`,
|
|
727
423
|
fs
|
|
728
|
-
.readFileSync(`./manifests/deployment/dd-
|
|
424
|
+
.readFileSync(`./manifests/deployment/dd-default-development/deployment.yaml`, 'utf8')
|
|
729
425
|
.replaceAll(`underpost:v${version}`, `underpost:v${newVersion}`),
|
|
730
426
|
'utf8',
|
|
731
427
|
);
|
|
@@ -782,25 +478,6 @@ ${shellExec(`git log | grep Author: | sort -u`, { stdout: true }).split(`\n`).jo
|
|
|
782
478
|
break;
|
|
783
479
|
}
|
|
784
480
|
|
|
785
|
-
case 'restore-macro-db':
|
|
786
|
-
{
|
|
787
|
-
const deployGroupId = process.argv[3];
|
|
788
|
-
const deployId = process.argv[4];
|
|
789
|
-
await restoreMacroDb(deployGroupId, deployId);
|
|
790
|
-
}
|
|
791
|
-
|
|
792
|
-
break;
|
|
793
|
-
|
|
794
|
-
case 'mongo': {
|
|
795
|
-
await MongooseDB.server();
|
|
796
|
-
break;
|
|
797
|
-
}
|
|
798
|
-
|
|
799
|
-
case 'lampp': {
|
|
800
|
-
await Lampp.install();
|
|
801
|
-
break;
|
|
802
|
-
}
|
|
803
|
-
|
|
804
481
|
case 'heb': {
|
|
805
482
|
// https://besu.hyperledger.org/
|
|
806
483
|
// https://github.com/hyperledger/besu/archive/refs/tags/24.9.1.tar.gz
|
|
@@ -836,11 +513,6 @@ ${shellExec(`git log | grep Author: | sort -u`, { stdout: true }).split(`\n`).jo
|
|
|
836
513
|
break;
|
|
837
514
|
}
|
|
838
515
|
|
|
839
|
-
case 'fix-deps': {
|
|
840
|
-
await fixDependencies();
|
|
841
|
-
break;
|
|
842
|
-
}
|
|
843
|
-
|
|
844
516
|
case 'update-default-conf': {
|
|
845
517
|
const defaultServer = DefaultConf.server['default.net']['/'];
|
|
846
518
|
let confName = process.argv[3];
|
|
@@ -863,7 +535,7 @@ ${shellExec(`git log | grep Author: | sort -u`, { stdout: true }).split(`\n`).jo
|
|
|
863
535
|
// mongodb-0.mongodb-service
|
|
864
536
|
DefaultConf.server[host][path].db.host = 'mongodb://mongodb-service:27017';
|
|
865
537
|
confName = '';
|
|
866
|
-
} else if (confName) {
|
|
538
|
+
} else if (confName && fs.existsSync(`./engine-private/conf/${confName}`)) {
|
|
867
539
|
DefaultConf.client = JSON.parse(fs.readFileSync(`./engine-private/conf/${confName}/conf.client.json`, 'utf8'));
|
|
868
540
|
DefaultConf.server = JSON.parse(fs.readFileSync(`./engine-private/conf/${confName}/conf.server.json`, 'utf8'));
|
|
869
541
|
DefaultConf.ssr = JSON.parse(fs.readFileSync(`./engine-private/conf/${confName}/conf.ssr.json`, 'utf8'));
|
|
@@ -894,6 +566,12 @@ ${shellExec(`git log | grep Author: | sort -u`, { stdout: true }).split(`\n`).jo
|
|
|
894
566
|
}
|
|
895
567
|
|
|
896
568
|
case 'ssh': {
|
|
569
|
+
// only import + start
|
|
570
|
+
// node bin/deploy ssh root@<host> <password> import
|
|
571
|
+
|
|
572
|
+
// generate + import + start
|
|
573
|
+
// node bin/deploy ssh root@<host> <password>
|
|
574
|
+
|
|
897
575
|
const host = process.argv[3] ?? `root@${await ip.public.ipv4()}`;
|
|
898
576
|
const domain = host.split('@')[1];
|
|
899
577
|
const user = 'root'; // host.split('@')[0];
|
|
@@ -966,7 +644,7 @@ EOF`);
|
|
|
966
644
|
// shellExec(`sudo echo "" > ~/.ssh/known_hosts`);
|
|
967
645
|
|
|
968
646
|
// ssh-copy-id -i ~/.ssh/id_rsa.pub -p <port_number> <username>@<host>
|
|
969
|
-
shellExec(`ssh-copy-id -i ~/.ssh/id_rsa.pub -p ${port} ${host}`);
|
|
647
|
+
// shellExec(`ssh-copy-id -i ~/.ssh/id_rsa.pub -p ${port} ${host}`);
|
|
970
648
|
// debug:
|
|
971
649
|
// shellExec(`ssh -vvv ${host}`);
|
|
972
650
|
|
|
@@ -1037,91 +715,11 @@ EOF`);
|
|
|
1037
715
|
break;
|
|
1038
716
|
}
|
|
1039
717
|
|
|
1040
|
-
case 'valkey': {
|
|
1041
|
-
if (!process.argv.includes('server')) {
|
|
1042
|
-
if (process.argv.includes('rocky')) {
|
|
1043
|
-
// shellExec(`yum install -y https://repo.percona.com/yum/percona-release-latest.noarch.rpm`);
|
|
1044
|
-
// shellExec(`sudo percona-release enable valkey experimental`);
|
|
1045
|
-
shellExec(`sudo dnf install valkey`);
|
|
1046
|
-
shellExec(`chown -R valkey:valkey /etc/valkey`);
|
|
1047
|
-
shellExec(`chown -R valkey:valkey /var/lib/valkey`);
|
|
1048
|
-
shellExec(`chown -R valkey:valkey /var/log/valkey`);
|
|
1049
|
-
shellExec(`sudo systemctl enable valkey.service`);
|
|
1050
|
-
shellExec(`sudo systemctl start valkey`);
|
|
1051
|
-
shellExec(`valkey-cli ping`);
|
|
1052
|
-
} else {
|
|
1053
|
-
shellExec(`cd /home/dd && git clone https://github.com/valkey-io/valkey.git`);
|
|
1054
|
-
shellExec(`cd /home/dd/valkey && make`);
|
|
1055
|
-
shellExec(`apt install valkey-tools`); // valkey-cli
|
|
1056
|
-
}
|
|
1057
|
-
}
|
|
1058
|
-
if (process.argv.includes('rocky')) {
|
|
1059
|
-
shellExec(`sudo systemctl stop valkey`);
|
|
1060
|
-
shellExec(`sudo systemctl start valkey`);
|
|
1061
|
-
} else shellExec(`cd /home/dd/valkey && ./src/valkey-server`);
|
|
1062
|
-
|
|
1063
|
-
break;
|
|
1064
|
-
}
|
|
1065
|
-
|
|
1066
|
-
case 'valkey-service': {
|
|
1067
|
-
shellExec(`pm2 start bin/deploy.js --node-args=\"--max-old-space-size=8192\" --name valkey -- valkey server`);
|
|
1068
|
-
break;
|
|
1069
|
-
}
|
|
1070
|
-
|
|
1071
|
-
case 'update-instances': {
|
|
1072
|
-
shellExec(`node bin deploy dd production --sync --build-manifest --info-router --dashboard-update`);
|
|
1073
|
-
shellExec(`node bin cron --dashboard-update --init`);
|
|
1074
|
-
const deployId = 'dd-core';
|
|
1075
|
-
const host = 'www.nexodev.org';
|
|
1076
|
-
const path = '/';
|
|
1077
|
-
|
|
1078
|
-
{
|
|
1079
|
-
const outputPath = './engine-private/instances';
|
|
1080
|
-
if (fs.existsSync(outputPath)) fs.mkdirSync(outputPath, { recursive: true });
|
|
1081
|
-
const collection = 'instances';
|
|
1082
|
-
if (process.argv.includes('export'))
|
|
1083
|
-
shellExec(
|
|
1084
|
-
`node bin db --export --collections ${collection} --out-path ${outputPath} --hosts ${host} --paths '${path}' ${deployId}`,
|
|
1085
|
-
);
|
|
1086
|
-
if (process.argv.includes('import'))
|
|
1087
|
-
shellExec(
|
|
1088
|
-
`node bin db --import --drop --preserveUUID --out-path ${outputPath} --hosts ${host} --paths '${path}' ${deployId}`,
|
|
1089
|
-
);
|
|
1090
|
-
}
|
|
1091
|
-
{
|
|
1092
|
-
const outputPath = './engine-private/crons';
|
|
1093
|
-
if (fs.existsSync(outputPath)) fs.mkdirSync(outputPath, { recursive: true });
|
|
1094
|
-
const collection = 'crons';
|
|
1095
|
-
if (process.argv.includes('export'))
|
|
1096
|
-
shellExec(
|
|
1097
|
-
`node bin db --export --collections ${collection} --out-path ${outputPath} --hosts ${host} --paths '${path}' ${deployId}`,
|
|
1098
|
-
);
|
|
1099
|
-
if (process.argv.includes('import'))
|
|
1100
|
-
shellExec(
|
|
1101
|
-
`node bin db --import --drop --preserveUUID --out-path ${outputPath} --hosts ${host} --paths '${path}' ${deployId}`,
|
|
1102
|
-
);
|
|
1103
|
-
}
|
|
1104
|
-
|
|
1105
|
-
break;
|
|
1106
|
-
}
|
|
1107
|
-
|
|
1108
718
|
case 'cli-docs': {
|
|
1109
719
|
buildCliDoc(program, process.argv[3], process.argv[4]);
|
|
1110
720
|
break;
|
|
1111
721
|
}
|
|
1112
722
|
|
|
1113
|
-
case 'monitor': {
|
|
1114
|
-
shellExec(
|
|
1115
|
-
`node bin monitor ${process.argv[6] === 'sync' ? '--sync ' : ''}--type ${process.argv[3]} ${process.argv[4]} ${
|
|
1116
|
-
process.argv[5]
|
|
1117
|
-
}`,
|
|
1118
|
-
{
|
|
1119
|
-
async: true,
|
|
1120
|
-
},
|
|
1121
|
-
);
|
|
1122
|
-
break;
|
|
1123
|
-
}
|
|
1124
|
-
|
|
1125
723
|
case 'postgresql': {
|
|
1126
724
|
if (process.argv.includes('install')) {
|
|
1127
725
|
shellExec(`sudo dnf install -y postgresql-server postgresql`);
|
package/bin/file.js
CHANGED
|
@@ -55,7 +55,15 @@ try {
|
|
|
55
55
|
|
|
56
56
|
console.log('copy paths', result);
|
|
57
57
|
|
|
58
|
-
if (type
|
|
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
|
+
}
|
|
64
|
+
} else {
|
|
65
|
+
fs.removeSync(toPath);
|
|
66
|
+
}
|
|
59
67
|
|
|
60
68
|
for (const copyPath of result) {
|
|
61
69
|
const folder = getDirname(`${toPath}/${copyPath}`);
|
|
@@ -72,28 +80,37 @@ try {
|
|
|
72
80
|
|
|
73
81
|
if (type === 'update-template') {
|
|
74
82
|
fs.copySync(`./.vscode`, `../pwa-microservices-template/.vscode`);
|
|
75
|
-
fs.copySync(`./.github`, `../pwa-microservices-template/.github`);
|
|
83
|
+
// fs.copySync(`./.github`, `../pwa-microservices-template/.github`);
|
|
76
84
|
fs.copySync(`./src/client/public/default`, `../pwa-microservices-template/src/client/public/default`);
|
|
77
85
|
|
|
78
86
|
for (const checkoutPath of ['README.md', 'package-lock.json', 'package.json'])
|
|
79
87
|
shellExec(`cd ../pwa-microservices-template && git checkout ${checkoutPath}`);
|
|
80
88
|
|
|
81
89
|
for (const deletePath of [
|
|
82
|
-
'
|
|
83
|
-
'.github/workflows/docker-image.yml',
|
|
84
|
-
'.github/workflows/deploy.ssh.yml',
|
|
85
|
-
'.github/workflows/deploy.api-rest.yml',
|
|
86
|
-
'.github/workflows/engine.lampp.ci.yml',
|
|
87
|
-
'.github/workflows/engine.core.ci.yml',
|
|
88
|
-
'.github/workflows/engine.cyberia.ci.yml',
|
|
90
|
+
'./.github',
|
|
89
91
|
'./manifests/deployment/dd-lampp-development',
|
|
90
92
|
'./manifests/deployment/dd-cyberia-development',
|
|
91
93
|
'./manifests/deployment/dd-core-development',
|
|
94
|
+
'./manifests/deployment/dd-template-development',
|
|
92
95
|
'bin/web3.js',
|
|
93
96
|
'bin/cyberia.js',
|
|
94
97
|
]) {
|
|
95
98
|
if (fs.existsSync(deletePath)) fs.removeSync('../pwa-microservices-template/' + deletePath);
|
|
96
99
|
}
|
|
100
|
+
|
|
101
|
+
fs.mkdirSync(`../pwa-microservices-template/.github/workflows`, {
|
|
102
|
+
recursive: true,
|
|
103
|
+
});
|
|
104
|
+
for (const _path of [
|
|
105
|
+
`./.github/workflows/pwa-microservices-template-page.cd.yml`,
|
|
106
|
+
`./.github/workflows/pwa-microservices-template-test.ci.yml`,
|
|
107
|
+
`./.github/workflows/npmpkg.ci.yml`,
|
|
108
|
+
`./.github/workflows/ghpkg.ci.yml`,
|
|
109
|
+
`./.github/workflows/publish.ci.yml`,
|
|
110
|
+
`./.github/workflows/release.cd.yml`,
|
|
111
|
+
])
|
|
112
|
+
fs.copyFileSync(_path, `../pwa-microservices-template/${_path}`);
|
|
113
|
+
|
|
97
114
|
const originPackageJson = JSON.parse(fs.readFileSync('./package.json', 'utf8'));
|
|
98
115
|
const templatePackageJson = JSON.parse(fs.readFileSync('../pwa-microservices-template/package.json', 'utf8'));
|
|
99
116
|
|