Heroku problem z "heroku rake db:migrate"

Witajcie,

Jestem nowy i zielony jesli chodzi o RoR. Dopiero sie ucze i natrafilem na problem, ktorego nie moge przeskoczyc. Wszystko mam zainstalowane na domowym serwerze Ubuntu v9.10. Mialem sporo problemow aby wszystko dzialalo bez problemu, ale sie nie poddawalem :wink: Szukalem odpowiedzi w necie i zawsze sobie jakos poradzilem ze wszystkimi problemami. Teraz mimo porad nie moge przeskoczyc tego problemu.

O to co otrzymuje w konsoli:

euts@euts:~/Jacka/Ruby/rails_projects/demo_app$ HEROKU_SSL_VERIFY=disable heroku rake db:migrate (in /app) rake aborted! uninitialized constant Rake::DSL /usr/ruby1.9.2/lib/ruby/1.9.1/rake.rb:2482:in `const_missing' /app/.bundle/gems/ruby/1.9.1/gems/rake-0.9.2/lib/rake/tasklib.rb:8:in `<class:TaskLib>' /app/.bundle/gems/ruby/1.9.1/gems/rake-0.9.2/lib/rake/tasklib.rb:6:in `<module:Rake>' /app/.bundle/gems/ruby/1.9.1/gems/rake-0.9.2/lib/rake/tasklib.rb:3:in `<top (required)>' /app/.bundle/gems/ruby/1.9.1/gems/rake-0.9.2/lib/rake/rdoctask.rb:20:in `require' /app/.bundle/gems/ruby/1.9.1/gems/rake-0.9.2/lib/rake/rdoctask.rb:20:in `<top (required)>' /app/.bundle/gems/ruby/1.9.1/gems/railties-3.0.1/lib/rails/tasks/documentation.rake:1:in `require' /app/.bundle/gems/ruby/1.9.1/gems/railties-3.0.1/lib/rails/tasks/documentation.rake:1:in `<top (required)>' /app/.bundle/gems/ruby/1.9.1/gems/railties-3.0.1/lib/rails/tasks.rb:15:in `load' /app/.bundle/gems/ruby/1.9.1/gems/railties-3.0.1/lib/rails/tasks.rb:15:in `block in <top (required)>' /app/.bundle/gems/ruby/1.9.1/gems/railties-3.0.1/lib/rails/tasks.rb:6:in `each' /app/.bundle/gems/ruby/1.9.1/gems/railties-3.0.1/lib/rails/tasks.rb:6:in `<top (required)>' /app/.bundle/gems/ruby/1.9.1/gems/railties-3.0.1/lib/rails/application.rb:213:in `require' /app/.bundle/gems/ruby/1.9.1/gems/railties-3.0.1/lib/rails/application.rb:213:in `initialize_tasks' /app/.bundle/gems/ruby/1.9.1/gems/railties-3.0.1/lib/rails/application.rb:139:in `load_tasks' /app/.bundle/gems/ruby/1.9.1/gems/railties-3.0.1/lib/rails/application.rb:77:in `method_missing' /app/Rakefile:7:in `<top (required)>' /usr/ruby1.9.2/lib/ruby/1.9.1/rake.rb:2373:in `load' /usr/ruby1.9.2/lib/ruby/1.9.1/rake.rb:2373:in `raw_load_rakefile' /usr/ruby1.9.2/lib/ruby/1.9.1/rake.rb:2007:in `block in load_rakefile' /usr/ruby1.9.2/lib/ruby/1.9.1/rake.rb:2058:in `standard_exception_handling' /usr/ruby1.9.2/lib/ruby/1.9.1/rake.rb:2006:in `load_rakefile' /usr/ruby1.9.2/lib/ruby/1.9.1/rake.rb:1991:in `run' /usr/ruby1.9.2/bin/rake:31:in `<main>'
W necie wyszukalem, ze musze odinstalowac rake 0.9.2, zainstalowac starsza wersje a w pliku ‘Gemfile’ zrobic wpis gem ‘rake’, ‘0.8.7’. Nastepnie ‘bundle install’. Zrobilem tak i wszystko jest tak samo, dokladnie ten sam blad.

O to moja wersja rake:

[code]euts@euts:~$ gem list -d rake

*** LOCAL GEMS ***

rake (0.8.7)
Author: Jim Weirich
Rubyforge: http://rubyforge.org/projects/rake
Homepage: http://rake.rubyforge.org
Installed at: /home/euts/.rvm/gems/ruby-1.9.2-p290@global

