EMBER_CLI_PROD_ASSETS를 1로 설정하려고 했는데, 에셋 사전 컴파일 시(버전 2.9.0.beta2 커밋: d2de058ff51f204fcf85c86a00750a59505af3bb) 다음과 같은 오류가 발생합니다:
yarn run v1.22.17
$ /var/www/discourse/app/assets/javascripts/node_modules/.bin/ember build -prod
WARNING: Node v16.13.2 is not tested against Ember CLI on your platform. We recommend that you use the most-recent "Active LTS" version of Node.js. See https://git.io/v7S5n for details.
DEPRECATION: The integration of jQuery into Ember has been deprecated and will be removed with Ember 4.0. You can either opt-out of using jQuery, or install the `@ember/jquery` addon to provide the jQuery integration. Please consult the deprecation guide for further details: https://emberjs.com/deprecations/v3.x#toc_jquery-apis
A system error occurred: uv_os_get_passwd returned ENOENT (no such file or directory)
node:internal/errors:464
ErrorCaptureStackTrace(err);
^
SystemError [ERR_SYSTEM_ERROR]: A system error occurred: uv_os_get_passwd returned ENOENT (no such file or directory)
at new SystemError (node:internal/errors:233:5)
at new NodeError (node:internal/errors:336:7)
at Object.userInfo (node:os:347:11)
at summarizeProcess (/var/www/discourse/app/assets/javascripts/node_modules/console-ui/lib/summarize-process.js:17:15)
at writeError (/var/www/discourse/app/assets/javascripts/node_modules/console-ui/lib/write-error.js:114:3)
at UI.writeError (/var/www/discourse/app/assets/javascripts/node_modules/console-ui/lib/index.js:167:20)
at CLI.logError (/var/www/discourse/app/assets/javascripts/node_modules/ember-cli/lib/cli/cli.js:318:13)
at CLI.run (/var/www/discourse/app/assets/javascripts/node_modules/ember-cli/lib/cli/cli.js:253:12)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async module.exports (/var/www/discourse/app/assets/javascripts/node_modules/ember-cli/lib/cli/index.js:145:12) {
code: 'ERR_SYSTEM_ERROR',
info: {
errno: -2,
code: 'ENOENT',
message: 'no such file or directory',
syscall: 'uv_os_get_passwd'
},
errno: [Getter/Setter],
syscall: [Getter/Setter]
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
흥미롭네요. 제안하신 내용을 실행했을 때 다음과 같은 결과를 얻었습니다 (root가 아닌 랜덤 사용자로 내부 라이브러리 시스템에 접근하려는 의도라면 충분히 이해가 가는 결과입니다):
node
Welcome to Node.js v16.13.2.
Type ".help" for more information.
> const os = require('os');
undefined
> os.userInfo().shell
Uncaught:
SystemError [ERR_SYSTEM_ERROR]: A system error occurred: uv_os_get_passwd returned ENOENT (no such file or directory)
at __node_internal_captureLargerStackTrace (node:internal/errors:464:5)
at new SystemError (node:internal/errors:233:5)
at new NodeError (node:internal/errors:336:7)
at Object.userInfo (node:os:347:11) {
code: 'ERR_SYSTEM_ERROR',
info: {
errno: -2,
code: 'ENOENT',
message: 'no such file or directory',
syscall: 'uv_os_get_passwd'
},
errno: [Getter/Setter: -2],
syscall: [Getter/Setter: 'uv_os_get_passwd']
}
>
Discourse 이미지를 정확히 어떻게 실행하고 계신가요? 보안 관련 추가 플래그가 있나요?
저희는 OpenShift 기반의 컨테이너화 솔루션을 사용 중이며, Discourse는 랜덤한 사용자 ID로 실행되고 있습니다. 지금까지는 문제가 없었으며, 공식 설치 가이드와 매우 유사한 접근 방식을 취하고 있습니다. EMBER_CLI_PROD_ASSETS를 0으로 설정하여 이 문제를 우회할 수는 있지만, 자산은 예전처럼 사전 컴파일됩니다. 다만, 향후 이 방향으로 전환할 계획이라면 현재의 사전 컴파일 프로세스가 폐기될 경우 랜덤 사용자 ID를 사용하는 컨테이너화 솔루션에 실질적인 문제가 될 수 있습니다.
따라서 몇 가지 질문을 드리고자 합니다:
예전 방식의 자산 사전 컴파일링을 폐기할 계획이라면(그렇다면) 예상 시점은 언제인가요?
os 모듈에 다른 방식으로 접근하거나, 다른 접근 방식을 고려하여 랜덤 사용자 ID를 사용하는 컨테이너화 솔루션이 계속 작동할 수 있는 방법이 있나요?
기록을 위해, 그리고 혹시 주변 누군가에게 도움이 될 수 있을지 모르겠지만. 무작위 uid를 사용하면서 ember cli가 예상대로 작동하도록 만드는 방법이 최소한 하나 있습니다. 그것은 rake assets:precompile 작업을 실행할 시점에 할당된 무작위 uid가 /etc/passwd에 항목으로 존재하도록 보장하는 것입니다.
다음과 같은 것 말이죠:
if [ `id -u` -ge 10000 ]; then
cat /etc/passwd | sed -e "s/^discourse:/builder:/" > /tmp/passwd
echo "discourse:x:`id -u`:`id -g`:,,,:/home/discourse:/bin/bash" >> /tmp/passwd
cat /tmp/passwd > /etc/passwd
rm /tmp/passwd
fi
yarn run v1.22.17
$ /discourse/app/assets/javascripts/node_modules/.bin/ember build -prod
WARNING: Node v16.13.2 is not tested against Ember CLI on your platform. We recommend that you use the most-recent "Active LTS" version of Node.js. See https://git.io/v7S5n for details.
DEPRECATION: The integration of jQuery into Ember has been deprecated and will be removed with Ember 4.0. You can either opt-out of using jQuery, or install the `@ember/jquery` addon to provide the jQuery integration. Please consult the deprecation guide for further details: https://emberjs.com/deprecations/v3.x#toc_jquery-apis
- Building
Environment: production
- Building
- building...
[WARN] (broccoli-terser-sourcemap) Minifying "assets/chunk.529.6ee9018498e97f872147.js" took: 24288ms (more than 20,000ms)
...
또한 이 작업이 꽤 비용이 많이 든다는 것도 알게 되었습니다. 사전 컴파일에만 거의 2GB의 램을 소비하니까요