Heroku Cheatsheet
#
Heroku is a cloud platform that allows developers to build, run, and operate applications entirely in the cloud. The Heroku CLI is a command-line tool that helps manage and deploy applications on the Heroku platform. It provides a convenient way to interact with Heroku services directly from your terminal.
Authentication
#
Command/Option | Example | Description |
---|
heroku login | heroku login | Log in to your Heroku account |
heroku logout | heroku logout | Log out of your Heroku account |
Application Management
#
Command/Option | Example | Description |
---|
heroku create | heroku create my-app | Create a new Heroku application |
heroku apps | heroku apps | List all Heroku applications in your account |
heroku rename | heroku rename new-name | Rename a Heroku application |
heroku destroy | heroku destroy my-app | Delete a Heroku application |
Deployment
#
Command/Option | Example | Description |
---|
git push heroku master | git push heroku master | Deploy code to Heroku from the master branch |
heroku releases | heroku releases | List releases for a Heroku application |
heroku rollback | heroku rollback v123 | Roll back to a previous release |
Scaling
#
Command/Option | Example | Description |
---|
heroku ps:scale | heroku ps:scale web=2 | Scale the number of dynos for a process type |
heroku ps | heroku ps | List dynos for a Heroku application |
Logs
#
Command/Option | Example | Description |
---|
heroku logs | heroku logs --tail | Tail logs from a Heroku application |
heroku logs –source app | heroku logs --source app | View logs generated by the app |
Configuration
#
Command/Option | Example | Description |
---|
heroku config | heroku config | List all config vars for a Heroku application |
heroku config:set | heroku config:set KEY=value | Set a config var for a Heroku application |
heroku config:unset | heroku config:unset KEY | Unset a config var for a Heroku application |
Add-ons
#
Command/Option | Example | Description |
---|
heroku addons | heroku addons | List all add-ons for a Heroku application |
heroku addons:create | heroku addons:create heroku-postgresql:hobby-dev | Provision an add-on for a Heroku application |
heroku addons:destroy | heroku addons:destroy heroku-postgresql | Remove an add-on from a Heroku application |
Databases
#
Command/Option | Example | Description |
---|
heroku pg | heroku pg | List all databases for a Heroku application |
heroku pg:psql | heroku pg:psql | Open a psql shell to a Heroku Postgres database |
heroku pg:backups | heroku pg:backups | List database backups |
heroku pg:backups:capture | heroku pg:backups:capture | Capture a new backup for a database |
Miscellaneous
#
Command/Option | Example | Description |
---|
heroku run | heroku run bash | Run a one-off command in a Heroku dyno |
heroku maintenance:on | heroku maintenance:on | Enable maintenance mode for a Heroku application |
heroku maintenance:off | heroku maintenance:off | Disable maintenance mode for a Heroku application |
heroku open | heroku open | Open the Heroku application in a web browser |
heroku domains | heroku domains | List custom domains for a Heroku application |
heroku domains:add | heroku domains:add www.example.com | Add a custom domain to a Heroku application |
This cheatsheet covers the most commonly used Heroku CLI commands and options, helping you to manage applications, deploy code, scale dynos, view logs, configure settings, manage add-ons, and handle databases effectively.