-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
auth-service에서 액세스 토큰을 발급받아 사용하는 리소스 서버들(account-service, notification-service, statistics-service)은
서버 시작할 때 한 번 auth-service의 http://auth-service:5000/oauth2/jwks 엔드포인트로 요청을 보내서 JWT 검증을 할때 사용할 공개 키를 받아와야 하기 때문에(JWT 액세스 토큰을 검증할 때 사용)
auth-service가 먼저 실행이 되어야 함, 그렇지 않으면 아래와 같은 에러 발생하고 서버 실행이 안됨

따라서 docker 설정에 auth-service 헬스체크를 추가하고 다른 서비스들은 depends_on 설정으로 auth-service가 healthy 상태가 되면 실행되도록 하려 했는데 auth-service 헬스체크가 안됨..실제로는 해당 엔드포인트에 접속이 되는데
두 가지 방법으로 해봤는데 저는 일단 다 안됐습니다..
- docker-compose-test.yml 수정
auth-service:
build:
context: ./auth-service
container_name: auth-service
ports:
- 5000:5000
# healthcheck: # 왜 안될까..
# test: [ "CMD", "curl", "-f", "http://localhost:5000/.well-known/openid-configuration" ]
# interval: 10s
# timeout: 5s
# retries: 3
# start_period: 30s # 초기화 시간 10초 대기
- auth-service 내 dockerfile 수정
FROM openjdk:17-jdk-slim
ADD ./build/libs/auth-service-1.0-SNAPSHOT.jar /app/
CMD ["java", "-Xmx200m", "-jar", "/app/auth-service-1.0-SNAPSHOT.jar"]
#HEALTHCHECK --interval=30s --timeout=30s CMD curl -f http://localhost:5000/.well-known/openid-configuration || exit 1
EXPOSE 5000
이 문제를 해결을 못해서 일단은 위 에러가 나면 서버를 재시작하면 그때는 제대로 공개키를 가져와서 일단 테스트할 때 계속 이런 방식으로 했는데...아시는 분 있으시면 해결 좀 부탁드립니다
마찬가지로 registry(유레카 서버)도 healthy 상태 확인되면 나머지 서비스들이 실행되어야 할 거 같은데 얘도 헬스 체크가 안됨
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels