Cannot schedule backup on Heroku? - heroku

I try to schedule a backup on Heroku Postgres but got an error:
heroku pg:backups:schedule DATABASE_URL --at '15:30 Asia/Tokyo'
got
▸ Invalid schedule format: expected --at '[HOUR]:00 [TIMEZONE]'

As the error shows, can only schedule on the hour:
heroku pg:backups:schedule DATABASE_URL --at '16:00 Asia/Tokyo'
will schedule at 4 pm in Tokyo.

Related

Deployment in heroku stopped working today

We are uploading an regularly with heroku-cli, but since today we receive the following error. Any ideas?
$$$ heroku war:deploy target/application.war --app appname
Uploading application.war
java -Dheroku.appName=appname -Xmx1g -Dheroku.warFile=target/application.war -jar /Users/bermeier0/.local/share/heroku/node_modules/#heroku-cli/plugin-java/lib/heroku-deploy-complete.jar
! ERROR: Server returned HTTP response code: 501 for URL: http://central.maven.org/maven2/com/heroku/webapp-runner/9.0.30.0/webapp-runner-9.0.30.0.jar
java.io.IOException: Server returned HTTP response code: 501 for URL: http://central.maven.org/maven2/com/heroku/webapp-runner/9.0.30.0/webapp-runner-9.0.30.0.jar
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1894)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1492)
at java.net.URL.openStream(URL.java:1045)
at org.apache.commons.io.FileUtils.copyURLToFile(FileUtils.java:1456)
at com.heroku.sdk.deploy.DeployWar.<init>(DeployWar.java:29)
at com.heroku.sdk.deploy.DeployWar$1.apply(DeployWar.java:87)
at com.heroku.sdk.deploy.DeployWar$1.apply(DeployWar.java:84)
at com.heroku.sdk.deploy.utils.Main.deploy(Main.java:53)
at com.heroku.sdk.deploy.DeployWar.deploy(DeployWar.java:84)
at com.heroku.sdk.deploy.DeployWar.main(DeployWar.java:94)
▸ There was a problem deploying to appname.
▸ Make sure you have permission to deploy by running: heroku apps:info -a appname
Problem seems to be that maven central repository switched to https, see this post
Heroku released a fix for this issue. Just run
heroku update

Heroku postgres: How to fork pg database with rollback to recover lost data

I deleted 3 rows accidentally from our production database (Heroku postgres). I followed this guide from Heroku on creating a rolled-back fork: https://devcenter.heroku.com/articles/heroku-postgres-rollback
My production DB is called HEROKU_POSTGRESQL_IVORY and is on plan Standard-0.
I have tried multiple combinations of the command that they suggest:
$ heroku addons:create heroku-postgresql:standard-0 --rollback
HEROKU_POSTGRESQL_IVORY --TO '2018-11-22 13:13+00' --APP my_app
$ heroku addons:create heroku-postgresql:standard-0 --rollback
HEROKU_POSTGRESQL_IVORY --TO '2018-11-22 13:13+00:00' --APP my_app
$ heroku addons:create heroku-postgresql:standard-0 --rollback
HEROKU_POSTGRESQL_IVORY --BY '0 days 1 hours 0 minutes' --APP my_app
All three of which have created a DB that wasn't rolled back. When I run heroku pg:info -a my_app, I can see the newly created DB, but the rollback version it gives is never from the desired time, and the rows that I deleted are not present:
Plan: Standard 0
Status: Available
Data Size: 52.4 MB
Tables: 34
PG Version: 10.6
Connections: 8/120
Connection Pooling: Available
Credentials: 2
Fork/Follow: Available
Rollback: earliest from 2018-11-22 14:17 UTC
Created: 2018-11-22 14:10 UTC
Region: eu
Data Encryption: In Use
Continuous Protection: On
Forked From: HEROKU_POSTGRESQL_IVORY
Maintenance: not required
Maintenance window: Wednesdays 21:00 to Thursdays 01:00 UTC
Add-on: postgresql-deep-1111
I realised soon after posting:
Make sure you use flags in lower case:
--to as opposed to --TO
--by as opposed to --BY

postgres error role and db doesnt exist after downloading OSX Mavericks

I restarted my computer recently and after trying to start my db locally with rails s I got the following:
/Users/example_name/.rvm/gems/ruby-1.9.3-p374/gems/activerecord-3.2.11/lib/active_record/connection_adapters/postgresql_adapter.rb:1208:in
`initialize': could not connect to server:
No such file or directory (PGError)
Then I tried to manually start the db by writing:
pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
And then it said server starting So I retyped rails s and then I recieved the error:
FATAL: role example_name doesn't exist
Which was a strange error I never got before so I tried to create the role again and after running rails s again I then got:
FATAL: database "example_db" does not exist (PGError)
I don't think I did anything to drop the db so I'm unsure what exactly is going on.
I did rake db:create:all and bundle exec rake db:migrate and now it works but the DB is empty! how did this happen? this isn't going to empty my production db if I deploy will it?

heroku pg:psql not working

I tried to connect to the Postgres database for my app on heroku by running the command "heroku pg:psql" and got the following error message:
psql: could not connect to server: Connection timed out (0x0000274C/10060)
Is the server running on host "URL.com"(IP address) and accepting
TCP/IP connections on port 5432?
I also tried to connect using Pgadmin and get the error:
Server doesn't listen. Is the server running on host "URL.com" (IP address) and accepting
TCP/IP connections on port 5432?
Can anyone tell me how to fix these errors and correctly connect to my database.
Thanks in advance!
Try this:
heroku pg:psql DATABASE_URL
As started to hint already using DATABASE_URL there are few more things to consider.
If you have multiple apps in Heroku it is always good to specify to what app you want to connect to where DB is added. Same applies if you have multiple databases to specify DB name (if it is something else than default DATABASE_URL).
Some examples how to connect:
-- Defining to what DB and app you want to connect to:
heroku pg:psql [lower case generated name] -a myapp
heroku pg:psql [lower case generated name] --app myapp
heroku pg:psql HEROKU_POSTGRESQL_[upper case generated name]_URL -a myapp
-- This will fall back to default DATABASE_URL part of your app:
heroku pg:psql -a myapp
Also to keep in mind as said here https://devcenter.heroku.com/articles/heroku-local#copy-heroku-config-vars-to-your-local-env-file:
Keep in mind that your deployed production app may be connecting to
different services than your local development app. For example, your
deployed production app might have a DATABASE_URL config var that
references a Heroku Postgres database, but your local app might have a
DATABASE_URL variable in the .env file that references your local
installation of Postgres.
Heroku guideline – https://devcenter.heroku.com/articles/heroku-postgresql#pg-psql (but it explains little about multi-database and multi-apps cases).
Heroku guideline for connecting externally - https://devcenter.heroku.com/articles/connecting-to-heroku-postgres-databases-from-outside-of-heroku
This answer might be silly, but it happened to me before. The internet connection I was in is blocking the connection on that port.

How fix number of connection for heroku staging DataBase

I'm using heroku to deploy my Rails 2.3.6 application.I'm using production Database backup for my staging server.But when i using this command for restart heroku.
heroku restart --app gentle-gorge-9319
after restart heroku when i reresh application home page i have this message in heroku logs
remaining connection slots are reserved for non-replication
superuser connections + heroku staging error
How i can increase connection pool for staging server.
Any help will be more appreciated...
Thanks

Resources