I'm following this tutorial to a tee and so far so good. I ran into a problem on step 2.6
On my terminal I input
heroku open
After which it opened a new webpage on Chrome.
The terminal then displayed
Opening aqueous-forest-3891... done
The webpage that opened was https://aqueous-forest-3891.herokuapp.com/ and unfortunately it says the webpage may have been moved or does not exist.
I've followed the tutorial exactly (as far as I can tell) and can't figure out what I've done wrong. I'm very new to Rails (and Ruby....and Heroku...).
I'm not exactly sure how to troubleshoot my problem or if there's a command I can use in my terminal for debugging - etc.
Good news: a Rails error means your app is running on the server
Bad news : your routes are likely causing a problem.
According to this blog (which has exactly the same issue), the problem is that Heroku won't host the "default" Rails page. You'll need to create a default page & redeploy:
#config/routes.rb
root "application#index"
#app/views/application/index.html.erb
Hello world
$ git add .
$ git commit -a -m "Default Page"
$ git push heroku master
Context
The error you're seeing is one from Rails:
This is good, as it means your Rails app is actually on the Heroku server & being picked up. This type of error is either suggestive that you have an error with your server (500 error), or a missing page (404 error).
-
If you had the following error, it would be a Heroku (platform) centric issue:
This is normally caused either by a lack of database connectivity, or some sort of environment issue (ENV vars missing etc).
The best way to debug Heroku is to use the Heroku logs.
These are written - as with most event-based software - on the server, allowing you to see what's going on. Heroku recently upgraded their software to include a new real-time logging system:
Checking in there will tell you what's going on, allowing you to take direct action to resolve it.
To debug your issue you will need to view the logs. A quick way is to add the Papertrail add on to your app (there's a free option). Add-ons can be added via the resources tab from Heroku.
Another option is to to view the heroku logs in the terminal with the command
heroku logs -t --app appName
By viewing the logs, you should get some error messages that will help you debug why your app isn't showing.
In my case I deployed custom branch to heroku master, which; heroku usually does not build itself.
If you want to deploy custom branch to heroku use this command.
git push -f heroku your_branch_name:master
Related
I am following Ruby On Rails Book Tutorial, Chapter 2, toy_app
I created repository in BitBucket, https://bitbucket.org/Marium36/toy_app/src/master/
And I am learning to deploy early and often to Heroku, https://salty-wave-17330.herokuapp.com/
On my local Ubuntu VM, I can perfectly load localhost:3000 and localhost:3000/users
On Heroku I can go to https://salty-wave-17330.herokuapp.com/
However, when I go to https://salty-wave-17330.herokuapp.com/users, I get the error:
We're sorry, but something went wrong.
If you are the application owner check the logs for more information.
The build logs look perfectly fine, https://bitbucket.org/Marium36/toy_app/src/master/build
What can be the problem?
Two things you can do:
First: Check your server logs (not build logs), this will most likely tell you where the problem is - https://devcenter.heroku.com/articles/heroku-cli-commands#heroku-logs
Secondly: Add an error monitor like Airbrake - Check out Errors and Exceptions section on this page - https://elements.heroku.com/addons
Also, build logs are only related to deploying the app, you have to check the server logs to know why your server is throwing an error.
I'm reading railstutorial.org Chapter 2 (about toy_app) using cloud IDE and I've run into a problem. I'm newbie so I would appreciate a simple sollution and explanation what I did wrong.
I followed every step as described in tutorial: I created my 'hello world' index page and I pushed it to heroku. I renamed my heroku site as well (it wasn't required in tutorial). Everything was fine at that moment.
I added user and micropost models. I've started a local server (on second terminal by typing rails server -b $IP -p $PORT) and added some users and microposts. Again, everything was working as expected.
I didn't close local server. I committed changes to git and I pushed it to Bitbucket and then to heroku. Finally, I typed heroku run rake db:migrate. It was the final step of this tutorial.
Everything seemed to be Ok, but I noticed that posts and users I added on local server weren't visible on my heroku site. Since I didn't close my local server, I checked it and posts I created were still available. As I said, situation on my heroku site was different.
I didn't get any errors during that process, only one warning after typing git push: Warning: Permanently added the RSA host key for IP address ... to the list of known hosts. Next time it didn't show up.
After my first try of every step I got promising outputs. After second and next tries it returned
On branch master
Your branch is up-to-date with 'origin/master'.
nothing to commit, working directory clean`
and
Everything up-to-date
So still nothing worrying.
I tried to restart server, to follow those steps again after closing my local server but it didn't help. I searched for solution but only what I found were problems with massive errors or different problems.
Actually, It is problem I can go along with because I don't need it updated at this stage, but I would like to hear an answer and find out if there is something wrong with heroku or it it normal behavior or even if it is newbie's blindness.
First your local database and heroku database are different. Any user created on local app won't be available on heroku app unless you use a common database.
rake db:migrate, in its most basic form, just runs the change or up method for all the migrations that have not yet been run. If there are no such migrations, it exits. It will run these migrations in order based on the date of the migration.
Try creating user and post on heroku app, it should work all fine.
http://site.com/users/password/new is returning a 404 in production mode but not in development. I am deploying via capistrano and it looks like it's copying the entire site over properly. I tried running the console in production mode on the server and couldn't find anything. Has anyone seen this before?
Since this path works in development and fails in production I would focus on the differences between your environments.
A common issue is that people commit their changes locally, but do not push them to (e.g.) GitHub before deploying with capistrano. Can you ssh into your server and go to the current path and run rake routes there? Try and check if there are differences.
Once you've confirmed that at least the routes on the server are up to date, try checking the production log while accessing /user/password/new. It should be in /shared/log/production.log. You could ssh there and use tail -f production.log to follow the log while you try to access the path.
On a side note, it seems that you are using Devise. There have been similar issues for the user root path. See for example this question. Perhaps this will shed some light on your problem.
I am working my way through Michael Hartl's Ruby on Rails Tutorial (on Mac OSX 10.7.2/Ruby 1.9.2/Rails 3.1.1) and just finished Chapter 2, which concludes with deploying a demo twitter app to Heroku.
Everything appears to be working properly when I run the app locally AND I was able to successfully deploy the app to Heroku in some capacity because it is available here: http://rich-twitter-baby.heroku.com/
However, what I can't figure out is why the /users and /microposts pages aren't showing up publicly (with lists of users and microposts respectively) as they do locally. I migrated my database to Heroku and pushed the info up there and everything seemed to work properly, but I get this error message when I try to view the pages publicly.
I've tried running "heroku console" but get this error:
Unable to attach to a dyno to open a console session.
Your application may have crashed.
Check the output of "heroku ps" and "heroku logs" for more information.
And the logs say error H13, while the ps looks like this:
Process State Command
------------ ------------------ ------------------------------
web.1 idle for 1h thin -p $PORT -e $RACK_ENV -R $HER..
Let me know if anyone has any ideas or if more info would help.
Thanks!
I would contact Heroku support on this. Dynos can crash and become 'zombiefied' which means they just sit there idle.
Normally these will clear themselves out within a few hours, but it shouldn't happen that often if at all.
Doing a new deploy will also normally restart everything back to clean.
If it's consistently happening, have you tried spinning up the application locally in production mode to try and reproduce the problem
rails server -e production
, or adding something like the Airbrake add-on to your app to capture the error.
Check your log using
$> heroku logs
At the command line of your development system that you used to push to heroku.
Post the log here if you can't figure it out from that.
I contacted Heroku Support about this issue and it turns out that the answer had to do with which stack my app was being deployed to. I did their workaround and everything is now up and running. Here's the full info from them:
It looks like the problem is that you're using Rails 3.1 and our Bamboo stack; we have full >asset pipeline support on our Cedar stack[1]. Since this is just a demo app, an easy >workaround is to precompile locally and commit the files:
rake assets:precompile
git add -A
git commit -m "precompiling assets"
git push heroku master
To get full asset pipeline support, you need to create your app on the Cedar stack and then >repeat the process you did to get your Bamboo app to work.
[1]: http://devcenter.heroku.com/articles/rails31_heroku_cedar
I'm trying to deploy my rails application with heroku (as shown here). I've created a very simple rails application (using ruby 1.9.2 and rails 3.0.3; i'm sure heroku supports these - see heroku docs), created and pushed github repo, created heroku repo and pushed it (all commiting is done). And when i'm trying to access my application controller, it throws 404 rails page like it's saying 'there is no such controller'. I've done heroku rake db:migrate but first time i ran it i got 'host not found' error. Running this again fixed that. Well, i'm not sure if i should run heroku addons add:postgresql - i though postgres is on by default, but heroku says i should pay in order to get DB (running command i've mentioned asks me to confirm billing it).
May be it sounds stupid, but how can i deploy my rails application (it's a very simple one) without paying any fees and such troubles as 404 pages like i mentioned in the beginning of my post? (and this is my question). Maybe i should choose other hosting (if it exists in our world) or am i doing something wrong with heroku?
You forgot to push your quotes_controller.rb to git and heroku probably.
git add controllers/quotes_controller.rb
it seems you forgot models also, and probably lot of files.