Heroku application error chapter 5 - ruby-on-rails

Hi i am at chapter 5 of the ror tutorial and i have problems pushing it onto heroku.
there was no issues at all, with pushing, until now, when it started showing issues with no cedar app supported - even though i have already created my current app using heroku create --stack cedar
Also when i ran the domain in the browswer, it brings me to a page where it says application error.
An error occurred in the application and your page could not be served. Please try again in a few moments.
If you are the application owner, check your logs for details.
can anyone help me with this? Thanks!

DB Connection
You'll be best running:
heroku run rake db:migrate
There are two types of error with heroku - either you have the standard Rails error, or the typical Heroku error (as you're seeing right now).
The heroku error is basically the result of having no connection to a workable database. Commonly, this is that you've not created the db (which is done with heroku run rake db:migrate), but is also part of not having a workable database
You may wish to consult the Heroku PostgreSQL docs on how to resolve this

Related

Trying to deploy Sinatra app to Heroku with psql database, getting load error

I'm not the most experienced of developers so please excuse me if this is a stupid question.
I am trying to deploy a Sinatra app that uses PostgreSQL as it's database. My application works locally but then when I try to deploy to Heroku, I get this error:
Screenshot of Terminal after I try to push to heroku master
I have no idea what is going on. I don't think I'm requiring anything incorrectly b/c I would think that it wouldn't work locally if that were the case. I tried running the bit of code that says "bundle exec rake -P" but it didn't do anything as far as I know. I thought maybe I'd have to create a database and migrate it since I did that with a Rails app I was working on, but this is in Sinatra, so not sure if you have to do something entirely different.
It apparently deployed to Heroku, but when I run heroku open, it doesn't work. I just get a page that says to try again later and look at the log.
Any ideas on how to solve this issue?

Syncing Heroku and localhost databases

Hey so I am following the One Month Rails guide to learning Ruby and I have hit a wall on one of the lessons. I have just finished uploading an image with Paperclip, and as I finished my work on my localhost and checked it on Heroku, something went wrong. The pin/image appears to have been pushed to my Heroku account, the only problem is that the username and password that works for my localhost:3000 won't work for my Heroku account. The same password should work for both, but for some reason something is wrong. I wish I could give you the action that is going on in my terminal, but the ruby rails is the only thing that has a continuous status flow. The problem may have been when I switched my password after not using my account on localhost for a few weeks, but i thought that once i "git pushed" that to heroku master, it would've synced. I have tried heroku run rake db:setup which didn't seem to do too much as well as wrestled by way through "Importing a Heroku Postgres Database with PG Backups", but I had some trouble working through that. Any ideas? Thanks for the help.
Your 'database.yml' should not be sent to Heroku, they take care of that, creating a new database.yml config file with the proper DB access details.
Try logging into your Heroku instance and deleting the file.
Edit: nevermind, assumed you were not able to connect to the DB, not to login into the website.
So if I'm understanding you correctly, you've deployed your application to Heroku and the login (to your application) that was working locally doesn't work on Heroku.
Deploying your application doesn't deploy data. Assuming you've run heroku run rake db:migrate then your database schemas will at least match.
At this point, you've got a couple of options.
Use a seeds.rb file which you can load with heroku run db:seed to setup some 'seed' data so that you can login.
Push your local database to Heroku - either via heroku db:push or using heroku pg:transfer provided by https://github.com/ddollar/heroku-pg-transfer
Use heroku run console to create your user account via the command line
User.create(email: 'someemail.com', password: 'somepassword', password_confirmation: 'somepassword')
I'd be inclined to go with the later option.
How did the user get in their in the first place? Perhaps going back to that step in the tutorial - just remember, if you are using rails console locally to use heroku run console on Heroku.

Rails/Heroku : db:push runs correctly but does not create the DB

I've been having problems yesterday with Heroku shared Postgres DB. It looks like my db is not correctly 'pushed' to my heroku DB.
Configuration
Using 'pg' gem for both development and production environments.
Using Heroku's 'shared-database' add-on.
Running Rails 3.1.1.
What I'm trying to do
Push my source code to Heroku and then synchronize my postgres DB with Heroku's one. No problem for the source itself, but I can't get my DB up and running.
What I've tried so far
1: Source code push : git push heroku master. OK. This works.
2: Then I try to run : heroku db:push. Seems to be running normally, no error, the schema is sent to Heroku, the different tables are correctly detected and seem to be sent as well :
3: Let's check it out, is everything allright ? heroku info :
Doh ! The database is still empty (and therefore I get DB-related errors when accessing dynamic pages). Can't understand what's happening, I've spent time on this issue yesterday evening but only been mpessing with Heroku for a little while and never encountered this issue. Any clues ?
I'm not convinced that the Database size figure is a live figure. Here's a clean deployment of an app to Heroku and the output of heroku info at each stage. The first run is post application creation, the second after a push of the code, the third after a heroku db:push.
The database was uploaded before the third output and the application is running however the DB:size is not reporting the figure.
Is your application actually erroring because the database isn't present?
The problem is in the commit process.
You should run manually after each commit from your console :
heroku run rake db:migrate
Enjoy
daniel

Heroku: Deploying rails application troubles

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.

Why doesn't Heroku show the default Rails page?

Following chapter (1) of the Ruby on Rails tutorial, I was able to successfuly push the application to "Heroku" using:
git push heroku master
But, when I open the website, I get a page with the following:
App crashed
This application is temporarily offline.
If you're the administrator of this app, please check your heroku logs for the backtrace.
Why is that? And, why don't I see the default Rails page?
Thanks.
In any situation where heroku gives you an error message in production, type heroku logs into your terminal. This will usually point you in the right direction.
http://docs.heroku.com/logs-exceptions
Also check your localhost and make sure you have migrated the database if one exists.
Are you able navigate to default local rails website at http://localhost:3000 and see the defaut site?

Resources