Heroku

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/OptionExampleDescription
heroku loginheroku loginLog in to your Heroku account
heroku logoutheroku logoutLog out of your Heroku account

Application Management #

Command/OptionExampleDescription
heroku createheroku create my-appCreate a new Heroku application
heroku appsheroku appsList all Heroku applications in your account
heroku renameheroku rename new-nameRename a Heroku application
heroku destroyheroku destroy my-appDelete a Heroku application

Deployment #

Command/OptionExampleDescription
git push heroku mastergit push heroku masterDeploy code to Heroku from the master branch
heroku releasesheroku releasesList releases for a Heroku application
heroku rollbackheroku rollback v123Roll back to a previous release

Scaling #

Command/OptionExampleDescription
heroku ps:scaleheroku ps:scale web=2Scale the number of dynos for a process type
heroku psheroku psList dynos for a Heroku application

Logs #

Command/OptionExampleDescription
heroku logsheroku logs --tailTail logs from a Heroku application
heroku logs –source appheroku logs --source appView logs generated by the app

Configuration #

Command/OptionExampleDescription
heroku configheroku configList all config vars for a Heroku application
heroku config:setheroku config:set KEY=valueSet a config var for a Heroku application
heroku config:unsetheroku config:unset KEYUnset a config var for a Heroku application

Add-ons #

Command/OptionExampleDescription
heroku addonsheroku addonsList all add-ons for a Heroku application
heroku addons:createheroku addons:create heroku-postgresql:hobby-devProvision an add-on for a Heroku application
heroku addons:destroyheroku addons:destroy heroku-postgresqlRemove an add-on from a Heroku application

Databases #

Command/OptionExampleDescription
heroku pgheroku pgList all databases for a Heroku application
heroku pg:psqlheroku pg:psqlOpen a psql shell to a Heroku Postgres database
heroku pg:backupsheroku pg:backupsList database backups
heroku pg:backups:captureheroku pg:backups:captureCapture a new backup for a database

Miscellaneous #

Command/OptionExampleDescription
heroku runheroku run bashRun a one-off command in a Heroku dyno
heroku maintenance:onheroku maintenance:onEnable maintenance mode for a Heroku application
heroku maintenance:offheroku maintenance:offDisable maintenance mode for a Heroku application
heroku openheroku openOpen the Heroku application in a web browser
heroku domainsheroku domainsList custom domains for a Heroku application
heroku domains:addheroku domains:add www.example.comAdd 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.

Heroku

Explore our comprehensive cheatsheets to enhance your knowledge and efficiency. Each cheatsheet provides detailed command options, examples, and descriptions to help you master various tools and technologies.