DEV Community

Lam
Lam

Posted on

2 2

Heroku Cheat Sheet

References

[Other tricks] htpasswd (for PHP apps)

Create an .htaccess file in the webroot:

AuthUserFile /app/www/.htpasswd
AuthType Basic
AuthName "Restricted Access"
Require valid-user
Enter fullscreen mode Exit fullscreen mode

Create a .htpasswd file:

$ htpasswd -c .htpasswd [username]
Enter fullscreen mode Exit fullscreen mode

See: gist.github.com

[Domains] Wildcard domains

heroku addons:add wildcard_domains
Enter fullscreen mode Exit fullscreen mode
*.yourdomain.com => heroku.com
Enter fullscreen mode Exit fullscreen mode

[Domains] domains - Custom domains

Add both!

heroku domains:add example.com
heroku domains:add www.example.com
Enter fullscreen mode Exit fullscreen mode

Removing

heroku domains:clear
heroku domains:remove example.com
Enter fullscreen mode Exit fullscreen mode

See: Custom domains (devcenter.heroku.com)

[Processes] run - Running tasks

heroku run bash
heroku run console                  # Rails console
heroku run rake assets:precompile
Enter fullscreen mode Exit fullscreen mode

[Processes] restart

heroku restart
Enter fullscreen mode Exit fullscreen mode

[Processes] ps - Managing processes

heroku ps              # list
heroku ps:scale web=1  # spawn more dynos
Enter fullscreen mode Exit fullscreen mode

Processes

maintenance

heroku maintenance:on
Enter fullscreen mode Exit fullscreen mode
heroku maintenance:off
Enter fullscreen mode Exit fullscreen mode

apps - Applications

heroku apps                  # list
heroku apps:create [NAME]
heroku apps:destroy --app APP
heroku apps:info
heroku apps:open             # open in browser
heroku apps:rename NEWNAME
Enter fullscreen mode Exit fullscreen mode

Image of Datadog

Create and maintain end-to-end frontend tests

Learn best practices on creating frontend tests, testing on-premise apps, integrating tests into your CI/CD pipeline, and using Datadog’s testing tunnel.

Download The Guide

Top comments (0)

Postmark Image

Speedy emails, satisfied customers

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay