2015-01-27 2 views
1

Я недавно разработал свое первое приложение Ruby on Rails и попытался развернуть его на Heroku, однако, когда я пытаюсь загрузить URL-адрес приложения, он просто возвращается с этой страницы:Ошибка Heroku/Rails, журналы не очень полезны

We're sorry, but something went wrong. 
If you are the application owner check the logs for more information. 

Вот мои журналы:

2015-01-27T14:11:44.782093+00:00 heroku[api]: Release v12 created by [email protected] 
2015-01-27T14:11:45.419564+00:00 heroku[web.1]: State changed from up to starting 
2015-01-27T14:11:48.394740+00:00 heroku[web.1]: Starting process with command `bin/rails server -p 21006 -e production` 
2015-01-27T14:11:49.304740+00:00 heroku[web.1]: Stopping all processes with SIGTERM 
2015-01-27T14:11:50.179113+00:00 app[web.1]: [2015-01-27 14:11:50] FATAL SignalException: SIGTERM 
2015-01-27T14:11:50.179123+00:00 app[web.1]: /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:32:in `start' 
2015-01-27T14:11:50.179120+00:00 app[web.1]: /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:170:in `select' 
2015-01-27T14:11:50.179121+00:00 app[web.1]: /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:170:in `block in start' 
2015-01-27T14:11:50.179126+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-1.6.0/lib/rack/handler/webrick.rb:35:in `run' 
2015-01-27T14:11:50.179124+00:00 app[web.1]: /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/webrick/server.rb:160:in `start' 
2015-01-27T14:11:50.179133+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:75:in `server' 
2015-01-27T14:11:50.179152+00:00 app[web.1]: bin/rails:8:in `require' 
2015-01-27T14:11:50.179150+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:39:in `run_command!' 
2015-01-27T14:11:50.179130+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:80:in `block in server' 
2015-01-27T14:11:50.179128+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.0/lib/rails/commands/server.rb:80:in `start' 
2015-01-27T14:11:50.179161+00:00 app[web.1]: [2015-01-27 14:11:50] INFO WEBrick::HTTPServer#start done. 
2015-01-27T14:11:50.179127+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-1.6.0/lib/rack/server.rb:286:in `start' 
2015-01-27T14:11:50.179160+00:00 app[web.1]: [2015-01-27 14:11:50] INFO going to shutdown ... 
2015-01-27T14:11:50.179131+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:75:in `tap' 
2015-01-27T14:11:50.179151+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/railties-4.2.0/lib/rails/commands.rb:17:in `<top (required)>' 
2015-01-27T14:11:50.179153+00:00 app[web.1]: bin/rails:8:in `<main>' 
2015-01-27T14:11:50.265926+00:00 app[web.1]: => Booting WEBrick 
2015-01-27T14:11:50.265932+00:00 app[web.1]: => Rails 4.2.0 application starting in production on http://0.0.0.0:39482 
2015-01-27T14:11:50.265936+00:00 app[web.1]: => Ctrl-C to shutdown server 
2015-01-27T14:11:50.265934+00:00 app[web.1]: => Run `rails server -h` for more startup options 
2015-01-27T14:11:50.265937+00:00 app[web.1]: Exiting 
2015-01-27T14:11:51.162075+00:00 heroku[web.1]: Process exited with status 143 
2015-01-27T14:11:52.030623+00:00 app[web.1]: [2015-01-27 14:11:52] INFO ruby 2.0.0 (2014-11-13) [x86_64-linux] 
2015-01-27T14:11:52.030600+00:00 app[web.1]: [2015-01-27 14:11:52] INFO WEBrick 1.3.1 
2015-01-27T14:11:52.030938+00:00 app[web.1]: [2015-01-27 14:11:52] INFO WEBrick::HTTPServer#start: pid=3 port=21006 
2015-01-27T14:11:52.681188+00:00 heroku[web.1]: State changed from starting to up 
2015-01-27T14:12:57.646409+00:00 heroku[router]: at=info method=GET path="/" host=www.biblequot.es request_id=8125c7b1-2590-4162-b98f-0b849febe74e fwd="94.175.136.230" dyno=web.1 connect=3ms service=1175ms status=500 bytes=1754 

Я ранее пытался работать, как сохранить секретные ключи в config/secrets.yml от того, на Github (репо будет общедоступным) и попытался установить GPG и использовать dotgpg (с помощью руководства here), но я не мог заставить его работать должным образом, вынул его из моей Gemfile, который я копировал в ниже:

source 'https://rubygems.org' 
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' 
gem 'rails', '4.2.0' 
# Use postgresql as the database for Active Record 
gem 'pg' 
# Use SCSS for stylesheets 
gem 'sass-rails', '~> 5.0' 
# Use Uglifier as compressor for JavaScript assets 
gem 'uglifier', '>= 1.3.0' 
# Use CoffeeScript for .coffee assets and views 
gem 'coffee-rails', '~> 4.1.0' 
# See https://github.com/sstephenson/execjs#readme for more supported runtimes 
# gem 'therubyracer', platforms: :ruby 

