Heroku Kafka certificates - heroku

According to the documentation, Heroku passes KAFKA_TRUSTED_CERT, KAFKA_CLIENT_CERT and KAFKA_CLIENT_CERT_KEY directly into my heroku applications. In consequence, only applications running on heroku can access Heroku Kafka? I would like to access it directly from my home workstation but i dont know how to get the ENVs

You can run either heroku config --app your_application_name to get all variables, or run heroku config:get KAFKA_TRUSTED_CERT --app your_application_name to just get one specific variable.
You can also login to Heroku dashboard and find all variables there in "Settings" section of your app.

Related

How to access Heroku app console by heroku CLI

I can check logs by heroku logs --app=my_app_name . I want to access app's console as shown in the picture. How can I access by heroku cli?
To access Heroku app bash by CLI:-
heroku login
heroku ps:exec --app=scoreboard-backend-dev
scoreboard-backend-dev is the app name

Error: Missing required flag: -a, --app APP app to run command against

I am new to Heroku and I keep getting the above error - everything looks good to go when I deploy in heroku, connect to my github repo etc.. but I keep getting this error.
Its a node/express app and works exactly as I'd like locally but it won't deploy. Any help would be appreciated.
For getting logs of particular heroku app, use:
heroku logs --app=app_name
For example: your app name is 'chatapp'
heroku logs -app=chatapp
just run the command with the --app flag, followed by the app name.
I like how the --app flag is "mandatory" according to the official documentation, but the lone usage example in the official documentation doesn't use the --app flag.
Anyway, it's not really mandatory. It's just implicit, usually. You have to tell Heroku which app you're using, with something like:
$ heroku git:remote -a your_app_name
and then it stops wondering which app to run these commands on.
you did not set git remote to your application, do that first by,
heroku git:remote -a your_app_name
To expand a little further on this (just for the benefit of other new users encountering a similar issue) - below is an example of a command you could enter in macOS Terminal:
heroku logs --tail --app yourexampleservername
If you have deployed yourexampleservername to Heroku, this should then display a log.

How to back up Heroku pg database from app itself?

From a remote shell, using the Heroku toolbelt, it's pretty easy to trigger a db backup with:
heroku pg:backups:capture --app my-app
But how can I do that from a script running on the app itself? Something triggered from the heroku scheduler or manually like:
heroku run node myScript.js --app my-app
I have psql available so maybe that's an option although I don't know where to write to.
I don't see a way to do this via API here: https://devcenter.heroku.com/articles/platform-api-reference

Multiple apps in git remotes when trying to access rails console

I have two git branches, staging and production, and I deployed them on Heroku in the same Heroku acccount. Suppose my app names are app1.heroku-app.com and app2.heroku-app.com and the remote names are heroku-staging and heroku-production,respectively. I deployed both apps on Heroku. After I login to Heroku from the console using heroku login and then try to access a Rails console using heroku run rails c, I get this message :
▸ multiple apps in git remotes
▸ remotes: heroku-staging heroku-production
How can I access a console?
If there's only one Heroku remote, heroku can infer which you want. When there are multiple (or if you want to access an application that doesn't have a remote in this Git repo, or when you're not in a Git repo at all), you need to use the --app option to specify which application you want a console on.
$ heroku --help
Usage: heroku COMMAND [--app APP] [command-specific-options]
$ heroku run rails c --app app1
$ heroku run rails c --app app2
In addition to being able to specify the app as a per-command flag, if you'd like for there to be a default environment, setting the environment variable HEROKU_APP to the app you want will make it so that heroku commands don't rely on git config.
$ heroku logs
› Error: Multiple apps in git remotes
...
$ export HEROKU_APP=app1
$ heroku logs
2018-12-31T03:56:34.888350+00:00 app[web.1]: 1.2.3.4 ...

How can I deploy to a specific app with heroku docker:release?

Using the heroku docker:release command, how can I specify which app to release to? I can't see from any documentation whether there's any switch for this purpose.
Heroku commands take their context from the directory you are in when you run them.
Go into the directory from where you did heroku create then run heroku docker:release.
If you haven't used heroku create, then you can specify the app name with the --app <APP NAME> command line parameter. for instance, if you were to release to the app named f00 you would type:
heroku docker:release --app f00

Resources