Skip to content

Commit

Permalink
[Feat]: ci-cd 테스트
Browse files Browse the repository at this point in the history
  • Loading branch information
bayy1216 committed May 31, 2024
1 parent 7d7602a commit e4edaca
Show file tree
Hide file tree
Showing 2 changed files with 79 additions and 16 deletions.
16 changes: 14 additions & 2 deletions .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,19 @@ jobs:
needs: ci # ci job이 성공적으로 끝나야 cd job이 실행됩니다.

# appleboy/ssh-action@master 액션을 사용하여 지정한 서버에 ssh로 접속하고, script를 실행합니다.
# script의 내용은 도커의 기존 프로세스들을 제거하고, docker repo로부터 방금 위에서 push한 내용을 pull 받아 실행하는 것입니다.
# script의 내용은 도커의 기존 프로세스들을 제거하고, docker repo로부터 방금 위에서 push한 내용을 pull 받아 실행하는 것입니다.
# 실행 시, docker-compose를 사용합니다.
steps:
- name: ✔️ send docker-compose.yml to EC2 server
uses: appleboy/scp-action@master
with:
username: ec2-user
host: ${{ secrets.HOST }}
key: ${{ secrets.KEY }}
port: 22
source: "./docker-compose.dev.yml"
target: "/home/ec2-user"

- name: Deploy to server
uses: appleboy/ssh-action@master
id: deploy
Expand All @@ -53,4 +63,6 @@ jobs:
docker rmi $(docker images -q) # 기존에 존재하는 도커 이미지들을 제거합니다.
docker image prune -f # 사용하지 않는 도커 이미지들을 제거합니다.
docker pull ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKER_REPOSITORY }}:${{ github.sha }}
docker run -d -p 80:8080 ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKER_REPOSITORY }}:${{ github.sha }}
# docker run -d -p 80:8080 ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKER_REPOSITORY }}:${{ github.sha }}
docker-compose -f /home/ec2-user/docker-compose.dev.yml up -d
79 changes: 65 additions & 14 deletions docker-compose.dev.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,65 @@
version: '3'
# 실행명령어
# docker-compose -f ./docker-compose.dev.yml up
services:
zzansuni-mysql:
image: mysql
restart: always
volumes:
- ./mysql-data:/var/lib/mysql
ports:
- "3306:3306"
environment:
MYSQL_DATABASE: zzansuni
MYSQL_ROOT_PASSWORD: root
https://kauth.kakao.com/oauth/authorize?client_id=c959f4526a0df321dff0a8636fec3428&redirect_uri=http://localhost:5173/login/kakao&response_type=code



https://kauth.kakao.com/oauth/token

{
"grant_type" : "authorization_code",
"client_id" : "c959f4526a0df321dff0a8636fec3428",
"client_secret" : "3VvjhxkuqYGAcC7Azk3ADOlUcbpynthH",
"redirect_uri" : "http://localhost:5173/kakao-login",
"code" : "YXqJN1z-sBbKoBttr31JlKyku0iU4xkTjWRH5KbOL2ZFWPqQKdL9wgAAAAQKKiVTAAABj8OkzCzMISgqRbFCUQ"
}



GitHub secret : ea9d92e0aeeb4190102879a56887df644bcbfcd9
client_Id: Ov23li1v7bWScQ4vJouK

https://nid.naver.com/oauth2.0/authorize?response_type=code&client_id=Ob2i2TZtIsaNqH8j_q9X&redirect_uri=http://localhost:5173/login/naver&state=mystate
Naver secret : bTrmROcpA_
client_id : Ob2i2TZtIsaNqH8j_q9X


https://openapi.naver.com/v1/nid/me



엑세스 : eyJhbGciOiJIUzI1NiJ9.eyJyb2xlIjoiVVNFUiIsImlzQWNjZXNzVG9rZW4iOnRydWUsInN1YiI6IjEiLCJleHAiOjE3MTcxMzg1MTEsImlzcyI6Inp6YW5zdW5pIn0.Zb77TXbbqGURLq7WQubzXtuTa_yM6LEoq_BKawb8HEE
리프래시 : eyJhbGciOiJIUzI1NiJ9.eyJyb2xlIjoiVVNFUiIsImlzQWNjZXNzVG9rZW4iOmZhbHNlLCJzdWIiOiIxIiwiZXhwIjoxNzE5NzI4NzExLCJpc3MiOiJ6emFuc3VuaSJ9.5b9VbCoHDVAji1bXsygzb9d257yJNHtnTQVTBr6TuG4


version: '3'
# 실행명령어
# docker-compose -f ./docker-compose.dev.yml up
services:
zzansuni-mysql:
image: mysql
restart: always
volumes:
- ./mysql-data:/var/lib/mysql
ports:
- "3306:3306"
environment:
MYSQL_DATABASE: zzansuni
MYSQL_ROOT_PASSWORD: root
zzanuni-spring:
image: ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKER_REPOSITORY }}:${{ github.sha }}
restart: always
ports:
- "80:8080"
depends_on:
- zzansuni-mysql
environment:
SPRING_PROFILES_ACTIVE: dev
JWT_SECRET: 4099a46b-39db-4860-a61b-2ae76ea24c43
KAKAO_CLIENT_ID: ${{ secrets.KAKAO_CLIENT_ID }}
KAKAO_CLIENT_SECRET: ${{ secrets.KAKAO_CLIENT_SECRET }}
KAKAO_REDIRECT_URI: ${{ secrets.KAKAO_REDIRECT_URI }}
NAVER_CLIENT_ID: ${{ secrets.NAVER_CLIENT_ID }}
NAVER_CLIENT_SECRET: ${{ secrets.NAVER_CLIENT_SECRET }}

0 comments on commit e4edaca

Please sign in to comment.