Heroku deployment rake db:create/migrate error - ruby-on-rails

I am following Hartl's ROR tutorial and I am trying to get my DB working on Heroku, but to no avail. When I run the following commands:
heroku run rake db:create
or
heroku run rake db:migrate
I get the following errors:
Running `rake db:create` attached to terminal... up, run.5477
/usr/bin/env: ruby2.2: No such file or directory
Running `rake db:migrate` attached to terminal... up, run.5562
/usr/bin/env: ruby2.2: No such file or directory
I am using postgresql for development and production. Here is my latest commit https://github.com/Euklidian-Space/sample-app
Here are the heroku logs:
2015-07-30T16:42:48.956556+00:00 heroku[api]: Starting process with command `bundle exec rake db:migrate` by gabriel.grover#gmail.com
2015-07-30T16:42:53.039994+00:00 heroku[run.5562]: Awaiting client
2015-07-30T16:42:53.090027+00:00 heroku[run.5562]: Starting process with command `bundle exec rake db:migrate`
2015-07-30T16:42:53.343439+00:00 heroku[run.5562]: State changed from starting to up
2015-07-30T16:42:55.633768+00:00 heroku[run.5562]: State changed from up to complete
2015-07-30T16:42:55.618985+00:00 heroku[run.5562]: Process exited with status 127

In your bin/bundle, bin/rake, bin/rails and bin/setup files, the first line of each reads #!/usr/bin/env ruby2.2. Change them all to #!/usr/bin/env ruby. Then try deploying again.

Related

"heroku run rake db:migrate" command returns ETIMEDOUT error message

Any ideas why I might be getting the below error message?
$ git push heroku master
Everything up-to-date
$ heroku run rake db:migrate
Running rake db:migrate on ⬢ agile-retreat-87004... !
▸ ETIMEDOUT: connect ETIMEDOUT 50.19.103.36:5000
Try to run in the background. Example:
heroku run:detached rake --app app-name db:migrate

Heroku run rake db:migrate

I did the following steps for deploying app and migrating my database:
git add -A
git commit -m "add changes"
git push heroku master
heroku run rake db:migrate
In console I see next:
Running `rake db:migrate` attached to terminal... up, run.9234
== 20150713191218 CreateMovies: migrating =================
-- create_table(:movies)
-> 0.0379s
== 20150713191218 CreateMovies: migrated (0.0381s) ============
heroku restart
But heroku run rake db:migrate does not work. When I run my app, my database is empty. I don't understand why. I don't see any errors.
And I'm sorry, that I repeat this question. I saw that people already asked about this problem, but no advice helped me.
try heroku run rake db:migrate RAILS_ENV=production
To populate your database automatically with rake task you need to use the command RAILS_ENV=production rake db:seed(this will populate your production database) and have a seed file in place. But I guess that was not really what you were looking for

heroku run rake db:migrate error “/usr/bin/env: ruby2.2: No such file or directory”

I'm brand new to Rails and I'm following this tutorial. I successfully pushed my app to heroku, but I can't get the database migrate.
I use a virtual machine with ubuntu server .
I typed:
$ heroku run rake db:migrate
and got this error:
Running `rake db:migrate` attached to terminal... up, run.3356
/usr/bin/env: ruby2.2: No such file or directory
I don't understand what I can do. I tried to use
$ heroku run rails db:migrate
$ rake rails:update:bin
but it didn't help.
the solution that worked for me is that for every file in the bin directory of my project, i changed the first line from:
#!/usr/bin/env ruby2.2
to
#!/usr/bin/env ruby

Error with migrating database in heroku

I'm following Michael Hartl's tutorial on learning web development with rails. When it comes to migrating the database the command:
heroku run rake db:migrate
gives the following error
Running `rake db:migrate` attached to terminal... up, run.2675
/usr/bin/env: ruby1.9.1: No such file or directory
I'm using Ruby 1.9.3 and I have declared that in the Gemfile. I don't really understand what could be causing this error and any help at all would be greatly appreciated.
use this
/usr/bin/env ruby
instead of
/usr/bin/env ruby.exe
on following files of your app.
bin/bundle
bin/rails
bin/rake
and the exec
heroku run rake db:migrate

Heroku run process using JRuby 1.7 and Rails 3.2 hangs

I was able to get the web process on heroku running with JRuby and trinidad. I am using this in my Gemfile, which seems to be the best practice over a custom heroku buildpack at this point:
ruby "1.9.3", :engine => "jruby", :engine_version => "1.7.0"
However, in trying to load the database (or connect to the rails console) via:
heroku run rake db:schema:load
or
heroku run console
The command just hangs. Tailing the heroku logs I see the process starting up and completing without error, but I never get any output back on the local command line and it just hangs.
2012-11-16T16:02:46+00:00 heroku[api]: Starting process with command `bundle exec rake db:schema:load`
2012-11-16T16:02:51+00:00 heroku[run.1]: Awaiting client
2012-11-16T16:02:51+00:00 heroku[run.1]: Starting process with command `bundle exec rake db:schema:load`
2012-11-16T16:02:51+00:00 heroku[run.1]: State changed from starting to up
2012-11-16T16:02:51+00:00 heroku[run.1]: State changed from starting to up
2012-11-16T16:03:21+00:00 heroku[run.1]: State changed from up to complete
2012-11-16T16:03:21+00:00 heroku[run.1]: State changed from up to complete
2012-11-16T16:03:21+00:00 heroku[run.1]: Process exited with status 0
I'm guessing I need to do add a rake and console item in the Procfile and tried some various combinations but nothing was working. It always hangs. I also didn't see anyone else's Procfile for JRuby including these items.
This turned out to be an issue with running the heroku gem from within JRuby. Running the commands via heroku toolbelt from outside of JRuby (MRI 1.9.3) works fine.

Resources