Heroku Rake and Heroku Push Not Working - Rails - ruby-on-rails

If i try running: heroku rake db:migrate, this is the error i get:
rake aborted!
undefined local variable or method `config' for main:Object
/app/config/application.rb:4:in `<top (required)>'
/app/Rakefile:4:in `require'
/app/Rakefile:4:in `<top (required)>'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/rake_module.rb:25:in `load'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/rake_module.rb:25:in `load_rakefile'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:637:in `raw_load_rakefile'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:94:in `block in load_rakefile'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:165:in `standard_exception_handling'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:93:in `load_rakefile'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:77:in `block in run'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:165:in `standard_exception_handling'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.0/lib/rake/application.rb:75:in `run'
/app/vendor/bundle/ruby/2.0.0/gems/rake-10.1.0/bin/rake:33:in `<top (required)>'
/app/vendor/bundle/ruby/2.0.0/bin/rake:23:in `load'
/app/vendor/bundle/ruby/2.0.0/bin/rake:23:in `<main>
Running: git push heroku master i get this:
Preparing app for Rails asset pipeline
Running: rake assets:precompile
rake aborted!
could not connect to server: Connection refused
Is the server running on host "127.0.0.1" and accepting
TCP/IP connections on port 5432?
I have tried adding: config.assets.initialize_on_precompile = false to application.rb but it did not help :(.
This app i'm trying to push used to be on heroku, but i accidentally deleted my herokuapp. Please help!

The problem was with Rolify, new version has problems so I had to step down back to 3.2.0.

Related

Cannot migrate on Heroku

I'd like to migrate database to production environment on Heroku.
I typed the following code, however I got error. I have no idea what to do. I'm looking forward to your advice. Thank you for your kindness.
$ heroku run rake db:migrate
Running `rake db:migrate --trace` attached to terminal... up, run.2338
rake aborted!
LoadError: libruby.so.2.2: cannot open shared object file: No such file or directory - /app/vendor/bundle/ruby/2.2.0/gems/pg-0.18.2/lib/pg_ext.so
/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:274:in `require'
/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:274:in `block in require'
/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:240:in `load_dependency'
/app/vendor/bundle/ruby/2.2.0/gems/activesupport-4.2.1/lib/active_support/dependencies.rb:274:in `require'
/app/vendor/bundle/ruby/2.2.0/gems/pg-0.18.2/lib/pg.rb:4:in `<top (required)>'
/app/vendor/bundle/ruby/2.2.0/gems/bundler-1.9.7/lib/bundler/runtime.rb:76:in `require'
/app/vendor/bundle/ruby/2.2.0/gems/bundler-1.9.7/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
/app/vendor/bundle/ruby/2.2.0/gems/bundler-1.9.7/lib/bundler/runtime.rb:72:in `each'
/app/vendor/bundle/ruby/2.2.0/gems/bundler-1.9.7/lib/bundler/runtime.rb:72:in `block in require'
/app/vendor/bundle/ruby/2.2.0/gems/bundler-1.9.7/lib/bundler/runtime.rb:61:in `each'
/app/vendor/bundle/ruby/2.2.0/gems/bundler-1.9.7/lib/bundler/runtime.rb:61:in `require'
/app/vendor/bundle/ruby/2.2.0/gems/bundler-1.9.7/lib/bundler.rb:134:in `require'
/app/config/application.rb:7:in `<top (required)>'
/app/Rakefile:4:in `require'
/app/Rakefile:4:in `<top (required)>'
/app/vendor/ruby-2.2.2/lib/ruby/2.2.0/rake/rake_module.rb:28:in `load'
/app/vendor/ruby-2.2.2/lib/ruby/2.2.0/rake/rake_module.rb:28:in `load_rakefile'
/app/vendor/ruby-2.2.2/lib/ruby/2.2.0/rake/application.rb:689:in `raw_load_rakefile'
/app/vendor/ruby-2.2.2/lib/ruby/2.2.0/rake/application.rb:94:in `block in load_rakefile'
/app/vendor/ruby-2.2.2/lib/ruby/2.2.0/rake/application.rb:176:in `standard_exception_handling'
/app/vendor/ruby-2.2.2/lib/ruby/2.2.0/rake/application.rb:93:in `load_rakefile'
/app/vendor/ruby-2.2.2/lib/ruby/2.2.0/rake/application.rb:77:in `block in run'
/app/vendor/ruby-2.2.2/lib/ruby/2.2.0/rake/application.rb:176:in `standard_exception_handling'
/app/vendor/ruby-2.2.2/lib/ruby/2.2.0/rake/application.rb:75:in `run'
/app/bin/rake:8:in `<main>'
Have you tried running migration directly from the bash inside the heroku server? If not, try the following...
heroku run bash --app your_app_name_goes_here
bundle exec rake db:migrate
First line of code opens the bash command terminal and the second one migrates the db as usual.
This would not be the suggested solution. But, in case you DO NOT care about losing data in the database, you can try and reset the database first and try again. Again, don't do this unless you are willing to lose existing data!
heroku pg:reset DATABASE
heroku run rake db:migrate
However you can perform this via bash as before.
Hope this helps you out.
You can run a dyno in the background using heroku run:detached. Unlike heroku run, these dynos will send their output to your logs instead of your console window. You can use heroku logs to view the output from these commands:$ heroku run:detached rake db:migrate
Running rake db:migrate... up, run.2
Use 'heroku logs -p run.2' to view the log output.

Redmine 2.1.2 + Gitolite setup - "rake aborted!" on "rake db:migrate_plugins"

I'm trying to setup a testing server with Redmine and GIT. I'm following this series of tutorials:
Setting up a Centralized Git Service
Setting up the Redmine Front End
Integrating Redmine and Gitolite
Fully Automating the Redmine Gitolite Integration
I'm installing the Gitolite plugin for Redmine, and I'm having some trouble getting it to work. I follow all the instructions, but when i run rake db:migrate_plugins I get this error:
/usr/share/redmine# RAILS_ENV=production rake db:migrate_plugins --trace
rake aborted!
GONE
/var/lib/gems/1.8/gems/rake-10.0.2/lib/rake/application.rb:191:in `deprecate'
/usr/lib/ruby/vendor_ruby/rake/rdoctask.rb:4
/usr/lib/ruby/vendor_ruby/rails/tasks/documentation.rake:5:in `require'
/usr/lib/ruby/vendor_ruby/rails/tasks/documentation.rake:5
/usr/lib/ruby/vendor_ruby/rails/tasks.rb:15:in `load'
/usr/lib/ruby/vendor_ruby/rails/tasks.rb:15
/usr/lib/ruby/vendor_ruby/rails/tasks.rb:6:in `each'
/usr/lib/ruby/vendor_ruby/rails/tasks.rb:6
/usr/lib/ruby/vendor_ruby/rails/application.rb:292:in `require'
/usr/lib/ruby/vendor_ruby/rails/application.rb:292:in `initialize_tasks'
/usr/lib/ruby/vendor_ruby/rails/railtie.rb:184:in `instance_exec'
/usr/lib/ruby/vendor_ruby/rails/railtie.rb:184:in `load_tasks'
/usr/lib/ruby/vendor_ruby/rails/railtie.rb:184:in `each'
/usr/lib/ruby/vendor_ruby/rails/railtie.rb:184:in `load_tasks'
/usr/lib/ruby/vendor_ruby/rails/engine.rb:424:in `load_tasks'
/usr/lib/ruby/vendor_ruby/rails/application.rb:145:in `load_tasks'
/usr/lib/ruby/vendor_ruby/rails/railtie/configurable.rb:30:in `send'
/usr/lib/ruby/vendor_ruby/rails/railtie/configurable.rb:30:in `method_missing'
/usr/share/redmine/Rakefile:7
/var/lib/gems/1.8/gems/rake-10.0.2/lib/rake/rake_module.rb:25:in `load'
/var/lib/gems/1.8/gems/rake-10.0.2/lib/rake/rake_module.rb:25:in `load_rakefile'
/var/lib/gems/1.8/gems/rake-10.0.2/lib/rake/application.rb:581:in `raw_load_rakefile'
/var/lib/gems/1.8/gems/rake-10.0.2/lib/rake/application.rb:87:in `load_rakefile'
/var/lib/gems/1.8/gems/rake-10.0.2/lib/rake/application.rb:158:in `standard_exception_handling'
/var/lib/gems/1.8/gems/rake-10.0.2/lib/rake/application.rb:86:in `load_rakefile'
/var/lib/gems/1.8/gems/rake-10.0.2/lib/rake/application.rb:70:in `run'
/var/lib/gems/1.8/gems/rake-10.0.2/lib/rake/application.rb:158:in `standard_exception_handling'
/var/lib/gems/1.8/gems/rake-10.0.2/lib/rake/application.rb:68:in `run'
/var/lib/gems/1.8/gems/rake-10.0.2/bin/rake:37
/usr/local/bin/rake:19:in `load'
/usr/local/bin/rake:19
Before that, I had to do some variations:
I've installed the plugin into /usr/share/redmine/plugins instead of /usr/share/redmine/vendor/plugins.
I've run bundle install so it installs some missing dependencies.
And I don't know what's next. I've been reading the docs over and over, but this seems to be a Ruby/Rails versioning problem out of my control.
I'm running Rails 3.2.8, Redmine 2.1.2 on Ubuntu 12.04 from PPAs. Perhaps I should stop trying these versions and go for old good Rails 2.3.14 and Redmine 1.3.2?

What is causing private method `gsub` called for nil:NilClass during Rails migration?

I've never sent this one before. I'm configuring a new server with an existing application. Trying to run a migration and here's the output.
root#beta:/vol/opt/dev/capistrano/foo-alpha/releases/20120330233010# RAILS_ENV=production rake db:migrate --trace
rake aborted!
private method `gsub' called for nil:NilClass
/usr/local/rvm/gems/jruby-1.6.6#global/gems/bundler-1.1.3/lib/bundler/runtime.rb:77:in `require'
org/jruby/RubyArray.java:1614:in `each'
/usr/local/rvm/gems/jruby-1.6.6#global/gems/bundler-1.1.3/lib/bundler/runtime.rb:55:in `require'
/usr/local/rvm/gems/jruby-1.6.6#global/gems/bundler-1.1.3/lib/bundler.rb:119:in `require'
/vol/opt/dev/capistrano/foo-alpha/releases/20120330233010/config/application.rb:7:in `(root)'
org/jruby/RubyKernel.java:1027:in `require'
/usr/local/rvm/rubies/jruby-1.6.6/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
/vol/opt/dev/capistrano/foo-alpha/releases/20120330233010/config/application.rb:4:in `(root)'
org/jruby/RubyKernel.java:1052:in `load'
/vol/opt/dev/capistrano/foo-alpha/releases/20120330233010/Rakefile:25:in `load_rakefile'
/usr/local/rvm/gems/jruby-1.6.6#foo/gems/rake-0.9.2.2/lib/rake/application.rb:501:in `raw_load_rakefile'
/usr/local/rvm/gems/jruby-1.6.6#foo/gems/rake-0.9.2.2/lib/rake/application.rb:82:in `load_rakefile'
/usr/local/rvm/gems/jruby-1.6.6#foo/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/usr/local/rvm/gems/jruby-1.6.6#foo/gems/rake-0.9.2.2/lib/rake/application.rb:81:in `load_rakefile'
/usr/local/rvm/gems/jruby-1.6.6#foo/gems/rake-0.9.2.2/lib/rake/application.rb:65:in `run'
/usr/local/rvm/gems/jruby-1.6.6#foo/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/usr/local/rvm/gems/jruby-1.6.6#foo/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
/usr/local/rvm/gems/jruby-1.6.6#foo/gems/rake-0.9.2.2/bin/rake:33:in `(root)'
org/jruby/RubyKernel.java:1052:in `load'
/usr/local/rvm/gems/jruby-1.6.6#foo/bin/rake:19:in `(root)'
Migrations on my local laptop and on an existing server are working fine. config/database.yml looks right. Database is up and running and I can connect to it. What is this?
I also just tested rails console and I'm also not able to get a console. Again a private method gsub called for nil:NilClass. It's somehow related to connecting to the database and I'm not sure how/why.
** UPDATE **
After adding some debug into runtime.rb, this is the exception that's being raised:
#<LoadError: no such file to load -- activerecord-jdbcmysql-adapter>
The messed up part is, it is installed:
# gem list |grep -i activerecord-jdbcmysql-adapter
activerecord-jdbcmysql-adapter (1.2.2)
Is this some kind of RVM or bundler bug?
** LAST UPDATE **
I installed Amazon Linux AMI (The other is running an Ubuntu) and cannot replicate this issue there.
This is a bug in bundler, it was reported for rvm-capistrano, please check your Gemfile and try removing / commenting some gems.
https://github.com/carlhuda/bundler/issues/1801

