How to schedule PostgreSql procedure using Heroku scheduler? - heroku

I am trying to schedule PostgreSql procedure using Heroku scheduler. I tried heroku pg:psql -c "call procedure_name();" --app app-name but gets the error from scheduler "bash: heroku: command not found"

That error is telling you important information. The Heroku CLI is not present in your environment, so bash complains that heroku isn't a command that it recognizes.
If you want to run heroku commands from your application you'll need to include the cli buildpack when you build your application to make sure it's properly bundled. Once you've included the buildpack and triggered a new build, this should work.

Related

"heroku run" gives error "CERT_HAS_EXPIRED: certificate has expired"

I get this error trying to run commands on Heroku:
$ heroku run pwd -r heroku
Running pwd on ⬢ my-app-name... !
▸ CERT_HAS_EXPIRED: certificate has expired
I also get this error attempting to open a console with heroku run rails console.
Any ideas? It did not help to update the CLI, or to log out from the CLI and back in.
Seems Heroku have an ongoing incident related to this: https://status.heroku.com/incidents/1236
Presumably they will fix it.
I am also getting CERT_HAS_EXPIRED: certificate has expired on running heroku run rails console
I tried with following lines, now its fixed.
heroku run:detached "heroku run rails c" -a app_name
heroku run rails c --app app_name
Now the issue https://status.heroku.com/incidents/1236 has been resolved.

`container:init` is not a heroku command

I have installed heroku with homebrew in my OSX El Capitan(10.11.5) and installed the heroku-container-tools with:
heroku plugins:install heroku-container-tools
The installation goes successfully:
Installing plugin heroku-container-tools... done
When I run a heroku version, I got this:
heroku-toolbelt/3.42.22 (universal.x86_64-darwin15) ruby/2.0.0
heroku-cli/5.2.20-9d094b0 (darwin-amd64) go1.6.2
=== Installed Plugins
heroku-container-tools#3.0.0
But when I run a heroku container:init I got this:
! `container:init` is not a heroku command.
! See `heroku help` for a list of available commands.
Running heroku help container I got this:
Usage: heroku container
Use Docker to build and deploy Heroku apps
Use Docker to build and deploy Heroku apps
Additional commands, type "heroku help COMMAND" for more details:
container:login # Logs in to the Heroku Docker registry
container:push [PROCESS] # Builds, then pushes a Docker image to deploy your Heroku app
I am following this heroku tutorial: https://devcenter.heroku.com/articles/local-development-with-docker
In the tutorial is said to run heroku container:init
This command was replaced but some other and heroku did not updated their documentation or I have some problem installing the plugin?
Yes, they restricted access to their container registry, just read the warning on top of the tutorial you're following https://devcenter.heroku.com/articles/local-development-with-docker
heroku container:release, which creates a Heroku-compatible slug and
deploys it to Heroku, has been deprecated. For access to our container
registry (available in private beta), please contact
docker-feedback#heroku.com
now there are only login and push commands. I hope you can easily ask for the access.

Reach heroku app terminal

I deployed an app onto heroku and wanted to check how can I connect to the deployed app in my terminal so I can do things like run migrations?
thanks in advance!
You can use the heroku command to create a one-off dyno to run arbitrary commands like bash or rake db:migrate.
For example heroku run bash -a my-app will run a bash shell on a one-off dyno.
Note that there is no way to directly connect to a running dyno on Heroku (e.g. via ssh); running the heroku run command will create a new temporary dyno that you can use to run commands using the deployed version of the code.

Running bash on heroku won't work

I am trying to run bash on heroku to test it out and it is failing
$ heroku run bash
▸ Error: No app specified
▸ Usage: heroku run --app APP
▸ We don't know which app to run this on.
▸ Run this command from inside an app folder or specify which app to use with --app APP
▸
▸ https://devcenter.heroku.com/articles/using-the-cli#app-commands
$ heroku run --app bash
▸ Usage: heroku run COMMAND
▸
▸ Example: heroku run bash
So, the example says heroku run bash will work but it doesn't. I have no dynos running. I feel I am missing something basic here...
Try run commands:
First you need to login, then you to see your apps and finally run bash
heroku login
Insert you user and password
heroku apps
=== user#gmail.com Apps
myaplication
then look at the list apps and write
heroku run bash --app myaplication
You could also do this:
get app name using;
heroku apps
then set heroku remote;
heroku git:remote -a yourappname
and finally run bash on/in your app
heroku run bash
I think you have two issues.
Firstly, you need to run bash within some app. You can either specify the app via the --app key as the help actually says or you can run this command inside the folder which has a heroku app initialized already. For connecting the folder to a heroku app - see this answer How to link a folder with an existing Heroku app.
Second, running a bash actually takes away one dyno from your app. So you need to have at least one dyno.
Try this command:
heroku pg:psql -a appname

Setting up Heroku for Neo4J

When I use the command heroku addons create:graphenedb --version v195. It gives error "No app specified , Run this command from an app folder or specify which app to use." I am new to Heroku and I do not understand which app folder it is talking about.
If you're not in your project folder or if it doesn't have a git remote to point it to Heroku you need to use the --app flag for the heroku command to specify the name of your app on Heroku

Resources