Github으로 레포지토리를 옮기고, Github Actions를 사용하기로 함
Gitlab(Webhook) => Jenkins => AWS EC2 (내부에서 Docker Image 생성 & Run)
장점)
1. Docker Hub에 의존하지 않아도 된다.
단점)
1. 복잡하다
2. 돈이 없다
- Github Action -
https://docs.github.com/en/actions/learn-github-actions/understanding-github-actions
Understanding GitHub Actions - GitHub Docs
GitHub Actions is a continuous integration and continuous delivery (CI/CD) platform that allows you to automate your build, test, and deployment pipeline. You can create workflows that build and test every pull request to your repository, or deploy merged
docs.github.com
- AWS S3 를 도커 레지스트리로 구축해서 사용하기 -
PYRASIS.COM: 이재홍의 언제나 최신 Docker - Unit 6. Docker 좀더 활용하기
저작권 안내 책 또는 웹사이트의 내용을 복제하여 다른 곳에 게시하는 것을 금지합니다.책 또는 웹사이트의 내용을 발췌, 요약하여 강의 자료, 발표 자료, 블로그 포스팅 등으로 만드는 것을 금
pyrasis.com
- Github Actions + AWS S3 + AWS Code Deploy + AWS EC2 -
https://dkswnkk.tistory.com/674
Spring Boot + GitHub Actions + AWS CodeDeploy를 활용한 CI/CD 구축
서론 지금까지 매번 프로젝트를 구축할 때마다 이전 코드들을 번거롭게 봐가면서 CI/CD를 구축했었는데, 이번 기회에 한번 문서화를 해보고자 글을 작성하게 되었습니다. [CI/CD] CI/CD란?, 지속적
dkswnkk.tistory.com
장점)
1. Docker Hub으로 간편하게 구축할 수 있다
2. (나에게는) 무료다
단점)
1. Public Repo ..
2. Docker Hub에 의존한다
Settings -> Secrets and variables -> Actions
DOCKERHUB_PASSWORD : 본인의 Docker Hub Username
DOCKERHUB_USERNAME : 본인의 Docker Hub Password
EC2_HOST : AWS EC2 인스턴스의 퍼블릭 IPv4 DNS
EC2_KEY : AWS EC2 인스턴스를 생성할 때 저장된 pem 키
EC2_PORT :
EC2_USERNAME : ubuntu
ENV_PATH : .env 파일 경로
SERVER_PORT : 해당 서버 돌아가는 포트
FROM openjdk:17
ARG IDLE_PROFILE
ARG JAR_FILE=build/libs/*.jar
ENV ENV_IDLE_PROFILE=$IDLE_PROFILE
COPY ${JAR_FILE} app.jar
RUN echo $ENV_IDLE_PROFILE
ENTRYPOINT ["java", "-Dspring.profiles.active=${ENV_IDLE_PROFILE}", "-jar","/app.jar"]
IDLE_PROFILE은 무중단 배포 시도하느랴 있음
1) 서로 다른 job간에 환경이 공유되지 않음을 간과하고, 코드를 작성하여 오류남
- ls 로 checkout 해온 code의 존재 여부를 확인했더니 없음 > 잘못 되었음을 깨달음
2) ssh: handshake failed: ssh: unable to authenticate, attempted methods [none publickey], no supported methods remain
[ 똑같은 에러 ]
https://github.com/marketplace/actions/ssh-remote-commands#if-you-are-using-openssh
SSH Remote Commands - GitHub Marketplace
Executing remote ssh commands
github.com
[해결 방안]
https://github.com/appleboy/ssh-action#setting-up-a-ssh-key
GitHub - appleboy/ssh-action: GitHub Actions for executing remote ssh commands.
GitHub Actions for executing remote ssh commands. Contribute to appleboy/ssh-action development by creating an account on GitHub.
github.com
// workflow 붙여넣기
[ 전체적인 로직 ]
https://chb2005.tistory.com/191
[CI/CD] Github Actions를 활용한 CI/CD 파이프라인 구축 (+ Docker hub)
Github Actions를 활용한 CI/CD 파이프라인 구축 개념 EC2 Instance 생성, EC2 Instance에 Docker 설치, Docker Hub 회원가입이 되어있다고 가정 Github Repository에 프로젝트의 추가사항이나 변경사항 push 혹은 merge Git
chb2005.tistory.com
[ IDLE_PROFILE / 무중단 배포 ]
Docker로 Spring 애플리케이션 배포하기
이전에 구축했던 무중단 배포 프로젝트에 Docker를 적용하려고한다. 최종적인 아키텍쳐 모습은 다음과 같다. Dockerfile과 배포 Script는 아래 저장소를 참고해주세요 GitHub - 92SooJong/Toy-Project-Board Contri
soojong.tistory.com
[5일의 기적 : 노하우 공유 커뮤니티] (2) ERD 설계 (0) | 2023.12.22 |
---|---|
[5일의 기적 : 노하우 공유 커뮤니티] (1) 기획 & 화면 설계 (0) | 2023.12.22 |
[One-pick] 서버 설정 (3) - NGINX : /api 는 8080포트로! (0) | 2023.09.24 |
[One-pick] 서버 설정(2) - SSL 설정 (0) | 2023.09.23 |
[One-pick] 서버 설정(1) - 가비아 도메인 구입 + DNS 레코드 추가 (0) | 2023.09.23 |