how to use app from github

I want to use app from github , i cloned it ,
but when i try bundle install , it requires a gem file .
I copied my gem file from other Local app , 'bundle install ' is successfull , but when i try 'rake db:migrate' i see it:
rusik#rusik-K50AF:~/work/ruby/episode-119/blog$ rake db:migrate
rake aborted!
no such file to load -- initializer
(See full trace by running task with --trace)
rusik#rusik-K50AF:~/work/ruby/episode-119/blog$ rake db:migrate --trace
rake aborted!
no such file to load -- initializer
/home/rusik/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
/home/rusik/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
/home/rusik/work/ruby/episode-119/blog/config/boot.rb:54:in `load_initializer'
/home/rusik/work/ruby/episode-119/blog/config/boot.rb:38:in `run'
/home/rusik/work/ruby/episode-119/blog/config/boot.rb:11:in `boot!'
/home/rusik/work/ruby/episode-119/blog/config/boot.rb:109:in `<top (required)>'
/home/rusik/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
/home/rusik/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
/home/rusik/work/ruby/episode-119/blog/Rakefile:4:in `<top (required)>'
/home/rusik/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/rake_module.rb:25:in `load'
/home/rusik/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/rake_module.rb:25:in `load_rakefile'
/ home/rusik/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/application.rb:501:in `raw_load_rakefile'
/home/rusik/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/application.rb:82:in `block in load_rakefile'
/home/rusik/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/home/rusik/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/application.rb:81:in `load_rakefile'
/home/rusik/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/application.rb:65:in `block in run'
/home/rusik/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/home/rusik/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
/home/rusik/.rvm/gems/ruby-1.9.2-p290/gems/rake-0.9.2.2/bin/rake:33:in `<top (required)>'
/home/rusik/.rvm/gems/ruby-1.9.2-p290/bin/rake:19:in `load'
/home/rusik/.rvm/gems/ruby-1.9.2-p290/bin/rake:19:in `<main>'
,
I tried to copy my db test.sqlite3 from my LOCAL app, but it doesn't work, the same problem.
So ,of'course, i tried rails server, but it doesn't work.
So , how to setup app from github?
It's rails 2 app, so there is no bundler at all. If you want to run it you should read README:
To setup the app, just run rake setup.

