Я попытался развернуть свое приложение Rails 6, которое работает стабильно на производстве (!), Во второй новой среде на elasti c beanstalk (eb), и я не могу запустить его, несмотря на то, что просто скопировал конфигурацию из первой установки.
После изучения всех ресурсов, которые я мог найти в течение 2 дней, в настоящее время я застрял со следующей ошибкой compilation failed: webpack not installed
:
-------------------------------------
/var/log/eb-activity.log
-------------------------------------
+++ export RUBY_VERSION=2.6.5
+++ RUBY_VERSION=2.6.5
+++ export GEM_ROOT=/opt/rubies/ruby-2.6.5/lib/ruby/gems/2.6.0
+++ GEM_ROOT=/opt/rubies/ruby-2.6.5/lib/ruby/gems/2.6.0
++ (( 0 != 0 ))
+ /opt/elasticbeanstalk/support/scripts/check-for-gem.rb puma
+ echo true
[2020-01-09T20:22:02.966Z] INFO [1508] - [Application update app-f4fb-200109_211455@11/AppDeployStage0/AppDeployPreHook] : Completed activity. Result:
Successfully execute hooks in directory /opt/elasticbeanstalk/hooks/appdeploy/pre.
[2020-01-09T20:22:02.966Z] INFO [1508] - [Application update app-f4fb-200109_211455@11/AppDeployStage0/EbExtensionPostBuild] : Starting activity...
[2020-01-09T20:22:10.381Z] INFO [1508] - [Application update app-f4fb-200109_211455@11/AppDeployStage0/EbExtensionPostBuild/Infra-EmbeddedPostBuild] : Starting activity...
[2020-01-09T20:22:10.462Z] INFO [1508] - [Application update app-f4fb-200109_211455@11/AppDeployStage0/EbExtensionPostBuild/Infra-EmbeddedPostBuild/postbuild_0_XXX] : Starting activity...
[2020-01-09T20:22:23.059Z] INFO [1508] - [Application update app-f4fb-200109_211455@11/AppDeployStage0/EbExtensionPostBuild/Infra-EmbeddedPostBuild/postbuild_0_XXX/Command 01_restart_nginx] : Starting activity...
[2020-01-09T20:22:24.293Z] INFO [1508] - [Application update app-f4fb-200109_211455@11/AppDeployStage0/EbExtensionPostBuild/Infra-EmbeddedPostBuild/postbuild_0_XXX/Command 01_restart_nginx] : Completed activity. Result:
nginx: [warn] conflicting server name "_" on 0.0.0.0:80, ignored
nginx: [warn] conflicting server name "localhost" on 0.0.0.0:80, ignored
nginx: [warn] conflicting server name "localhost" on 0.0.0.0:80, ignored
Stopping nginx: [ OK ]
Starting nginx: nginx: [warn] conflicting server name "_" on 0.0.0.0:80, ignored
nginx: [warn] conflicting server name "localhost" on 0.0.0.0:80, ignored
nginx: [warn] conflicting server name "localhost" on 0.0.0.0:80, ignored
[ OK ]
[2020-01-09T20:22:24.293Z] INFO [1508] - [Application update app-f4fb-200109_211455@11/AppDeployStage0/EbExtensionPostBuild/Infra-EmbeddedPostBuild/postbuild_0_XXX] : Completed activity.
[2020-01-09T20:22:24.375Z] INFO [1508] - [Application update app-f4fb-200109_211455@11/AppDeployStage0/EbExtensionPostBuild/Infra-EmbeddedPostBuild/postbuild_1_XXX] : Starting activity...
[2020-01-09T20:22:37.045Z] INFO [1508] - [Application update app-f4fb-200109_211455@11/AppDeployStage0/EbExtensionPostBuild/Infra-EmbeddedPostBuild/postbuild_1_XXX/Command 10_install_webpack] : Starting activity...
[2020-01-09T20:25:12.155Z] INFO [1508] - [Application update app-f4fb-200109_211455@11/AppDeployStage0/EbExtensionPostBuild/Infra-EmbeddedPostBuild/postbuild_1_XXX/Command 10_install_webpack] : Completed activity. Result:
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.11 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.11: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
+ webpack@4.41.5
added 322 packages from 197 contributors and audited 4227 packages in 144.209s
3 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
[2020-01-09T20:25:13.256Z] INFO [1508] - [Application update app-f4fb-200109_211455@11/AppDeployStage0/EbExtensionPostBuild/Infra-EmbeddedPostBuild/postbuild_1_XXX/Command 11_precompile] : Starting activity...
[2020-01-09T20:30:24.349Z] INFO [1508] - [Application update app-f4fb-200109_211455@11/AppDeployStage0/EbExtensionPostBuild/Infra-EmbeddedPostBuild/postbuild_1_XXX/Command 11_precompile] : Activity execution failed, because: yarn install v1.21.1
warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
[1/4] Resolving packages...
[2/4] Fetching packages...
info fsevents@1.2.9: The platform "linux" is incompatible with this module.
info "fsevents@1.2.9" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Saved lockfile.
Done in 162.47s.
yarn install v1.21.1
warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
[1/4] Resolving packages...
[2/4] Fetching packages...
info fsevents@1.2.9: The platform "linux" is incompatible with this module.
info "fsevents@1.2.9" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
[4/4] Building fresh packages...
Done in 83.51s.
I, [2020-01-09T20:29:36.608192 #2970] INFO -- : Writing /var/app/ondeck/public/assets/manifest-cadda289ef9c70eaa0879a36e6263cb33f7523a16b3ef862e0b8609cdc2bdab1.js
I, [2020-01-09T20:29:36.609243 #2970] INFO -- : Writing /var/app/ondeck/public/assets/manifest-cadda289ef9c70eaa0879a36e6263cb33f7523a16b3ef862e0b8609cdc2bdab1.js.gz
I, [2020-01-09T20:29:36.609422 #2970] INFO -- : Writing /var/app/ondeck/public/assets/XXX-c0be3de839559053bb0a9486d5645ccba7a7452f6ef0370ee498e1fa59e364b2.png
I, [2020-01-09T20:29:36.609592 #2970] INFO -- : Writing /var/app/ondeck/public/assets/XXX-469a46bb9645a42d499c7f74ee69ffad4176e08c4373b6fe67a418e8289f3d83.png
I, [2020-01-09T20:29:36.609775 #2970] INFO -- : Writing /var/app/ondeck/public/assets/XXX-e57001fd85a8e1f4da2bb4bbd309a7d880a9d18e3447d743190ff9befb86413f.jpg
I, [2020-01-09T20:29:36.610062 #2970] INFO -- : Writing /var/app/ondeck/public/assets/application-e18be23bdc9236e71700193c31376705b918eab0738fdd68ef83e572da76c13d.css
I, [2020-01-09T20:29:36.610155 #2970] INFO -- : Writing /var/app/ondeck/public/assets/application-e18be23bdc9236e71700193c31376705b918eab0738fdd68ef83e572da76c13d.css.gz
I, [2020-01-09T20:29:36.610249 #2970] INFO -- : Writing /var/app/ondeck/public/assets/wall_street-e57001fd85a8e1f4da2bb4bbd309a7d880a9d18e3447d743190ff9befb86413f.jpg
I, [2020-01-09T20:29:36.610500 #2970] INFO -- : Writing /var/app/ondeck/public/assets/asset-d0ff5974b6aa52cf562bea5921840c032a860a91a3512f7fe8f768f6bbe005f6.css
I, [2020-01-09T20:29:36.610582 #2970] INFO -- : Writing /var/app/ondeck/public/assets/asset-d0ff5974b6aa52cf562bea5921840c032a860a91a3512f7fe8f768f6bbe005f6.css.gz
I, [2020-01-09T20:29:36.690087 #2970] INFO -- : Writing /var/app/ondeck/public/assets/XXX-d0ff5974b6aa52cf562bea5921840c032a860a91a3512f7fe8f768f6bbe005f6.css
I, [2020-01-09T20:29:36.690356 #2970] INFO -- : Writing /var/app/ondeck/public/assets/XXX-d0ff5974b6aa52cf562bea5921840c032a860a91a3512f7fe8f768f6bbe005f6.css.gz
I, [2020-01-09T20:29:36.690743 #2970] INFO -- : Writing /var/app/ondeck/public/assets/main-e18be23bdc9236e71700193c31376705b918eab0738fdd68ef83e572da76c13d.css
I, [2020-01-09T20:29:36.690957 #2970] INFO -- : Writing /var/app/ondeck/public/assets/main-e18be23bdc9236e71700193c31376705b918eab0738fdd68ef83e572da76c13d.css.gz
I, [2020-01-09T20:29:36.691548 #2970] INFO -- : Writing /var/app/ondeck/public/assets/round-d0ff5974b6aa52cf562bea5921840c032a860a91a3512f7fe8f768f6bbe005f6.css
I, [2020-01-09T20:29:36.772944 #2970] INFO -- : Writing /var/app/ondeck/public/assets/round-d0ff5974b6aa52cf562bea5921840c032a860a91a3512f7fe8f768f6bbe005f6.css.gz
Compiling...
Compilation failed:
webpack not installed
Install webpack to start bundling: [32m
$ npm install --save-dev webpack
(ElasticBeanstalk::ExternalInvocationError)
[2020-01-09T20:30:24.349Z] INFO [1508] - [Application update app-f4fb-200109_211455@11/AppDeployStage0/EbExtensionPostBuild/Infra-EmbeddedPostBuild/postbuild_1_XXX/Command 11_precompile] : Activity failed.
[2020-01-09T20:30:24.349Z] INFO [1508] - [Application update app-f4fb-200109_211455@11/AppDeployStage0/EbExtensionPostBuild/Infra-EmbeddedPostBuild/postbuild_1_XXX] : Activity failed.
[2020-01-09T20:30:24.349Z] INFO [1508] - [Application update app-f4fb-200109_211455@11/AppDeployStage0/EbExtensionPostBuild/Infra-EmbeddedPostBuild] : Activity failed.
[2020-01-09T20:30:25.008Z] INFO [1508] - [Application update app-f4fb-200109_211455@11/AppDeployStage0/EbExtensionPostBuild] : Activity failed.
[2020-01-09T20:30:25.008Z] INFO [1508] - [Application update app-f4fb-200109_211455@11/AppDeployStage0] : Activity failed.
[2020-01-09T20:30:25.009Z] INFO [1508] - [Application update app-f4fb-200109_211455@11] : Completed activity. Result:
Application update - Command CMD-AppDeploy failed
[2020-01-09T20:36:59.175Z] INFO [5013] - [CMD-TailLogs] : Starting activity...
[2020-01-09T20:36:59.175Z] INFO [5013] - [CMD-TailLogs/AddonsBefore] : Starting activity...
[2020-01-09T20:36:59.175Z] INFO [5013] - [CMD-TailLogs/AddonsBefore] : Completed activity.
[2020-01-09T20:36:59.175Z] INFO [5013] - [CMD-TailLogs/TailLogs] : Starting activity...
[2020-01-09T20:36:59.175Z] INFO [5013] - [CMD-TailLogs/TailLogs/TailLogs] : Starting activity...
-------------------------------------
/var/log/eb-commandprocessor.log
-------------------------------------
[2020-01-09T20:15:53.363Z] DEBUG [1508] : Retrieving metadata for key: AWS::ElasticBeanstalk::Ext||_API||_Commands..
[2020-01-09T20:15:53.364Z] INFO [1508] : Found enabled addons: ["logpublish", "logstreaming"].
[2020-01-09T20:15:53.444Z] INFO [1508] : Updating Command definition of addon logpublish.
[2020-01-09T20:15:53.444Z] INFO [1508] : Updating Command definition of addon logstreaming.
[2020-01-09T20:15:53.444Z] DEBUG [1508] : Retrieving metadata for key: AWS::CloudFormation::Init||Infra-WriteApplication2||files..
[2020-01-09T20:15:53.445Z] DEBUG [1508] : Retrieving metadata for key: AWS::ElasticBeanstalk::Ext||ManifestFileS3Key..
[2020-01-09T20:15:56.071Z] INFO [1508] : Loading manifest from bucket 'elasticbeanstalk-eu-west-1-511205900284' using computed S3 key 'resources/environments/e-zcsy2pgich/_runtime/versions/manifest_1578600905237'.
[2020-01-09T20:15:56.520Z] INFO [1508] : Updated manifest cache: deployment ID 11 and serial 18.
[2020-01-09T20:15:56.520Z] DEBUG [1508] : Loaded definition of Command CMD-AppDeploy.
[2020-01-09T20:15:56.520Z] INFO [1508] : Executing Application update
[2020-01-09T20:15:56.520Z] INFO [1508] : Executing command: CMD-AppDeploy...
[2020-01-09T20:15:56.520Z] INFO [1508] : Executing command CMD-AppDeploy activities...
[2020-01-09T20:15:56.520Z] DEBUG [1508] : Setting environment variables..
[2020-01-09T20:15:56.520Z] INFO [1508] : Running AddonsBefore for command CMD-AppDeploy...
[2020-01-09T20:15:59.632Z] DEBUG [1508] : Running stages of Command CMD-AppDeploy from stage 0 to stage 1...
[2020-01-09T20:15:59.632Z] INFO [1508] : Running stage 0 of command CMD-AppDeploy...
[2020-01-09T20:15:59.632Z] INFO [1508] : Running leader election...
[2020-01-09T20:16:07.059Z] INFO [1508] : Instance is Leader.
[2020-01-09T20:16:07.059Z] DEBUG [1508] : Loaded 5 actions for stage 0.
[2020-01-09T20:16:07.059Z] INFO [1508] : Running 1 of 5 actions: DownloadSourceBundle...
[2020-01-09T20:16:14.038Z] INFO [1508] : Running 2 of 5 actions: EbExtensionPreBuild...
[2020-01-09T20:18:12.566Z] INFO [1508] : Running 3 of 5 actions: AppDeployPreHook...
[2020-01-09T20:22:02.966Z] INFO [1508] : Running 4 of 5 actions: EbExtensionPostBuild...
[2020-01-09T20:30:25.008Z] ERROR [1508] : Command execution failed: Activity failed. (ElasticBeanstalk::ActivityFatalError)
caused by: yarn install v1.21.1
warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
[1/4] Resolving packages...
[2/4] Fetching packages...
info fsevents@1.2.9: The platform "linux" is incompatible with this module.
info "fsevents@1.2.9" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Saved lockfile.
Done in 162.47s.
yarn install v1.21.1
warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
[1/4] Resolving packages...
[2/4] Fetching packages...
info fsevents@1.2.9: The platform "linux" is incompatible with this module.
info "fsevents@1.2.9" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
[4/4] Building fresh packages...
Done in 83.51s.
I, [2020-01-09T20:29:36.608192 #2970] INFO -- : Writing /var/app/ondeck/public/assets/manifest-cadda289ef9c70eaa0879a36e6263cb33f7523a16b3ef862e0b8609cdc2bdab1.js
I, [2020-01-09T20:29:36.609243 #2970] INFO -- : Writing /var/app/ondeck/public/assets/manifest-cadda289ef9c70eaa0879a36e6263cb33f7523a16b3ef862e0b8609cdc2bdab1.js.gz
I, [2020-01-09T20:29:36.609422 #2970] INFO -- : Writing /var/app/ondeck/public/assets/XXX-c0be3de839559053bb0a9486d5645ccba7a7452f6ef0370ee498e1fa59e364b2.png
I, [2020-01-09T20:29:36.609592 #2970] INFO -- : Writing /var/app/ondeck/public/assets/XXX-469a46bb9645a42d499c7f74ee69ffad4176e08c4373b6fe67a418e8289f3d83.png
I, [2020-01-09T20:29:36.609775 #2970] INFO -- : Writing /var/app/ondeck/public/assets/XXX-e57001fd85a8e1f4da2bb4bbd309a7d880a9d18e3447d743190ff9befb86413f.jpg
I, [2020-01-09T20:29:36.610062 #2970] INFO -- : Writing /var/app/ondeck/public/assets/application-e18be23bdc9236e71700193c31376705b918eab0738fdd68ef83e572da76c13d.css
I, [2020-01-09T20:29:36.610155 #2970] INFO -- : Writing /var/app/ondeck/public/assets/application-e18be23bdc9236e71700193c31376705b918eab0738fdd68ef83e572da76c13d.css.gz
I, [2020-01-09T20:29:36.610249 #2970] INFO -- : Writing /var/app/ondeck/public/assets/XXX-e57001fd85a8e1f4da2bb4bbd309a7d880a9d18e3447d743190ff9befb86413f.jpg
I, [2020-01-09T20:29:36.610500 #2970] INFO -- : Writing /var/app/ondeck/public/assets/asset-d0ff5974b6aa52cf562bea5921840c032a860a91a3512f7fe8f768f6bbe005f6.css
I, [2020-01-09T20:29:36.610582 #2970] INFO -- : Writing /var/app/ondeck/public/assets/asset-d0ff5974b6aa52cf562bea5921840c032a860a91a3512f7fe8f768f6bbe005f6.css.gz
I, [2020-01-09T20:29:36.690087 #2970] INFO -- : Writing /var/app/ondeck/public/assets/XXX-d0ff5974b6aa52cf562bea5921840c032a860a91a3512f7fe8f768f6bbe005f6.css
I, [2020-01-09T20:29:36.690356 #2970] INFO -- : Writing /var/app/ondeck/public/assets/XXX-d0ff5974b6aa52cf562bea5921840c032a860a91a3512f7fe8f768f6bbe005f6.css.gz
I, [2020-01-09T20:29:36.690743 #2970] INFO -- : Writing /var/app/ondeck/public/assets/main-e18be23bdc9236e71700193c31376705b918eab0738fdd68ef83e572da76c13d.css
I, [2020-01-09T20:29:36.690957 #2970] INFO -- : Writing /var/app/ondeck/public/assets/main-e18be23bdc9236e71700193c31376705b918eab0738fdd68ef83e572da76c13d.css.gz
I, [2020-01-09T20:29:36.691548 #2970] INFO -- : Writing /var/app/ondeck/public/assets/round-d0ff5974b6aa52cf562bea5921840c032a860a91a3512f7fe8f768f6bbe005f6.css
I, [2020-01-09T20:29:36.772944 #2970] INFO -- : Writing /var/app/ondeck/public/assets/round-d0ff5974b6aa52cf562bea5921840c032a860a91a3512f7fe8f768f6bbe005f6.css.gz
Compiling...
Compilation failed:
webpack not installed
Install webpack to start bundling: [32m
$ npm install --save-dev webpack
(ElasticBeanstalk::ExternalInvocationError)
[2020-01-09T20:30:25.009Z] ERROR [1508] : Command CMD-AppDeploy failed!
[2020-01-09T20:30:25.086Z] INFO [1508] : Command processor returning results:
{"status":"FAILURE","api_version":"1.0","results":[{"status":"FAILURE","msg":"(TRUNCATED)...NFO -- : Writing /var/app/ondeck/public/assets/round-d0ff5974b6aa52cf562bea5921840c032a860a91a3512f7fe8f768f6bbe005f6.css.gz\nCompiling...\nCompilation failed:\n\nwebpack not installed\n\nInstall webpack to start bundling: \u001b[32m\n$ npm install --save-dev webpack. \ncontainer_command 11_precompile in .ebextensions/yarn.config failed. For more detail, check /var/log/eb-activity.log using console or EB CLI","returncode":1,"events":[]}],"truncated":"true"}
Логически я пытался установить веб-пакет снова и снова, который как правило, уже должно быть сделано через файл ebextensions yarn.config
:
commands:
# 01_remove_clean_and_install_latest_nodejs:
# run this command from /tmp directory
# cwd: /tmp
# test: '[ -f /usr/bin/node ] && echo "remove previous node"'
# command: 'sudo yum remove -y nodejs | sudo rm /etc/yum.repos.d/nodesource*'
02_node_get:
# run this command from /tmp directory
cwd: /tmp
# flag -y for no-interaction installation
command: 'sudo curl --silent --location https://rpm.nodesource.com/setup_13.x | sudo bash -'
03_node_install:
# run this command from /tmp directory
cwd: /tmp
command: 'sudo yum -y install nodejs'
04_yarn_get:
# run this command from /tmp directory
cwd: /tmp
# don't run the command if yarn is already installed (file /usr/bin/yarn exists)
test: '[ ! -f /usr/bin/yarn ] && echo "yarn not installed"'
command: 'sudo wget https://dl.yarnpkg.com/rpm/yarn.repo -O /etc/yum.repos.d/yarn.repo'
05_yarn_install:
# run this command from /tmp directory
cwd: /tmp
test: '[ ! -f /usr/bin/yarn ] && echo "yarn not installed"'
command: 'sudo yum -y install yarn'
06_mkdir_webapp_dir:
command: mkdir /home/webapp
ignoreErrors: true
07_chown_webapp_dir:
command: chown webapp:webapp /home/webapp
ignoreErrors: true
08_chmod_webapp_dir:
command: chmod 700 /home/webapp
ignoreErrors: true
09_update_bundler:
command: gem update bundler
ignoreErrors: true
container_commands:
10_install_webpack:
command: "sudo npm install --save-dev webpack"
11_precompile:
command: "bundle exec rake assets:precompile"
Мои другие настройки RAILS_SKIP_ASSET_COMPILATION=true
в eb
Я попытался установить webpack вручную после s sh -ing в машину через npm и пряжу, с и без sudo, но ничего не сработало ...
Каждый eb deploy
занимает примерно 20 минут и затем переходит в "серьезное" состояние с вышеуказанной ошибкой.
Редактировать
По какой-то странной причине я заставил его работать сейчас, запустив bundle exec rails webpacker:install
в дополнение к наличию его в Gemfile. Все еще не устраивает установка, но, по крайней мере, сейчас она работает