arui-scripts 18.4.0 → 18.5.0
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/.turbo/turbo-lint.log +11 -8
- package/.turbo/turbo-test.log +5 -5
- package/CHANGELOG.md +20 -0
- package/build/commands/docker-build/index.js +2 -0
- package/build/commands/docker-build-compiled/index.js +2 -0
- package/build/commands/util/docker-build.d.ts +2 -1
- package/build/commands/util/docker-build.js +20 -5
- package/build/configs/app-configs/get-defaults.d.ts +2 -0
- package/build/configs/app-configs/get-defaults.js +7 -1
- package/build/configs/app-configs/types.d.ts +8 -0
- package/build/configs/util/apply-overrides.d.ts +1 -0
- package/build/templates/base-nginx.conf.template.d.ts +2 -0
- package/build/templates/base-nginx.conf.template.js +61 -0
- package/build/templates/dockerfile-compiled.template.js +3 -0
- package/build/templates/dockerfile.template.js +3 -0
- package/build/tsconfig-local.tsbuildinfo +1 -1
- package/docs/overrides.md +3 -0
- package/docs/settings.md +16 -0
- package/package.json +1 -1
package/.turbo/turbo-lint.log
CHANGED
|
@@ -49,8 +49,8 @@
|
|
|
49
49
|
32:8 warning Prefer named exports import/no-default-export
|
|
50
50
|
|
|
51
51
|
/home/runner/work/arui-scripts/arui-scripts/packages/arui-scripts/src/configs/app-configs/types.ts
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
105:17 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
|
|
53
|
+
128:17 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
|
|
54
54
|
|
|
55
55
|
/home/runner/work/arui-scripts/arui-scripts/packages/arui-scripts/src/configs/babel-client.ts
|
|
56
56
|
69:8 warning Prefer named exports import/no-default-export
|
|
@@ -107,9 +107,9 @@
|
|
|
107
107
|
28:18 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
|
|
108
108
|
29:24 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
|
|
109
109
|
36:14 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
110
|
+
50:38 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
|
|
111
|
+
128:48 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
|
|
112
|
+
151:8 warning Prefer named exports import/no-default-export
|
|
113
113
|
|
|
114
114
|
/home/runner/work/arui-scripts/arui-scripts/packages/arui-scripts/src/configs/util/check-node-version.ts
|
|
115
115
|
7:8 warning Prefer named exports import/no-default-export
|
|
@@ -151,12 +151,15 @@
|
|
|
151
151
|
/home/runner/work/arui-scripts/arui-scripts/packages/arui-scripts/src/plugins/postcss-prefix-selector.ts
|
|
152
152
|
40:79 warning Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
|
|
153
153
|
|
|
154
|
+
/home/runner/work/arui-scripts/arui-scripts/packages/arui-scripts/src/templates/base-nginx.conf.template.ts
|
|
155
|
+
62:8 warning Prefer named exports import/no-default-export
|
|
156
|
+
|
|
154
157
|
/home/runner/work/arui-scripts/arui-scripts/packages/arui-scripts/src/templates/dockerfile-compiled.template.ts
|
|
155
158
|
2:8 warning Using exported name 'configs' as identifier for default export import/no-named-as-default
|
|
156
|
-
|
|
159
|
+
52:8 warning Prefer named exports import/no-default-export
|
|
157
160
|
|
|
158
161
|
/home/runner/work/arui-scripts/arui-scripts/packages/arui-scripts/src/templates/dockerfile.template.ts
|
|
159
|
-
|
|
162
|
+
40:8 warning Prefer named exports import/no-default-export
|
|
160
163
|
|
|
161
164
|
/home/runner/work/arui-scripts/arui-scripts/packages/arui-scripts/src/templates/nginx.conf.template.ts
|
|
162
165
|
36:8 warning Prefer named exports import/no-default-export
|
|
@@ -167,6 +170,6 @@
|
|
|
167
170
|
/home/runner/work/arui-scripts/arui-scripts/packages/arui-scripts/src/types.d.ts
|
|
168
171
|
4:12 warning Prefer named exports import/no-default-export
|
|
169
172
|
|
|
170
|
-
✖
|
|
173
|
+
✖ 77 problems (0 errors, 77 warnings)
|
|
171
174
|
0 errors and 2 warnings potentially fixable with the `--fix` option.
|
|
172
175
|
|
package/.turbo/turbo-test.log
CHANGED
|
@@ -5,20 +5,20 @@ ts-jest[versions] (WARN) Version 29.7.0 of jest installed has not been tested wi
|
|
|
5
5
|
ts-jest[versions] (WARN) Version 5.6.3 of typescript installed has not been tested with ts-jest. If you're experiencing issues, consider using a supported version (>=4.3.0 <5.0.0-0). Please do not report issues in ts-jest if you are using unsupported versions.
|
|
6
6
|
ts-jest[versions] (WARN) Version 5.6.3 of typescript installed has not been tested with ts-jest. If you're experiencing issues, consider using a supported version (>=4.3.0 <5.0.0-0). Please do not report issues in ts-jest if you are using unsupported versions.
|
|
7
7
|
ts-jest[versions] (WARN) Version 5.6.3 of typescript installed has not been tested with ts-jest. If you're experiencing issues, consider using a supported version (>=4.3.0 <5.0.0-0). Please do not report issues in ts-jest if you are using unsupported versions.
|
|
8
|
-
PASS src/configs/
|
|
8
|
+
PASS src/configs/util/__tests__/get-polyfills.tests.ts (22 s)
|
|
9
9
|
PASS src/configs/util/__tests__/apply-overrides.tests.ts
|
|
10
10
|
PASS src/configs/app-configs/__tests__/update-with-env.tests.ts
|
|
11
|
-
PASS src/configs/
|
|
12
|
-
PASS src/configs/app-configs/__tests__/update-with-package.tests.ts
|
|
11
|
+
PASS src/configs/app-configs/__tests__/update-with-presets.tests.ts (23.524 s)
|
|
13
12
|
PASS src/configs/app-configs/__tests__/validate-settings-keys.tests.ts
|
|
13
|
+
PASS src/configs/app-configs/__tests__/update-with-package.tests.ts
|
|
14
14
|
Failed to load /home/runner/work/arui-scripts/arui-scripts/packages/arui-scripts/tsconfig.json: Missing baseUrl in compilerOptions
|
|
15
15
|
Failed to load /home/runner/work/arui-scripts/arui-scripts/packages/arui-scripts/tsconfig.json: Missing baseUrl in compilerOptions
|
|
16
16
|
Failed to load /home/runner/work/arui-scripts/arui-scripts/packages/arui-scripts/tsconfig.json: Missing baseUrl in compilerOptions
|
|
17
17
|
Failed to load /home/runner/work/arui-scripts/arui-scripts/packages/arui-scripts/tsconfig.json: Missing baseUrl in compilerOptions
|
|
18
|
-
PASS src/configs/util/__tests__/find-plugin.tests.ts (
|
|
18
|
+
PASS src/configs/util/__tests__/find-plugin.tests.ts (28.952 s)
|
|
19
19
|
|
|
20
20
|
Test Suites: 7 passed, 7 total
|
|
21
21
|
Tests: 21 passed, 21 total
|
|
22
22
|
Snapshots: 0 total
|
|
23
|
-
Time:
|
|
23
|
+
Time: 30.509 s
|
|
24
24
|
Ran all test suites.
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# [15.3.0](https://github.com/core-ds/arui-scripts/compare/v15.2.0...v15.3.0) (2023-06-30)
|
|
2
2
|
|
|
3
|
+
## 18.5.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#286](https://github.com/core-ds/arui-scripts/pull/286) [`d003647`](https://github.com/core-ds/arui-scripts/commit/d00364743ab9a11e11393841b31a5ead2fd12b2f) Thanks [@makdv](https://github.com/makdv)! - #### Добавлена возможность перезаписывать некоторые параметры для базового конфига nginx (/etc/nginx/nginx.conf).
|
|
8
|
+
|
|
9
|
+
Пример добавления нового свойства `nginx` (в примере указаны значения, которые и так будут использованы по-умолчанию)
|
|
10
|
+
|
|
11
|
+
```json
|
|
12
|
+
"aruiScripts": {
|
|
13
|
+
"nginx": {
|
|
14
|
+
"workerProcesses": 2,
|
|
15
|
+
"workerRlimitNoFile": 20000,
|
|
16
|
+
"workerConnections": 19000,
|
|
17
|
+
"eventsUse": "epoll",
|
|
18
|
+
"daemon": "off"
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
```
|
|
22
|
+
|
|
3
23
|
## 18.4.0
|
|
4
24
|
|
|
5
25
|
### Minor Changes
|
|
@@ -14,6 +14,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
16
16
|
const app_configs_1 = __importDefault(require("../../configs/app-configs"));
|
|
17
|
+
const base_nginx_conf_template_1 = __importDefault(require("../../templates/base-nginx.conf.template"));
|
|
17
18
|
const dockerfile_template_1 = __importDefault(require("../../templates/dockerfile.template"));
|
|
18
19
|
const nginx_conf_template_1 = __importDefault(require("../../templates/nginx.conf.template"));
|
|
19
20
|
const start_template_1 = __importDefault(require("../../templates/start.template"));
|
|
@@ -30,6 +31,7 @@ const yarn_1 = require("../util/yarn");
|
|
|
30
31
|
pathToTempDir,
|
|
31
32
|
dockerfileTemplate: dockerfile_template_1.default,
|
|
32
33
|
nginxConfTemplate: nginx_conf_template_1.default,
|
|
34
|
+
nginxBaseConfTemplate: base_nginx_conf_template_1.default,
|
|
33
35
|
startScriptTemplate: start_template_1.default,
|
|
34
36
|
allowLocalDockerfile: true,
|
|
35
37
|
allowLocalStartScript: true,
|
|
@@ -14,6 +14,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
16
16
|
const app_configs_1 = __importDefault(require("../../configs/app-configs"));
|
|
17
|
+
const base_nginx_conf_template_1 = __importDefault(require("../../templates/base-nginx.conf.template"));
|
|
17
18
|
const dockerfile_compiled_template_1 = __importDefault(require("../../templates/dockerfile-compiled.template"));
|
|
18
19
|
const nginx_conf_template_1 = __importDefault(require("../../templates/nginx.conf.template"));
|
|
19
20
|
const start_template_1 = __importDefault(require("../../templates/start.template"));
|
|
@@ -28,6 +29,7 @@ const exec_1 = __importDefault(require("../util/exec"));
|
|
|
28
29
|
pathToTempDir,
|
|
29
30
|
dockerfileTemplate: dockerfile_compiled_template_1.default,
|
|
30
31
|
nginxConfTemplate: nginx_conf_template_1.default,
|
|
32
|
+
nginxBaseConfTemplate: base_nginx_conf_template_1.default,
|
|
31
33
|
startScriptTemplate: start_template_1.default,
|
|
32
34
|
allowLocalDockerfile: false,
|
|
33
35
|
allowLocalStartScript: false,
|
|
@@ -6,13 +6,14 @@ export declare function getBuildParamsFromArgs(): {
|
|
|
6
6
|
type PrepareFilesForDockerParams = {
|
|
7
7
|
dockerfileTemplate: string;
|
|
8
8
|
nginxConfTemplate: string;
|
|
9
|
+
nginxBaseConfTemplate: string;
|
|
9
10
|
startScriptTemplate: string;
|
|
10
11
|
pathToTempDir: string;
|
|
11
12
|
allowLocalDockerfile: boolean;
|
|
12
13
|
allowLocalStartScript: boolean;
|
|
13
14
|
addNodeModulesToDockerIgnore: boolean;
|
|
14
15
|
};
|
|
15
|
-
export declare function prepareFilesForDocker({ dockerfileTemplate, nginxConfTemplate, startScriptTemplate, pathToTempDir, allowLocalDockerfile, allowLocalStartScript, addNodeModulesToDockerIgnore, }: PrepareFilesForDockerParams): Promise<void>;
|
|
16
|
+
export declare function prepareFilesForDocker({ dockerfileTemplate, nginxConfTemplate, nginxBaseConfTemplate, startScriptTemplate, pathToTempDir, allowLocalDockerfile, allowLocalStartScript, addNodeModulesToDockerIgnore, }: PrepareFilesForDockerParams): Promise<void>;
|
|
16
17
|
export declare function dockerVersionSatisfies(request: string): boolean;
|
|
17
18
|
type DockerBuildCommandParams = {
|
|
18
19
|
tempDirName: string;
|
|
@@ -21,6 +21,7 @@ const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
|
21
21
|
const satisfies_1 = __importDefault(require("semver/functions/satisfies"));
|
|
22
22
|
const shelljs_1 = __importDefault(require("shelljs"));
|
|
23
23
|
const app_configs_1 = __importDefault(require("../../configs/app-configs"));
|
|
24
|
+
const get_defaults_1 = require("../../configs/app-configs/get-defaults");
|
|
24
25
|
function getBuildParamsFromArgs() {
|
|
25
26
|
let imageVersion = app_configs_1.default.version;
|
|
26
27
|
let imageName = app_configs_1.default.name;
|
|
@@ -54,8 +55,14 @@ function getBuildParamsFromArgs() {
|
|
|
54
55
|
};
|
|
55
56
|
}
|
|
56
57
|
function prepareFilesForDocker(_a) {
|
|
57
|
-
return __awaiter(this, arguments, void 0, function* ({ dockerfileTemplate, nginxConfTemplate, startScriptTemplate, pathToTempDir, allowLocalDockerfile, allowLocalStartScript, addNodeModulesToDockerIgnore, }) {
|
|
58
|
+
return __awaiter(this, arguments, void 0, function* ({ dockerfileTemplate, nginxConfTemplate, nginxBaseConfTemplate, startScriptTemplate, pathToTempDir, allowLocalDockerfile, allowLocalStartScript, addNodeModulesToDockerIgnore, }) {
|
|
58
59
|
yield fs_extra_1.default.emptyDir(pathToTempDir);
|
|
60
|
+
let nginxBaseConf = '';
|
|
61
|
+
if (app_configs_1.default.nginx) {
|
|
62
|
+
nginxBaseConf = app_configs_1.default.localNginxBaseConf
|
|
63
|
+
? yield fs_extra_1.default.readFile(app_configs_1.default.localNginxBaseConf, 'utf8')
|
|
64
|
+
: nginxBaseConfTemplate;
|
|
65
|
+
}
|
|
59
66
|
const nginxConf = app_configs_1.default.localNginxConf
|
|
60
67
|
? yield fs_extra_1.default.readFile(app_configs_1.default.localNginxConf, 'utf8')
|
|
61
68
|
: nginxConfTemplate;
|
|
@@ -70,7 +77,9 @@ function prepareFilesForDocker(_a) {
|
|
|
70
77
|
(yield getAndModifyDockerIgnoreContent(dockerIgnoreFilePath));
|
|
71
78
|
yield Promise.all([
|
|
72
79
|
fs_extra_1.default.writeFile(path_1.default.join(pathToTempDir, 'Dockerfile'), dockerfile, 'utf8'),
|
|
73
|
-
fs_extra_1.default.writeFile(path_1.default.join(pathToTempDir,
|
|
80
|
+
fs_extra_1.default.writeFile(path_1.default.join(pathToTempDir, get_defaults_1.nginxConfigFileName), nginxConf, 'utf8'),
|
|
81
|
+
nginxBaseConf &&
|
|
82
|
+
fs_extra_1.default.writeFile(path_1.default.join(pathToTempDir, get_defaults_1.baseNginxConfigFileName), nginxBaseConf, 'utf8'),
|
|
74
83
|
fs_extra_1.default.writeFile(path_1.default.join(pathToTempDir, 'start.sh'), startScript, {
|
|
75
84
|
encoding: 'utf8',
|
|
76
85
|
mode: 0o555,
|
|
@@ -78,7 +87,7 @@ function prepareFilesForDocker(_a) {
|
|
|
78
87
|
addNodeModulesToDockerIgnore &&
|
|
79
88
|
dockerIgnoreFileContent &&
|
|
80
89
|
fs_extra_1.default.writeFile(dockerIgnoreFilePath, dockerIgnoreFileContent, 'utf-8'),
|
|
81
|
-
]);
|
|
90
|
+
].filter(Boolean));
|
|
82
91
|
});
|
|
83
92
|
}
|
|
84
93
|
function dockerVersionSatisfies(request) {
|
|
@@ -88,7 +97,8 @@ function dockerVersionSatisfies(request) {
|
|
|
88
97
|
const dockerClientVersion = shelljs_1.default.exec("docker version --format '{{.Client.Version}}'", {
|
|
89
98
|
silent: true,
|
|
90
99
|
});
|
|
91
|
-
return (0, satisfies_1.default)(dockerServerVersion.toString(), request) &&
|
|
100
|
+
return ((0, satisfies_1.default)(dockerServerVersion.toString(), request) &&
|
|
101
|
+
(0, satisfies_1.default)(dockerClientVersion.toString(), request));
|
|
92
102
|
}
|
|
93
103
|
function getDockerBuildCommand({ tempDirName, imageFullName }) {
|
|
94
104
|
// если пытаться собрать проект на маках с m1, докер будет пытаться вытянуть базовый образ под свою платформу и
|
|
@@ -97,7 +107,12 @@ function getDockerBuildCommand({ tempDirName, imageFullName }) {
|
|
|
97
107
|
// Соответственно они будут падать при наличии этого флага.
|
|
98
108
|
// https://docs.docker.com/engine/release-notes/20.10/
|
|
99
109
|
const canUsePlatformFlag = dockerVersionSatisfies('>=20.10.21');
|
|
100
|
-
return `docker build ${canUsePlatformFlag ? '--platform linux/x86_64' : ''}
|
|
110
|
+
return `docker build ${canUsePlatformFlag ? '--platform linux/x86_64' : ''} \
|
|
111
|
+
-f "./${tempDirName}/Dockerfile" \
|
|
112
|
+
--build-arg START_SH_LOCATION="./${tempDirName}/start.sh" \
|
|
113
|
+
--build-arg NGINX_CONF_LOCATION="./${tempDirName}/${get_defaults_1.nginxConfigFileName}" \
|
|
114
|
+
--build-arg NGINX_BASE_CONF_LOCATION="./${tempDirName}/${get_defaults_1.baseNginxConfigFileName}" \
|
|
115
|
+
-t ${imageFullName} .`;
|
|
101
116
|
}
|
|
102
117
|
function getAndModifyDockerIgnoreContent(dockerIgnoreFilePath) {
|
|
103
118
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import { AppConfigs, AppContext } from './types';
|
|
2
|
+
export declare const nginxConfigFileName = "nginx.conf";
|
|
3
|
+
export declare const baseNginxConfigFileName = "base-nginx.conf";
|
|
2
4
|
export declare function getDefaultAppConfig(): AppConfigs;
|
|
3
5
|
export declare function getDefaultAppContext(): AppContext;
|
|
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.baseNginxConfigFileName = exports.nginxConfigFileName = void 0;
|
|
6
7
|
exports.getDefaultAppConfig = getDefaultAppConfig;
|
|
7
8
|
exports.getDefaultAppContext = getDefaultAppContext;
|
|
8
9
|
const fs_1 = __importDefault(require("fs"));
|
|
@@ -11,6 +12,8 @@ const resolve_1 = require("../util/resolve");
|
|
|
11
12
|
const read_config_file_1 = require("./read-config-file");
|
|
12
13
|
const CWD = process.cwd();
|
|
13
14
|
const absoluteSrcPath = path_1.default.resolve(CWD, 'src');
|
|
15
|
+
exports.nginxConfigFileName = 'nginx.conf';
|
|
16
|
+
exports.baseNginxConfigFileName = 'base-nginx.conf';
|
|
14
17
|
function getDefaultAppConfig() {
|
|
15
18
|
var _a;
|
|
16
19
|
const appPackage = getPackageJson();
|
|
@@ -39,6 +42,7 @@ function getDefaultAppConfig() {
|
|
|
39
42
|
dockerRegistry: '',
|
|
40
43
|
baseDockerImage: 'alfabankui/arui-scripts:16.20.2-slim',
|
|
41
44
|
nginxRootPath: '/src',
|
|
45
|
+
nginx: null,
|
|
42
46
|
runFromNonRootUser: true,
|
|
43
47
|
removeDevDependenciesDuringDockerBuild: true,
|
|
44
48
|
// archive compilation configs
|
|
@@ -97,7 +101,8 @@ function getDefaultAppContext() {
|
|
|
97
101
|
const projectTsConfigPath = path_1.default.join(CWD, 'tsconfig.json');
|
|
98
102
|
const yarnLockFilePath = path_1.default.join(CWD, 'yarn.lock');
|
|
99
103
|
const overridesPath = (0, resolve_1.tryResolve)(path_1.default.join(CWD, 'arui-scripts.overrides'));
|
|
100
|
-
const nginxConfFilePath = path_1.default.join(CWD,
|
|
104
|
+
const nginxConfFilePath = path_1.default.join(CWD, exports.nginxConfigFileName);
|
|
105
|
+
const nginxBaseConfFilePath = path_1.default.join(CWD, exports.baseNginxConfigFileName);
|
|
101
106
|
const dockerfileFilePath = path_1.default.join(CWD, 'Dockerfile');
|
|
102
107
|
const startScriptFilePath = path_1.default.join(CWD, 'start.sh');
|
|
103
108
|
return {
|
|
@@ -117,6 +122,7 @@ function getDefaultAppContext() {
|
|
|
117
122
|
// compilation configs locations
|
|
118
123
|
tsconfig: fs_1.default.existsSync(projectTsConfigPath) ? projectTsConfigPath : null,
|
|
119
124
|
localNginxConf: fs_1.default.existsSync(nginxConfFilePath) ? nginxConfFilePath : null,
|
|
125
|
+
localNginxBaseConf: fs_1.default.existsSync(nginxBaseConfFilePath) ? nginxBaseConfFilePath : null,
|
|
120
126
|
localDockerfile: fs_1.default.existsSync(dockerfileFilePath) ? dockerfileFilePath : null,
|
|
121
127
|
localStartScript: fs_1.default.existsSync(startScriptFilePath) ? startScriptFilePath : null,
|
|
122
128
|
// Эти пути зависят от других настроек, которые могут быть переопределены пользователем
|
|
@@ -25,6 +25,13 @@ export type AppConfigs = {
|
|
|
25
25
|
dockerRegistry: string;
|
|
26
26
|
baseDockerImage: string;
|
|
27
27
|
nginxRootPath: string;
|
|
28
|
+
nginx: {
|
|
29
|
+
workerProcesses?: number;
|
|
30
|
+
workerRlimitNoFile?: number;
|
|
31
|
+
workerConnections?: number;
|
|
32
|
+
eventsUse?: string;
|
|
33
|
+
daemon?: string;
|
|
34
|
+
} | null;
|
|
28
35
|
runFromNonRootUser: boolean;
|
|
29
36
|
removeDevDependenciesDuringDockerBuild: boolean;
|
|
30
37
|
archiveName: string;
|
|
@@ -111,6 +118,7 @@ export type AppContext = {
|
|
|
111
118
|
useYarn: boolean;
|
|
112
119
|
tsconfig: string | null;
|
|
113
120
|
localNginxConf: string | null;
|
|
121
|
+
localNginxBaseConf: string | null;
|
|
114
122
|
localDockerfile: string | null;
|
|
115
123
|
localStartScript: string | null;
|
|
116
124
|
overridesPath: string[];
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const app_configs_1 = require("../configs/app-configs");
|
|
7
|
+
const apply_overrides_1 = __importDefault(require("../configs/util/apply-overrides"));
|
|
8
|
+
const baseNginxConfig = {
|
|
9
|
+
workerProcesses: 2,
|
|
10
|
+
workerRlimitNoFile: 20000,
|
|
11
|
+
workerConnections: 19000,
|
|
12
|
+
eventsUse: 'epoll',
|
|
13
|
+
daemon: 'off',
|
|
14
|
+
};
|
|
15
|
+
const nginx = Object.assign(Object.assign({}, baseNginxConfig), app_configs_1.configs.nginx);
|
|
16
|
+
const baseNginxTemplate = `
|
|
17
|
+
worker_processes ${nginx.workerProcesses};
|
|
18
|
+
worker_rlimit_nofile ${nginx.workerRlimitNoFile};
|
|
19
|
+
daemon ${nginx.daemon};
|
|
20
|
+
|
|
21
|
+
error_log /var/log/nginx/error.log;
|
|
22
|
+
pid /var/run/nginx.pid;
|
|
23
|
+
|
|
24
|
+
events {
|
|
25
|
+
worker_connections ${nginx.workerConnections};
|
|
26
|
+
use ${nginx.eventsUse};
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
http {
|
|
30
|
+
include /etc/nginx/mime.types;
|
|
31
|
+
default_type application/octet-stream;
|
|
32
|
+
|
|
33
|
+
server_tokens off;
|
|
34
|
+
access_log off;
|
|
35
|
+
keepalive_timeout 65;
|
|
36
|
+
proxy_read_timeout 200;
|
|
37
|
+
sendfile on;
|
|
38
|
+
tcp_nopush on;
|
|
39
|
+
tcp_nodelay on;
|
|
40
|
+
|
|
41
|
+
gzip_static on;
|
|
42
|
+
brotli on;
|
|
43
|
+
brotli_static on;
|
|
44
|
+
brotli_types application/atom+xml application/javascript application/json application/rss+xml
|
|
45
|
+
application/vnd.ms-fontobject application/x-font-opentype application/x-font-truetype
|
|
46
|
+
application/x-font-ttf application/x-javascript application/xhtml+xml application/xml
|
|
47
|
+
font/eot font/opentype font/otf font/truetype image/svg+xml image/vnd.microsoft.icon
|
|
48
|
+
image/x-icon image/x-win-bitmap text/css text/javascript text/plain text/xml application/wasm;
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
# Only retry if there was a communication error, not a timeout
|
|
52
|
+
# on the Node server (to avoid propagating "queries of death"
|
|
53
|
+
# to all frontends)
|
|
54
|
+
proxy_next_upstream error;
|
|
55
|
+
|
|
56
|
+
#cache
|
|
57
|
+
proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=all:32m max_size=1g;
|
|
58
|
+
|
|
59
|
+
include /etc/nginx/conf.d/*.conf;
|
|
60
|
+
}`;
|
|
61
|
+
exports.default = (0, apply_overrides_1.default)('nginxConf', baseNginxTemplate);
|
|
@@ -8,6 +8,7 @@ const app_configs_1 = __importDefault(require("../configs/app-configs"));
|
|
|
8
8
|
const apply_overrides_1 = __importDefault(require("../configs/util/apply-overrides"));
|
|
9
9
|
const installProductionCommand = (0, yarn_1.getInstallProductionCommand)();
|
|
10
10
|
const yarnVersion = (0, yarn_1.getYarnVersion)();
|
|
11
|
+
const { nginx } = app_configs_1.default;
|
|
11
12
|
// В зависимости от используемого мендежера зависимостей для их установки нужно копировать разный набор файлов
|
|
12
13
|
const filesRequiredToInstallDependencies = [
|
|
13
14
|
'package.json',
|
|
@@ -20,12 +21,14 @@ const dockerfileTemplate = `
|
|
|
20
21
|
FROM ${app_configs_1.default.baseDockerImage}
|
|
21
22
|
ARG START_SH_LOCATION
|
|
22
23
|
ARG NGINX_CONF_LOCATION
|
|
24
|
+
ARG NGINX_BASE_CONF_LOCATION
|
|
23
25
|
|
|
24
26
|
WORKDIR /src
|
|
25
27
|
|
|
26
28
|
# Полу-статичные файлы, могут легко кешироваться
|
|
27
29
|
ADD $START_SH_LOCATION /src/start.sh
|
|
28
30
|
ADD $NGINX_CONF_LOCATION /src/nginx.conf
|
|
31
|
+
${nginx ? 'ADD $NGINX_BASE_CONF_LOCATION /etc/nginx/nginx.conf' : ''}
|
|
29
32
|
|
|
30
33
|
# Зависимости. При некоторой удаче могут кешироваться и соответственно кешировать установку зависимостей
|
|
31
34
|
${filesRequiredToInstallDependencies
|
|
@@ -8,6 +8,7 @@ const apply_overrides_1 = __importDefault(require("../configs/util/apply-overrid
|
|
|
8
8
|
const appPathToAdd = app_configs_1.configs.clientOnly ? app_configs_1.configs.buildPath : '.';
|
|
9
9
|
const appTargetPath = app_configs_1.configs.clientOnly ? `/src/${app_configs_1.configs.buildPath}` : '/src';
|
|
10
10
|
const nginxConfTargetLocation = app_configs_1.configs.clientOnly ? '/etc/nginx/conf.d/default.conf' : '/src/nginx.conf';
|
|
11
|
+
const { nginx } = app_configs_1.configs;
|
|
11
12
|
const nginxNonRootPart = app_configs_1.configs.runFromNonRootUser
|
|
12
13
|
? `RUN chown -R nginx:nginx /src && \\
|
|
13
14
|
mkdir -p /var/lib/nginx && \\
|
|
@@ -24,10 +25,12 @@ const dockerfileTemplate = `
|
|
|
24
25
|
FROM ${app_configs_1.configs.baseDockerImage}
|
|
25
26
|
ARG START_SH_LOCATION
|
|
26
27
|
ARG NGINX_CONF_LOCATION
|
|
28
|
+
ARG NGINX_BASE_CONF_LOCATION
|
|
27
29
|
|
|
28
30
|
WORKDIR /src
|
|
29
31
|
ADD $START_SH_LOCATION /src/start.sh
|
|
30
32
|
ADD $NGINX_CONF_LOCATION ${nginxConfTargetLocation}
|
|
33
|
+
${nginx ? 'ADD $NGINX_BASE_CONF_LOCATION /etc/nginx/nginx.conf' : ''}
|
|
31
34
|
|
|
32
35
|
${nginxNonRootPart}
|
|
33
36
|
|