3

我已经对 Heroku 开发中心进行了大量研究,现在我正在向社区寻求帮助。这是我的问题。我无法将我的数据库推送到 Heroku Cedar Stack。我正在尝试通过 Taps gem 将 sqlite 数据库迁移到 postgresql。当我准备好部署时,我运行:

bundle install --without production
heroku run db:push

我得到以下结果:

Running db:seed attached to terminal... up, run.17
sh: db:seed: not found
heroku run rake db:migrate

当我运行迁移时:

heroku run rake db:migrate

我得到以下信息:

Running rake db:migrate attached to terminal... up, run.18
rake aborted!
No Rakefile found (looking for: rakefile, Rakefile, rakefile.rb, Rakefile.rb)
/usr/local/lib/ruby/1.9.1/rake.rb:2367:in `raw_load_rakefile'
/usr/local/lib/ruby/1.9.1/rake.rb:2007:in `block in load_rakefile'
/usr/local/lib/ruby/1.9.1/rake.rb:2058:in `standard_exception_handling'
/usr/local/lib/ruby/1.9.1/rake.rb:2006:in `load_rakefile'
/usr/local/lib/ruby/1.9.1/rake.rb:1991:in `run'
/usr/local/bin/rake:31:in `<main>'

每次我推送到 Heroku(git push heroku master)时它都会失败,因为我的 gem 文件正在尝试安装 sqlite3 gem——即使它在我的 Gemfile 中的开发和测试组内。即使成功运行以下命令,我的 database.yml 生产环境仍然指向 sqlite 适配器:

heroku config:add BUNDLE_WITHOUT="test development" --app app_name_on_heroku

没有想法。请帮忙。如果它有用,我可以发布我的 gemfile、heroku ps 和日志的结果。

干杯

更新:遵循@John 的指示后,我现在收到以下终端消息。

Sending schema
Schema:        100% |==========================================| Time: 00:00:07
Sending indexes
schema_migrat: 100% |==========================================| Time: 00:00:00
Sending data
4 tables, 6 records
schema_migrat:   0% |                                          | ETA:  --:--:--
Saving session to push_201111070749.dat..
!!! Caught Server Exception
HTTP CODE: 500
Taps Server Error: LoadError: no such file to load -- sequel/adapters/

以及以下警告:

