[英]Don't run Bundler as root - Rails6 on Elastic Beanstalk
我一直在嘗試將 Rails 6 應用程序部署到 Elastic Beanstalk,並且被這個 Bundle Root 錯誤困擾了一天多。 我已經通讀了我能找到的所有內容,但到目前為止沒有任何效果。
[錯誤] 執行命令 [app-deploy] - [stage ruby application] 時發生錯誤。 停止運行命令。 錯誤:在 Gemfile 中安裝依賴項失敗,錯誤命令 /bin/sh -c bundle install --local 失敗,錯誤命令在 900 秒后超時。 Stderr:不要以 root 身份運行 Bundler。 如果需要,Bundler 可以要求 sudo,並且以 root 用戶身份安裝你的 bundle 會破壞該機器上所有非 root 用戶的應用程序。
我的寶石文件:
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
ruby '2.7.2'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 6.0.3', '>= 6.0.3.3'
# Use sqlite3 as the database for Active Record
gem 'pg'
# Use Puma as the app server
gem 'puma', '~> 5.0'
# Use SCSS for stylesheets
gem 'sass-rails', '>= 6'
# Transpile app-like JavaScript. Read more: https://github.com/rails/webpacker
gem 'webpacker', '~> 4.0'
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
gem 'turbolinks', '~> 5'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.7'
gem 'sendgrid-ruby'
gem 'faker'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 4.0'
# Use Active Model has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use Active Storage variant
# gem 'image_processing', '~> 1.2'
# Reduces boot times through caching; required in config/boot.rb
gem 'bootsnap', '>= 1.4.2', require: false
gem 'will_paginate', '~> 3.1.0'
gem 'bootstrap-will_paginate', '1.0.0'
gem 'sprockets', '~> 4.0'
gem 'devise'
gem 'bootstrap'
gem 'jquery-rails'
gem 'figaro'
gem 'rails-controller-testing'
gem 'validates_zipcode'
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
gem 'minitest'
gem 'minitest-reporters'
end
group :development do
# Access an interactive console on exception pages or by calling 'console' anywhere in the code.
gem 'web-console', '>= 3.3.0'
gem 'listen', '~> 3.2'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
end
group :test do
# Adds support for Capybara system testing and selenium driver
gem 'capybara', '>= 2.15'
gem 'selenium-webdriver'
# Easy installation and use of web drivers to run system tests with browsers
gem 'webdrivers'
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', '>= 1.2016.7'
我的 .ebextension/fix_rails_6.config:
packages:
yum:
git: []
commands:
02_download_nodejs:
command: "curl --silent --location https://rpm.nodesource.com/setup_8.x | sudo bash -"
03_install_nodejs:
command: "yum -y install nodejs"
container_commands:
19_precompile:
command: "bundle exec rake assets:precompile"
和我的環境屬性:
BUNDLER_DEPLOYMENT_MODE true
BUNDLE_WITHOUT test:development
RACK_ENV production
RAILS_SKIP_ASSET_COMPILATION true
RAILS_SKIP_MIGRATION false
我猜你在部署的服務器上有一個舊的、過時的Gemfile.lock
,它列出了不正確的 Gems 版本。
如果它在本地構建和運行,我建議您確保將Gemfile.lock
文件與其余代碼和Gemfile
一起分發到您的服務器。
如果這不起作用, Gemfile.lock
從部署的服務器中刪除Gemfile.lock
試
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.