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.
- package/bin/not-cli.mjs +148 -41
- package/package.json +1 -1
- package/playground/.env +16 -0
- package/playground/deploy/production.sh +13 -0
- package/playground/deploy/stage.sh +13 -0
- package/playground/nginx/development.conf +63 -0
- package/playground/nginx/production.conf +63 -0
- package/playground/nginx/stage.conf +63 -0
- package/playground/pm2/development.json +46 -0
- package/playground/pm2/production.json +46 -0
- package/playground/pm2/stage.json +46 -0
- package/playground/site/.babelrc +11 -0
- package/playground/site/.eslintignore +4 -0
- package/playground/site/.eslintrc.json +23 -0
- package/playground/site/app/front/build/admin.css +2 -0
- package/playground/site/app/front/build/admin.js +52420 -0
- package/playground/site/app/front/build/client.css +2 -0
- package/playground/site/app/front/build/client.js +52420 -0
- package/playground/site/app/front/build/guest.css +2 -0
- package/playground/site/app/front/build/guest.js +50916 -0
- package/playground/site/app/front/build/root.css +2 -0
- package/playground/site/app/front/build/root.js +60016 -0
- package/playground/site/app/front/build/user.css +2 -0
- package/playground/site/app/front/build/user.js +52418 -0
- package/playground/site/app/front/build.env.js +15 -0
- package/playground/site/app/front/index.!.js +66 -0
- package/playground/site/app/front/index.admin.js +162 -0
- package/playground/site/app/front/index.client.js +162 -0
- package/playground/site/app/front/index.guest.js +162 -0
- package/playground/site/app/front/index.root.js +226 -0
- package/playground/site/app/front/index.user.js +162 -0
- package/playground/site/app/front/rollup.!.js +70 -0
- package/playground/site/app/front/rollup.admin.js +70 -0
- package/playground/site/app/front/rollup.client.js +70 -0
- package/playground/site/app/front/rollup.guest.js +70 -0
- package/playground/site/app/front/rollup.root.js +70 -0
- package/playground/site/app/front/rollup.user.js +70 -0
- package/playground/site/app/front/src/admin/main/index.js +34 -0
- package/playground/site/app/front/src/client/main/index.js +34 -0
- package/playground/site/app/front/src/common/index.js +40 -0
- package/playground/site/app/front/src/common/ncInit.js +18 -0
- package/playground/site/app/front/src/common/ws.client.main.js +34 -0
- package/playground/site/app/front/src/guest/main/index.js +45 -0
- package/playground/site/app/front/src/root/main/index.js +34 -0
- package/playground/site/app/front/src/user/main/index.js +34 -0
- package/playground/site/app/server/app.js +25 -0
- package/playground/site/app/server/config/common.json +126 -0
- package/playground/site/app/server/config/development.json +33 -0
- package/playground/site/app/server/config/production.json +34 -0
- package/playground/site/app/server/config/stage.json +34 -0
- package/playground/site/app/server/index.js +20 -0
- package/playground/site/app/server/routes/index.js +34 -0
- package/playground/site/app/server/routes/site.js +71 -0
- package/playground/site/app/server/views/admin/foot.pug +1 -0
- package/playground/site/app/server/views/admin/head.pug +7 -0
- package/playground/site/app/server/views/admin/menu.pug +2 -0
- package/playground/site/app/server/views/admin.pug +19 -0
- package/playground/site/app/server/views/dashboard.pug +20 -0
- package/playground/site/app/server/views/index.pug +15 -0
- package/playground/site/app/server/views/parts/header.android.pug +6 -0
- package/playground/site/app/server/views/parts/header.ios.pug +5 -0
- package/playground/site/app/server/views/parts/header.pug +18 -0
- package/playground/site/app/server/views/parts/menu.pug +1 -0
- package/playground/site/app/server/views/parts/overview.pug +2 -0
- package/playground/site/app/server/ws/auth.js +41 -0
- package/playground/site/app/server/ws/index.js +84 -0
- package/playground/site/bin/build.sh +8 -0
- package/playground/site/package.json +85 -0
- package/playground/site/project.manifest.json +37 -0
- package/src/cli/const.mjs +9 -0
- package/src/cli/readers/debugPort.mjs +16 -0
- package/src/cli/readers/deploy.mjs +80 -0
- package/src/cli/readers/hostname.mjs +4 -5
- package/src/cli/readers/index.mjs +12 -0
- package/src/cli/readers/init_root_user.mjs +9 -8
- package/src/cli/readers/nginx.mjs +41 -0
- package/src/cli/readers/not_node_monitor.mjs +7 -4
- package/src/cli/readers/not_node_reporter.mjs +6 -3
- package/src/cli/readers/pm2.mjs +29 -0
- package/src/cli/readers/ssl.mjs +2 -1
- package/src/cli/readers/ws.mjs +18 -4
- package/src/cli/renderers/controllers.mjs +1 -0
- package/src/cli/renderers/deploy.mjs +39 -0
- package/src/cli/renderers/index.mjs +9 -0
- package/src/cli/renderers/nginx.mjs +44 -0
- package/src/cli/renderers/pm2.mjs +42 -0
- package/tmpl/dirs/module.front.mjs +1 -1
- package/tmpl/dirs/project.mjs +18 -0
- package/tmpl/dirs/server.mjs +4 -3
- package/tmpl/files/app/config/common.ejs +2 -4
- package/tmpl/files/module.front/common/index.ejs +7 -6
- package/tmpl/files/module.front/common/ws.client.main.ejs +2 -3
- package/tmpl/files/module.front/role/index.ejs +1 -1
- package/tmpl/files/project/deploy.ejs +13 -0
- package/tmpl/files/{app → project}/env.ejs +3 -3
- package/tmpl/files/project/nginx.ejs +63 -0
- package/tmpl/files/project/pm2.ejs +46 -0
|
@@ -5,29 +5,30 @@ const DEFAULT_PASSWORD = generator.generate({
|
|
|
5
5
|
numbers: true,
|
|
6
6
|
});
|
|
7
7
|
|
|
8
|
-
function collectInitRootUser(inquirer) {
|
|
8
|
+
function collectInitRootUser(inquirer, config) {
|
|
9
9
|
return inquirer.prompt([
|
|
10
10
|
{
|
|
11
11
|
type: "input",
|
|
12
12
|
name: "name",
|
|
13
|
-
message: "
|
|
13
|
+
message: "Root username",
|
|
14
14
|
default: "root",
|
|
15
15
|
},
|
|
16
16
|
{
|
|
17
17
|
type: "input",
|
|
18
18
|
name: "email",
|
|
19
|
-
message: "
|
|
19
|
+
message: "Root user email",
|
|
20
|
+
default: `admin@${config.hostname.development}`,
|
|
20
21
|
},
|
|
21
22
|
{
|
|
22
23
|
type: "input",
|
|
23
24
|
name: "password",
|
|
24
|
-
message: "
|
|
25
|
+
message: "Root user password",
|
|
25
26
|
default: DEFAULT_PASSWORD,
|
|
26
27
|
},
|
|
27
28
|
{
|
|
28
29
|
type: "input",
|
|
29
30
|
name: "passwordConfirmation",
|
|
30
|
-
message: "Re-type password",
|
|
31
|
+
message: "Re-type root password",
|
|
31
32
|
validate(inpt, answer) {
|
|
32
33
|
return inpt === answer.password;
|
|
33
34
|
},
|
|
@@ -35,8 +36,8 @@ function collectInitRootUser(inquirer) {
|
|
|
35
36
|
]);
|
|
36
37
|
}
|
|
37
38
|
|
|
38
|
-
export default (inquirer) => {
|
|
39
|
-
inquirer
|
|
39
|
+
export default (inquirer, config) => {
|
|
40
|
+
return inquirer
|
|
40
41
|
.prompt([
|
|
41
42
|
{
|
|
42
43
|
type: "confirm",
|
|
@@ -47,7 +48,7 @@ export default (inquirer) => {
|
|
|
47
48
|
])
|
|
48
49
|
.then(({ enabled }) => {
|
|
49
50
|
if (enabled) {
|
|
50
|
-
return collectInitRootUser(inquirer);
|
|
51
|
+
return collectInitRootUser(inquirer, config);
|
|
51
52
|
} else {
|
|
52
53
|
return false;
|
|
53
54
|
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
function collectData(inquirer) {
|
|
2
|
+
return inquirer.prompt([
|
|
3
|
+
{
|
|
4
|
+
type: "confirm",
|
|
5
|
+
name: "http2",
|
|
6
|
+
message: "Enable HTTP2?",
|
|
7
|
+
default: true,
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
type: "confirm",
|
|
11
|
+
name: "http3",
|
|
12
|
+
message: "Enable HTTP3?",
|
|
13
|
+
default: false,
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
type: "confirm",
|
|
17
|
+
name: "ssl",
|
|
18
|
+
message: "Enable SSL?",
|
|
19
|
+
default: true,
|
|
20
|
+
},
|
|
21
|
+
]);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export default (inquirer) => {
|
|
25
|
+
return inquirer
|
|
26
|
+
.prompt([
|
|
27
|
+
{
|
|
28
|
+
type: "confirm",
|
|
29
|
+
name: "enabled",
|
|
30
|
+
message: "Create NGINX configs set?",
|
|
31
|
+
default: true,
|
|
32
|
+
},
|
|
33
|
+
])
|
|
34
|
+
.then((answer) => {
|
|
35
|
+
if (answer.enabled) {
|
|
36
|
+
return collectData(inquirer);
|
|
37
|
+
} else {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
};
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { DEFAULT_NODE_API_URL } from "../const.mjs";
|
|
2
2
|
|
|
3
|
-
function collectNodeMonitor(inquirer) {
|
|
3
|
+
function collectNodeMonitor(inquirer, config) {
|
|
4
4
|
return inquirer.prompt([
|
|
5
5
|
{
|
|
6
6
|
type: "input",
|
|
7
7
|
name: "report_key",
|
|
8
8
|
message: "Report API Key",
|
|
9
|
+
default: config?.not_node_reporter
|
|
10
|
+
? config?.not_node_reporter.key
|
|
11
|
+
: "",
|
|
9
12
|
},
|
|
10
13
|
{
|
|
11
14
|
type: "input",
|
|
@@ -28,8 +31,8 @@ function collectNodeMonitor(inquirer) {
|
|
|
28
31
|
]);
|
|
29
32
|
}
|
|
30
33
|
|
|
31
|
-
export default (inquirer) => {
|
|
32
|
-
inquirer
|
|
34
|
+
export default (inquirer, config) => {
|
|
35
|
+
return inquirer
|
|
33
36
|
.prompt([
|
|
34
37
|
{
|
|
35
38
|
type: "confirm",
|
|
@@ -40,7 +43,7 @@ export default (inquirer) => {
|
|
|
40
43
|
])
|
|
41
44
|
.then(({ enabled }) => {
|
|
42
45
|
if (enabled) {
|
|
43
|
-
return collectNodeMonitor(inquirer);
|
|
46
|
+
return collectNodeMonitor(inquirer, config);
|
|
44
47
|
} else {
|
|
45
48
|
return false;
|
|
46
49
|
}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { DEFAULT_NODE_API_URL } from "../const.mjs";
|
|
2
2
|
|
|
3
|
-
function collectNodeReporter(inquirer) {
|
|
3
|
+
function collectNodeReporter(inquirer, config) {
|
|
4
4
|
return inquirer.prompt([
|
|
5
5
|
{
|
|
6
6
|
type: "input",
|
|
7
7
|
name: "key",
|
|
8
8
|
message: "Report API Key",
|
|
9
|
+
default: config?.not_node_monitor
|
|
10
|
+
? config?.not_node_monitor.report_key
|
|
11
|
+
: "",
|
|
9
12
|
},
|
|
10
13
|
{
|
|
11
14
|
type: "input",
|
|
@@ -22,7 +25,7 @@ function collectNodeReporter(inquirer) {
|
|
|
22
25
|
]);
|
|
23
26
|
}
|
|
24
27
|
|
|
25
|
-
export default (inquirer) => {
|
|
28
|
+
export default (inquirer, config) => {
|
|
26
29
|
return inquirer
|
|
27
30
|
.prompt([
|
|
28
31
|
{
|
|
@@ -34,7 +37,7 @@ export default (inquirer) => {
|
|
|
34
37
|
])
|
|
35
38
|
.then((answer) => {
|
|
36
39
|
if (answer.enabled) {
|
|
37
|
-
return collectNodeReporter(inquirer);
|
|
40
|
+
return collectNodeReporter(inquirer, config);
|
|
38
41
|
} else {
|
|
39
42
|
return false;
|
|
40
43
|
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
function collectData(inquirer) {
|
|
2
|
+
return inquirer.prompt([
|
|
3
|
+
{
|
|
4
|
+
type: "confirm",
|
|
5
|
+
name: "watch",
|
|
6
|
+
message: "Watch & restart?",
|
|
7
|
+
default: true,
|
|
8
|
+
},
|
|
9
|
+
]);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export default (inquirer) => {
|
|
13
|
+
return inquirer
|
|
14
|
+
.prompt([
|
|
15
|
+
{
|
|
16
|
+
type: "confirm",
|
|
17
|
+
name: "enabled",
|
|
18
|
+
message: "Create pm2 environment configs set?",
|
|
19
|
+
default: true,
|
|
20
|
+
},
|
|
21
|
+
])
|
|
22
|
+
.then((answer) => {
|
|
23
|
+
if (answer.enabled) {
|
|
24
|
+
return collectData(inquirer);
|
|
25
|
+
} else {
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
};
|
package/src/cli/readers/ssl.mjs
CHANGED
package/src/cli/readers/ws.mjs
CHANGED
|
@@ -1,10 +1,24 @@
|
|
|
1
|
-
|
|
1
|
+
import { getDefaultPortByShift } from "../const.mjs";
|
|
2
|
+
|
|
3
|
+
function collectData(inquirer, config) {
|
|
2
4
|
return inquirer.prompt([
|
|
5
|
+
{
|
|
6
|
+
type: "input",
|
|
7
|
+
name: "hostname",
|
|
8
|
+
message: "WS hostname (default: window.location.hostname)",
|
|
9
|
+
default: "",
|
|
10
|
+
},
|
|
3
11
|
{
|
|
4
12
|
type: "input",
|
|
5
13
|
name: "port",
|
|
6
14
|
message: "WS port number",
|
|
7
|
-
default:
|
|
15
|
+
default: getDefaultPortByShift(config.port, 1),
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
type: "input",
|
|
19
|
+
name: "path",
|
|
20
|
+
message: "WS path ",
|
|
21
|
+
default: "websocket",
|
|
8
22
|
},
|
|
9
23
|
{
|
|
10
24
|
type: "config",
|
|
@@ -15,7 +29,7 @@ function collectData(inquirer) {
|
|
|
15
29
|
]);
|
|
16
30
|
}
|
|
17
31
|
|
|
18
|
-
export default (inquirer) => {
|
|
32
|
+
export default (inquirer, config) => {
|
|
19
33
|
return inquirer
|
|
20
34
|
.prompt([
|
|
21
35
|
{
|
|
@@ -27,7 +41,7 @@ export default (inquirer) => {
|
|
|
27
41
|
])
|
|
28
42
|
.then((answer) => {
|
|
29
43
|
if (answer.enabled) {
|
|
30
|
-
return collectData(inquirer);
|
|
44
|
+
return collectData(inquirer, config);
|
|
31
45
|
} else {
|
|
32
46
|
return false;
|
|
33
47
|
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { resolve } from "node:path";
|
|
2
|
+
const TEMPLATE_FILE = "./project/deploy.ejs";
|
|
3
|
+
const envs = ["development", "stage", "production"];
|
|
4
|
+
|
|
5
|
+
export default async (
|
|
6
|
+
project_layer_dir,
|
|
7
|
+
data,
|
|
8
|
+
config,
|
|
9
|
+
createFileContent,
|
|
10
|
+
makeScriptExecutable
|
|
11
|
+
) => {
|
|
12
|
+
for (let environment of envs) {
|
|
13
|
+
if (config.deploy[environment]) {
|
|
14
|
+
const DEST_FILE_PATH = resolve(
|
|
15
|
+
project_layer_dir,
|
|
16
|
+
"./deploy",
|
|
17
|
+
`./${environment}.sh`
|
|
18
|
+
);
|
|
19
|
+
const args = {
|
|
20
|
+
...config,
|
|
21
|
+
...data,
|
|
22
|
+
environment,
|
|
23
|
+
hostname: config.hostname[environment],
|
|
24
|
+
deploy: {
|
|
25
|
+
...config.deploy[environment],
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
await createFileContent(
|
|
29
|
+
DEST_FILE_PATH,
|
|
30
|
+
{
|
|
31
|
+
tmpl: TEMPLATE_FILE,
|
|
32
|
+
args: ["AppName", "environment", "deploy"],
|
|
33
|
+
},
|
|
34
|
+
args
|
|
35
|
+
);
|
|
36
|
+
await makeScriptExecutable(DEST_FILE_PATH);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
};
|
|
@@ -27,3 +27,12 @@ export { frontModuleRoleMain };
|
|
|
27
27
|
|
|
28
28
|
import frontModuleGuestMain from "./frontModuleGuestMain.mjs";
|
|
29
29
|
export { frontModuleGuestMain };
|
|
30
|
+
|
|
31
|
+
import pm2 from "./pm2.mjs";
|
|
32
|
+
export { pm2 };
|
|
33
|
+
|
|
34
|
+
import deploy from "./deploy.mjs";
|
|
35
|
+
export { deploy };
|
|
36
|
+
|
|
37
|
+
import nginx from "./nginx.mjs";
|
|
38
|
+
export { nginx };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { resolve } from "node:path";
|
|
2
|
+
const TEMPLATE_FILE = "./project/nginx.ejs";
|
|
3
|
+
const envs = ["development", "stage", "production"];
|
|
4
|
+
|
|
5
|
+
function getPath(project_layer_dir, config, environment) {
|
|
6
|
+
if (config.deploy && config.deploy[environment]) {
|
|
7
|
+
return config.deploy[environment].path;
|
|
8
|
+
}
|
|
9
|
+
return project_layer_dir;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export default async (project_layer_dir, data, config, createFileContent) => {
|
|
13
|
+
for (let environment of envs) {
|
|
14
|
+
const DEST_FILE_PATH = resolve(
|
|
15
|
+
project_layer_dir,
|
|
16
|
+
"./nginx",
|
|
17
|
+
`./${environment}.conf`
|
|
18
|
+
);
|
|
19
|
+
const args = {
|
|
20
|
+
...config,
|
|
21
|
+
...data,
|
|
22
|
+
environment,
|
|
23
|
+
hostname: config.hostname[environment],
|
|
24
|
+
path: getPath(project_layer_dir, config, environment),
|
|
25
|
+
};
|
|
26
|
+
await createFileContent(
|
|
27
|
+
DEST_FILE_PATH,
|
|
28
|
+
{
|
|
29
|
+
tmpl: TEMPLATE_FILE,
|
|
30
|
+
args: [
|
|
31
|
+
"AppName",
|
|
32
|
+
"environment",
|
|
33
|
+
"nginx",
|
|
34
|
+
"ws",
|
|
35
|
+
"ssl",
|
|
36
|
+
"path",
|
|
37
|
+
"hostname",
|
|
38
|
+
"port",
|
|
39
|
+
],
|
|
40
|
+
},
|
|
41
|
+
args
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { resolve } from "node:path";
|
|
2
|
+
const TEMPLATE_FILE = "./project/pm2.ejs";
|
|
3
|
+
const envs = ["development", "stage", "production"];
|
|
4
|
+
|
|
5
|
+
export default async (project_layer_dir, data, config, createFileContent) => {
|
|
6
|
+
for (let environment of envs) {
|
|
7
|
+
const DEST_FILE_PATH = resolve(
|
|
8
|
+
project_layer_dir,
|
|
9
|
+
"./pm2",
|
|
10
|
+
`./${environment}.json`
|
|
11
|
+
);
|
|
12
|
+
const args = {
|
|
13
|
+
...config,
|
|
14
|
+
...data,
|
|
15
|
+
environment,
|
|
16
|
+
hostname: config.hostname[environment],
|
|
17
|
+
};
|
|
18
|
+
await createFileContent(
|
|
19
|
+
DEST_FILE_PATH,
|
|
20
|
+
{
|
|
21
|
+
tmpl: TEMPLATE_FILE,
|
|
22
|
+
args: [
|
|
23
|
+
"AppName",
|
|
24
|
+
"appName",
|
|
25
|
+
"environment",
|
|
26
|
+
"nginx",
|
|
27
|
+
"pm2",
|
|
28
|
+
"ssl",
|
|
29
|
+
"ws",
|
|
30
|
+
"path",
|
|
31
|
+
"hostname",
|
|
32
|
+
"port",
|
|
33
|
+
"debugPort",
|
|
34
|
+
"not_node_reporter",
|
|
35
|
+
"not_node_monitor",
|
|
36
|
+
"db",
|
|
37
|
+
],
|
|
38
|
+
},
|
|
39
|
+
args
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
site: {
|
|
3
|
+
content: "app",
|
|
4
|
+
},
|
|
5
|
+
deploy: {
|
|
6
|
+
ifArgs: ["deploy"],
|
|
7
|
+
},
|
|
8
|
+
nginx: {
|
|
9
|
+
ifArgs: ["nginx"],
|
|
10
|
+
},
|
|
11
|
+
pm2: {
|
|
12
|
+
ifArgs: ["pm2"],
|
|
13
|
+
},
|
|
14
|
+
".env": {
|
|
15
|
+
tmpl: "project/env.ejs",
|
|
16
|
+
args: ["init_root_user", "not_node_monitor", "not_node_reporter"],
|
|
17
|
+
},
|
|
18
|
+
};
|
package/tmpl/dirs/server.mjs
CHANGED
|
@@ -18,25 +18,26 @@ export default {
|
|
|
18
18
|
"rolesSecondary",
|
|
19
19
|
"user",
|
|
20
20
|
"ws",
|
|
21
|
+
"nginx",
|
|
21
22
|
],
|
|
22
23
|
},
|
|
23
24
|
"development.json": {
|
|
24
25
|
tmpl: EMPTY_CONFIG,
|
|
25
|
-
args: ["hostname"],
|
|
26
|
+
args: ["hostname", "nginx"],
|
|
26
27
|
options: {
|
|
27
28
|
ENV: "development",
|
|
28
29
|
},
|
|
29
30
|
},
|
|
30
31
|
"stage.json": {
|
|
31
32
|
tmpl: EMPTY_CONFIG,
|
|
32
|
-
args: ["hostname"],
|
|
33
|
+
args: ["hostname", "nginx"],
|
|
33
34
|
options: {
|
|
34
35
|
ENV: "stage",
|
|
35
36
|
},
|
|
36
37
|
},
|
|
37
38
|
"production.json": {
|
|
38
39
|
tmpl: EMPTY_CONFIG,
|
|
39
|
-
args: ["hostname"],
|
|
40
|
+
args: ["hostname", "nginx"],
|
|
40
41
|
options: {
|
|
41
42
|
ENV: "production",
|
|
42
43
|
},
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"key": "<%- session.key %>"
|
|
45
45
|
},
|
|
46
46
|
<% } %>
|
|
47
|
-
<% if (ssl) { %>
|
|
47
|
+
<% if (ssl && !nginx) { %>
|
|
48
48
|
"ssl": {
|
|
49
49
|
"enabled": true,
|
|
50
50
|
"keys": {
|
|
@@ -112,14 +112,12 @@
|
|
|
112
112
|
"search": ""
|
|
113
113
|
}
|
|
114
114
|
},
|
|
115
|
-
<% } %>
|
|
116
|
-
<% if (modules.includes('not-filter')){ %>
|
|
115
|
+
<% } %>
|
|
117
116
|
"rateLimiter": {
|
|
118
117
|
"keyPrefix": "rateLimiterMiddleware",
|
|
119
118
|
"points": 500,
|
|
120
119
|
"duration": 1
|
|
121
120
|
}
|
|
122
|
-
<% } %>
|
|
123
121
|
},
|
|
124
122
|
"middleware": {
|
|
125
123
|
<%- modules.map(entry => `"${entry}": {}`).join(',') %>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<% if(modules.includes('not-ws')){ %>
|
|
1
|
+
<% if(modules.includes('not-ws') && ws){ %>
|
|
2
2
|
import main from './ws.client.main.js';
|
|
3
3
|
<% } %>
|
|
4
4
|
|
|
@@ -13,15 +13,16 @@ let manifest = {
|
|
|
13
13
|
url: '/'
|
|
14
14
|
},
|
|
15
15
|
modules:{
|
|
16
|
-
<% if(modules.includes('not-ws')){ %>
|
|
16
|
+
<% if(modules.includes('not-ws') && ws){ %>
|
|
17
17
|
ws:{
|
|
18
18
|
clients:{
|
|
19
19
|
//options for ws client here
|
|
20
20
|
main: {
|
|
21
|
-
host: window.location.hostname,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
host: '<%- ws.hostname %>' || window.location.hostname,
|
|
22
|
+
port: <%- ws.port %>,
|
|
23
|
+
path: '<%- ws.path %>',
|
|
24
|
+
secure: <%- ws.secure %>,
|
|
25
|
+
ssl: <%- !!ssl %>
|
|
25
26
|
}
|
|
26
27
|
}
|
|
27
28
|
}
|
|
@@ -6,9 +6,8 @@ const main = {
|
|
|
6
6
|
getToken: () => {
|
|
7
7
|
return notCommon.getApp().getModel('user', {}).$token({})
|
|
8
8
|
.then((res) => {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
return res.result.token;
|
|
9
|
+
notCommon.getApp().setWorking('token', res.result);
|
|
10
|
+
return res.result;
|
|
12
11
|
});
|
|
13
12
|
},
|
|
14
13
|
messenger: {
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
echo 'deploying <%- AppName %> to <%- environment %>'
|
|
3
|
+
cd site
|
|
4
|
+
npm run <%- environment %>
|
|
5
|
+
cd ../
|
|
6
|
+
echo 'syncing data'
|
|
7
|
+
ssh <%- deploy.user %>@<%- deploy.hostname %> "echo '1' > <%- deploy.path %>/deploying"
|
|
8
|
+
rsync -av --progress --exclude-from='./deploy/.exclude' site <%- deploy.user %>@<%- deploy.hostname %>:<%- deploy.path %>/
|
|
9
|
+
rsync -av --progress deploy/<%- environment %>.json <%- deploy.user %>@<%- deploy.hostname %>:<%- deploy.path %>/pm2/<%- environment %>.json
|
|
10
|
+
ssh <%- deploy.user %>@<%- deploy.hostname %> "cd <%- deploy.path %>/site && npm i"
|
|
11
|
+
ssh <%- deploy.user %>@<%- deploy.hostname %> "cd <%- deploy.path %> && pm2 startOrRestart pm2/<%- environment %>.json"
|
|
12
|
+
ssh <%- deploy.user %>@<%- deploy.hostname %> "rm <%- deploy.path %>/deploying"
|
|
13
|
+
exit 0;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
<% if (not_node_reporter)
|
|
1
|
+
<% if (not_node_reporter) { %>
|
|
2
2
|
NOT_NODE_ERROR_KEY=<%- not_node_reporter.key %>
|
|
3
3
|
NOT_NODE_ERROR_URL_NODE=<%- not_node_reporter.url_node %>
|
|
4
4
|
NOT_NODE_ERROR_URL_BROWSER=<%- not_node_reporter.url_browser %>
|
|
5
5
|
<% } %>
|
|
6
|
-
<% if (not_node_monitor)
|
|
6
|
+
<% if (not_node_monitor) { %>
|
|
7
7
|
NOT_NODE_MONITOR_INTERVAL=<%- not_node_monitor.interval %>
|
|
8
8
|
NOT_NODE_MONITOR_REPORT_INTERVAL=<%- not_node_monitor.report_interval %>
|
|
9
9
|
NOT_NODE_MONITOR_REPORT_KEY=<%- not_node_monitor.report_key %>
|
|
10
10
|
NOT_NODE_MONITOR_REPORT_URL=<%- not_node_monitor.report_url %>
|
|
11
11
|
<% } %>
|
|
12
|
-
<% if (init_root_user)
|
|
12
|
+
<% if (init_root_user) { %>
|
|
13
13
|
INIT_ROOT_USERNAME=<%- init_root_user.name %>
|
|
14
14
|
INIT_ROOT_EMAIL=<%- init_root_user.email %>
|
|
15
15
|
INIT_ROOT_PASSWORD=<%- init_root_user.password %>
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
map $http_upgrade $connection_upgrade {
|
|
2
|
+
default upgrade;
|
|
3
|
+
'' close;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
upstream websocket2 {
|
|
7
|
+
server <%- ws.hostname %>:<%- ws.port %>;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
server {
|
|
11
|
+
listen 80 <%- nginx.ssl?" ssl ":" " %> <%- nginx.http2?" http2 ":" " %> <%- nginx.http3?" http3 ":" " %>;
|
|
12
|
+
root <%- path %>/site/app/static;
|
|
13
|
+
index index.html index.htm;
|
|
14
|
+
server_name <%- hostname %>;
|
|
15
|
+
|
|
16
|
+
location /assets/{expires 365d; alias <%- path %>/site/app/static/assets/;}
|
|
17
|
+
location /css/{ expires 365d; alias <%- path %>/site/app/static/css/;}
|
|
18
|
+
location /js/{ expires 365d;alias <%- path %>/site/app/static/js/; }
|
|
19
|
+
location /img/{ expires 365d;alias <%- path %>/site/app/static/img/;}
|
|
20
|
+
location /webfonts/{ expires 365d;alias <%- path %>/site/app/static/webfonts/; }
|
|
21
|
+
location /favicon.ico { expires 365d;alias <%- path %>/site/app/static/favicon.ico; }
|
|
22
|
+
location /sitemap.xml { expires 1d; alias <%- path %>/site/app/static/sitemap.xml; }
|
|
23
|
+
location /robots.txt { expires 365d;alias <%- path %>/site/app/static/robots.txt; }
|
|
24
|
+
location /manifest.webmaniest { expires 365d;alias <%- path %>/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 <%- ssl?'https':'http' %>://<%- hostname %>:<%- port %>/api;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
<% if (ws){ %>
|
|
39
|
+
location /<%- ws.path %> {
|
|
40
|
+
proxy_pass <%- ssl?'https':'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 <%- ssl?'https':'http' %>://<%- hostname %>:<%- port %>/;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
<% if (nginx.ssl) { %>
|
|
61
|
+
listen 443 ssl <%- nginx.http2?" http2 ":" " %> <%- nginx.http3?" http3 ":" " %>;
|
|
62
|
+
<% } %>
|
|
63
|
+
}
|