"heroku run rake db:migrate" issue - ruby-on-rails

Folks, I am following Ruby on Rails Tutorial and working on the DemoApp in Chapter 2. My env is :
Win 7
Ruby 1.9.3
Rails 4.0.2
I have deployed the demo app (under directory demo_app) locally and have tested it out locally as well. I did push it to Heroku using
c:\rails_projects\demo_app heroku create --stack cedar
c:\rails_projects\demo_app git push heroku master
the app gets deployed to heroku.
When I run: heroku run rake db:migrate
I get the error:
No app specified. Run this command from an app folder or specify which app to use with --app APP.
I have run it with heroku run rake db:migrate --app demo_app
but get the same error.
Not sure what to do.

Heroku will have given your app a random name when you created the app. Run heroku apps from the terminal to get the name of your app, then heroku run rake db:migrate --app your_app_name.

Assuming the name of your app is robot.
On your terminal, heroku run rake db:migrate --app=robot

Related

How to specify an app's name while running a Heroku command?

I've just run heroku run rails db:migrate to add some new columns to my production tables after git push heroku master but I receive the error
Simons-MBP:gourmet_coffee Simon$ heroku run rake db:migrate
▸ Error: Could not find git remote stagegcl in /Users/Simon/gourmet_coffee
▸ remotes: heroku staging
So it's clearly trying to run on my staging app. How do I change this so it's my production app?
If you have multiple apps for the same project, you can use --app or -a flag to specify the name of the app.
heroku run rails db:migrate --app <the-name-of-your-app>

Error Code H10 on Heroku Logs

I have a ruby on rails app hosted locally that works fine, but when I push to heroku and open the app there it won't load. I ran heroku logs and I got
I have already ran $ heroku run rake db:migrate, and have bundle update and bundle install my gem files. I ran heroku restart before the heroku logs.
Like I said, locally it runs fine.
heroku logs screenshot
My contact.rb https://gist.github.com/Connerh92/eb8c26053d5e0329a60b28da071c5eb4

How to run DB migrations that effect only on heroku fork app

On heroku I create fork app using heroku fork --from sourceapp --to targetapp
By this I copy an existing application and Heroku Postgres data.
Now I push some migrations on fork app using git push forked master.
How I run these migrations on heroku that it effect only heroku-fork app.
When I run heroku run rake db:migrate , is it effect both or only fork one?
When you have multiple applications associated with the same codebase, Heroku will ask you which application you want to run the command on.
You'll specify that with the -a or --app flag, so for example
heroku run rake db:migrate --app <APPNAME>
This will allow you to run commands on the fork app or the source app.

Rails clear cache on heroku

How can I clear the cache on Heroku?
I've tried heroku run rails c + Rails.cache.clear and receive the following error
Errno::ENOENT: No such file or directory # dir_initialize - /app/tmp/cache/
I also tried heroku run rake tmp:clear (from this post). The task runs but when I go back into the console and run Rails.cache, nothing has changed.
How can I clear the cache?
Did you try this? (This works with Celadon Cedar with the Heroku Toolbelt package at least)
heroku run --app YOUR_APP_NAME rails runner Rails.cache.clear
Update
If the above does not work, try running:
heroku run rake tmp:create
heroku run rake tmp:clear

Deploying Ruby on Rails to Heroku

I am trying to upload RoR application to Heroku.
OS - Ubuntu, ruby version - 2.2.2p95, rails version - 4.2.1, database - PostgreSQL, installed RoR via BrightBox (Tutorial from treehouse), using git push heroku master to upload.
On the local server app works fine. When I push it to heroku, it gives out an error:
The page you were looking for doesn't exist.
You may have mistyped the address or the page may have moved.
If you are the application owner check the logs for more information.
Log files say:
/usr/bin/env: ruby2.2: No such file or directory
I've tried all the possible variants, I could find on the Internet:
rake rails:update:bin
Remove bin from ~/.gitignore (But there is no such file)
heroku config:set PATH=bin:vendor/bundle/ruby/2.2.2/bin:/usr/local/bin:/usr/bin:/bin
Adding this to the GemFile: ruby '2.2.2'
Changed #!/usr/bin/env ruby2.2(.2 (not sure about ".2")) to #!/usr/bin/env ruby (in bin/rake, bin/bundle and bin/rails)
heroku run rails db:migrate
rake rails:update:bin
ln -s /usr/bin/nodejs /usr/bin/node
To upload to heroku, I've configured git, after that logged in heroku, after that "heroku create", after that "git push heroku master", then "heroku open"
And many others... Any ideas how to solve that problem?
Do you have the gem rails12_factor installed and config.assets.compile = true ?
Not sure you mistyped or something else. but heroku run rails db:migrate will not work it should be heroku run rake db:migrate . It might be because you don't have root page. Precompile issue etc.
Run heroku logs -a app_name to see actual logs.

Resources