Ruby based make-like utility.[/code]

Potrzebuje pomocy bo niechcialbym zakonczyc zabawy/nauki z RoR na tym etapie :(.

Z gory dzieki za pomoc.
Pozdrawiam

Dodaj require 'rake/dsl_definition'
do początku Rakefile

cześć

problem dosyć popularny w Ubuntu, tu masz rozwiązanie : http://stackoverflow.com/questions/6181312/how-to-fix-the-uninitialized-constant-rakedsl-problem-on-heroku , w skrócie trzeba wpierw spróbować sam nagłówek, a potem dodając linijki w odpowiednie miejsca, masz tam dobrze wyjaśnione.

Ale … za pierwszym razem jak miałem ten problem po dodaniu było wszystko okey, a po zaktualizowaniu do nowszej wersji nie pomogło. Teraz nie wiem jak jest, nie używałem już jakiś czas. Nie łam się, czasami odwala z heroku, na nim świat się nie kończy, choć irytuje to trochę ; )

[quote=changs]Dodaj require 'rake/dsl_definition'
do początku Rakefile[/quote]
To nie zawsze działa.

Hej, dzieki za szybka odpowiedz.

Teraz wyglada to troche lepiej. Nie wiedzialem, ze musialem zrobic update a pozniej przepchnac do heroku.

Dodalem wpis. A pozniej zrobilem cos takiego:

bundle install git commit -a -m "update lockfile" git push heroku master
Teraz mam cos takiego:

