Heroku: rogue transfer in progress - heroku

I started a migration on Heroku last night that gave me no feedback for hours, and which I eventually stopped because it wasn't clear if the system was even doing anything.
Ever since, it's been a nightmare. I cannot access the relevant database tables in heroku console, I can't migrate, rollback, or use pgbackups.
Helpfully, pgbackups gave me a one line explanation just now:
a transfer is currently in progress
This I assume is the migration I tried to execute hours ago. How can I stop whatever Heroku is doing so I can do a quick restore and get back up and running?

You can remove the problem backup stuck in the "a transfer is currently in progress" by finding the name of the backup and then destroying it. E.g.
heroku pgbackups
My problem backup was listed like this:
b210 | 2013/01/02 12:29.33 | unknown | DATABASE_URL
So to destroy it I just did:
heroku pgbackups:destroy b210
It removed the problem backup for me so I could get on with using pgbackups again properly.

I just had this problem too. Found an easier way of fixing it - briefly remove the pgbackups addon.
heroku addons:remove pgbackups
heroku addons:add pgbackups
WARNING as mentioned in the comments below, this will destroy all extant backups!

I accidentally did a transfer from my COLOR_URL database to my DATABASE_URL which was the same database. heroku pgackups:transfer let this happen which caused the main database to get stuck in
a transfer is currently in progress
I fixed it by looking at the process list pg:ps and killing all connections pg:killall
After doing this and looking at pg:ps the process list was empty and I was free to use the main database again with pgbackups.
NOTE this could be a destructive operation so make sure you have a snapshot before you do this.

The real solution is to contact Heroku support and have them kill the rogue process for you. They say they are re-architecting pgbackups to give users more control.

It never became clear what happened - after a day or so I was able to interact with heroku console, but I was never able to run another migration. This is what I did:
Renamed my app to something else.
Created a new app in its place, checking the stack was the same, and copying over all add-ons and domains.
I restored the database from pgbackups (highly recommended if you're not using this add-on).
This fixed the problem. Note: Be careful to check that your pgbackup doesn't cause unacceptable data loss.

Related

Autobus add-on is being removed from Heroku

I just received an email from Autobus saying that due to "Salesforce's complete and long-term failure to fulfill its obligations to us we have to stop our service starting December 1, 2022.".
That is very unfortunate as we don't really have an alternative add-on (Remora Offsite Backup starts at $75/month).
Does anyone know how to automatically backup Postgres database from Heroku automatically without Autobus help?
For now we have to setup scheduled backups using the Heroku CLI...
heroku pg:backups:schedule DATABASE_URL --at '20:00 America/Sao_Paulo'
More details at https://devcenter.heroku.com/articles/heroku-postgres-backups

I deleted an app and the database was deleted too, is there a way to recover?

I had a database that I was using for two applications, when I deleted one that I no longer used, it deleted the database together, is there a way to recover?
Was your second app using manually added credentials to access the database, or did you use Heroku's "Attach Database" option to link to it?
When deleting an app on Heroku, all associated resources that were created within that app will also be deleted. If Heroku was made aware another app was attached to it (via "Attach Database") then it ought to have shown a warning.
Either way, if the database no longer shows in your data dashboard then it has been removed. Contact Heroku support to see if they keep deleted databases a short time before permanent deletion...
In future, it's worth occasionally using Heroku's "Create Manual Backup" option for databases (you can find it in the "Durability" tab for each database) and downloading a copy to keep safe. (And definitely do a backup again before deleting anything, I always find that a nerve wracking time! ;)

discord.py how to make a JSON file work on Heroku

When I host the bot using Heroku it no longer calculates the JSON files (even if it makes them work they do not appear) and when I restart it is as if nothing had happened and reset everything.
How can I do?
Heroku does not store changes made to files. Heroku dynos restart every once in a while, and that is when data is lost; redeploying the app can also cause the data to be lost. Using a third-party database, such as MongoDB is recommended.

Trying to setup heroku app on my pc

I am going through the getting started guide with heroku and I hit a snag, cannot seem to access the remote database it connects but there is no database name. I have installed postgres sql 9.5 locally but attempting to push the local database I created fails also and when i run heroku pg:info it never responds.
I am going through the documentation but there is a lot of it, so hopefully some psql wizard will see this and go, oh this is what he is doing wrong and let me know.
It's likely that you have not "Created" the database. rake db:create - This needs to be done on Heroku's servers and your local machine.
Not quite correct,I am not using ruby, one major caveat I did not notice initially is that I was not in the bash shell which might have been part of my problem, what i wound up doing was connecting to the postgresql remote instance from my local install using pgadmin and creating the table manually from there. I had to get the connection info which I obtained by using heroku pg:credentials DATABASE which gave me the info I needed to add the server in pgadmin, you do need to check ssl for that within the tool, and it helps to add the database name to restricted so you see only your database, not the whole 10 gazillion they have in production :) I hope this helps anyone else that has the same problem.
Thanks

Heroku shared database not resetting

Trying to reset my Rails app's shared database on Heroku.
Doing the following appears to work.
heroku pg:reset SHARED_DATABASE --confirm rabid-raccoon-2000
I get: Resetting SHARED_DATABASE (DATABASE_URL)... done
And running heroku run rake db:migrate after that appears to work as well. But when I run heroku run console, or try to use the app, it does not reflect the changes (it still uses an ancient db schema- even right after I reset it).
I've tried this with both the free 5mb free db, as well as with the $15 shared db, both to no avail. No idea what db it's working with.
My database.yml is checked into version control, but I don't see how that can be a problem.
Just deleted the app and started over. Explanations are welcome.
Just a thought... I followed the directions here to set up a beta postgresql database. The plus is that it gives me direct access to the database so I can change anything needed by my tables.
I then removed the generated .sql file with "git rm conf/evolutions/default/1.sql," committed and pushed to heroku. Happily, the app is now working!
This issue is very frustrating, especially since it mostly affects people using Heroku for the first time (w/ the shared database). It wasn't the database script since it worked just fine on the local dev database. Hope this helps you out for next time.

Resources