无法将rails 5.2 app部署到弹性beanstalk

时间:2018-04-12 12:26:33

标签: ruby-on-rails amazon-web-services amazon-ec2 ruby-on-rails-5 elastic-beanstalk

我正在尝试将简单的rails 5.2应用程序部署到弹性beanstalk。这是一个简单的博客应用程序,只有2个模型,即帖子和评论模型。请注意,即使您创建了没有模型或控制器的新rails 5.2应用程序,新空应用程序的部署仍然失败。

我正在创建弹性beanstalk环境:

eb create --single --envvars SECRET_KEY_BASE=$(rails secret),RAILS_MASTER_KEY=$(cat config/credentials.yml.enc)

部署失败。这是nginx / error.log

2018/04/11 18:32:49 [warn] 2995#0: conflicting server name "localhost" on 0.0.0.0:80, ignored

以下是eb-activity-log

的简化版本
+ cd /var/app/ondeck
+ su -s /bin/bash -c 'bundle exec 
 /opt/elasticbeanstalk/support/scripts/check-for-rake-task.rb 
 assets:precompile' webapp
 `/home/webapp` is not a directory.
 Bundler will use `/tmp/bundler/home/webapp' as your home directory 
temporarily.
+ '[' false == true ']'
+ su -s /bin/bash -c 'bundle exec rake assets:precompile' webapp
`/home/webapp` is not a directory.
Bundler will use `/tmp/bundler/home/webapp' as your home directory 
temporarily.
rake aborted!
ActiveSupport::MessageEncryptor::InvalidMessage: 
ActiveSupport::MessageEncryptor::InvalidMessage
(erb):7:in `<main>'
/var/app/ondeck/config/environment.rb:5:in `<main>'
/opt/rubies/ruby-2.5.0/bin/bundle:23:in `load'
/opt/rubies/ruby-2.5.0/bin/bundle:23:in `<main>'

Caused by:
ArgumentError: key must be 16 bytes
(erb):7:in `<main>'
/var/app/ondeck/config/environment.rb:5:in `<main>'
/opt/rubies/ruby-2.5.0/bin/bundle:23:in `load'
/opt/rubies/ruby-2.5.0/bin/bundle:23:in `<main>'
Tasks: TOP => environment
(See full trace by running task with --trace) 
(ElasticBeanstalk::ExternalInvocationError)
caused by: ++ /opt/elasticbeanstalk/bin/get-config container -k 
script_dir
+ EB_SCRIPT_DIR=/opt/elasticbeanstalk/support/scripts
++ /opt/elasticbeanstalk/bin/get-config container -k app_staging_dir
+ EB_APP_STAGING_DIR=/var/app/ondeck
++ /opt/elasticbeanstalk/bin/get-config container -k app_user
+ EB_APP_USER=webapp
++ /opt/elasticbeanstalk/bin/get-config container -k support_dir
+ EB_SUPPORT_DIR=/opt/elasticbeanstalk/support
+ . /opt/elasticbeanstalk/support/envvars

+cd /var/app/ondeck
+ su -s /bin/bash -c 'bundle exec 
/opt/elasticbeanstalk/support/scripts/check-for-rake-task.rb 
assets:precompile' webapp
`/home/webapp` is not a directory.
Bundler will use `/tmp/bundler/home/webapp' as your home directory 
temporarily.
+ '[' false == true ']'
+ su -s /bin/bash -c 'bundle exec rake assets:precompile' webapp
`/home/webapp` is not a directory.
Bundler will use `/tmp/bundler/home/webapp' as your home directory 
temporarily.
rake aborted!
ActiveSupport::MessageEncryptor::InvalidMessage: 
ActiveSupport::MessageEncryptor::InvalidMessage
(erb):7:in `<main>'
/var/app/ondeck/config/environment.rb:5:in `<main>'
/opt/rubies/ruby-2.5.0/bin/bundle:23:in `load'
/opt/rubies/ruby-2.5.0/bin/bundle:23:in `<main>'

Caused by:
ArgumentError: key must be 16 bytes
(erb):7:in `<main>'
/var/app/ondeck/config/environment.rb:5:in `<main>'
/opt/rubies/ruby-2.5.0/bin/bundle:23:in `load'
/opt/rubies/ruby-2.5.0/bin/bundle:23:in `<main>'
Tasks: TOP => environment
(See full trace by running task with --trace) 
(Executor::NonZeroExitStatus)

Brian这是我的Gemfile:

source 'https://rubygems.org'

git_source(:github) do |repo_name|
  repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
  "https://github.com/#{repo_name}.git"
end

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.2.0'

# Use sqlite3 as the database for Active Record
gem 'sqlite3', group: :development
gem 'pg', '~> 1.0.0',  group: :production

# Use Puma as the app server
gem 'puma', '~> 3.11'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 4.1.8'
gem 'jquery-rails'
# 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'
# Use Redis adapter to run Action Cable in production
gem 'redis', '~> 4.0'
gem 'sidekiq', ' < 6'

# Reduces boot times through caching; required in config/boot.rb
gem 'bootsnap', '>= 1.1.0', require: false

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]
end

group :development do
  # Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
  gem 'web-console', '>= 3.3.0'
  gem 'listen', '>= 3.0.5', '< 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', '< 4.0'
  gem 'selenium-webdriver'
  gem 'minitest-reporters', '~> 1.1'
  # Easy installation and use of chromedriver to run system tests with 
  Chrome
  gem 'chromedriver-helper'
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

我没有创建任何nginx.conf。这是puma.rb:

threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }
threads threads_count, threads_count
port  ENV.fetch("PORT") { 3000 }
environment ENV.fetch("RAILS_ENV") { "development" }
plugin :tmp_restart

0 个答案:

没有答案