-
Notifications
You must be signed in to change notification settings - Fork 16
[신은수] Sprint8 #116
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
base: 신은수
Are you sure you want to change the base?
[신은수] Sprint8 #116
Conversation
|
||
} catch (Exception e) { | ||
log.error("HTTP Upload BinaryContent failed: fileName={}", file.getOriginalFilename(), e); | ||
throw new RuntimeException("파일 업로드 실패", e); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이 에러도 커스텀하게 정의해주시는게 좋을것 같아요 !
@RequestPart(value = "profile", required = false) MultipartFile profile | ||
) { | ||
|
||
log.info("HTTP Update User requested: id={}, profilePresent={}", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
로깅에서 삼항 연산자같은 로직이 들어가는것은 실무에선 선호 되진 않습니다.
return binaryContentMapper.toDto(binaryContent); | ||
} | ||
|
||
@Override |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Transactional(readOnly=trure)
추가해주시면 좋을것 같습니다.
); | ||
} | ||
|
||
@Override |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Transactional(readOnly=trure)
추가해주시면 좋을것 같습니다.
return readStatusMapper.toDto(readStatus); | ||
} | ||
|
||
@Override |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Transactional(readOnly=trure)
추가해주시면 좋을것 같습니다.
} | ||
|
||
@Override | ||
public List<ReadStatusDto> findAllByUserId(UUID userId) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Transactional(readOnly=trure)
추가해주시면 좋을것 같습니다.
} | ||
|
||
@Override | ||
public UserStatusDto find(UUID userStatusId) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Transactional(readOnly=trure)
추가해주시면 좋을것 같습니다.
} | ||
|
||
@Override | ||
public List<UserStatusDto> findAll() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Transactional(readOnly=trure)
추가해주시면 좋을것 같습니다.
|
||
@Service | ||
@RequiredArgsConstructor | ||
public class S3UploadService { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
오 s3를 서비스로 분리한 부분 잘하셨습니다.
spring: | ||
datasource: | ||
driver-class-name: org.postgresql.Driver | ||
url: ${DATASOURCE_URL:jdbc:postgresql://localhost:5432/discodeit} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
db명도 변수로 관리하시는게 좋습니다.
요구사항
애플리케이션 컨테이너화
Dockerfile 작성
이미지 빌드 및 실행 테스트
Docker Compose 구성
BinaryContentStorage 고도화 (AWS S3)
AWS S3 버킷 구성
AWS S3 접근을 위한 IAM 구성
AWS S3 테스트
AWS S3를 활용한 BinaryContentStroage 고도화
앞서 작성한 테스트 메소드를 참고해 S3BinaryContentStorage를 구현하세요.
discodeit.storage.type 값이 s3인 경우에만 Bean으로 등록되어야 합니다.
S3BinaryContentStorageTest를 함께 작성하면서 구현하세요.
BinaryContentStorage 설정을 유연하게 제어할 수 있도록 application.yaml을 수정하세요.
download 메소드는 PresignedUrl을 활용해 리다이렉트하는 방식으로 구현하세요.
AWS를 활용한 배포 (AWS RDS, ECR, ECS)
AWS RDS 구성
AWS RDS PostgreSQL 인스턴스를 생성하세요.
과금이 발생할 수 있으니 다음 항목은 한번 더 확인해주세요.
SSH 터널링을 통해 개발 환경에서 접근할 수 있도록 EC2를 구성하세요.
EC2 인스턴스를 생성하세요.
보안 그룹에서 인바운드 규칙을 편집하세요.
DataGrip을 통해 연결 후 데이터베이스와 사용자, 테이블을 초기화하세요.
AWS ECR 구성
AWS ECS 구성
배포 환경에서 컨테이너 실행 간 사용할 환경 변수를 정의하고, S3에 업로드하세요.
AWS ECS 콘솔에서 클러스터를 생성하세요.
태스크를 정의하세요.
discodeit 클러스터 상세 화면에서 서비스를 생성하세요.
태스크의 EC2 보안 그룹의 인바운드 규칙을 설정하여 어디서든 접근할 수 있도록 하세요.
태스크 실행이 완료되면 해당 EC2의 퍼블릭 IP에 접속해보세요.
심화
주요 변경사항
스크린샷
멘토에게