not-node 6.1.3 → 6.1.5

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 (97) hide show
  1. package/bin/not-cli.mjs +148 -41
  2. package/package.json +1 -1
  3. package/playground/.env +16 -0
  4. package/playground/deploy/production.sh +13 -0
  5. package/playground/deploy/stage.sh +13 -0
  6. package/playground/nginx/development.conf +63 -0
  7. package/playground/nginx/production.conf +63 -0
  8. package/playground/nginx/stage.conf +63 -0
  9. package/playground/pm2/development.json +46 -0
  10. package/playground/pm2/production.json +46 -0
  11. package/playground/pm2/stage.json +46 -0
  12. package/playground/site/.babelrc +11 -0
  13. package/playground/site/.eslintignore +4 -0
  14. package/playground/site/.eslintrc.json +23 -0
  15. package/playground/site/app/front/build/admin.css +2 -0
  16. package/playground/site/app/front/build/admin.js +52420 -0
  17. package/playground/site/app/front/build/client.css +2 -0
  18. package/playground/site/app/front/build/client.js +52420 -0
  19. package/playground/site/app/front/build/guest.css +2 -0
  20. package/playground/site/app/front/build/guest.js +50916 -0
  21. package/playground/site/app/front/build/root.css +2 -0
  22. package/playground/site/app/front/build/root.js +60016 -0
  23. package/playground/site/app/front/build/user.css +2 -0
  24. package/playground/site/app/front/build/user.js +52418 -0
  25. package/playground/site/app/front/build.env.js +15 -0
  26. package/playground/site/app/front/index.!.js +66 -0
  27. package/playground/site/app/front/index.admin.js +162 -0
  28. package/playground/site/app/front/index.client.js +162 -0
  29. package/playground/site/app/front/index.guest.js +162 -0
  30. package/playground/site/app/front/index.root.js +226 -0
  31. package/playground/site/app/front/index.user.js +162 -0
  32. package/playground/site/app/front/rollup.!.js +70 -0
  33. package/playground/site/app/front/rollup.admin.js +70 -0
  34. package/playground/site/app/front/rollup.client.js +70 -0
  35. package/playground/site/app/front/rollup.guest.js +70 -0
  36. package/playground/site/app/front/rollup.root.js +70 -0
  37. package/playground/site/app/front/rollup.user.js +70 -0
  38. package/playground/site/app/front/src/admin/main/index.js +34 -0
  39. package/playground/site/app/front/src/client/main/index.js +34 -0
  40. package/playground/site/app/front/src/common/index.js +40 -0
  41. package/playground/site/app/front/src/common/ncInit.js +18 -0
  42. package/playground/site/app/front/src/common/ws.client.main.js +34 -0
  43. package/playground/site/app/front/src/guest/main/index.js +45 -0
  44. package/playground/site/app/front/src/root/main/index.js +34 -0
  45. package/playground/site/app/front/src/user/main/index.js +34 -0
  46. package/playground/site/app/server/app.js +25 -0
  47. package/playground/site/app/server/config/common.json +126 -0
  48. package/playground/site/app/server/config/development.json +33 -0
  49. package/playground/site/app/server/config/production.json +34 -0
  50. package/playground/site/app/server/config/stage.json +34 -0
  51. package/playground/site/app/server/index.js +20 -0
  52. package/playground/site/app/server/routes/index.js +34 -0
  53. package/playground/site/app/server/routes/site.js +71 -0
  54. package/playground/site/app/server/views/admin/foot.pug +1 -0
  55. package/playground/site/app/server/views/admin/head.pug +7 -0
  56. package/playground/site/app/server/views/admin/menu.pug +2 -0
  57. package/playground/site/app/server/views/admin.pug +19 -0
  58. package/playground/site/app/server/views/dashboard.pug +20 -0
  59. package/playground/site/app/server/views/index.pug +15 -0
  60. package/playground/site/app/server/views/parts/header.android.pug +6 -0
  61. package/playground/site/app/server/views/parts/header.ios.pug +5 -0
  62. package/playground/site/app/server/views/parts/header.pug +18 -0
  63. package/playground/site/app/server/views/parts/menu.pug +1 -0
  64. package/playground/site/app/server/views/parts/overview.pug +2 -0
  65. package/playground/site/app/server/ws/auth.js +41 -0
  66. package/playground/site/app/server/ws/index.js +84 -0
  67. package/playground/site/bin/build.sh +8 -0
  68. package/playground/site/package.json +85 -0
  69. package/playground/site/project.manifest.json +37 -0
  70. package/src/cli/const.mjs +9 -0
  71. package/src/cli/readers/debugPort.mjs +16 -0
  72. package/src/cli/readers/deploy.mjs +80 -0
  73. package/src/cli/readers/hostname.mjs +4 -5
  74. package/src/cli/readers/index.mjs +12 -0
  75. package/src/cli/readers/init_root_user.mjs +9 -8
  76. package/src/cli/readers/nginx.mjs +41 -0
  77. package/src/cli/readers/not_node_monitor.mjs +7 -4
  78. package/src/cli/readers/not_node_reporter.mjs +6 -3
  79. package/src/cli/readers/pm2.mjs +29 -0
  80. package/src/cli/readers/ssl.mjs +2 -1
  81. package/src/cli/readers/ws.mjs +18 -4
  82. package/src/cli/renderers/controllers.mjs +1 -0
  83. package/src/cli/renderers/deploy.mjs +39 -0
  84. package/src/cli/renderers/index.mjs +9 -0
  85. package/src/cli/renderers/nginx.mjs +44 -0
  86. package/src/cli/renderers/pm2.mjs +42 -0
  87. package/tmpl/dirs/module.front.mjs +1 -1
  88. package/tmpl/dirs/project.mjs +18 -0
  89. package/tmpl/dirs/server.mjs +4 -3
  90. package/tmpl/files/app/config/common.ejs +2 -4
  91. package/tmpl/files/module.front/common/index.ejs +7 -6
  92. package/tmpl/files/module.front/common/ws.client.main.ejs +2 -3
  93. package/tmpl/files/module.front/role/index.ejs +1 -1
  94. package/tmpl/files/project/deploy.ejs +13 -0
  95. package/tmpl/files/{app → project}/env.ejs +3 -3
  96. package/tmpl/files/project/nginx.ejs +63 -0
  97. package/tmpl/files/project/pm2.ejs +46 -0
