CI/CD NodeJS + CircleCi + Heroku 배포
8299 단어 node
CircleCi와 지속적 제공/지속적 배포에 대해 논의해 봅시다.
또 다른 CircleCi 대안인 my 를 확인하십시오. _
🎯 전제 조건
NodeJ 및 익스프레스 지식
Heroku 계정
CircleCi 계정
Heroku를 배포하기 위해 매우 간단한 앱을 만들어 보겠습니다.
서버를 생성하자
package.json 및 .env 파일을 편집해 보겠습니다.
이제 우리는 서버를 시작합니다

이 섹션 2에서는 Heroku CLI를 사용하여 Heroku에 배포합니다.
헤로쿠에 로그인
Heroku 앱 만들기

이 단계에서 코드를 Github에 푸시하겠습니다.
git init && git add . && git commit -m "Initial commit" && git branch -M main && git remote add origin https://github.com/drsimplegraffiti/cicd-heroku-circleci.git && git push -u origin main
다음으로 heroku를 apploid 앱에 연결합니다.

Heroku 환경 변수에 포트를 추가해 봅시다.

Heroku에 배포할 수 있습니다.

브라우저에서 앱 열기
결과:
이 섹션에서는 github로 서클을 설정해 보겠습니다. circleci으로 이동하여
Github
로 로그인
CircleCI에서 앱을 설정하고 연결해 봅시다.
프로젝트 설정 버튼 클릭

배포 방법 선택

Heroku로 배포 선택

circleci에서 환경 구성 설정


클릭하고 실행
구성 파일을 복사하고
yml
파일에서 일부 편집을 수행하겠습니다.
config.yml 파일 설정

이제 커밋을 클릭하고 실행하십시오. 빌드가 성공했는지 확인합니다.

배포라는 다른 라우터를 추가해 보겠습니다.

실행하지 않았다는 점에 유의하십시오
git push heroku main
. 우리의 deploy endpoint
가 활성화되어 있는지 봅시다. 브라우저를 열고 다음을 입력하십시오.https://apploid.herokuapp.com/deploy
실패한 빌드 디버깅
사소한 문제를 디버깅하는 방법을 보여주기 위해 이 빌드를 일부러 실패하도록 만들었습니다. 자세한 내용을 보려면 실패 버튼을 클릭하십시오.

CircleCi 환경 변수에 Heroku api 키와 heroku 앱 이름을 추가하지 않기 전에 이런 일이 발생했습니다. 지금 바로 해 보겠습니다. Heroku의 계정 설정으로 이동하여 키를 복사하고 CircleCi의 env 변수에 붙여넣습니다.

프로젝트 설정에서 CircleCi로 이동하여 환경을 추가하십시오.

github에 리푸시하자
이제 heroku에 반영된 배포된 URL로 브라우저를 엽니다.
결론
도움이 되었기를 바랍니다. 아래 섹션의 의견
Reference
이 문제에 관하여(CI/CD NodeJS + CircleCi + Heroku 배포), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://dev.to/drsimplegraffiti/cicd-nodejs-circleci-heroku-deployement-3b79텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념
(Collection and Share based on the CC Protocol.)