Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BE] 문서화 오류 수정 #836

Open
wants to merge 48 commits into
base: BE/dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
1bd2e9e
Merge pull request #804 from woowacourse-teams/BE/dev
reddevilmidzy Oct 16, 2024
25263a9
chore: 로컬 IP 주소 변경
reddevilmidzy Oct 16, 2024
76b9e5a
Merge branch 'BE/test' into BE/feature/#781-zero-downtime
reddevilmidzy Oct 16, 2024
f2d2362
Merge pull request #805 from woowacourse-teams/BE/feature/#781-zero-d…
reddevilmidzy Oct 16, 2024
0dcc589
chore: 블루 그린 포트 변경
reddevilmidzy Oct 16, 2024
b78f531
Merge branch 'BE/test' into BE/feature/#781-zero-downtime
reddevilmidzy Oct 16, 2024
d0bc602
Merge pull request #808 from woowacourse-teams/BE/feature/#781-zero-d…
reddevilmidzy Oct 16, 2024
8c83a64
chore: 그린 포트 변경
JiHyeonL Oct 16, 2024
b5444c1
Merge branch 'BE/test' into BE/feature/#781-zero-downtime
JiHyeonL Oct 16, 2024
c31d1f8
Merge pull request #809 from woowacourse-teams/BE/feature/#781-zero-d…
reddevilmidzy Oct 16, 2024
cfdf3ba
refactor: GREEN 포트 8081:8081로 변경
JiHyeonL Oct 17, 2024
226dec1
Merge branch 'BE/test' into BE/feature/#781-zero-downtime
reddevilmidzy Oct 17, 2024
94c77cd
[BE] 포트 비교 바꿔보기 (#813)
koust6u Oct 17, 2024
e856f89
Merge pull request #812 from woowacourse-teams/BE/feature/#781-zero-d…
reddevilmidzy Oct 17, 2024
8524164
chore: 스크립트 변경
reddevilmidzy Oct 17, 2024
85efb72
Merge branch 'BE/test' into BE/feature/#781-zero-downtime
reddevilmidzy Oct 17, 2024
e5efb52
Merge pull request #816 from woowacourse-teams/BE/feature/#781-zero-d…
reddevilmidzy Oct 17, 2024
179a0e7
[BE] 무중단 배포 스크립트 변경
koust6u Oct 17, 2024
2e79df9
Merge branch 'BE/test' into BE/feature/#781-zero-downtime
koust6u Oct 17, 2024
21dfa66
Merge pull request #817 from woowacourse-teams/BE/feature/#781-zero-d…
reddevilmidzy Oct 17, 2024
20a4f7e
Update be_cd-test.yml
koust6u Oct 17, 2024
f0c30db
[BE] 무중단 배포 스크립트 변경
koust6u Oct 17, 2024
db391c8
[BE] 무중단 배포 스크립트 변경
koust6u Oct 17, 2024
fd0d28d
chore: 무중단 배포 스크립트 변경
koust6u Oct 17, 2024
49d5375
chore: 무중단 배포 스크립트 변경
koust6u Oct 17, 2024
c51bd94
chore: 변수 설정
reddevilmidzy Oct 17, 2024
4d44158
Merge branch 'BE/test' of https://github.com/woowacourse-teams/2024-c…
reddevilmidzy Oct 17, 2024
18fd9da
chore: 도커 컴포즈 변경
reddevilmidzy Oct 17, 2024
306ba73
chore: yml 수정
reddevilmidzy Oct 17, 2024
eb6989e
chore: yml 수정
reddevilmidzy Oct 17, 2024
05661fa
chore: yml 수정
reddevilmidzy Oct 17, 2024
e80fee1
chore: 스위칭 문법 주석
reddevilmidzy Oct 17, 2024
0e6a7b3
fix: 헬스 체크 응답 수정
reddevilmidzy Oct 18, 2024
f8c9098
chore: 업데이트 이전 도커 이미지 삭제
koust6u Oct 18, 2024
3651a1a
chore: 업데이트 이전 도커 이미지 삭제
koust6u Oct 18, 2024
14c3a02
chore: CD 순서 변경
reddevilmidzy Oct 18, 2024
3cc2e6c
style: 테스트용 api 수정
reddevilmidzy Oct 18, 2024
d9ef5f1
fix: 새로운 환경 대기를 도커 이미지 대신 http 요청으로 확인
reddevilmidzy Oct 18, 2024
bb24a9f
fix: 새로운 환경 대기를 도커 이미지 대신 http 요청으로 확인 /api 프리픽스 추가
reddevilmidzy Oct 18, 2024
8c56dc6
chore: 배포 스크립트에서 nginx 변경
reddevilmidzy Oct 18, 2024
72e6ef2
style: 헬스 체크 응답 변경
reddevilmidzy Oct 19, 2024
07a6f53
chore: CD 스크립트 변경
reddevilmidzy Oct 19, 2024
0930748
style: 헬스 체크 응답 변경
reddevilmidzy Oct 19, 2024
2fd6cfd
fix: 로그 제거
reddevilmidzy Oct 19, 2024
6fc0be9
docs: 잘못된 문서화 수정
koust6u Oct 20, 2024
b63f898
docs: 응답이 리스트인 경우 @ArraySchema 사용
reddevilmidzy Oct 20, 2024
025d7a8
docs: 잘못된 문서 수정
koust6u Oct 20, 2024
ab1a73c
Merge remote-tracking branch 'origin/BE/feature/refact-docs' into BE/…
koust6u Oct 20, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 18 additions & 33 deletions .github/workflows/be_cd-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ jobs:

- name: Image build and push
run: |
docker build --build-arg PROFILE=test --build-arg DEPENDENCY=build/dependency -t ${{ secrets.DOCKER_REPO_NAME }}/springboot-app:test-latest --platform linux/arm64 .
docker push ${{ secrets.DOCKER_REPO_NAME }}/springboot-app:test-latest
docker build --build-arg PROFILE=test --build-arg DEPENDENCY=build/dependency -t ${{ secrets.DOCKER_REPO_NAME }}/springboot-app --platform linux/arm64 .
docker push ${{ secrets.DOCKER_REPO_NAME }}/springboot-app

- name: Upload docker-compose yaml script to artifact
uses: actions/upload-artifact@v4
Expand Down Expand Up @@ -69,6 +69,12 @@ jobs:

- name: Extract secrets as .be_app-env file
run: |
chmod +x ./deploy.sh
source ./deploy.sh

echo "BLUE_PORT=$BLUE_PORT" >> $GITHUB_ENV
echo "GREEN_PORT=$GREEN_PORT" >> $GITHUB_ENV

cat <<EOF > ${{ secrets.DOCKER_COMPOSE_YAML_PATH }}/.be_app-env

# Docker Hub info from Github Secrets
Expand All @@ -94,48 +100,27 @@ jobs:
INSTANCE_NAME=${{ secrets.INSTANCE_A_NAME }}

# Server App
BLUE_SERVER_BINDING_PORT=${{ secrets.BLUE_SERVER_BINDING_PORT }}
GREEN_SERVER_BINDING_PORT=${{ secrets.GREEN_SERVER_BINDING_PORT }}
BLUE_SERVER_BINDING_PORT=${BLUE_PORT}
GREEN_SERVER_BINDING_PORT=${GREEN_PORT}
SERVER_LOGS_PATH=${{ secrets.SERVER_LOGS_PATH }}
EOF

- name: Stop and remove existing containers
run: |
sudo docker-compose --env-file ${{ secrets.DOCKER_COMPOSE_YAML_PATH }}/.be_app-env -f ${{ secrets.DOCKER_COMPOSE_YAML_PATH }}/be_app-docker-compose.yml down --rmi all
- name: Deploy docker container
run: |
sudo docker-compose --env-file ${{ secrets.DOCKER_COMPOSE_YAML_PATH }}/.be_app-env -f ${{ secrets.DOCKER_COMPOSE_YAML_PATH }}/be_app-docker-compose.yml up -d

# 실행중인 서버 확인
- name: Determine Active and Inactive Ports (Blue/Green)
id: determine-ports
- name: Start the new (green/blue) environment
run: |
ip="127.0.0.1"
ports=(8080 8081)
for port in "${ports[@]}"; do
RESPONSE=$(curl -s http://$ip:$port/api/actuator/health)
IS_ACTIVE=$(echo ${RESPONSE} | grep 'UP' | wc -l)
if [ $IS_ACTIVE -eq 1 -a $port -eq "8080" ]; then
echo "BLUE_PORT=8080" >> $GITHUB_ENV
echo "GREEN_PORT=8081" >> $GITHUB_ENV
elif [ $IS_ACTIVE -eq 1 -a $port -eq "8081" ]; then
echo "BLUE_PORT=8081" >> $GITHUB_ENV
echo "GREEN_PORT=8080" >> $GITHUB_ENV
fi
done
sudo docker-compose --env-file ${{ secrets.DOCKER_COMPOSE_YAML_PATH }}/.be_app-env -f ${{ secrets.DOCKER_COMPOSE_YAML_PATH }}/be_app-docker-compose.yml -p $GREEN_PORT up -d

- name: Start the new (green/blue) environment
- name: remove old spring-app image
run: |
sudo docker-compose --env-file ${{ secrets.DOCKER_COMPOSE_YAML_PATH }}/.be_app-env -f ${{ secrets.DOCKER_COMPOSE_YAML_PATH }}/be_app-docker-compose.yml -p ${{ env.GREEN_PORT }} up -d
sudo docker image rm -f coduo2024/springboot-app;

- name: Wait for new environment to be healthy
run: |
until sudo docker inspect --format '{{json .State.Health.Status}}' ${env.GREEN_PORT}_springboot-app | grep "healthy"; do sleep 5; done
until curl -sf http://localhost:${GREEN_PORT}/api/actuator/health | grep "UP"; do sleep 5; done

- name: Switch traffic to new environment
- name: Reload NGINX
run: |
sudo docker-compose --env-file ${{ secrets.DOCKER_COMPOSE_YAML_PATH }}/.be_app-env -f ${{ secrets.DOCKER_COMPOSE_YAML_PATH }}/be_app-docker-compose.yml -p ${{ env.GREEN_PORT }} up -d --scale springboot-app=1
sudo systemctl reload nginx

- name: Stop and remove the old environment
run: |
sudo docker-compose --env-file ${{ secrets.DOCKER_COMPOSE_YAML_PATH }}/.be_app-env -f ${{ secrets.DOCKER_COMPOSE_YAML_PATH }}/be_app-docker-compose.yml -p ${{ env.BLUE_PORT }} down
sudo docker-compose --env-file ${{ secrets.DOCKER_COMPOSE_YAML_PATH }}/.be_app-env -f ${{ secrets.DOCKER_COMPOSE_YAML_PATH }}/be_app-docker-compose.yml -p $BLUE_PORT down
34 changes: 3 additions & 31 deletions backend/be_app-docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,38 +1,10 @@
services:

springboot-blue:
container_name: coduo_springboot-app-blue
image: ${DOCKER_REPO_NAME}/springboot-app:test-latest
platform: linux/arm64
ports:
- "${BLUE_SERVER_BINDING_PORT}:8080"
volumes:
- ${SERVER_LOGS_PATH}/springboot-app/blue:/logs
- ${SERVER_LOGS_PATH}/springboot-app/backup/blue:/logs/backup
environment:
SPRING_DATASOURCE_REPLICA_MASTER_JDBC-URL: ${MASTER_DB_URL}
SPRING_DATASOURCE_REPLICA_MASTER_USERNAME: ${MASTER_DB_USERNAME}
SPRING_DATASOURCE_REPLICA_MASTER_PASSWORD: ${MASTER_DB_PASSWORD}
SPRING_DATASOURCE_REPLICA_SLAVE_JDBC-URL: ${SLAVE_DB_URL}
SPRING_DATASOURCE_REPLICA_SLAVE_USERNAME: ${SLAVE_DB_USERNAME}
SPRING_DATASOURCE_REPLICA_SLAVE_PASSWORD: ${SLAVE_DB_PASSWORD}
SPRING_JPA_HIBERNATE_DDL-AUTO: ${DDL_AUTO}
OAUTH_GITHUB_CLIENT_ID: ${CLIENT_ID}
OAUTH_GITHUB_CLIENT_SECRET: ${CLIENT_SECRET}
OAUTH_GITHUB_REDIRECT_URI: ${CLIENT_REDIRECT_URI}
JWT_SIGN_KEY: ${JWT_KEY}
EC2_PREFIX: ${INSTANCE_NAME}
SERVER_PORT: ${BLUE_SERVER_BINDING_PORT}
restart: on-failure
networks:
- coduo_net

springboot-green:
container_name: coduo_springboot-app-green
image: ${DOCKER_REPO_NAME}/springboot-app:test-latest
container_name: coduo_springboot-app-${GREEN_SERVER_BINDING_PORT}
image: ${DOCKER_REPO_NAME}/springboot-app
platform: linux/arm64
ports:
- "${GREEN_SERVER_BINDING_PORT}:8081"
- "${GREEN_SERVER_BINDING_PORT}:${GREEN_SERVER_BINDING_PORT}"
volumes:
- ${SERVER_LOGS_PATH}/springboot-app/green:/logs
- ${SERVER_LOGS_PATH}/springboot-app/backup/green:/logs/backup
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ public class CommonController {

@GetMapping("/health-check")
public String healthCheck() {
return "Coduo is OK";
return "Coduo is OK!";
}

@GetMapping("/help")
public String help() {
return "불쌍한 켈리를 살려주세요...";
return "히히";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@
@Tag(name = "인증/인가 API")
public interface AuthControllerDocs {

@Operation(summary = "로그아웃 요청을 한다..")
@ApiResponse(responseCode = "200", description = "회원 정보(유저이름)을 등록한다.", content
= @Content(schema = @Schema(contentMediaType = MediaType.APPLICATION_JSON_VALUE)))
@Operation(summary = "로그아웃 요청을 한다.")
@ApiResponse(responseCode = "200", description = "로그아웃 요청 성공.")
@ApiResponse(responseCode = "401", description = "인증 실패",
content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
schema = @Schema(implementation = ApiErrorResponse.class)))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.enums.ParameterIn;
import io.swagger.v3.oas.annotations.media.ArraySchema;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
Expand Down Expand Up @@ -58,8 +59,8 @@ ResponseEntity<Void> updatePairRoomStatus(
);

@Operation(summary = "자신의 페어룸을 조회한다.")
@ApiResponse(responseCode = "200", description = "페어룸 조회 성공", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
schema = @Schema(implementation = PairRoomMemberResponse.class)))
@ApiResponse(responseCode = "200", description = "페어룸 조회 성공", content = @Content(
array = @ArraySchema(schema = @Schema(implementation = PairRoomMemberResponse.class))))
ResponseEntity<List<PairRoomMemberResponse>> getPairRooms(
@Parameter(
in = ParameterIn.COOKIE,
Expand All @@ -74,7 +75,7 @@ ResponseEntity<List<PairRoomMemberResponse>> getPairRooms(
@ApiResponse(responseCode = "200", description = "페어룸 존재 여부", content = @Content(mediaType = MediaType.APPLICATION_JSON_VALUE,
schema = @Schema(implementation = PairRoomExistResponse.class)))
ResponseEntity<PairRoomExistResponse> pairRoomExists(String accessCode);

@Operation(summary = "페어룸을 삭제한다.")
@ApiResponse(responseCode = "204", description = "페어룸 삭제 성공")
ResponseEntity<Void> deletePairRoom(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ ResponseEntity<Void> updateTodoOrder(
);

@Operation(summary = "투두를 삭제한다.")
@ApiResponse(responseCode = "204", description = "투두 삭제 성공")
ResponseEntity<Void> deleteTodo(
@Parameter(description = "삭제할 투두 id")
@PathVariable("todoId") final long todoId
Expand Down
Loading