-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: deploy.sh > 헬스체크 API를 actuator로 변경 * chore: /greeting api 제거 * chore: Dockerfile-prod, dev > Dockerfile로 통일 * chore: aws-cicd-prod.yml에서 빌드하는 Dockerfile 이름 변경 * chore: develop blue-green 배포 테스트 * chore: aws-cicd.yml > deploy_target 변경 * chore: aws-cicd.yml > ec2 인스턴스 동적으로 변경 * fix: set-env에서 스크립트 오타 수정 * chore: 인스턴스 값 확인 * chore: 인스턴스 값 확인 * chore: 인스턴스 값 확인 * chore: 인스턴스 값 확인 * chore: 호스트 IP 값 확인 * chore: setup 호스트 아이피 설정 부분 변경 * chore: setup 호스트 아이피 설정 부분 변경 * chore: setup 호스트 아이피 설정 부분 변경 * chore: 값 주입 테스트 * chore: 값 주입 테스트 * chore: 값 주입 방식 변경 * chore: cicd.yml prod, dev 분리 * chore: cicd.yml 오타 수정 * chore: dev > docker-compose 파일 수정 * chore: aws-cicd-dev.yml > build-args 추가 * chore: aws-cicd-dev.yml > build-args 부분 dev로 변경 * chore: layer-batch 실행 환경 dev, prod로 변경 * chore: layer-batch > application-dev.yml DB user 부분 수정 * chore: prod yml 수정, debug 부분 삭제 * chore: prod 배포 테스트 * chore: prod 배포 테스트 * chore prod cicd > setup env 부분 변경 * chore: dev 배포 테스트 * chore: github actions 파일 on.push, on.pull_request 정리 * chore: actuator 설정 추가 후 dev 배포 테스트 * chore: actuator 설정 추가 후 prod 배포 테스트 * chore: aws-cicd-prod.yml에서 on.push 브랜치 정리
- Loading branch information
Showing
18 changed files
with
346 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,10 @@ | ||
FROM openjdk:17 | ||
|
||
ARG JAR_FILE=./build/libs/*.jar | ||
ARG SPRING_PROFILE | ||
|
||
COPY ${JAR_FILE} layer-server.jar | ||
ENTRYPOINT ["java", "-Duser.timezone=Asia/Seoul","-Dspring.profiles.active=dev" ,"-jar" ,"layer-server.jar"] | ||
|
||
ENV SPRING_PROFILE=${SPRING_PROFILE} | ||
|
||
ENTRYPOINT ["java", "-Duser.timezone=Asia/Seoul","-Dspring.profiles.active=${SPRING_PROFILE}" ,"-jar" ,"layer-server.jar"] |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
#!/bin/bash | ||
|
||
IS_GREEN=$(sudo docker ps | grep layer-api-green) # 현재 실행중인 App이 blue인지 확인합니다. | ||
DEFAULT_CONF="/etc/nginx/nginx.conf" | ||
|
||
|
||
if [ -z $IS_GREEN ];then # blue라면 | ||
|
||
echo "### BLUE => GREEN ###" | ||
|
||
echo "1. get green image" | ||
cd ./layer-api/infra/production | ||
|
||
echo "1.1. pull latest green image" | ||
sudo docker-compose -f docker-compose-green.yaml pull | ||
|
||
echo "2. green container up" | ||
sudo docker-compose -f docker-compose-green.yaml up -d | ||
|
||
while [ 1 = 1 ]; do | ||
echo "3. green health check..." | ||
sudo sleep 3 | ||
|
||
REQUEST=$(sudo curl http://127.0.0.1:8080/actuator/health) # green으로 request | ||
if [ -n "$REQUEST" ]; then # 서비스 가능하면 health check 중지 | ||
echo "health check success" | ||
break ; | ||
fi | ||
done; | ||
|
||
echo "4. reload nginx" | ||
sudo cp ./nginx.green.conf /etc/nginx/nginx.conf | ||
sudo nginx -s reload | ||
|
||
echo "5. blue container down" | ||
sudo docker-compose -f docker-compose-blue.yaml rm -s -f layer-api-blue batch-job-blue admin-app-blue | ||
else | ||
echo "### GREEN => BLUE ###" | ||
echo "1. get blue image" | ||
cd ./layer-api/infra/production | ||
|
||
echo "1.1. pull latest blue image" | ||
sudo docker-compose -f docker-compose-blue.yaml pull | ||
|
||
echo "2. blue container up" | ||
sudo docker-compose -f docker-compose-blue.yaml up -d | ||
|
||
|
||
while [ 1 = 1 ]; do | ||
echo "3. blue health check..." | ||
sleep 3 | ||
REQUEST=$(curl http://127.0.0.1:8081/actuator/health) # blue로 request | ||
|
||
if [ -n "$REQUEST" ]; then # 서비스 가능하면 health check 중지 | ||
echo "health check success" | ||
break ; | ||
fi | ||
done; | ||
|
||
echo "4. reload nginx" | ||
sudo cp ./nginx.blue.conf /etc/nginx/nginx.conf | ||
sudo nginx -s reload | ||
|
||
echo "5. green container down" | ||
sudo docker-compose -f docker-compose-green.yaml rm -s -f layer-api-green batch-job-green admin-app-green | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
services: | ||
redis: | ||
build: | ||
context: . | ||
dockerfile: Dockerfile-redis | ||
ports: | ||
- "6379:6379" | ||
volumes: | ||
- redis-data:/data # Persistent data storage | ||
restart: always | ||
networks: | ||
- app-network | ||
|
||
layer-api-blue: | ||
image: docker.io/clean01/layer-server_layer-api:latest | ||
container_name: layer-api-blue | ||
ports: | ||
- "8081:8080" | ||
environment: | ||
- TZ=Asia/Seoul | ||
- SPRING_PROFILES_ACTIVE=dev | ||
volumes: | ||
- ./application-secret.properties:/config/application-secret.properties | ||
- ./tokens:/config/tokens | ||
networks: | ||
- app-network | ||
logging: | ||
driver: "json-file" | ||
options: | ||
max-size: "10m" | ||
max-file: "3" | ||
|
||
batch-job-blue: | ||
image: docker.io/clean01/layer-server_layer-batch:latest | ||
container_name: layer-batch-blue | ||
environment: | ||
- TZ=Asia/Seoul | ||
volumes: | ||
- ./application-secret.properties:/config/application-secret.properties | ||
- ./tokens:/config/tokens | ||
networks: | ||
- app-network | ||
depends_on: | ||
- layer-api-blue | ||
restart: always | ||
logging: | ||
driver: "json-file" | ||
options: | ||
max-size: "10m" | ||
max-file: "3" | ||
|
||
admin-app-blue: | ||
image: docker.io/clean01/layer-server_layer-admin:latest # | ||
container_name: layer-admin-blue | ||
ports: | ||
- "3001:3000" | ||
environment: | ||
- TZ=Asia/Seoul | ||
- SPRING_PROFILES_ACTIVE=dev | ||
volumes: | ||
- ./application-secret.properties:/config/application-secret.properties | ||
- ./tokens:/config/tokens | ||
networks: | ||
- app-network | ||
depends_on: | ||
- layer-api-blue | ||
restart: always | ||
logging: | ||
driver: "json-file" | ||
options: | ||
max-size: "10m" | ||
max-file: "3" | ||
|
||
networks: | ||
app-network: | ||
|
||
volumes: | ||
redis-data: |
Oops, something went wrong.