Heroku "We're sorry, but something went wrong" after Postgres migration - ruby-on-rails

I recently did Heroku's requested database migration from a "shared database" to Postgres. I followed Heroku's directions carefully, and it all went fine until the last step: removing the old shared database. At that point, my app went down with the "something went wrong" message, and it's been down ever since (going on two weeks now).
Note that the app was still working after the step in which I switched to the new database, and according to "heroku config", it is using the new database. It shouldn't care about the old one disappearing. The logs say nothing other than 500 errors.
I submitted an urgent support request to Heroku, but they were not helpful. They just said that my data is still there but, "Your application isn't logging so it's not clear why this is happening but it doesn't appear to be due to the migration." That was a week ago, so it's not looking like they're going to do anything more.
I agree that the problem shouldn't be due to the migration, but given that I've made no changes to the app except the migration, and that it died exactly when I removed the old database, I don't see what else it could be.
My app is probably pretty old at this point (Rails 3.0.3), so my only thought now is to update everything to the latest versions and redeploy. The app is used to record merit badges and rank advancements for our local Boy Scout troop, so I really need to get it running again. Any advice would be greatly appreciated.

My first instinct would to db:pull the heroku hosted database. (make a copy).
Then try to start your app locally.

Heroku has fixed the problem. My hypothesis was correct: my app was so old that the migration procedure did not actually update it to use the new database. They say that they'll be applying the fix to their other old apps now.

If the app started failing the moment you removed the shared database, it means that your app was still connected to this database and was never connecting to the new one. It sounds to me like you did not run heroku pg:promote HEROKU_POSTGRESQL_<color of new database> --app <your-app>. Can you try that?
Edit:
Based on the further info provided in your comments, it's possible that this is a potential issue in the aspen and bamboo stacks (that only affect a few customers). The thing to try now is a new deploy. Try making a trivial change - maybe a newline in your project README - and deploy the app again. This will force a slug recompile that will write out a new database.yml using the correct DB.
Even better would be to migrate to the cedar stack though

Related

Rails Tutorial: Why can I sign up a new user without problems on the local server but not on Heroku?

I've completed the Rails Tutorial. I kept up with every detail until the end of chapter 8. The last four chapters I just copied and pasted without trying to understand much.
The Sample App works perfectly on a Cloud9 local web server, but not on Heroku. Specifically, When I want to sign up a new user, I get the message "We're sorry, but something went wrong."
Why can I sign up a new user without problems on the local server but not on Heroku? Is the functionality of the final sample app supposed to be exactly the same on both local and heroku?
You are getting a 500, look at the server logs for a clue. Probably need to run migrations.
Run your migrations:
heroku run rake:db migrate
You may need to restart heroku:
heroku restart
If it still doesn't work, try resetting your database. If you're using postgres, try:
heroku pg:reset DATABASE
I completed every step in the entire Rails Tutorial book, except one, which I thought was optional and wouldn't affect the result in production.
10.3 Email in Production shows you how to configure your application to send emails in production (for account activation in the book's sample application) using a Heroku add-on called Sendgrid.
You do have to give Heroku credit card information (though for the purposes of the book you don't have to actually make any purchase or subscription), and this is why I initially didn't implement this section of the book.
After following along and implementing section 10.3 my final application is fully functional in production.

What if we mistakenly deleted some migration file..?

I have deleted some migration file mistakenly. Those files are already migrated.
If I am creating migration with same name, and fire rake db:migrate command it is showing me message that Table already exist. Is there any way to regain those files?
please help..
You will find information about previous migration in config/schema.rb
There is no need of keeping old migration files if all databases (developers, staging and production) have been migrated. Even if you did not delete the old files, they would not prevent you from getting a error message if you try to create a duplicate table.
I am relatively new to RoR. However, I'm a bit concerned that losing this file will present some problems if you aspire to host your app on a server other than the one it is currently hosted on. For example, if you had a mind to host the app in Heroku, you would need to run your migrations in that environment.
If you are not terribly far along with your application, it would be best to start over, take care not to delete your migrations, and put your app under version control so that you will have a fallback should you run into this problem in the future.

How to clean RoR database yml cache?

I've just set out to creating my first RoR project, using MySQL. Obviously after the first visit to browser the site informed me about not being able to connect to the DB with the current settings. I've quickly updated them in the config/database.yml, however it still complained about the old settings.
Eventually, it updated and was working fine, but I'm sure there's a cache somewhere that could have been cleared to make this less of a nuisance.
I have commented it earlier, Now adding it to my answer ;)
It seems like you have not restarted the server after done the changes in database.yml. Because, database.yml is being loaded once at the time of server start-up. So please try with restarting your rails server.

Backing up my locally hosted rails apps in preparation for OS upgrade

I have some apps running on Heroku. I will be upgrading my OS in two weeks. The last time I upgraded though (6 months ago) I ran into some problems.
Here's what I did:
copied all my rails apps onto DVD
upgraded OS
transferred rails apps from DVD to new OS
Then, after setting up new SSH-keys I tried to push to some of my heroku apps and, whilst I can't remember the exact error message off-hand, it more or less amounted to "fatal exception the remote end hung up"
So I know that I'm doing something wrong here.
First of all, is there any need for me to be putting my heroku hosted rails apps onto DVD? Would I be better just pulling all my apps from their heroku repos once I've done the upgrade? What do others do here?
The reason I stuck them on DVD is because I tend to push a specific production branch to Heroku and sometimes omit large development files from it...
Secondly, was this problem caused by SSH keys? Should I have backed up the old keys and transferred them from my old OS to my new one too, or is Heroku perfectly happy to let you change OS's like that?
My solution in the end was to just create new heroku apps and reassign the custom domain names in heroku add-ons menu... I never actually though of pulling from the heroku repos as I tend to push a specific branch to heroku and that branch doesn't always have all the development files in it...
I realise that the error message I mentioned doesn't particularly help anyone but I didn't think to remember it 6 months ago. Any advice would be appreciated
PS - when I say upgrade, I mean full install of the new version with full format of the HDD.
One of the reasons for using a (D)VCS (Version Control System) is reproducibility (usually "reproducibility of builds", but here also the ability to reproduce a given state of a system versioned at a given time)
So it could be a good test to see if you have:
all your system properly committed
all the process to regenerate the extra content (if need be) you need from your restored data
Making a bundle of your repo (meaning dealing with only one file to backup somewhere else, DVD or otherwise) is a good start.
And regarding your "hung up" error message, if SSH is involved, that means you need also to save SSH keys (see comments) usually located under the user's homedir (as in ~/.ssh/authorized_key)

Rails app unable to save anything after deployment

today I uploaded my app to server, and after seting it into development mode, and running of course rake tasks (rake db: migrate, and rade db: migrate RAILS_ENV="production") and well it just doesn't save anything.
The problem happens when I try to create any new items, it just goest to the listing of models...
Your question is very vague. I believe you're saying the app writes files to the server's hard drive. If that's what you're asking, I think the best guess is that something's wrong with file system permissions. Unfortunately, I can't say what is wrong without more details.
i solved it.
reason i asked was because i absolutely went through each and every one of my potential problems and took care of them, and well in the end none of them were the reason of such a failure. so then i went to the basics
and i basically had to clone my development environment on the production machine.
so i had to downgrade rails a couple of versions, and some gems too.
that took care of it, everything went on smoothly, so if anyone ever encounters such mysterous failures, give this a try.

Resources