["/app/.bundle/gems/ruby/1.9.1/gems/sequel-3.20.0/lib/sequel/core.rb:249:in require'", "/app/.bundle/gems/ruby/1.9.1/gems/sequel-3.20.0/lib/sequel/core.rb:249:inblock in tsk_require'", "/app/.bundle/gems/ ruby/1.9.1/gems/sequel-3.20.0/lib/sequel/core.rb:72:in block in check_requiring_thread'", "<internal:prelude>:10:insynchronize'", "/app/.bundle/gems/ruby/1.9.1/gems/sequel-3.20. 0/lib/sequel/core.rb:69:in check_requiring_thread'", "/app/.bundle/gems/ruby/1.9.1/gems/sequel-3.20.0/lib/sequel/core.rb:249:intsk_require'", "/app/.bundle/gems/ruby/1.9.1/gems/sequel-3.20.0/lib/sequel/database/connecting.rb: 25:in adapter_class'", "/app/.bundle/gems/ruby/1.9.1/gems/sequel-3.20.0/lib/sequel/database/connecting.rb:54:inconnect'", "/app/.bundle/gems/ruby/1.9.1/gems/sequel-3.20.0/lib/sequel/core.rb:119:in connect'", "/app/lib/taps/db_session.rb:14:inconn'", "/app/lib /taps/server.rb:91:in block in <class:Server>'", "/app/.bundle/gems/ruby/1.9.1/gems/sinatra-1.0/lib/sinatra/base.rb:865:incall'", "/app/.bundle/gems/ruby/1.9.1/gems/sinatra-1.0/lib/sinatra/base.rb:865:in block in route'", "/app/.bundle/gems/ruby/1.9.1/gems/sinatra-1.0/lib/sinatra/base.rb:521:ininstance_eval'", "/app/.bundle/gems/ruby/1.9.1/gems/sinatra-1.0/lib/sinatra/base.rb:521:inroute_eval'", "/app/.bundle/gems/ruby/1.9.1/gems/sinatra-1.0/lib/sinatra/base.rb:500:in路线中的块(2级)!'”,“/app/.bundle/gems/ruby/1.9.1/gems/sinatra-1.0/lib/sinatra/base.rb:497:catch'", "/app/.bundle/gems/ruby/1.9.1/gems/sinatra-1.0/lib/sinatra/base.rb:497:in路线中的块!'”, "/app/.bundle/gems/ruby/1.9.1/gems/sinatra-1.0/lib/sinatra/base.rb:476:in each'", "/app/.bundle/gems/ruby/1.9.1/gems/sinatra-1.0/lib/sinatra/base.rb:476:inroute!'", "/app/.bundle/gems/ruby/1.9. 1/gems/sinatra-1.0/lib/sinatra/base.rb:601:in dispatch!'", "/app/.bundle/gems/ruby/1.9.1/gems/sinatra-1.0/lib/sinatra/base.rb:411:inblock in call!'", "/app/.bundle/gems/ruby/1.9.1/gems/sinatra-1.0/lib/sinatra /base.rb:566:in instance_eval'", "/app/.bundle/gems/ruby/1.9.1/gems/sinatra-1.0/lib/sinatra/base.rb:566:inblock in invoke'", "/app/.bundle/gems/ruby/1.9.1/gems/sinatra-1.0/lib/sinatra/base.rb:566:in catch'", "/app/.bundle/gems/ruby/1.9.1/gems/sinatra-1.0/lib/sinatra/base.rb:566:ininvoke'", "/app/.bundle/gems/ruby/1.9.1/gems/sinatra-1.0/lib/sinatra/base.rb:411:in call!'", "/app/.bundle/gems/ruby/1.9.1/gems/sinatra-1.0/lib/sinatra/base.rb:399:incall'", "/app/.bundle/gems/ruby/1.9.1 /gems/rack-1.2.1/lib/rack/auth/basic.rb:25:in call'", "/app/.bundle/gems/ruby/1.9.1/gems/sinatra-1.0/lib/sinatra/base.rb:979:inblock in call'", "/app/.bundle/gems/ruby/1.9.1/gems/sinatra-1.0/lib/sinatra/base.rb:1005:insynchronize'", "/app/.bundle/gems/ruby/1.9.1/gems/sinatra-1.0/lib/sinatra/base.rb:979:in调用'", "/home/heroku_rack/lib/static_assets.rb:9:in call'", "/home/heroku_rack/lib/last_access.rb:15:incall'", "/app/.bundle/gems/ruby/1.9.1/gems/rack-1.2.1/lib/rack/ urlmap.rb:47:in block in call'", "/app/.bundle/gems/ruby/1.9.1/gems/rack-1.2.1/lib/rack/urlmap.rb:41:ineach'", "/app/.bundle/gems/ruby/1.9.1/gems/rack-1.2.1/lib/rack/urlmap.rb:41:in call'", "/home/heroku_rack/lib/date_header.rb:14:incall'", " /app/.bundle/gems/ruby/1.9.1/gems/rack-1.2.1/lib/rack/builder.rb:77:in call'", "/app/.bundle/gems/ruby/1.9.1/gems/thin-1.2.7/lib/thin/connection.rb:76:inblock in pre_process'", "/app/.bundle/gems/ruby/ 1.9.1/gems/thin-1.2.7/lib/thin/connection.rb:74:in catch'", "/app/.bundle/gems/ruby/1.9.1/gems/thin-1.2.7/lib/thin/connection.rb:74:inpre_process'", "/app/.bundle/gems/ruby/1.9.1/gems/thin-1.2.7/ lib/thin/connection.rb:57:in process'", "/app/.bundle/gems/ruby/1.9.1/gems/thin-1.2.7/lib/thin/connection.rb:42:inreceive_data'", "/app/.bundle/gems/ruby/1.9.1/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in run_machine'", "/app/.bundle/gems/ruby/1.9.1/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:inrun'" , "/app/.bundle/gems/ruby/1.9.1/gems/thin-1.2.7/lib/thin/backends/base.rb:57:在start'", "/app/.bundle/gems/ruby/1.9.1/gems/thin-1.2.7/lib/thin/server.rb:156:in开始'", "/app/.bundle/gems/ruby/1.9.1/gems/thin-1.2.7/lib/thin/controllers/controller.rb:80:in start'", "/app/.bundle/gems/ruby/1.9.1/gems/thin-1.2.7/lib/thin/runner.rb:177:inrun_command'", "/app/.bundle /gems/ruby/1.9.1/gems/thin-1.2.7/lib/thin/runner.rb:143:in run!'", "/app/.bundle/gems/ruby/1.9.1/gems/thin-1.2.7/bin/thin:6:in'", "/usr/ruby1.9.2/bin/thin:19:in load'", "/usr/ruby1.9.2/bin/thin:19:in'"]

4

4 回答 4

2

有类似的问题。在 Bundler 的开发组中包含 SQLite gem,在生产组中包含 Postgres gem。Heroku 仍然尝试安装 SQLite。

显然,Cedar 堆栈不支持没有特定组的捆绑。https://devcenter.heroku.com/articles/bundler

请注意 - 目前,Cedar 堆栈不支持 BUNDLE_WITHOUT。

必须到 Gemfile.lock,从 Gemfile 中注释掉 SQLite gem,重新捆绑安装,将新的 Gemfile 和 Gemfile.lock 添加到 git 并推回 Heroku。此外,由于 SQLite 是 Taps 的依赖项,因此我也对此发表了评论。

当我想启动开发环境时,这是一个颠倒上述情况的问题。

下次只在开发中使用 Postgres!

于 2012-04-06T17:53:59.677 回答
1

首先,数据库推送命令是

heroku db:push

不是通过heroku run

我怀疑您的 Sqlite 问题(也许?)归结为您推送分支的语法 - 要将分支推送到 heroku,您必须这样做

git push heroku branchname:master

这就是说将我推到heroku遥控器上的主分支。如果你真的在做git push heroku branchname,你实际上并没有部署任何东西,因为 heroku 只会部署 master 分支,所以你可以在你的代码中进行更改,推送 - 但实际上不会影响已部署的代码。尽管这并不能解释为什么您会收到No rakefile found消息。

于 2011-11-07T08:54:20.613 回答
1

我有同样的问题,真正有帮助的是两件事

  1. 彻底清除您的 git 存储库,然后从头开始 - git init、git add 。然后 git 阶段。然后 git commit -m “无论你想放什么”。之后销毁应用程序,再次创建它,并执行包括 db:migrate 在内的所有步骤。确保你像这样创建你的应用程序:heroku create --stack cedar

  2. 检查此链接 https://github.com/carlhuda/bundler/blob/master/ISSUES.md

于 2011-11-26T02:44:30.450 回答
0

https://devcenter.heroku.com/articles/rails3#deploy-your-application-to-heroku中所述,您只需要部署您的代码

heroku create
git push heroku master
于 2012-10-14T09:32:27.783 回答