I'm working through the odin project's web development course and I'm getting tripped up on the last part of the installations project where you are tasked with deploying a rails app to Heroku. I've been working on this for about a week but I refuse to give up but I realize that I need some help.
Here's the link to the tutorial I'm trying to work through (on a mac):
http://installfest.railsbridge.org/installfest/deploy_a_rails_app
I have a Heroku account set up, and am running Ruby 2.3.0 and rails 4.2.5.1. Rubygems are at 2.6.1 (but I tried them at 2.5.1 too).
Everything works fine but when I get to heroku run rake db:migrate I always get the time out error:
[~/railsbridge/test_app] ruby-2.3.0 $ git push heroku master
Everything up-to-date
[~/railsbridge/test_app] ruby-2.3.0 $ heroku run rake db:migrate
Running rake db:migrate on powerful-journey-35824... up, run.9421
▸ ETIMEDOUT: connect ETIMEDOUT 50.19.103.36:5000
I saw another post suggesting that the problem is a result of the connection I'm using blocking port 5000 (I'm at a library). I checked port 5000 on canyouseeme.org as well but it also timed out.
I then tried deploying the app detached using heroku run:detached rake db:migrate and it seems to work until I open heroku again and it shows that the page I'm looking for doesn't exist.
Basically what I'm asking is, does anyone have any idea why this test app isn't getting pushed from my terminal to the heroku deployment page?
I'm a python/django guy, but taking a guess the "everything up to date" message is likely because you have not commited your changes to git. Try:
git commit -a
git push heroku master
Now run your rake command.
Related
I hope life's great and you're busy coding.
I am following mhartl's Rails tutorial for I am really eager to learn RoR for web app development. I tried to troubleshoot by starting from scratch several times which had me going through the pain of creating new bitbucket repos and so on. Anyways I felt you guys probably faced this already so you might be able to help.
After all the steps in the tutorial, up to 2.1, which is
$ git commit -am "Add hello"
$ heroku create
$ git push heroku master
and seems to be successful given the shell message below:
remote: https://fast-sea-56609.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy... done.
To https://git.heroku.com/fast-sea-56609.git
* [new branch] master -> master
when I go to the URL, I get this screenshot with the message
The page you were looking for doesn't exist.
I checked this post Unable to see Ruby on Rails App deployed on Heroku? and I solved the localhost:3000 db migration thingy so now I have localhost:3000/users displaying properly but the heroku url does not display any different.
Tell me if I can provide more informations or run anything to help you troubleshoot. Thanks for the time you spent on reading this rather than doing anything else.
As you have mentioned that you are following Michael Hartl Rails Tutorial I suggest you to complete each task or chapter till the end.
Here the problem caused might be because you missed a part of your tutorial, that the autor ask you to complete the first applications step again with your toy application like bellow:
I suggest doing by following the same “hello, world!” steps in Listing 1.8 and Listing 1.9.1(Did you do these steps in your application before committing and pushing to heroku ?) Then commit the changes and push up to Heroku:
$ git commit -am "Add hello"
$ heroku create
$ git push heroku master
Once you finish making the first working copy of you Rails app in local the next step is to deploy it in heroku to test your app in production environment.
Yo can follow the official Heroku guide to know more about deploying an application into heroku
from this link.
You said you ran rake db:migrate on your local machine. But did you run it on heroku as well?
heroku run rake db:migrate
Remember you need to call this command each time you add new migration to your rails project and push the changes to heroku.
Be sure to check heroku logs for other errors:
heroku logs
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.
I'm trying to push my Rails app to Heroku, and I'm at the point where I'm trying to create/migrate the database, but I cannot get the rake command to run. Here's the message I'm getting:
$ heroku run rake db:migrate
Running `rake db:migrate` attached to terminal... up, run.2439
bash: rake: command not found
I spent a lot of time getting Postgres set up on my local machine, and it's working fine (was able to run rake commands without issue, and the app is running locally), but I don't know why I'm getting this error when I try to migrate the heroku database.
Figured it out. Turns out I had an error when I tried to deploy the app to Heroku, so it was never deployed. I didn't realize this because I was trying to push a branch that was not the "master" branch to heroku, thinking it would be fine. I wasn't getting any errors on that push, but that's because heroku won't try to deploy anything other than the "master" branch. Once I pushed the "master" branch, I got a bunch of pre-compile errors. Once those were cleaned up, I the app was deployed properly and I was able to run the rake commands.
Long story short, make sure your app successfully deployed before trying to run rake commands.
This is a basic, stupid question, but I configured my Rails app to deploy on Heroku, and I'm able to open the application from my Heroku account, etc. But when I want to change my code, do I need to re-deploy the whole application? I tried just committing/pushing to heroku master, but I get the error "fatal: remote end hung up unexpectedly." What should I do instead?
Also: am I supposed to run db:migrate BEFORE deploying/pushing?
There is nothing stupid about a basic question, as everyone has to start somewhere.
The basic process with deploying a Rails app to Heroku is to:
Make changes
Add and Commit your changes ($ git add files_changed.rb & $ git commit -m "make changes")
Push your changes to Heroku ($ git push heroku master)
This then pushes your code to the remote Heroku repository and redeploys your Rails application. If you have made any database migrations, you need to run:
$ heroku run rake db:migrate
This runs db:migrate on your heroku app - see how that works? :)
Running rake db:migrate locally simply migrates your local development database.
For an university exam, I'm creating a Ruby on Rails app.
Currently, my app is working on http://localhost:3000/say/hello.
I would like to upload my app on Heroku web server. The problem is that it doesn't run the hello world program. Instead I see the start view of Ruby on Rails app: http://tecweb2.heroku.com/.
How do I get my hello world program to run on Heroku?
You need to follow the instructions on that page, mainly delete the public/index.html page.
you should use this command to understand whats going on
heroku logs
whatever shows up in red is what you are having problems with
here is the workflow that I use
create the heroku app
heroku create --stack cedar
push to your git repo
git push origin master
push to heroku repo
git push heroku master
rake the databse in heroku
heroku run rake db:migrate
Here is the heroku getting started guide for rails 3
http://devcenter.heroku.com/articles/rails3