Heroku is a web hosting platform supporting many languages, and this guide is a reference to Heroku’s command-line interface.
access
- Collaborationaccess
- Collaborationheroku access # List
heroku access:add me@xy.com
heroku access:remove me@xy.com
heroku apps:transfer new@owner.com
logs
- Show logslogs
- Show logsheroku logs
heroku logs -t # --tail (stream)
heroku logs -s app # --source (only on app logs)
pg
- PostgreSQLpg
- PostgreSQLheroku addons:add heroku-postgresql
heroku addons:add pgbackups:auto-month
See: Heroku PostgreSQL (devcenter.heroku.com)
config
- Environment var configurationconfig
- Environment var configurationheroku config # List
heroku config -s # List in shell format
heroku config:get KEY
heroku config:set KEY=val
heroku config:set KEY1=val KEY2=val ...
heroku config:unset KEY1
apps
- Applicationsapps
- Applicationsheroku apps # list
heroku apps:create [NAME]
heroku apps:destroy --app APP
heroku apps:info
heroku apps:open # open in browser
heroku apps:rename NEWNAME
ps
- Managing processesps
- Managing processesheroku ps # list
heroku ps:scale web=1 # spawn more dynos
run
- Running tasksrun
- Running tasksheroku run bash
heroku run console # Rails console
heroku run rake assets:precompile
domains
- Custom domainsdomains
- Custom domainsheroku domains:add example.com
heroku domains:add www.example.com
heroku domains:clear
heroku domains:remove example.com
See: Custom domains (devcenter.heroku.com)
Create an .htaccess
file in the webroot:
AuthUserFile /app/www/.htpasswd
AuthType Basic
AuthName "Restricted Access"
Require valid-user
Create a .htpasswd
file:
$ htpasswd -c .htpasswd [username]
See: gist.github.com