package/bin/not-cli.mjs CHANGED
@@ -26,6 +26,7 @@ import * as Renderers from "../src/cli/renderers/index.mjs";
26
26
  //file system structure
27
27
  //directories
28
28
  //files and information how to render them from which template and with what args with readers names
29
+ import ProjectStructure from "../tmpl/dirs/project.mjs";
29
30
  import ApplicationStructure from "../tmpl/dirs/app.mjs";
30
31
  import ApplicationServerStructure from "../tmpl/dirs/server.mjs";
31
32
  import ApplicationFrontStructure from "../tmpl/dirs/front.mjs";
@@ -38,7 +39,8 @@ import ApplicationModuleFrontStructure from "../tmpl/dirs/module.front.mjs";
38
39
 
39
40
  import { firstLetterToLower } from "../src/common.js";
40
41
 
41
- const ApplicationSubStructures = {
42
+ const ProjectSubStructures = {
43
+ app: ApplicationStructure,
42
44
  server: ApplicationServerStructure,
43
45
  front: ApplicationFrontStructure,
44
46
  static: ApplicationStaticStructure,
@@ -49,17 +51,20 @@ const ApplicationSubStructures = {
49
51
  };
50
52
  //path to various templates
51
53
  const PATH_TMPL = resolve(__dirname, "../tmpl/files");
52
- const DEFAULT_SERVER_MODULES_SUB_PATH = "./app/server/modules";
53
- const DEFAULT_FRONT_MODULES_SUB_PATH = "./app/front/src";
54
+ const DEFAULT_SERVER_MODULES_SUB_PATH = "./site/app/server/modules";
55
+ const DEFAULT_FRONT_MODULES_SUB_PATH = "./site/app/front/src";
56
+
57
+ let silent = true;
54
58
 
55
59
  async function readArgs(structure, config) {
56
60
  let result = {};
57
61
  if (Object.hasOwn(structure, "args")) {
58
62
  for (let entry of structure.args) {
59
63
  if (!Object.hasOwn(config, entry)) {
60
- console.log(
61
- `no ${entry} in config, reading data from user input`
62
- );
64
+ !silent &&
65
+ console.log(
66
+ `no ${entry} in config, reading data from user input`
67
+ );
63
68
  config[entry] = await Readers[entry](inquirer, config);
64
69
  }
65
70
  result[entry] = config[entry];
@@ -73,7 +78,7 @@ async function readArgs(structure, config) {
73
78
  }
74
79
 
75
80
  async function renderFile(input, dest, data) {
76
- console.log("render", dest);
81
+ !silent && console.log("render", dest);
77
82
  const renderedFileContent = await ejs.renderFile(input, data, {
78
83
  async: true,
79
84
  });
@@ -136,14 +141,19 @@ function dirRequiresAbsentModules(subStructure, config) {
136
141
  );
137
142
  }
138
143
 
144
+ function dirRequiresNotNullArgs(subStructure, config) {
145
+ return (
146
+ Object.hasOwn(subStructure, "ifArgs") &&
147
+ Array.isArray(subStructure.ifArgs) &&
148
+ !subStructure.ifArgs.every((entry) => {
149
+ return Object.hasOwn(config, entry) && config[entry];
150
+ })
151
+ );
152
+ }
139
153
  async function createDirContent(dest, structure = {}, config = {}) {
140
154
  if (typeof structure === "string") {
141
155
  //console.log("need to create sub structure", structure);
142
- await createDirContent(
143
- dest,
144
- ApplicationSubStructures[structure],
145
- config
146
- );
156
+ await createDirContent(dest, ProjectSubStructures[structure], config);
147
157
  return;
148
158
  }
149
159
  const dirs = {};
@@ -168,6 +178,9 @@ async function createDirContent(dest, structure = {}, config = {}) {
168
178
  if (dirRequiresAbsentModules(subStructure, config)) {
169
179
  continue;
170
180
  }
181
+ if (dirRequiresNotNullArgs(subStructure, config)) {
182
+ continue;
183
+ }
171
184
  await createDir(directoryPath);
172
185
  if (Object.hasOwn(subStructure, "content")) {
173
186
  await createDirContent(directoryPath, subStructure.content, config);
@@ -202,7 +215,7 @@ async function createServerModule(modules_dir, config) {
202
215
  //console.log(JSON.stringify(moduleConfig, null, 4));
203
216
  await createDirContent(
204
217
  moduleDir,
205
- ApplicationSubStructures["module.server"],
218
+ ProjectSubStructures["module.server"],
206
219
  moduleConfig
207
220
  );
208
221
  const layersList = moduleConfig.moduleLayers;
@@ -301,24 +314,24 @@ async function createBootstrapFrontModule(modules_dir, config) {
301
314
  await createDir(modules_dir);
302
315
  await createDirContent(
303
316
  modules_dir,
304
- ApplicationSubStructures["module.front"],
317
+ ProjectSubStructures["module.front"],
305
318
  config
306
319
  );
307
320
  for (let role of config.roles) {
308
321
  await createDir(resolve(modules_dir, role));
309
322
  const targetFrontModuleDir = resolve(modules_dir, role, "main");
310
323
  await createDir(targetFrontModuleDir);
311
- if (role !== "guest") {
324
+ if (role === "guest") {
312
325
  await Renderers.frontModuleGuestMain(
313
326
  targetFrontModuleDir,
314
- config,
327
+ { ...config, roleName: role },
315
328
  renderFile,
316
329
  PATH_TMPL
317
330
  );
318
331
  } else {
319
332
  await Renderers.frontModuleRoleMain(
320
333
  targetFrontModuleDir,
321
- config,
334
+ { ...config, roleName: role },
322
335
  renderFile,
323
336
  PATH_TMPL
324
337
  );
@@ -326,13 +339,15 @@ async function createBootstrapFrontModule(modules_dir, config) {
326
339
  }
327
340
  }
328
341
 
329
- function installPackages(opts) {
342
+ function installPackages(siteDir) {
330
343
  return new Promise((resolve, reject) => {
331
344
  console.log("installing packages...");
332
- let npmInstall = spawn(`npm`, ["i"], { cwd: opts.dir });
345
+ let npmInstall = spawn(`npm`, ["i"], {
346
+ cwd: siteDir,
347
+ });
333
348
 
334
349
  npmInstall.stderr.on("data", (data) => {
335
- console.error(data.toString());
350
+ !silent && console.error(data.toString());
336
351
  });
337
352
  npmInstall.on("exit", (code) => {
338
353
  if (code == 0) {
@@ -344,13 +359,15 @@ function installPackages(opts) {
344
359
  });
345
360
  }
346
361
 
347
- function buildClientSideScripts(opts) {
362
+ function buildClientSideScripts(siteDir) {
348
363
  return new Promise((resolve, reject) => {
349
364
  console.log("building client side scripts...");
350
- let npmInstall = spawn(`npm`, ["run", "build"], { cwd: opts.dir });
365
+ let npmInstall = spawn(`npm`, ["run", "build"], {
366
+ cwd: siteDir,
367
+ });
351
368
 
352
369
  npmInstall.stderr.on("data", (data) => {
353
- console.error(data.toString());
370
+ !silent && console.error(data.toString());
354
371
  });
355
372
  npmInstall.on("exit", (code) => {
356
373
  if (code == 0) {
@@ -362,20 +379,81 @@ function buildClientSideScripts(opts) {
362
379
  });
363
380
  }
364
381
 
365
- function postStartupInstructions(opts) {
382
+ function postStartupInstructions(siteDir, config) {
366
383
  console.log(
367
- "Generation of source code, configurations and installation of packages successfully finished."
384
+ "Generation of source code, configurations, toolchain and installation of packages successfully finished."
368
385
  );
386
+ if (config.nginx) {
387
+ console.log("To enable NGINX reverse proxy:");
388
+ console.log(
389
+ "1. Copy config file for desired envrionment to NGINX directory and enable it"
390
+ );
391
+ for (let env of ["development", "stage", "production"]) {
392
+ console.log(
393
+ `For '${env}' environment exec while in project directory:`
394
+ );
395
+ console.log(
396
+ `$ sudo cp nginx/${env}.conf to /var/nginx/sites-available/${config.hostname[env]}.conf`
397
+ );
398
+ console.log(
399
+ `$ sudo ln -s /var/nginx/sites-available/${config.hostname[env]}.conf /var/nginx/sites-enabled/${config.hostname[env]}.conf`
400
+ );
401
+ }
402
+ console.log("2. Restart NGINX server");
403
+ console.log("$ sudo systemctl restart nginx");
404
+ }
369
405
  console.log(
370
- `To start server navigate to directory '${opts.dir}' (cd '${opts.dir}') and run 'npm start'`
406
+ `To start server navigate to [project]/site directory (cd '${siteDir}') and run 'npm start'`
371
407
  );
372
408
  }
373
409
 
410
+ function makeScriptExecutable(pathToTargetScript) {
411
+ return new Promise((resolve, reject) => {
412
+ console.log(`chmod`, "+x", pathToTargetScript);
413
+ let npmInstall = spawn(`chmod`, ["+x", pathToTargetScript]);
414
+ npmInstall.stderr.on("data", (data) => {
415
+ !silent && console.error(data.toString());
416
+ });
417
+ npmInstall.on("exit", (code) => {
418
+ if (code == 0) {
419
+ resolve();
420
+ } else {
421
+ reject(`chmod +x ${pathToTargetScript} ${code}`);
422
+ }
423
+ });
424
+ });
425
+ }
426
+
427
+ async function createProjectToolsAndConfigs(projectDir, projectConfig) {
428
+ console.log(projectDir);
429
+ if (projectConfig.pm2) {
430
+ console.log("Rendering PM2 configs");
431
+ await Renderers.pm2(projectDir, {}, projectConfig, createFileContent);
432
+ }
433
+
434
+ if (projectConfig.nginx) {
435
+ console.log("Rendering NGINX configs");
436
+ await Renderers.nginx(projectDir, {}, projectConfig, createFileContent);
437
+ }
438
+
439
+ if (projectConfig.deploy) {
440
+ console.log("Rendering deployment scripts");
441
+ await Renderers.deploy(
442
+ projectDir,
443
+ {},
444
+ projectConfig,
445
+ createFileContent,
446
+ makeScriptExecutable
447
+ );
448
+ }
449
+ }
450
+
374
451
  program
375
452
  .command("create")
376
453
  .addOption(
377
454
  new Option("-d, --dir <dir>").default(CWD, "current working directory")
378
455
  )
456
+ .addOption(new Option("-v, --verbose").default(false, "extensive output"))
379
457
  .description(
380
458
  "create application in target directory (create -d [pathToDir])"
381
459
  )
@@ -384,19 +462,47 @@ program
384
462
  if (!isAbsolute(opts.dir)) {
385
463
  opts.dir = resolve(CWD, opts.dir);
386
464
  }
387
- console.log("creating application in", opts.dir);
388
- const AppConfig = {};
465
+ const siteDir = resolve(opts.dir, "./site");
466
+ if (opts.v) {
467
+ silent = false;
468
+ }
469
+ console.log("creating project in", opts.dir);
470
+ console.log("creating site in", siteDir);
471
+ const ProjectConfig = {
472
+ path: opts.dir,
473
+ };
389
474
  //
390
- AppConfig.AppName = await Readers.AppName(inquirer, AppConfig);
391
- AppConfig.appName = await Readers.appName(inquirer, AppConfig);
392
- AppConfig.roles = await Readers.roles(inquirer, AppConfig);
393
- AppConfig.rolesSecondary = await Readers.rolesSecondary(
475
+ ProjectConfig.AppName = await Readers.AppName(inquirer, ProjectConfig);
476
+ ProjectConfig.appName = await Readers.appName(inquirer, ProjectConfig);
477
+ ProjectConfig.hostname = await Readers.hostname(
478
+ inquirer,
479
+ ProjectConfig
480
+ );
481
+ ProjectConfig.roles = await Readers.roles(inquirer, ProjectConfig);
482
+ ProjectConfig.rolesSecondary = await Readers.rolesSecondary(
483
+ inquirer,
484
+ ProjectConfig
485
+ );
486
+ ProjectConfig.modules = await Readers.modules(inquirer, ProjectConfig);
487
+ ProjectConfig.nginx = await Readers.nginx(inquirer, ProjectConfig);
488
+ ProjectConfig.pm2 = await Readers.pm2(inquirer, ProjectConfig);
489
+ ProjectConfig.deploy = await Readers.deploy(inquirer, ProjectConfig);
490
+ ProjectConfig.port = await Readers.port(inquirer, ProjectConfig);
491
+ ProjectConfig.debugPort = await Readers.debugPort(
394
492
  inquirer,
395
- AppConfig
493
+ ProjectConfig
494
+ );
495
+ ProjectConfig.not_node_monitor = await Readers.not_node_monitor(
496
+ inquirer,
497
+ ProjectConfig
498
+ );
499
+ ProjectConfig.not_node_reporter = await Readers.not_node_reporter(
500
+ inquirer,
501
+ ProjectConfig
396
502
  );
397
- AppConfig.modules = await Readers.modules(inquirer, AppConfig);
398
503
  await createDir(opts.dir);
399
- await createDirContent(opts.dir, ApplicationStructure, AppConfig);
504
+ await createDirContent(opts.dir, ProjectStructure, ProjectConfig);
505
+ await createProjectToolsAndConfigs(opts.dir, ProjectConfig);
400
506
  const PATH_MODULES_SERVER = resolve(
401
507
  opts.dir,
402
508
  DEFAULT_SERVER_MODULES_SUB_PATH
@@ -406,16 +512,17 @@ program
406
512
  DEFAULT_FRONT_MODULES_SUB_PATH
407
513
  );
408
514
  while (await Readers.isUserNeedCreateServerModule(inquirer)) {
409
- await createServerModule(PATH_MODULES_SERVER, AppConfig);
515
+ await createServerModule(PATH_MODULES_SERVER, ProjectConfig);
410
516
  }
411
517
 
412
518
  if (await Readers.isUserNeedFrontModuleBootstrap(inquirer)) {
413
- await createBootstrapFrontModule(PATH_MODULES_FRONT, AppConfig);
519
+ await createBootstrapFrontModule(PATH_MODULES_FRONT, ProjectConfig);
414
520
  }
415
- console.log(`cd '${opts.dir}' && npm i`);
416
- await installPackages(opts);
417
- await buildClientSideScripts(opts);
418
- postStartupInstructions(opts);
521
+
522
+ console.log("siteDir", siteDir);
523
+ await installPackages(siteDir);
524
+ await buildClientSideScripts(siteDir);
525
+ postStartupInstructions(siteDir, ProjectConfig);
419
526
  });
420
527
 
421
528
  program.parse();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "not-node",
3
- "version": "6.1.3",
3
+ "version": "6.1.5",
4
4
  "description": "node complimentary part for client side notFramework.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -0,0 +1,16 @@
1
+
2
+ NOT_NODE_ERROR_KEY=123456
3
+ NOT_NODE_ERROR_URL_NODE=https://appmon.ru/api/key/collect
4
+ NOT_NODE_ERROR_URL_BROWSER=https://appmon.ru/api/key/collect
5
+
6
+
7
+ NOT_NODE_MONITOR_INTERVAL=5000
8
+ NOT_NODE_MONITOR_REPORT_INTERVAL=60
9
+ NOT_NODE_MONITOR_REPORT_KEY=123456
10
+ NOT_NODE_MONITOR_REPORT_URL=https://appmon.ru/api/key/collect
11
+
12
+
13
+ INIT_ROOT_USERNAME=root
14
+ INIT_ROOT_EMAIL=admin@127.0.0.1
15
+ INIT_ROOT_PASSWORD=Hcp22adidX
16
+
@@ -0,0 +1,13 @@
1
+ #!/bin/bash
2
+ echo 'deploying notNodeApplication to production'
3
+ cd site
4
+ npm run production
5
+ cd ../
6
+ echo 'syncing data'
7
+ ssh cypher@not-node-application "echo '1' > /var/server/not-node-application/deploying"
8
+ rsync -av --progress --exclude-from='./deploy/.exclude' site cypher@not-node-application:/var/server/not-node-application/
9
+ rsync -av --progress deploy/production.json cypher@not-node-application:/var/server/not-node-application/pm2/production.json
10
+ ssh cypher@not-node-application "cd /var/server/not-node-application/site && npm i"
11
+ ssh cypher@not-node-application "cd /var/server/not-node-application && pm2 startOrRestart pm2/production.json"
12
+ ssh cypher@not-node-application "rm /var/server/not-node-application/deploying"
13
+ exit 0;
@@ -0,0 +1,13 @@
1
+ #!/bin/bash
2
+ echo 'deploying notNodeApplication to stage'
3
+ cd site
4
+ npm run stage
5
+ cd ../
6
+ echo 'syncing data'
7
+ ssh cypher@stage.not-node-application "echo '1' > /var/server/not-node-application/deploying"
8
+ rsync -av --progress --exclude-from='./deploy/.exclude' site cypher@stage.not-node-application:/var/server/not-node-application/
9
+ rsync -av --progress deploy/stage.json cypher@stage.not-node-application:/var/server/not-node-application/pm2/stage.json
10
+ ssh cypher@stage.not-node-application "cd /var/server/not-node-application/site && npm i"
11
+ ssh cypher@stage.not-node-application "cd /var/server/not-node-application && pm2 startOrRestart pm2/stage.json"
12
+ ssh cypher@stage.not-node-application "rm /var/server/not-node-application/deploying"
13
+ exit 0;
@@ -0,0 +1,63 @@
1
+ map $http_upgrade $connection_upgrade {
2
+ default upgrade;
3
+ '' close;
4
+ }
5
+
6
+ upstream websocket2 {
7
+ server :3001;
8
+ }
9
+
10
+ server {
11
+ listen 80 ssl http2 ;
12
+ root /var/server/nn/playground/site/app/static;
13
+ index index.html index.htm;
14
+ server_name 127.0.0.1;
15
+
16
+ location /assets/{expires 365d; alias /var/server/nn/playground/site/app/static/assets/;}
17
+ location /css/{ expires 365d; alias /var/server/nn/playground/site/app/static/css/;}
18
+ location /js/{ expires 365d;alias /var/server/nn/playground/site/app/static/js/; }
19
+ location /img/{ expires 365d;alias /var/server/nn/playground/site/app/static/img/;}
20
+ location /webfonts/{ expires 365d;alias /var/server/nn/playground/site/app/static/webfonts/; }
21
+ location /favicon.ico { expires 365d;alias /var/server/nn/playground/site/app/static/favicon.ico; }
22
+ location /sitemap.xml { expires 1d; alias /var/server/nn/playground/site/app/static/sitemap.xml; }
23
+ location /robots.txt { expires 365d;alias /var/server/nn/playground/site/app/static/robots.txt; }
24
+ location /manifest.webmaniest { expires 365d;alias /var/server/nn/playground/site/app/static/manifest.webmaniest; }
25
+
26
+
27
+ location /api {
28
+ expires -1;
29
+ proxy_set_header Host $host;
30
+ proxy_set_header X-Real-IP $remote_addr;
31
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
32
+ proxy_set_header X-Forwarded-Proto $scheme;
33
+ proxy_set_header X-FILENAME $http_x_filename;
34
+ proxy_set_header SessionID $http_SessionID;
35
+ proxy_pass http://127.0.0.1:3000/api;
36
+ }
37
+
38
+
39
+ location /websocket {
40
+ proxy_pass http://websocket2;
41
+ proxy_http_version 1.1;
42
+ proxy_set_header Upgrade $http_upgrade;
43
+ proxy_set_header Connection $connection_upgrade;
44
+ proxy_set_header Host $host;
45
+ }
46
+
47
+
48
+
49
+ location / {
50
+ expires 365d;
51
+ proxy_set_header Host $host;
52
+ proxy_set_header X-Real-IP $remote_addr;
53
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
54
+ proxy_set_header X-Forwarded-Proto $scheme;
55
+ proxy_set_header X-FILENAME $http_x_filename;
56
+ proxy_set_header SessionID $http_SessionID;
57
+ proxy_pass http://127.0.0.1:3000/;
58
+ }
59
+
60
+
61
+ listen 443 ssl http2 ;
62
+
63
+ }
@@ -0,0 +1,63 @@
1
+ map $http_upgrade $connection_upgrade {
2
+ default upgrade;
3
+ '' close;
4
+ }
5
+
6
+ upstream websocket2 {
7
+ server :3001;
8
+ }
9
+
10
+ server {
11
+ listen 80 ssl http2 ;
12
+ root /var/server/not-node-application/site/app/static;
13
+ index index.html index.htm;
14
+ server_name not-node-application;
15
+
16
+ location /assets/{expires 365d; alias /var/server/not-node-application/site/app/static/assets/;}
17
+ location /css/{ expires 365d; alias /var/server/not-node-application/site/app/static/css/;}
18
+ location /js/{ expires 365d;alias /var/server/not-node-application/site/app/static/js/; }
19
+ location /img/{ expires 365d;alias /var/server/not-node-application/site/app/static/img/;}
20
+ location /webfonts/{ expires 365d;alias /var/server/not-node-application/site/app/static/webfonts/; }
21
+ location /favicon.ico { expires 365d;alias /var/server/not-node-application/site/app/static/favicon.ico; }
22
+ location /sitemap.xml { expires 1d; alias /var/server/not-node-application/site/app/static/sitemap.xml; }
23
+ location /robots.txt { expires 365d;alias /var/server/not-node-application/site/app/static/robots.txt; }
24
+ location /manifest.webmaniest { expires 365d;alias /var/server/not-node-application/site/app/static/manifest.webmaniest; }
25
+
26
+
27
+ location /api {
28
+ expires -1;
29
+ proxy_set_header Host $host;
30
+ proxy_set_header X-Real-IP $remote_addr;
31
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
32
+ proxy_set_header X-Forwarded-Proto $scheme;
33
+ proxy_set_header X-FILENAME $http_x_filename;
34
+ proxy_set_header SessionID $http_SessionID;
35
+ proxy_pass http://not-node-application:3000/api;
36
+ }
37
+
38
+
39
+ location /websocket {
40
+ proxy_pass http://websocket2;
41
+ proxy_http_version 1.1;
42
+ proxy_set_header Upgrade $http_upgrade;
43
+ proxy_set_header Connection $connection_upgrade;
44
+ proxy_set_header Host $host;
45
+ }
46
+
47
+
48
+
49
+ location / {
50
+ expires 365d;
51
+ proxy_set_header Host $host;
52
+ proxy_set_header X-Real-IP $remote_addr;
53
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
54
+ proxy_set_header X-Forwarded-Proto $scheme;
55
+ proxy_set_header X-FILENAME $http_x_filename;
56
+ proxy_set_header SessionID $http_SessionID;
57
+ proxy_pass http://not-node-application:3000/;
58
+ }
59
+
60
+
61
+ listen 443 ssl http2 ;
62
+
63
+ }
@@ -0,0 +1,63 @@
1
+ map $http_upgrade $connection_upgrade {
2
+ default upgrade;
3
+ '' close;
4
+ }
5
+
6
+ upstream websocket2 {
7
+ server :3001;
8
+ }
9
+
10
+ server {
11
+ listen 80 ssl http2 ;
12
+ root /var/server/not-node-application/site/app/static;
13
+ index index.html index.htm;
14
+ server_name stage.not-node-application;
15
+
16
+ location /assets/{expires 365d; alias /var/server/not-node-application/site/app/static/assets/;}
17
+ location /css/{ expires 365d; alias /var/server/not-node-application/site/app/static/css/;}
18
+ location /js/{ expires 365d;alias /var/server/not-node-application/site/app/static/js/; }
19
+ location /img/{ expires 365d;alias /var/server/not-node-application/site/app/static/img/;}
20
+ location /webfonts/{ expires 365d;alias /var/server/not-node-application/site/app/static/webfonts/; }
21
+ location /favicon.ico { expires 365d;alias /var/server/not-node-application/site/app/static/favicon.ico; }
22
+ location /sitemap.xml { expires 1d; alias /var/server/not-node-application/site/app/static/sitemap.xml; }
23
+ location /robots.txt { expires 365d;alias /var/server/not-node-application/site/app/static/robots.txt; }
24
+ location /manifest.webmaniest { expires 365d;alias /var/server/not-node-application/site/app/static/manifest.webmaniest; }
25
+
26
+
27
+ location /api {
28
+ expires -1;
29
+ proxy_set_header Host $host;
30
+ proxy_set_header X-Real-IP $remote_addr;
31
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
32
+ proxy_set_header X-Forwarded-Proto $scheme;
33
+ proxy_set_header X-FILENAME $http_x_filename;
34
+ proxy_set_header SessionID $http_SessionID;
35
+ proxy_pass http://stage.not-node-application:3000/api;
36
+ }
37
+
38
+
39
+ location /websocket {
40
+ proxy_pass http://websocket2;
41
+ proxy_http_version 1.1;
42
+ proxy_set_header Upgrade $http_upgrade;
43
+ proxy_set_header Connection $connection_upgrade;
44
+ proxy_set_header Host $host;
45
+ }
46
+
47
+
48
+
49
+ location / {
50
+ expires 365d;
51
+ proxy_set_header Host $host;
52
+ proxy_set_header X-Real-IP $remote_addr;
53
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
54
+ proxy_set_header X-Forwarded-Proto $scheme;
55
+ proxy_set_header X-FILENAME $http_x_filename;
56
+ proxy_set_header SessionID $http_SessionID;
57
+ proxy_pass http://stage.not-node-application:3000/;
58
+ }
59
+
60
+
61
+ listen 443 ssl http2 ;
62
+
63
+ }
@@ -0,0 +1,46 @@
1
+ {
2
+ "apps": [
3
+ {
4
+ "name": "not-node-application.development",
5
+ "script": "./site/app/server/index.js",
6
+ "node_args": [
7
+ "--stack-trace-limit=50",
8
+
9
+ "--inspect=3002"
10
+
11
+ ],
12
+ "watch": true,
13
+ "ignore_watch": [
14
+ "./site/node_modules",
15
+ "./site/docs",
16
+ "./site/app/static",
17
+ "./site/app/front/build",
18
+ "./db.dumps"
19
+ ],
20
+ "exec_mode": "fork",
21
+ "env": {
22
+ "hostname": "https://127.0.0.1",
23
+ "NODE_ENV": "development",
24
+
25
+ "NOT_NODE_ERROR_KEY": "123456",
26
+ "NOT_NODE_ERROR_URL_NODE": "https://appmon.ru/api/key/collect",
27
+ "NOT_NODE_ERROR_URL_BROWSER": "https://appmon.ru/api/key/collect",
28
+
29
+
30
+ "NOT_NODE_MONITOR_INTERVAL": 5000,
31
+ "NOT_NODE_MONITOR_REPORT_INTERVAL": 60,
32
+ "NOT_NODE_MONITOR_REPORT_KEY": "123456",
33
+ "NOT_NODE_MONITOR_REPORT_URL": "https://appmon.ru/api/key/collect"
34
+
35
+
36
+ "db__mongoose__uri": "mongodb://localhost/reporter?authSource=reporter",
37
+ "db__mongoose__options__host": "localhost",
38
+ "db__mongoose__options__user": "reporter",
39
+ "db__mongoose__options__pass": "developer",
40
+ "db__mongoose__options__db": "reporter",
41
+
42
+
43
+ }
44
+ }
45
+ ]
46
+ }
@@ -0,0 +1,46 @@
1
+ {
2
+ "apps": [
3
+ {
4
+ "name": "not-node-application.production",
5
+ "script": "./site/app/server/index.js",
6
+ "node_args": [
7
+ "--stack-trace-limit=50",
8
+
9
+ "--inspect=3002"
10
+
11
+ ],
12
+ "watch": true,
13
+ "ignore_watch": [
14
+ "./site/node_modules",
15
+ "./site/docs",
16
+ "./site/app/static",
17
+ "./site/app/front/build",
18
+ "./db.dumps"
19
+ ],
20
+ "exec_mode": "fork",
21
+ "env": {
22
+ "hostname": "https://not-node-application",
23
+ "NODE_ENV": "production",
24
+
25
+ "NOT_NODE_ERROR_KEY": "123456",
26
+ "NOT_NODE_ERROR_URL_NODE": "https://appmon.ru/api/key/collect",
27
+ "NOT_NODE_ERROR_URL_BROWSER": "https://appmon.ru/api/key/collect",
28
+
29
+
30
+ "NOT_NODE_MONITOR_INTERVAL": 5000,
31
+ "NOT_NODE_MONITOR_REPORT_INTERVAL": 60,
32
+ "NOT_NODE_MONITOR_REPORT_KEY": "123456",
33
+ "NOT_NODE_MONITOR_REPORT_URL": "https://appmon.ru/api/key/collect"
34
+
35
+
36
+ "db__mongoose__uri": "mongodb://localhost/reporter?authSource=reporter",
37
+ "db__mongoose__options__host": "localhost",
38
+ "db__mongoose__options__user": "reporter",
39
+ "db__mongoose__options__pass": "developer",
40
+ "db__mongoose__options__db": "reporter",
41
+
42
+
43
+ }
44
+ }
45
+ ]
46
+ }