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
Related
How can I turn off Postgres database addon on a Heroku app? I have looked in various questions on SO and also visited Heroku documentation but was unable to find any help related to this.
You can reset the database, destroy the database or remove the addon on heroku, but then you lose all your data. Unless you made a backup.
When I create an app in Heroku and add a database (PostgreSQL) to it, is there a way to add a web interface for that database (such as phpPgAdmin)?
I'm no expert, but I think you can't have this functionality. Have a look at the monitoring section; in case you want to get some logs. Furthermore it's worth checking Heroku Postgres add-on section. There you can find details about different plans e.g. they include different features.
However, there is a way to connect to Postgres database on Heroku using pgAdmin [not web interface] as answered in this SO Question and this DBA Stackexchange.
Hope this helps until some extend.
If you do not mind running the web interface locally, you can use phppgadmin to manage the Heroku postgreSQL db.
This is easily done by spinning a docker container.
docker pull dockage/phppgadmin
docker run --name=phppgadmin-heroku -d --publish=81:80 -e PHP_PG_ADMIN_SERVER_HOST=<your_db_url_from_heroku> -e PHP_PG_ADMIN_SERVER_DEFAULT_DB=<your_db_name_from_heroku> -e PHP_PG_ADMIN_OWNED_ONLY=true dockage/phppgadmin:latest
This will run the phppgadmin on http://localhost:81. Of course, the same container could be deployed on Heroku, if a local deployment is not enough for your needs.
I successfully pushed my Sinatra-powered Ruby app to Heroku.
One of the files I pushed is a Ruby script which scrapes the web and puts data into a PostgreSQL database (that's the non-Sinatra one).
I set up a PostgreSQL add-on for the Heroku app, but I haven't gotten further than that.
What I'm trying to figure out is how I'd edit the scraping script (which uses the Sequel gem) to add the data it scrapes to the Heroku PostgreSQL add-on database.
I took a look this tutorial on it, but I got stuck on the first step. I'm afraid I don't understand the command prompt syntax they listed.
Furthermore, when I tried to follow their alternate instructions using PGAdmin III, I ran into another problem. The Heroku tutorial says:
As an alternative, you can also create an a dump file using the PGAdmin GUI tool. To do so, select a database from the Object Browser and click Tools > Backup. Set the filename to data.dump, use the “COMPRESS” format, and (under “Dump Options #1”) choose not to save Privilege or Tablespace.
The problem here is I see no "COMPRESS" format in PGAdmin. Instead, I just save the file "data.dump" as an "All files" type without any formatting.
I'm not sure if this is correct, and if it is, what exactly I need to do next.
Can anyone confirm that I'm on the right path, and if so, what specifically I must do next?
EDIT: For clarification, I'm trying to get my scraping script to add its scraping data to the Heroku app's PostgreSQL database. Right now, it's still written as if it were on my local machine, scraping to my local PostgreSQL database.
It looks like you can run
heroku pg:credentials DATABASE --app your-app-name
where "DATABASE" is literally the word "DATABASE". Once you have the credentials, configure your script to access that database.
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.
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.