오늘 CI/CD Architecture 그림을 Draw.io를 활용해서 작성했다
- API, DEV Branch에 개발 내용이 푸쉬가 필요
- 해당 레포지를 나의 레포지로 Fork 진행
- 레포지 Clone 진행 및 Docker Image Build (버전 관리 파일인 Requirements.txt → Api Requirements로 진행 / Issue 가능성 있음)
- 생성된 Image를 GCR에 Push
- VM Instance 생성 및 GCR의 이미지 VM에 Push
- Github Action에 필요한 Key 값들 GCP에서 가져와야 함
- 추가적으로, Slack Webhook Key 역시 필요
- 모든 Keys가 깃헙 레포지에 추가된다면, dev 브랜치에 푸쉬하여 깃헙 액션이 잘 작동하는 확인
- Action 진행 현황 파악 및 배포 완료 시 성공
- Backend
- Frontend
FROM python:3.8.5-slim-buster
RUN mkdir steamrec
COPY start.sh /steamrec/start.sh
COPY /backend /steamrec/backend
COPY /frontend /steamrec/frontend
COPY requirements.txt /steamrec/requirements.txt
RUN pip install --upgrade pip \
&& pip install -r /steamrec/requirements.txt
WORKDIR /steamrec
EXPOSE 8001
CMD ["sh", "start.sh"]
# Python 버전 관리 및 gcloud CLI 설정
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
- uses: google-github-actions/setup-gcloud@v0
with:
version: '318.0.0'
service_account_key: ${{ secrets.SERVICE_ACCOUNT_KEY }}
project_id: ${{ secrets.GCP_PROJECT_ID }}
The startup agent encountered errors. Your container was not started. To inspect the agent's logs use 'sudo journalctl -u konlet-startup' command.
문제 정의: Container 작동 X
원인1 : 애초에 이미지를 빌드하고 컨테이너를 구동했어야 했는데, 당연히 될 거란 생각에 넘어간 게 큰 착오였음.
원인2 : 애초에 이미지를 빌드하고 컨테이너를 구동했어야 했는데, 당연히 될 거란 생각에 넘어간 게 큰 착오였음.
해결방법 : 컨테이너 상에서 어디서 오류가 났는지, 실행을 하고 에러코드확인 및 도커파일 수정