콘텐츠로 이동

Heroku 클립

Heroku CLI는 Heroku 플랫폼에서 애플리케이션 배포 및 관리를위한 워크플로우를 명령합니다.

설치 및 인증

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

앱 관리

Basic App 운영

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

앱 구성

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

계정 만들기

Git 배포

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

컨테이너 배포

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와 확장

Dyno 관리

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 유형

Command Description
heroku ps:type Show dyno types
heroku ps:resize web=standard-1x Resize dyno type
heroku ps:exec SSH into dyno

더 알아보기

추가 관리

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

인기 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

Database 운영

프로젝트

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

데이터베이스 유지

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

로깅 및 모니터링

로그인

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

관련 기사

Command Description
heroku ps:autoscale:enable Enable autoscaling
heroku ps:autoscale:disable Disable autoscaling
heroku metrics Show app metrics

도메인 및 SSL

도메인 관리

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 인증서

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 및 리뷰 앱

Pipeline 관리

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

회사 소개

Command Description
heroku pipelines:promote --remote staging Promote to production
heroku releases:rollback --remote production Rollback production

리뷰 앱

Command Description
heroku reviewapps:enable Enable review apps
heroku reviewapps:disable Disable review apps

팀 및 협업

팀 관리

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

오시는 길

Command Description
heroku access List app collaborators
heroku access:add user@example.com Add collaborator
heroku access:remove user@example.com Remove collaborator

제품정보 플러그인

플러그인 관리

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

인기 플러그인

Command Description
heroku plugins:install heroku-repo Install repo plugin
heroku repo:reset Reset git repository
heroku repo:purge_cache Purge build cache

환경 관리

다수 환경

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

환경 변수

Command Description
heroku config --remote staging Show staging config
heroku config:set NODE_ENV=production --remote production Set production config

정비 및 문제 해결

정비 형태

Command Description
heroku maintenance:on Enable maintenance mode
heroku maintenance:off Disable maintenance mode
heroku maintenance Check maintenance status

문제 해결

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

- 연혁

Command Description
heroku labs:enable preboot Enable preboot
heroku labs:disable preboot Disable preboot
heroku ps:wait Wait for dyno to be ready

최고의 연습

계정 만들기

  1. ** 파이프 사용 ** : staging 및 생산 환경 설정
  2. ** 환경 변수 **: config vars에 있는 상점 윤곽
  3. **Database 마이그레이션 **: 배포 중 마이그레이션
  4. 명세 Health Check: 건강 점검 종료

계정 관리

  1. SSL: 항상 생산 앱에 SSL을 사용
  2. ** 환경 분리 **: 분리되는 staging와 생산
  3. **액세스 컨트롤 **: Limit collaborator 접속
  4. 명세 ** Secrets 관리 **: 민감한 데이터에 대한 config vars 사용

- 연혁

  1. **Dyno Sizing **: 적절한 dyno 유형 선택
  2. Caching: 캐싱 전략 구현
  3. **Database 최적화 **: 데이터베이스 쿼리를 모니터링하고 최적화
  4. CDN: 정적 자산을 위한 CDN 사용

관련 기사

  1. Logging: 종합 로깅 구현
  2. Metrics: 모니터 애플리케이션 메트릭
  3. Alerts: 중요한 문제에 대한 경고 설정
  4. 명세 Error Tracking: 오류 추적 서비스 사용