euts@euts:~/Jacka/Ruby/rails_projects/demo_app$ HEROKU_SSL_VERIFY=disable heroku rake db:migrate (in /app) rake aborted! no such file to load -- rake/dsl_definition /app/Rakefile:6:in `require' /app/Rakefile:6:in `<top (required)>' /usr/ruby1.9.2/lib/ruby/1.9.1/rake.rb:2373:in `load' /usr/ruby1.9.2/lib/ruby/1.9.1/rake.rb:2373:in `raw_load_rakefile' /usr/ruby1.9.2/lib/ruby/1.9.1/rake.rb:2007:in `block in load_rakefile' /usr/ruby1.9.2/lib/ruby/1.9.1/rake.rb:2058:in `standard_exception_handling' /usr/ruby1.9.2/lib/ruby/1.9.1/rake.rb:2006:in `load_rakefile' /usr/ruby1.9.2/lib/ruby/1.9.1/rake.rb:1991:in `run' /usr/ruby1.9.2/bin/rake:31:in `<main>'
Co robic :(?

Nie znam się na heroku, ale czy nie powinieneś odpalać rake przez bundlera? (bundle exec rake …)

masz w Gemfile “heroku” ?

O to moj Gemefile w, ktorym nie widze ‘heroku’:

[code]source ‘http://rubygems.org

gem ‘rails’, ‘3.0.1’
gem ‘rake’, ‘0.8.7’
gem ‘delayed_job’

Bundle edge Rails instead:

gem ‘rails’, :git => ‘git://github.com/rails/rails.git’

gem ‘sqlite3-ruby’, ‘1.2.5’, :require => ‘sqlite3’

Use unicorn as the web server

gem ‘unicorn’

Deploy with Capistrano

gem ‘capistrano’

To use debugger

gem ‘ruby-debug’

Bundle the extra gems:

gem ‘bj’

gem ‘nokogiri’

gem ‘sqlite3-ruby’, :require => ‘sqlite3’

gem ‘aws-s3’, :require => ‘aws/s3’

Bundle gems for the local environment. Make sure to

put test-only gems in this group so their generators

and rake tasks are available in development mode:

group :development, :test do

gem ‘webrat’

end[/code]

…czy powinienem podac jakas wersje czy ‘gem ‘heroku’’ wystarczy?

powinno wystarcześ, dodaj do Gemfile i uruchom bundle.

To samo :(:

euts@euts:~/Jacka/Ruby/rails_projects/demo_app$ HEROKU_SSL_VERIFY=disable heroku rake db:migrate (in /app) rake aborted! no such file to load -- rake/dsl_definition /app/Rakefile:6:in `require' /app/Rakefile:6:in `<top (required)>' /usr/ruby1.9.2/lib/ruby/1.9.1/rake.rb:2373:in `load' /usr/ruby1.9.2/lib/ruby/1.9.1/rake.rb:2373:in `raw_load_rakefile' /usr/ruby1.9.2/lib/ruby/1.9.1/rake.rb:2007:in `block in load_rakefile' /usr/ruby1.9.2/lib/ruby/1.9.1/rake.rb:2058:in `standard_exception_handling' /usr/ruby1.9.2/lib/ruby/1.9.1/rake.rb:2006:in `load_rakefile' /usr/ruby1.9.2/lib/ruby/1.9.1/rake.rb:1991:in `run' /usr/ruby1.9.2/bin/rake:31:in `<main>'

Próbowałeś heroku bundle exec rake … ? Jeśli to nie zadziała to Bundle.require musi być wywołany przed tym wywalającym się require.

…dzieki za info. Zrobilem straszny blad. Generalnie na stronie Heroku po zalogowaniu w appsach mialem ich cala mase bo bawilem sie wczesniej i narobil sie tam straszny balagan. Zaczalem wszystko usuwac i przez przypadek usunalem apps do tego nad ktorym teraz pracuje. Kiedy chce zrobic ‘git push heroku master’ to otrzymuje cos takiego:

[code]euts@euts:~/Jacka/Ruby/rails_projects/demo_app$ git push heroku master
! No such app as electric-autumn-423

fatal: The remote end hung up unexpectedly[/code]
Generalnie nie chce zaczynac nowega watka jak to odwrocic itd. Stworze nowy projekt i przepchne go do heroku pod wlasciwy adres strony.
Jak to zrobie to dam znac czy Twoja podpowiedz z 'heroku bundle exec rake ’ da rade cos zmienic.

Sorrka za komplikacje, ale nagrzebalem bez wiekszego zastanowienia :wink:

Peace!

Nie wiem czy dobrze wpisalem, ale…

euts@euts:~$ heroku bundle exec rake db:migrate ! bundle is not a heroku command. See 'heroku help'.

dzisiaj odapallem applikacje na heroku

oto co zrobilem:

gemfile

source 'http://rubygems.org' gem 'rails', '3.0.9' gem 'rake', '0.9.2' gem 'pg' gem 'heroku'
rakefile:

[code=‘ruby’]require ‘rake/file_utils’
require ‘rake/dsl_definition’
require ‘rake’

module ::NazwaTwojejAplikacji
class Application
include Rake::DSL
end
end

module ::RakeFileUtils
extend Rake::FileUtilsExt
end

NazwaTwojejAplikacji::Application.load_tasks[/code]
odpalanie rakeow na heroku:

np.:

heroku rake db:migrate

nie jestem pewien czy potrzebuje w Rakefile

require 'rake/file_utils'

ale nie chce mi sie sprawdzac
najwazniejsze, ze dziala !!

moj stack to:

* bamboo-mri-1.9.2

swoj mozesz sprawdzic korzystajac z:

heroku stack --all

Dzieki za pomoc. Powoli trace wiare, ze sie uda :).

Podam wszystko co mam w plikach oraz podam jak najwiecej informacji. Moze gdzies cos mam zle wpisane.

Wiec tak, zaczynam od plikow:

Gemfile

[code]source ‘http://rubygems.org

gem ‘rails’, ‘3.0.9’
gem ‘rake’, ‘0.9.2’
gem ‘heroku’

Bundle edge Rails instead:

gem ‘rails’, :git => ‘git://github.com/rails/rails.git’

gem ‘sqlite3-ruby’, ‘1.2.5’, :require => ‘sqlite3’

Use unicorn as the web server

gem ‘unicorn’

Deploy with Capistrano

gem ‘capistrano’

To use debugger

gem ‘ruby-debug’

Bundle the extra gems:

gem ‘bj’

gem ‘nokogiri’

gem ‘sqlite3-ruby’, :require => ‘sqlite3’

gem ‘aws-s3’, :require => ‘aws/s3’

Bundle gems for the local environment. Make sure to

put test-only gems in this group so their generators

and rake tasks are available in development mode:

group :development, :test do

gem ‘webrat’

end[/code]

Rakefile

[code]# Add your own tasks in files placed in lib/tasks ending in .rake,

for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.

require File.expand_path(’…/config/application’, FILE)

require ‘rake/file_utils’
require ‘rake/dsl_definition’
require ‘rake’

module ::DemoApp1
class Application
include Rake::DSL
end
end

module ::RakeFileUtils
extend Rake::FileUtilsExt
end

DemoApp1::Application.load_tasks[/code]
…kiedy robie ‘bundle update’ otrzymuje:

euts@euts:~/Jacka/Ruby/rails_projects/demo_app1$ bundle update Fetching source index for http://rubygems.org/ Using rake (0.9.2) Using abstract (1.0.0) Using activesupport (3.0.9) Using builder (2.1.2) Using i18n (0.5.0) Using activemodel (3.0.9) Using erubis (2.6.6) Using rack (1.2.3) Using rack-mount (0.6.14) Using rack-test (0.5.7) Using tzinfo (0.3.29) Using actionpack (3.0.9) Using mime-types (1.16) Using polyglot (0.3.2) Using treetop (1.4.10) Using mail (2.2.19) Using actionmailer (3.0.9) Using arel (2.0.10) Using activerecord (3.0.9) Using activeresource (3.0.9) Using addressable (2.2.6) Using bundler (1.0.15) Using launchy (2.0.5) Using rest-client (1.6.3) Using term-ansicolor (1.0.6) Using heroku (2.4.0) Using rdoc (3.9.1) Using thor (0.14.6) Using railties (3.0.9) Using rails (3.0.9) Using sqlite3-ruby (1.2.5) Your bundle is updated! Use `bundle show [gemname]` to see where a bundled gem is installed.
…nastepnie robie ‘HEROKU_SSL_VERIFY=disable heroku rake db:migrate’ i otrzymuje:

euts@euts:~/Jacka/Ruby/rails_projects/demo_app1$ HEROKU_SSL_VERIFY=disable heroku rake db:migrate (in /app) rake aborted! uninitialized constant Rake::DSL /usr/ruby1.9.2/lib/ruby/1.9.1/rake.rb:2482:in `const_missing' /app/Rakefile:9:in `<class:Application>' /app/Rakefile:8:in `<module:DemoApp1>' /app/Rakefile:7:in `<top (required)>' /usr/ruby1.9.2/lib/ruby/1.9.1/rake.rb:2373:in `load' /usr/ruby1.9.2/lib/ruby/1.9.1/rake.rb:2373:in `raw_load_rakefile' /usr/ruby1.9.2/lib/ruby/1.9.1/rake.rb:2007:in `block in load_rakefile' /usr/ruby1.9.2/lib/ruby/1.9.1/rake.rb:2058:in `standard_exception_handling' /usr/ruby1.9.2/lib/ruby/1.9.1/rake.rb:2006:in `load_rakefile' /usr/ruby1.9.2/lib/ruby/1.9.1/rake.rb:1991:in `run' /usr/ruby1.9.2/bin/rake:31:in `<main>'
Jesli chodzi o moj stack to:

[code]euts@euts:~/Jacka/Ruby/rails_projects/demo_app1$ heroku stack --all
aspen-mri-1.8.6

  • bamboo-mri-1.9.2
    bamboo-ree-1.8.7
    bamboo-mri-1.9.1 (beta)
    cedar (beta)[/code]
    Nie mam zielonego pojecia co jest nie tak.
    Jedyne co jest inaczej niz podales to nie mam wpisu ‘gem ‘pg’’ w Gemefile. Kiedy dokonalem tego wpisu to w trakcie robienia ‘bundle update’ wyskakiwaly straszne bledy.

…o to te bledy:

[code]euts@euts:~/Jacka/Ruby/rails_projects/demo_app1$ euts@euts:~/Jacka/Ruby/rails_projects/demo_app1$ heroku stack --all
-bash: euts@euts:~/Jacka/Ruby/rails_projects/demo_app1$: No such file or directory
euts@euts:~/Jacka/Ruby/rails_projects/demo_app1$ aspen-mri-1.8.6
aspen-mri-1.8.6: command not found
euts@euts:~/Jacka/Ruby/rails_projects/demo_app1$ * bamboo-mri-1.9.2
No command ‘app’ found, but there are 19 similar ones
app: command not found
euts@euts:~/Jacka/Ruby/rails_projects/demo_app1$ bamboo-ree-1.8.7
bamboo-ree-1.8.7: command not found
euts@euts:~/Jacka/Ruby/rails_projects/demo_app1$ bamboo-mri-1.9.1 (beta)
-bash: syntax error near unexpected token beta' euts@euts:~/Jacka/Ruby/rails_projects/demo_app1$ cedar (beta) -bash: syntax error near unexpected tokenbeta’
euts@euts:~/Jacka/Ruby/rails_projects/demo_app1$ bundle update
Fetching source index for http://rubygems.org/
Using rake (0.9.2)
Using abstract (1.0.0)
Using activesupport (3.0.9)
Using builder (2.1.2)
Using i18n (0.5.0)
Using activemodel (3.0.9)
Using erubis (2.6.6)
Using rack (1.2.3)
Using rack-mount (0.6.14)
Using rack-test (0.5.7)
Using tzinfo (0.3.29)
Using actionpack (3.0.9)
Using mime-types (1.16)
Using polyglot (0.3.2)
Using treetop (1.4.10)
Using mail (2.2.19)
Using actionmailer (3.0.9)
Using arel (2.0.10)
Using activerecord (3.0.9)
Using activeresource (3.0.9)
Using addressable (2.2.6)
Using bundler (1.0.15)
Using launchy (2.0.5)
Using rest-client (1.6.3)
Using term-ansicolor (1.0.6)
Using heroku (2.4.0)
Installing pg (0.11.0) with native extensions /home/euts/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:551:in `rescue in block in build_extensions’: ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError)

    /home/euts/.rvm/rubies/ruby-1.9.2-p290/bin/ruby extconf.rb

checking for pg_config… no
No pg_config… trying anyway. If building fails, please try again with
–with-pg-config=/path/to/pg_config
checking for libpq-fe.h… no
Can’t find the 'libpq-fe.h header
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.

Provided configuration options:
–with-opt-dir
–without-opt-dir
–with-opt-include
–without-opt-include=${opt-dir}/include
–with-opt-lib
–without-opt-lib=${opt-dir}/lib
–with-make-prog
–without-make-prog
–srcdir=.
–curdir
–ruby=/home/euts/.rvm/rubies/ruby-1.9.2-p290/bin/ruby
–with-pg
–without-pg
–with-pg-dir
–without-pg-dir
–with-pg-include
–without-pg-include=${pg-dir}/include
–with-pg-lib
–without-pg-lib=${pg-dir}/lib
–with-pg-config
–without-pg-config
–with-pg_config
–without-pg_config

Gem files will remain installed in /home/euts/.rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/pg-0.11.0 for inspection.
Results logged to /home/euts/.rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/pg-0.11.0/ext/gem_make.out
from /home/euts/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:529:in block in build_extensions' from /home/euts/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:504:ineach’
from /home/euts/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:504:in build_extensions' from /home/euts/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:180:ininstall’
from /home/euts/.rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/bundler-1.0.15/lib/bundler/source.rb:101:in block in install' from /home/euts/.rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/bundler-1.0.15/lib/bundler/rubygems_integration.rb:78:inpreserve_paths’
from /home/euts/.rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/bundler-1.0.15/lib/bundler/source.rb:91:in install' from /home/euts/.rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/bundler-1.0.15/lib/bundler/installer.rb:58:inblock (2 levels) in run’
from /home/euts/.rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/bundler-1.0.15/lib/bundler/rubygems_integration.rb:93:in with_build_args' from /home/euts/.rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/bundler-1.0.15/lib/bundler/installer.rb:57:inblock in run’
from /home/euts/.rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/bundler-1.0.15/lib/bundler/spec_set.rb:12:in block in each' from /home/euts/.rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/bundler-1.0.15/lib/bundler/spec_set.rb:12:ineach’
from /home/euts/.rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/bundler-1.0.15/lib/bundler/spec_set.rb:12:in each' from /home/euts/.rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/bundler-1.0.15/lib/bundler/installer.rb:49:inrun’
from /home/euts/.rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/bundler-1.0.15/lib/bundler/installer.rb:8:in install' from /home/euts/.rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/bundler-1.0.15/lib/bundler/cli.rb:270:inupdate’
from /home/euts/.rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/bundler-1.0.15/lib/bundler/vendor/thor/task.rb:22:in run' from /home/euts/.rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/bundler-1.0.15/lib/bundler/vendor/thor/invocation.rb:118:ininvoke_task’
from /home/euts/.rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/bundler-1.0.15/lib/bundler/vendor/thor.rb:246:in dispatch' from /home/euts/.rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/bundler-1.0.15/lib/bundler/vendor/thor/base.rb:389:instart’
from /home/euts/.rvm/gems/ruby-1.9.2-p290@rails3tutorial/gems/bundler-1.0.15/bin/bundle:13:in <top (required)>' from /home/euts/.rvm/gems/ruby-1.9.2-p290@rails3tutorial/bin/bundle:19:inload’
from /home/euts/.rvm/gems/ruby-1.9.2-p290@rails3tutorial/bin/bundle:19:in `’[/code]