# Use jquery as the JavaScript library 
gem 'jquery-rails' 
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks 
gem 'turbolinks' 
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder 
gem 'jbuilder', '~> 2.0' 
# bundle exec rake doc:rails generates the API under doc/api. 
gem 'sdoc', '~> 0.4.0', group: :doc 

# Use ActiveModel has_secure_password 
# gem 'bcrypt', '~> 3.1.7' 

# Use Unicorn as the app server 
# gem 'unicorn' 

# Use Capistrano for deployment 
# gem 'capistrano-rails', group: :development 

# Use font-awesome! 
gem 'font-awesome-sass' 

group :development, :test do 
    # Call 'byebug' anywhere in the code to stop execution and get a debugger console 
    gem 'byebug' 

    # Access an IRB console on exception pages or by using <%= console %> in views 
    gem 'web-console', '~> 2.0' 

    # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring 
    gem 'spring' 
end 

А также для хорошей меры, вот мой config/enviroment/production.rb файл:

Rails.application.configure do 


# Settings specified here will take precedence over those in config/application.rb. 

    # Code is not reloaded between requests. 
    config.cache_classes = true 

    # Eager load code on boot. This eager loads most of Rails and 
    # your application in memory, allowing both threaded web servers 
    # and those relying on copy on write to perform better. 
    # Rake tasks automatically ignore this option for performance. 
    config.eager_load = true 

    # Full error reports are disabled and caching is turned on. 
    config.consider_all_requests_local  = false 
    config.action_controller.perform_caching = true 

    # Enable Rack::Cache to put a simple HTTP cache in front of your application 
    # Add `rack-cache` to your Gemfile before enabling this. 
    # For large-scale production use, consider using a caching reverse proxy like 
    # NGINX, varnish or squid. 
    # config.action_dispatch.rack_cache = true 

    # Disable serving static files from the `/public` folder by default since 
    # Apache or NGINX already handles this. 
    config.serve_static_files = ENV['RAILS_SERVE_STATIC_FILES'].present? 

    # Compress JavaScripts and CSS. 
    config.assets.js_compressor = :uglifier 
    # config.assets.css_compressor = :sass 

    # Do not fallback to assets pipeline if a precompiled asset is missed. 
    config.assets.compile = true 

    # Asset digests allow you to set far-future HTTP expiration dates on all assets, 
    # yet still be able to expire them through the digest params. 
    config.assets.digest = true 

    # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb 

    # Specifies the header that your server uses for sending files. 
    # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache 
    # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX 

    # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. 
    # config.force_ssl = true 

    # Use the lowest log level to ensure availability of diagnostic information 
    # when problems arise. 
    config.log_level = :debug 

    # Prepend all log lines with the following tags. 
    # config.log_tags = [ :subdomain, :uuid ] 

    # Use a different logger for distributed setups. 
    # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new) 

    # Use a different cache store in production. 
    # config.cache_store = :mem_cache_store 

    # Enable serving of images, stylesheets, and JavaScripts from an asset server. 
    # config.action_controller.asset_host = 'http://assets.example.com' 

    # Ignore bad email addresses and do not raise email delivery errors. 
    # Set this to true and configure the email server for immediate delivery to raise delivery errors. 
    # config.action_mailer.raise_delivery_errors = false 

    # Enable locale fallbacks for I18n (makes lookups for any locale fall back to 
    # the I18n.default_locale when a translation cannot be found). 
    config.i18n.fallbacks = true 

    # Send deprecation notices to registered listeners. 
    config.active_support.deprecation = :notify 

    # Use default logging formatter so that PID and timestamp are not suppressed. 
    config.log_formatter = ::Logger::Formatter.new 

    # Do not dump schema after migrations. 
    config.active_record.dump_schema_after_migration = false 

end 

Извините за то, что вы так много написали здесь, я просто надеюсь, что кто-то может быстро решить мою проблему :) Также как бонус, что лучший способ скрыть секретные ключи в secrets.yml? Имеет ли значение, существуют ли ключи разработки и тестирования? (ключ производства скрыт в переменной среды). Благодаря!

ответ

0

В ваших журналах похоже, что ваше приложение получило Sigterm, но когда вы видите сообщение об ошибке рельсов «Нам очень жаль, но что-то пошло не так». Это означает, что сервер запущен, и ошибка находится внутри вашего приложения rails.

Поэтому нам нужно больше узнать о ваших журналах, чтобы помочь вам.

Самый простой способ для environement переменной является создание .env.sample с примерами environement переменной и каждый разработчик создает свой собственный файл .env и использовать dotenv-рельсы с gem 'dotenv-rails', groups: [:development, :test] внутри Gemfile

Вы можете даже заменить ваш database.yml с:

DATABASE_URL=postgres://username:[email protected]:5432/database_name

Но dotgpg выглядит великолепно, я буду стараться использовать его.

0

в каталоге проекта, запустить

heroku run console 

это должно дать вам больше информации

Смежные вопросы