deploying rails app to heroku migrations rake error on windows

I am attempting to deploy my app to heroku via a windows 7 machine.
I've made it as far as git push heroku master without running into any major issues but when I try to rake the migrations i get the following error
$ heroku rake db:migrate --trace
rake aborted!
No such file or directory - /disk1/tmp/13403_23723015091620/.bundle/gems/specifi
cations/activesupport-2.3.8.gemspec
/disk1/home/slugs/211056_9194ad5_13a9/mnt/.bundle/environment.rb:178:in `read'
/disk1/home/slugs/211056_9194ad5_13a9/mnt/.bundle/environment.rb:178
/disk1/home/slugs/211056_9194ad5_13a9/mnt/.bundle/environment.rb:147:in `map'
/disk1/home/slugs/211056_9194ad5_13a9/mnt/.bundle/environment.rb:147
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
/disk1/home/slugs/211056_9194ad5_13a9/mnt/config/../config/preinitializer.rb:3
/disk1/home/slugs/211056_9194ad5_13a9/mnt/config/boot.rb:28:in `load'
/disk1/home/slugs/211056_9194ad5_13a9/mnt/config/boot.rb:28:in `preinitialize'
/disk1/home/slugs/211056_9194ad5_13a9/mnt/config/boot.rb:10:in `boot!'
/disk1/home/slugs/211056_9194ad5_13a9/mnt/config/boot.rb:129
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require' /disk1/home/slugs/211056_9194ad5_13a9/mnt/Rakefile:4
/home/slugs/211056_9194ad5_13a9/mnt/.bundle/gems/gems/rake-0.8.7/lib/rake.rb:2383:in `load'
/home/slugs/211056_9194ad5_13a9/mnt/.bundle/gems/gems/rake-0.8.7/lib/rake.rb:238
3:in `raw_load_rakefile'
/home/slugs/211056_9194ad5_13a9/mnt/.bundle/gems/gems/rake-0.8.7/lib/rake.rb:2017:in `load_rakefile'
/home/slugs/211056_9194ad5_13a9/mnt/.bundle/gems/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/home/slugs/211056_9194ad5_13a9/mnt/.bundle/gems/gems/rake-0.8.7/lib/rake.rb:2016:in `load_rakefile'
/home/slugs/211056_9194ad5_13a9/mnt/.bundle/gems/gems/rake-0.8.7/lib/rake.rb:2000:in `run'
/home/slugs/211056_9194ad5_13a9/mnt/.bundle/gems/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/home/slugs/211056_9194ad5_13a9/mnt/.bundle/gems/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
/home/slugs/211056_9194ad5_13a9/mnt/.bundle/gems/gems/rake-0.8.7/bin/rake:31
/usr/local/bin/rake:19:in `load'
/usr/local/bin/rake:19
(in /disk1/home/slugs/211056_9194ad5_13a9/mnt)
I should mention, though it could be determined from the above code, that I am using bundler. Perhaps it is due to this.
I'm at a total loss as to what this could mean. I came across this SO thread, but all the fixes it presented I had already tried and they didn't work. I am beginning to appreciate why rails deployment is derided so. Any suggestions?
Did you already take a look on Heroku's documentation about Bundler at http://docs.heroku.com/bundler ?
Are you sure that your Gemfile and Gemfile.lock files are added to your git repository?
I'm able to duplicate this problem:
http://github.com/heroku/heroku/issues#issue/30
The same Rails app will deploy via OS X.

Resources