Skip to content

Commit

Permalink
Merge pull request #41 from uswLectureEvaluation/feat/health_check
Browse files Browse the repository at this point in the history
feat: 헬스 체크 API
  • Loading branch information
wonslee authored Dec 19, 2023
2 parents a6f1327 + 3b3298b commit ad039c1
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/deploy-develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
- name: Docker build
run: |
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }}
docker build -f Dockerfile.dev -t ${{ secrets.DOCKER_USERNAME }}/suwiki .
docker build -f dev.Dockerfile -t ${{ secrets.DOCKER_USERNAME }}/suwiki .
docker tag ${{ secrets.DOCKER_USERNAME }}/suwiki ${{ secrets.DOCKER_USERNAME }}/suwiki:${GITHUB_SHA::7}
docker push ${{ secrets.DOCKER_USERNAME }}/suwiki:${GITHUB_SHA::7} # Github에서 기본적으로 제공하는 환경변수 commit SHA
Expand All @@ -81,7 +81,7 @@ jobs:
for RETRY_COUNT in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15; do
echo "> #${RETRY_COUNT} trying..."
RESPONSE_CODE=$(curl -s -o /dev/null -w "%{http_code}" $TARGET_URL:$PORT/hello)
RESPONSE_CODE=$(curl -s -o /dev/null -w "%{http_code}" $TARGET_URL:$PORT/health)
if [ "${RESPONSE_CODE}" -eq 200 ]; then
echo "> New WAS successfully running"
Expand Down
File renamed without changes.
20 changes: 20 additions & 0 deletions src/main/java/usw/suwiki/HealthCheckController.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package usw.suwiki;

import static org.springframework.http.HttpStatus.OK;

import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/health")
@RequiredArgsConstructor
public class HealthCheckController {
@GetMapping
@ResponseStatus(OK)
public String check() {
return "✅";
}
}

0 comments on commit ad039c1

Please sign in to comment.