推送到heroku让我无法获得OPENSHIFT_SECRET_TOKEN,默认使用

时间:2014-05-05 12:01:33

标签: ruby-on-rails ruby-on-rails-3 heroku deployment

我正在尝试在heroku服务器上部署我的应用程序,该服务器之前部署在Open shift上。它在我上次推送之前工作正常,现在给我以下错误。虽然,它在我的本地机器上工作正常。错误如下。

=> Ctrl-C to shutdown server
2014-05-05T10:46:19.190707+00:00 app[web.1]: Connecting to database specified by DATABASE_URL
2014-05-05T10:46:19.209705+00:00 app[web.1]: Unable to get OPENSHIFT_SECRET_TOKEN, using default
2014-05-05T10:46:19.209862+00:00 app[web.1]: Unable to get OPENSHIFT_SECRET_TOKEN, using default
2014-05-05T10:46:19.929309+00:00 app[web.1]: Exiting
2014-05-05T10:46:19.930376+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.13/lib/rails/engine.rb:436:in `eager_load!'
2014-05-05T10:46:19.930344+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:317:in `rescue in depend_on': No such file to load -- selenium-webdriver (LoadError)
2014-05-05T10:46:19.930368+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.13/lib/rails/engine.rb:439:in `block (2 levels) in eager_load!'
2014-05-05T10:46:19.930366+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:225:in `require_dependency'
2014-05-05T10:46:19.930373+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.13/lib/rails/engine.rb:438:in `block in eager_load!'
2014-05-05T10:46:19.930372+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.13/lib/rails/engine.rb:438:in `each'
2014-05-05T10:46:19.930377+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.13/lib/rails/application/finisher.rb:53:in `block in <module:Finisher>'
2014-05-05T10:46:19.930378+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.13/lib/rails/initializable.rb:30:in `instance_exec'
2014-05-05T10:46:19.930374+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.13/lib/rails/engine.rb:436:in `each'
2014-05-05T10:46:19.930348+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:312:in `depend_on'
2014-05-05T10:46:19.930379+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.13/lib/rails/initializable.rb:30:in `run'
2014-05-05T10:46:19.930381+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.13/lib/rails/initializable.rb:55:in `block in run_initializers'
2014-05-05T10:46:19.930382+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.13/lib/rails/initializable.rb:54:in `each'
2014-05-05T10:46:19.930391+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.13/lib/rails/application.rb:136:in `initialize!'
2014-05-05T10:46:19.930390+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.13/lib/rails/initializable.rb:54:in `run_initializers'
2014-05-05T10:46:19.930394+00:00 app[web.1]:    from /app/config/environment.rb:5:in `<top (required)>'
2014-05-05T10:46:19.930392+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.13/lib/rails/railtie/configurable.rb:30:in `method_missing'
2014-05-05T10:46:19.930395+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require'
2014-05-05T10:46:19.930396+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `block in require'
2014-05-05T10:46:19.930400+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:236:in `load_dependency'
2014-05-05T10:46:19.930401+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require'
2014-05-05T10:46:19.930402+00:00 app[web.1]:    from /app/config.ru:3:in `block in <main>'
2014-05-05T10:46:19.930404+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.4.5/lib/rack/builder.rb:51:in `instance_eval'
2014-05-05T10:46:19.930405+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.4.5/lib/rack/builder.rb:51:in `initialize'
2014-05-05T10:46:19.930409+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.4.5/lib/rack/builder.rb:40:in `eval'
2014-05-05T10:46:19.930406+00:00 app[web.1]:    from /app/config.ru:in `new'
2014-05-05T10:46:19.930408+00:00 app[web.1]:    from /app/config.ru:in `<main>'
2014-05-05T10:46:19.930413+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.13/lib/rails/commands/server.rb:46:in `app'
2014-05-05T10:46:19.930411+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.4.5/lib/rack/server.rb:200:in `app'
2014-05-05T10:46:19.930410+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.4.5/lib/rack/builder.rb:40:in `parse_file'
2014-05-05T10:46:19.930422+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.4.5/lib/rack/server.rb:304:in `wrapped_app'
2014-05-05T10:46:19.930424+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/rack-1.4.5/lib/rack/server.rb:254:in `start'
2014-05-05T10:46:19.930425+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.13/lib/rails/commands/server.rb:70:in `start'
2014-05-05T10:46:19.930426+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.13/lib/rails/commands.rb:55:in `block in <top (required)>'
2014-05-05T10:46:19.930427+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.13/lib/rails/commands.rb:50:in `tap'
2014-05-05T10:46:19.930428+00:00 app[web.1]:    from /app/vendor/bundle/ruby/2.0.0/gems/railties-3.2.13/lib/rails/commands.rb:50:in `<top (required)>'
2014-05-05T10:46:19.930430+00:00 app[web.1]:    from script/rails:6:in `require'
2014-05-05T10:46:19.930433+00:00 app[web.1]:    from script/rails:6:in `<main>'
2014-05-05T10:46:21.257306+00:00 heroku[web.1]: State changed from starting to crashed
2014-05-05T10:46:21.258394+00:00 heroku[web.1]: State changed from crashed to starting

更新 我的database.yml看起来像这样

sqlite: &sqlite
  adapter: sqlite3
  database: db/<%= Rails.env %>.sqlite3

mysql: &mysql
  adapter: mysql2
  database: "<%=ENV['OPENSHIFT_APP_NAME']%>"
  username: "<%=ENV['OPENSHIFT_MYSQL_DB_USERNAME']%>"
  password: "<%=ENV['OPENSHIFT_MYSQL_DB_PASSWORD']%>"
  host:     <%=ENV['OPENSHIFT_MYSQL_DB_HOST']%>
  port:     <%=ENV['OPENSHIFT_MYSQL_DB_PORT']%>

postgresql: &postgresql
  adapter: postgresql
  database: <%=ENV['OPENSHIFT_APP_NAME']%>
  username: <%=ENV['OPENSHIFT_POSTGRESQL_DB_USERNAME']%>
  password: <%=ENV['OPENSHIFT_POSTGRESQL_DB_PASSWORD']%>
  host:     <%=ENV['OPENSHIFT_POSTGRESQL_DB_HOST']%>
  port:     <%=ENV['OPENSHIFT_POSTGRESQL_DB_PORT']%>
  min_messages: ERROR
  reconnect: false

defaults: &defaults
  pool: 5
  timeout: 5000
  encoding: utf8
  <<: *<%= ENV['RAILS_DB'] || "sqlite" %>

development:
  <<: *defaults

test: &test
  <<: *defaults

production:
  <<: *defaults

我的config / initializers / secret_token.rb看起来像这样。

require File.join(Rails.root,'lib','openshift_secret_generator.rb')

    RailsApp::Application.config.secret_token = initialize_secret(
      :token,
      'my token'
    )

1 个答案:

答案 0 :(得分:1)

Heroku将为所有版本的Rails重写database.yml&lt; 4.1 - 因此可以安全地假设这不是问题。

我很想查看config\initializers\secret_token.rb作为问题的原因,我怀疑这将会访问OPENSHIFT_SECRET_TOKEN,这在初始化应用程序时会出错。