-
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.
commit 33a9606 Author: alstn113 <[email protected]> Date: Wed Jan 8 16:19:39 2025 +0900 feat: deploy 스크립트 사용 commit 51ec497 Author: alstn113 <[email protected]> Date: Wed Jan 8 16:19:23 2025 +0900 refactor: 컨테이너 이름 변경 및 blue, green 컨테이너로 변경 commit d734939 Author: alstn113 <[email protected]> Date: Wed Jan 8 16:18:58 2025 +0900 feat: spring actuator 의존성 추가 commit 989b1bb Author: alstn113 <[email protected]> Date: Wed Jan 8 16:18:38 2025 +0900 feat: container switching shell script commit 9ea9ac5 Author: alstn113 <[email protected]> Date: Wed Jan 8 10:27:09 2025 +0900 docs: 서비스 개발 블로그 주소를 등록한다. commit cad802e Author: alstn113 <[email protected]> Date: Sat Jan 4 11:24:40 2025 +0900 refactor: V1__init.sql format commit 40e31a9 Author: alstn113 <[email protected]> Date: Fri Jan 3 14:13:29 2025 +0900 feat: question template에 passage textarea를 추가한다. commit 85aa0fe Author: alstn113 <[email protected]> Date: Thu Jan 2 17:44:04 2025 +0900 feat: 시험 제출 후 결과로 이동 commit 2e2cecb Author: alstn113 <[email protected]> Date: Thu Jan 2 17:19:02 2025 +0900 feat: question passage 필드 추가 commit 5b6751e Author: alstn113 <[email protected]> Date: Thu Jan 2 16:31:22 2025 +0900 refactor: question의 passage 필드에 관련된 테스트 코드를 수정한다. commit 81b5226 Author: alstn113 <[email protected]> Date: Thu Jan 2 16:30:56 2025 +0900 feat: question에 passage 필드를 추가하고 관련된 것들을 수정한다. commit e5d421b Author: alstn113 <[email protected]> Date: Thu Jan 2 14:18:17 2025 +0900 feat: question entity에 passage column 추가 commit 924c1ce Author: alstn113 <[email protected]> Date: Thu Jan 2 13:56:27 2025 +0900 docs: 서버, API 명세서, 웹 주소를 추가한다. commit 03f7869 Author: alstn113 <[email protected]> Date: Thu Jan 2 13:52:27 2025 +0900 refactor: issue template에 불필요한 이모티콘을 제거한다. commit 47d716c Author: alstn113 <[email protected]> Date: Wed Jan 1 20:44:01 2025 +0900 refactor: CardBody의 공통 부분을 통일하고 분리한다.
- Loading branch information
Showing
55 changed files
with
1,257 additions
and
2,951 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
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,6 +1,6 @@ | ||
services: | ||
redis: | ||
container_name: fluffy-redis | ||
container_name: redis | ||
image: redis:7.4.1 | ||
restart: always | ||
ports: | ||
|
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,18 +1,28 @@ | ||
x-app: &app | ||
image: ${DOCKER_APP_IMAGE} | ||
env_file: | ||
- .env | ||
environment: | ||
TZ: Asia/Seoul | ||
SPRING_PROFILES_ACTIVE: prod | ||
restart: always | ||
depends_on: | ||
- redis | ||
|
||
services: | ||
app: | ||
container_name: fluffy-app | ||
image: ${DOCKER_APP_IMAGE} | ||
ports: | ||
- '8080:8080' | ||
env_file: | ||
- .env | ||
environment: | ||
TZ: Asia/Seoul | ||
SPRING_PROFILES_ACTIVE: prod | ||
restart: always | ||
redis: | ||
container_name: fluffy-redis | ||
container_name: redis | ||
image: redis:7.4.1 | ||
restart: always | ||
ports: | ||
- '6379:6379' | ||
app-blue: | ||
<<: *app | ||
container_name: app-blue | ||
ports: | ||
- '8080:8080' | ||
app-green: | ||
<<: *app | ||
container_name: app-green | ||
ports: | ||
- '8081:8080' |
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,50 @@ | ||
#!/bin/bash | ||
|
||
NGINX_CONFIG_PATH="/etc/nginx/sites-available/api.fluffy.run" | ||
HOST_HEALTH_CHECK_ENDPOINT="http://localhost:8082/actuator/health" | ||
HEALTH_CHECK_ATTEMPTS=5 | ||
HEALTH_CHECK_DELAY=3 | ||
|
||
health_check() { | ||
for i in $(seq 1 $HEALTH_CHECK_ATTEMPTS); do | ||
echo "Health check attempt ($i/$HEALTH_CHECK_ATTEMPTS)" | ||
response=$(curl -s -o /dev/null -w "%{http_code}" $HOST_HEALTH_CHECK_ENDPOINT) | ||
|
||
if [ $response -eq 200 ]; then | ||
echo "Health check passed" | ||
return 0 | ||
fi | ||
|
||
sleep $HEALTH_CHECK_DELAY | ||
done | ||
|
||
echo "Health check failed" | ||
return 1 | ||
} | ||
|
||
switch_container() { | ||
local prev_container=$1 | ||
local next_container=$2 | ||
|
||
docker compose -f compose.yml up $next_container -d | ||
|
||
if ! health_check; then | ||
echo "Health check failed, rolling back" | ||
docker compose -f compose.yml down $next_container | ||
return 1 | ||
fi | ||
|
||
sed -i "s/server $prev_container:8080;/server $next_container:8080;/" "$NGINX_CONFIG_PATH" | ||
|
||
sudo nginx -s reload | ||
} | ||
|
||
IS_GREEN=$(docker container ps | grep app-green) | ||
|
||
if [ -z "$IS_GREEN" ]; then | ||
echo "### BLUE >> GREEN ###" | ||
switch_container "app-blue" "app-green" | ||
else | ||
echo "### GREEN >> BLUE ###" | ||
switch_container "app-green" "app-blue" | ||
fi |
Oops, something went wrong.