Heroku CLI
Umfassende Heroku CLI Befehle und Workflows für die Bereitstellung und Verwaltung von Anwendungen auf der Heroku-Plattform.
Installation & Authentication
| | Command | Description | |
| --- | --- |
| | heroku login
| Login to Heroku | |
| | heroku login -i
| Login interactively | |
| | heroku logout
| Logout from Heroku | |
| | heroku auth:whoami
| Show current user | |
| | heroku auth:token
| Display auth token | |
App Management
Basic App Operationen
| | Command | Description | |
| --- | --- |
| | heroku apps
| List all apps | |
| | heroku apps:create myapp
| Create new app | |
| | heroku apps:destroy myapp
| Delete app | |
| | heroku apps:info
| Show app info | |
| | heroku apps:rename newname
| Rename app | |
| | heroku apps:open
| Open app in browser | |
App Konfiguration
| | Command | Description | |
| --- | --- |
| | heroku config
| Show config vars | |
| | heroku config:set KEY=value
| Set config var | |
| | heroku config:unset KEY
| Remove config var | |
| | heroku config:get KEY
| Get specific config var | |
| | heroku buildpacks
| List buildpacks | |
| | heroku buildpacks:set heroku/nodejs
| Set buildpack | |
Bereitstellung
Git Bereitstellung
| | Command | Description | |
| --- | --- |
| | git push heroku main
| Deploy from main branch | |
| | git push heroku develop:main
| Deploy from develop branch | |
| | heroku git:remote -a myapp
| Add Heroku remote | |
| | heroku releases
| List releases | |
| | heroku releases:rollback v123
| Rollback to specific release | |
Containerverlegung
| | Command | Description | |
| --- | --- |
| | heroku container:login
| Login to container registry | |
| | heroku container:push web
| Build and push container | |
| | heroku container:release web
| Release container | |
| | heroku container:rm web
| Remove container | |
Dynos und Skalierung
Dyno Management
| | Command | Description | |
| --- | --- |
| | heroku ps
| List dynos | |
| | heroku ps:scale web=2
| Scale web dynos | |
| | heroku ps:scale worker=1
| Scale worker dynos | |
| | heroku ps:restart
| Restart all dynos | |
| | heroku ps:restart web.1
| Restart specific dyno | |
| | heroku ps:stop web.1
| Stop specific dyno | |
Dyno-Typen
| | Command | Description | |
| --- | --- |
| | heroku ps:type
| Show dyno types | |
| | heroku ps:resize web=standard-1x
| Resize dyno type | |
| | heroku ps:exec
| SSH into dyno | |
Add-ons
Add-on Management
| | Command | Description | |
| --- | --- |
| | heroku addons
| List app add-ons | |
| | heroku addons:create heroku-postgresql
| Add PostgreSQL | |
| | heroku addons:create heroku-redis
| Add Redis | |
| | heroku addons:destroy ADDON_NAME
| Remove add-on | |
| | heroku addons:upgrade ADDON_NAME:PLAN
| Upgrade add-on plan | |
| | heroku addons:downgrade ADDON_NAME:PLAN
| Downgrade add-on plan | |
Beliebte Add-ons
| | Command | Description | |
| --- | --- |
| | heroku addons:create sendgrid
| Add SendGrid email | |
| | heroku addons:create papertrail
| Add Papertrail logging | |
| | heroku addons:create newrelic
| Add New Relic monitoring | |
| | heroku addons:create scheduler
| Add Heroku Scheduler | |
Datenbanken
PostgreSQL
| | Command | Description | |
| --- | --- |
| | heroku pg
| List PostgreSQL databases | |
| | heroku pg:info
| Show database info | |
| | heroku pg:psql
| Connect to database | |
| | heroku pg:reset DATABASE_URL
| Reset database | |
| | heroku pg:backups
| List backups | |
| | heroku pg:backups:capture
| Create backup | |
| | heroku pg:backups:restore BACKUP_URL DATABASE_URL
| Restore backup | |
Datenbankwartung
| | Command | Description | |
| --- | --- |
| | heroku pg:maintenance
| Show maintenance info | |
| | heroku pg:maintenance:run
| Run maintenance | |
| | heroku pg:stats
| Show database stats | |
| | heroku pg:diagnose
| Diagnose database issues | |
Protokollierung und Überwachung
Logs
| | Command | Description | |
| --- | --- |
| | heroku logs
| Show recent logs | |
| | heroku logs --tail
| Stream logs | |
| | heroku logs --source app
| Show app logs only | |
| | heroku logs --dyno web.1
| Show specific dyno logs | |
| | heroku logs --num 1000
| Show more log lines | |
Überwachung
| | Command | Description | |
| --- | --- |
| | heroku ps:autoscale:enable
| Enable autoscaling | |
| | heroku ps:autoscale:disable
| Disable autoscaling | |
| | heroku metrics
| Show app metrics | |
Domains und SSL
Domain Management
| | Command | Description | |
| --- | --- |
| | heroku domains
| List domains | |
| | heroku domains:add example.com
| Add custom domain | |
| | heroku domains:remove example.com
| Remove domain | |
| | heroku domains:info example.com
| Show domain info | |
SSL Zertifikate
| | Command | Description | |
| --- | --- |
| | heroku certs
| List SSL certificates | |
| | heroku certs:add cert.pem key.pem
| Add SSL certificate | |
| | heroku certs:remove
| Remove SSL certificate | |
| | heroku certs:auto:enable
| Enable automatic SSL | |
| | heroku certs:auto:disable
| Disable automatic SSL | |
Pipelines und Review Apps
Pipeline Management
| | Command | Description | |
| --- | --- |
| | heroku pipelines
| List pipelines | |
| | heroku pipelines:create mypipeline
| Create pipeline | |
| | heroku pipelines:destroy mypipeline
| Delete pipeline | |
| | heroku pipelines:add mypipeline --stage staging
| Add app to pipeline | |
| | heroku pipelines:remove
| Remove app from pipeline | |
Promotionen
| | Command | Description | |
| --- | --- |
| | heroku pipelines:promote --remote staging
| Promote to production | |
| | heroku releases:rollback --remote production
| Rollback production | |
Bewertung Apps
| | Command | Description | |
| --- | --- |
| | heroku reviewapps:enable
| Enable review apps | |
| | heroku reviewapps:disable
| Disable review apps | |
Teams und Zusammenarbeit
Teammanagement
| | Command | Description | |
| --- | --- |
| | heroku teams
| List teams | |
| | heroku members
| List team members | |
| | heroku members:add user@example.com
| Add team member | |
| | heroku members:remove user@example.com
| Remove team member | |
Zugriffskontrolle
| | Command | Description | |
| --- | --- |
| | heroku access
| List app collaborators | |
| | heroku access:add user@example.com
| Add collaborator | |
| | heroku access:remove user@example.com
| Remove collaborator | |
CLI Plugins
Plugin Management
| | Command | Description | |
| --- | --- |
| | heroku plugins
| List installed plugins | |
| | heroku plugins:install PLUGIN_NAME
| Install plugin | |
| | heroku plugins:uninstall PLUGIN_NAME
| Uninstall plugin | |
| | heroku plugins:update
| Update all plugins | |
Beliebte Plugins
| | Command | Description | |
| --- | --- |
| | heroku plugins:install heroku-repo
| Install repo plugin | |
| | heroku repo:reset
| Reset git repository | |
| | heroku repo:purge_cache
| Purge build cache | |
Umweltmanagement
Mehrere Umgebungen
| | Command | Description | |
| --- | --- |
| | heroku git:remote -a myapp-staging -r staging
| Add staging remote | |
| | heroku git:remote -a myapp-production -r production
| Add production remote | |
| | git push staging main
| Deploy to staging | |
| | git push production main
| Deploy to production | |
Umweltvariablen
| | Command | Description | |
| --- | --- |
| | heroku config --remote staging
| Show staging config | |
| | heroku config:set NODE_ENV=production --remote production
| Set production config | |
Wartung und Fehlerbehebung
Wartungsmodus
| | Command | Description | |
| --- | --- |
| | heroku maintenance:on
| Enable maintenance mode | |
| | heroku maintenance:off
| Disable maintenance mode | |
| | heroku maintenance
| Check maintenance status | |
Fehlerbehebung
| | Command | Description | |
| --- | --- |
| | heroku run bash
| Run bash shell | |
| | heroku run rails console
| Run Rails console | |
| | heroku run python manage.py shell
| Run Django shell | |
| | heroku run node
| Run Node.js REPL | |
Leistung
| | Command | Description | |
| --- | --- |
| | heroku labs:enable preboot
| Enable preboot | |
| | heroku labs:disable preboot
| Disable preboot | |
| | heroku ps:wait
| Wait for dyno to be ready | |
Best Practices
Bereitstellung
- Use Pipelines: Aufbau von Staging- und Produktionsumgebungen
- ** Umgebungsvariablen*: Konfiguration in config vars speichern
- *Datenbasis Migrationen: Migrationen während des Einsatzes ausführen
- *Gesundheitschecks: Implementierung von Gesundheitscheck-Endpunkten
Sicherheit
- SSL: Verwenden Sie immer SSL für Produktionsapps
- *Umwelttrennung: Staging und Produktion getrennt halten
- Access Control: Zugriff auf die Mitarbeitergrenzen
- *Secrets Management: Verwenden Sie config vars für sensible Daten
Leistung
- Dyno Sizing: Wählen Sie entsprechende Dyno-Typen
- Caching: Umsetzung von Cache-Strategien
- ** Datenbankoptimierung*: Datenbankabfragen überwachen und optimieren
- CDN: Verwenden Sie CDN für statische Vermögenswerte
Überwachung
- Logging: Vollständige Protokollierung durchführen
- Metrics: Anwendungsmetriken überwachen
- *Alerts: Alarme für kritische Fragen einrichten
- *Error Tracking: Fehlerverfolgungsdienste nutzen