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

ReceiptOption 날짜 컬럼 Flyway 스키마 추가 #336

Merged
merged 74 commits into from
Jul 29, 2024
Merged
Show file tree
Hide file tree
Changes from 73 commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
bf4f9ad
[ci] targets 변경
YeaChan05 Jun 14, 2024
0fd1edf
배포 15차 (#279)
YeaChan05 Jun 14, 2024
7a6ce1f
배포 14.1차 (#281)
hwan2-99 Jun 14, 2024
aa8fd6e
배포 14.2차 (#283)
YeaChan05 Jun 14, 2024
12c6ce6
배포 14.3차 (#285)
YeaChan05 Jun 17, 2024
7fdf6a6
[ci] targets 변경
YeaChan05 Jun 17, 2024
5f39ebe
[ci] targets 변경
YeaChan05 Jun 17, 2024
17a44f3
[ci] targets 변경
YeaChan05 Jun 17, 2024
4927714
[ci] targets 변경
YeaChan05 Jun 17, 2024
e624598
[ci] targets 변경
YeaChan05 Jun 17, 2024
78d2fc6
[ci] request schema 변경
YeaChan05 Jun 17, 2024
b5618a6
[ci] targets 변경
YeaChan05 Jun 17, 2024
0836bd8
[ci] targets 변경
YeaChan05 Jun 17, 2024
0102ad0
[ci] 의존관계 변경
YeaChan05 Jun 17, 2024
a9d314e
[ci] 기존으로 변경
YeaChan05 Jun 17, 2024
8706697
[ci] 기존으로 변경
YeaChan05 Jun 17, 2024
4a430f7
[ci] targets 변경
YeaChan05 Jun 17, 2024
2723c22
[ci] docker network 변경
YeaChan05 Jun 17, 2024
e3789c4
[ci] application timezone 수정
YeaChan05 Jun 19, 2024
3475b42
[ci] targets 수정
YeaChan05 Jun 19, 2024
de010f2
[ci] 미반영파일 지정
YeaChan05 Jun 19, 2024
29bf775
[ci] 미반영파일 지정
YeaChan05 Jun 19, 2024
f39390b
[ci] 미반영파일 지정
YeaChan05 Jun 19, 2024
bf32201
[ci] 설정파일 백업 로직 작성
YeaChan05 Jun 19, 2024
6650474
[ci] targets 수정
YeaChan05 Jun 19, 2024
9782df8
[ci] targets 수정
YeaChan05 Jun 19, 2024
bcf7b64
배포 15차 (#290)
YeaChan05 Jun 19, 2024
055023e
[ci] loki 세팅
YeaChan05 Jun 20, 2024
3e3d5b2
[ci] loki 세팅
YeaChan05 Jun 20, 2024
ea3110d
[ci] loki 세팅
YeaChan05 Jun 20, 2024
b3f71c2
[ci] loki 세팅
YeaChan05 Jun 20, 2024
2c03621
[ci] loki 세팅
YeaChan05 Jun 20, 2024
65d3ff1
배포 16차 (#301)
kmw2378 Jun 21, 2024
87f338c
배포 16차 (#307)
YeaChan05 Jun 25, 2024
d555a15
배포 17차 (#318)
kmw2378 Jun 28, 2024
3ffebbb
[HOTFIX]로그인시 응답 Body에 리프레시 토큰을 담지 않도록 수정
kmw2378 Jun 28, 2024
64953a4
[HOTFIX]로그인시 응답 Body에 리프레시 토큰을 담지 않도록 수정
kmw2378 Jun 28, 2024
ea83b35
[ci] loki 주석
YeaChan05 Jun 28, 2024
289a66e
[ci] 주석 수정
YeaChan05 Jun 28, 2024
6c90f4b
[refactor]들여쓰기 수정
kmw2378 Jun 29, 2024
204456c
Merge branch 'deploy' of https://github.com/KakaoFunding/back-end int…
kmw2378 Jun 29, 2024
d29ae20
[cicd]nginx 프록시 버퍼 확장
kmw2378 Jun 29, 2024
73c6802
배포 17.1차 (#319)
kmw2378 Jun 29, 2024
5279e2c
[refactor]엑세스 토큰 만료시간을 10초로 설정
kmw2378 Jun 29, 2024
7d58a37
Merge branch 'deploy' of https://github.com/KakaoFunding/back-end int…
kmw2378 Jun 29, 2024
1b842e8
[refactor]엑세스 토큰 만료시간을 1시간으로 설정
kmw2378 Jun 29, 2024
13b878e
[ci] prometheus 데이터 유지 기간 1주일로 지정
YeaChan05 Jul 1, 2024
2c1f915
[ci] prometheus config 수정
YeaChan05 Jul 1, 2024
bf36da7
[ci] prometheus config 수정
YeaChan05 Jul 2, 2024
26a45ed
[ci] prometheus config 수정
YeaChan05 Jul 2, 2024
9df070d
[ci] prometheus config 수정
YeaChan05 Jul 2, 2024
22202b1
[ci] prometheus config 수정
YeaChan05 Jul 2, 2024
88293ab
[ci] prometheus config 수정
YeaChan05 Jul 2, 2024
741ff59
[ci] docker network 수정
YeaChan05 Jul 2, 2024
6cf77d4
[ci] 스크립트 수정
YeaChan05 Jul 2, 2024
6237bf6
[ci] 스크립트 수정
YeaChan05 Jul 2, 2024
6e69bfa
[ci] docker network 수정
YeaChan05 Jul 2, 2024
d0c803d
[ci] nginx.conf 수정
YeaChan05 Jul 2, 2024
e266210
[ci] nginx.conf 수정
YeaChan05 Jul 2, 2024
f675a4e
[ci] nginx.conf 수정
YeaChan05 Jul 2, 2024
fb812df
[ci] grafana 설정 수정
YeaChan05 Jul 3, 2024
2382474
[ci] grafana 설정 수정
YeaChan05 Jul 3, 2024
5beabc4
[ci] grafana user 수정
YeaChan05 Jul 3, 2024
f4e9b0a
[ci] grafana user 수정
YeaChan05 Jul 3, 2024
77927ca
[ci] docker network 수정
YeaChan05 Jul 3, 2024
eddd386
[ci] grafana volume 수정
YeaChan05 Jul 3, 2024
7391a90
[refactor] 메트릭 로깅 추가
kmw2378 Jul 4, 2024
827d328
[refactor]메트릭은 로깅 안되도록 수정
kmw2378 Jul 6, 2024
3ce3e02
[fix]충돌 해결
kmw2378 Jul 6, 2024
e48b994
Merge remote-tracking branch 'origin/develop' into deploy
YeaChan05 Jul 21, 2024
c4bc5a0
기능 구현 마무리 (#333)
YeaChan05 Jul 21, 2024
896d5fb
[feat]MemberRepository @Param 명시
kmw2378 Jul 22, 2024
4528d32
[feat]V1__add_receipt_option_date_column.sql 추가
kmw2378 Jul 25, 2024
c7d6ffe
Merge branch 'develop' into feature/335
YeaChan05 Jul 29, 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
2 changes: 1 addition & 1 deletion .github/workflows/build-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ run-name: Running
on:
push:
branches:
- deploy # deploy 브런치로 푸쉬했을 때 실행
- deploy
pull_request:
branches:
- deploy
Expand Down
12 changes: 12 additions & 0 deletions appspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ files:
- source: /
destination: /home/ec2-user/cicd
overwrite: yes
exclude:
- /home/ec2-user/cicd/src/main/resources/application-prod.yml

file_exists_behavior: OVERWRITE

Expand All @@ -31,6 +33,11 @@ permissions:
- file

hooks:
BeforeInstall:
- location: scripts/backup.sh
timeout: 60
runas: ec2-user

ApplicationStop:
- location: scripts/stop.sh
timeout: 60
Expand All @@ -40,3 +47,8 @@ hooks:
- location: scripts/deploy.sh
timeout: 600
runas: ec2-user

AfterInstall:
- location: scripts/restore.sh
timeout: 60
runas: ec2-user
33 changes: 11 additions & 22 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ services:
- app3
- prometheus
- grafana
networks:
- server-network

app1:
image: "yeachan05/application:latest"
Expand All @@ -34,8 +32,9 @@ services:
- redis
volumes:
- /home/ec2-user/application-prod.yml:/config/application-prod.yml
networks:
- server-network
environment:
- TZ=Asia/Seoul
- spring.application.name=app1

app2:
image: "yeachan05/application:latest"
Expand All @@ -47,8 +46,9 @@ services:
- redis
volumes:
- /home/ec2-user/application-prod.yml:/config/application-prod.yml
networks:
- server-network
environment:
- TZ=Asia/Seoul
- spring.application.name=app2

app3:
image: "yeachan05/application:latest"
Expand All @@ -60,8 +60,9 @@ services:
- redis
volumes:
- /home/ec2-user/application-prod.yml:/config/application-prod.yml
networks:
- server-network
environment:
- TZ=Asia/Seoul
- spring.application.name=app3

redis:
container_name: redis
Expand All @@ -71,8 +72,6 @@ services:
- "6379:6379"
volumes:
- redis-data:/data
networks:
- server-network

prometheus:
image: prom/prometheus
Expand All @@ -85,21 +84,18 @@ services:
- "9090:9090"
extra_hosts:
- "host.docker.internal:host-gateway"
networks:
- server-network

grafana:
image: grafana/grafana
container_name: grafana
restart: always
user: "472"
ports:
- "3009:3000"
environment:
- GF_SECURITY_ADMIN_PASSWORD=${GRAFANA_PASSWORD}
volumes:
- grafana-storage:/var/lib/grafana
networks:
- server-network

mysqld_exporter:
image: quay.io/prometheus/mysqld-exporter
Expand All @@ -111,14 +107,7 @@ services:
- "9104:9104"
volumes:
- /home/ec2-user/my.cnf:/etc/mysql/my.cnf
networks:
- server-network

volumes:
grafana-storage:
prometheus-data:
redis-data:

networks:
server-network:
driver: bridge
redis-data:
5 changes: 5 additions & 0 deletions nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ http {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;

# 프록시 버퍼 확장
proxy_buffer_size 128k;
proxy_buffers 4 256k;
proxy_busy_buffers_size 256k;
}
location = /favicon.ico {
return 204;
Expand Down
2 changes: 1 addition & 1 deletion prometheus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ scrape_configs:

- job_name: 'spring-boot-apps'
static_configs:
- targets: ['app1:8080', 'app2:8080', 'app3:8080']
- targets: ['host.docker.internal:8081', 'host.docker.internal:8082', 'host.docker.internal:8083']
metrics_path: '/actuator/prometheus'

- job_name: 'mysql'
Expand Down
4 changes: 4 additions & 0 deletions scripts/backup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

mkdir -p /home/ec2-user/cicd/backup
cp /home/ec2-user/cicd/src/main/resources/application-prod.yml /home/ec2-user/cicd/backup/
5 changes: 5 additions & 0 deletions scripts/restore.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

if [ -f /home/ec2-user/cicd/backup/application-prod.yml ]; then
cp /home/ec2-user/cicd/backup/application-prod.yml /home/ec2-user/cicd/src/main/resources/application-prod.yml
fi
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import lombok.RequiredArgsConstructor;
import org.kakaoshare.backend.domain.member.dto.oauth.authenticate.OAuthLoginRequest;
import org.kakaoshare.backend.domain.member.dto.oauth.authenticate.OAuthLoginResponse;
import org.kakaoshare.backend.domain.member.dto.oauth.authenticate.OAuthLoginResult;
import org.kakaoshare.backend.domain.member.dto.oauth.issue.OAuthReissueRequest;
import org.kakaoshare.backend.domain.member.dto.oauth.issue.ReissueResponse;
import org.kakaoshare.backend.domain.member.dto.oauth.issue.ReissueResult;
Expand All @@ -29,11 +30,11 @@ public class OAuthController {

@PostMapping("/login")
public ResponseEntity<?> login(@RequestBody @Valid final OAuthLoginRequest oAuthLoginRequest) {
final OAuthLoginResponse loginResponse = oAuthService.login(oAuthLoginRequest);
final ResponseCookie cookie = refreshTokenCookieProvider.createCookie(loginResponse.refreshToken());
final OAuthLoginResult oAuthLoginResult = oAuthService.login(oAuthLoginRequest);
final ResponseCookie cookie = refreshTokenCookieProvider.createCookie(oAuthLoginResult.refreshToken());
return ResponseEntity.ok()
.header(HttpHeaders.SET_COOKIE, cookie.toString())
.body(loginResponse);
.body(OAuthLoginResponse.from(oAuthLoginResult));
}

@PostMapping("/logout")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
public record OAuthLoginRequest(
@NotNull(message = "소셜 이름은 필수입니다.") String provider,
@NotNull(message = "소셜 리프레시 토큰은 필수입니다.") String socialAccessToken
) {}
) {
}
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@
package org.kakaoshare.backend.domain.member.dto.oauth.authenticate;

import lombok.Builder;
import org.kakaoshare.backend.domain.member.dto.oauth.profile.OAuthProfile;
import org.kakaoshare.backend.domain.member.dto.oauth.token.RefreshTokenDto;
import org.kakaoshare.backend.domain.member.entity.token.RefreshToken;

@Builder
public record OAuthLoginResponse(String accessToken, RefreshTokenDto refreshToken, OAuthLoginMemberResponse member) {
public static OAuthLoginResponse of(final String accessToken,
final RefreshToken refreshToken,
final OAuthProfile oAuthProfile) {
return new OAuthLoginResponse(accessToken, RefreshTokenDto.from(refreshToken), OAuthLoginMemberResponse.from(oAuthProfile));
public record OAuthLoginResponse(String accessToken, OAuthLoginMemberResponse member) {
public static OAuthLoginResponse from(final OAuthLoginResult oAuthLoginResult) {
return new OAuthLoginResponse(oAuthLoginResult.accessToken(), oAuthLoginResult.member());
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package org.kakaoshare.backend.domain.member.dto.oauth.authenticate;

import lombok.Builder;
import org.kakaoshare.backend.domain.member.dto.oauth.profile.OAuthProfile;
import org.kakaoshare.backend.domain.member.dto.oauth.token.RefreshTokenDto;
import org.kakaoshare.backend.domain.member.entity.token.RefreshToken;

@Builder
public record OAuthLoginResult(String accessToken, RefreshTokenDto refreshToken, OAuthLoginMemberResponse member) {
public static OAuthLoginResult of(final String accessToken,
final RefreshToken refreshToken,
final OAuthProfile oAuthProfile) {
return new OAuthLoginResult(accessToken, RefreshTokenDto.from(refreshToken), OAuthLoginMemberResponse.from(oAuthProfile));
}
}
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
package org.kakaoshare.backend.domain.member.repository;

import java.util.List;
import org.kakaoshare.backend.domain.member.entity.Member;
import org.kakaoshare.backend.domain.member.repository.query.MemberRepositoryCustom;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;
import java.util.Optional;
import org.springframework.data.jpa.repository.Query;

public interface MemberRepository extends JpaRepository<Member, Long>, MemberRepositoryCustom {
Optional<Member> findMemberByProviderId(String providerId);
@Query("SELECT m FROM Member m WHERE m.providerId IN :providerIds")
List<Member> findByProviderIds(List<String> providerIds);
List<Member> findByProviderIds(@Param("providerIds") List<String> providerIds);
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import lombok.RequiredArgsConstructor;
import org.kakaoshare.backend.domain.member.dto.oauth.authenticate.OAuthLoginRequest;
import org.kakaoshare.backend.domain.member.dto.oauth.authenticate.OAuthLoginResponse;
import org.kakaoshare.backend.domain.member.dto.oauth.authenticate.OAuthLoginResult;
import org.kakaoshare.backend.domain.member.dto.oauth.issue.OAuthReissueRequest;
import org.kakaoshare.backend.domain.member.dto.oauth.issue.OAuthReissueResponse;
import org.kakaoshare.backend.domain.member.dto.oauth.issue.ReissueResult;
Expand Down Expand Up @@ -42,15 +42,15 @@ public class OAuthService {
private final OAuthWebClientService webClientService;

@Transactional
public OAuthLoginResponse login(final OAuthLoginRequest oAuthLoginRequest) {
public OAuthLoginResult login(final OAuthLoginRequest oAuthLoginRequest) {
final ClientRegistration registration = clientRegistrationRepository.findByRegistrationId(oAuthLoginRequest.provider());
final OAuthProfile oAuthProfile = getProfile(oAuthLoginRequest, registration);
final UserDetails userDetails = addOrFindByProfile(oAuthProfile);
final String accessToken = jwtProvider.createAccessToken(userDetails);
final RefreshToken refreshToken = refreshTokenProvider.createToken(userDetails.getUsername());
refreshTokenRepository.save(refreshToken);

return OAuthLoginResponse.of(accessToken, refreshToken, oAuthProfile);
return OAuthLoginResult.of(accessToken, refreshToken, oAuthProfile);
}

@Transactional
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ALTER TABLE receipt_option
ADD COLUMN created_at datetime(6) null,
ADD COLUMN updated_at datetime(6) null;
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.kakaoshare.backend.domain.member.dto.oauth.authenticate.OAuthLoginRequest;
import org.kakaoshare.backend.domain.member.dto.oauth.authenticate.OAuthLoginResponse;
import org.kakaoshare.backend.domain.member.dto.oauth.authenticate.OAuthLoginResult;
import org.kakaoshare.backend.domain.member.dto.oauth.issue.OAuthReissueRequest;
import org.kakaoshare.backend.domain.member.dto.oauth.issue.OAuthReissueResponse;
import org.kakaoshare.backend.domain.member.dto.oauth.issue.ReissueResult;
Expand Down Expand Up @@ -101,8 +101,8 @@ public void authenticateWhenNewMember() throws Exception {
doReturn(refreshToken).when(refreshTokenProvider).createToken(userDetails.getUsername());
doReturn(refreshToken).when(refreshTokenRepository).save(any());

final OAuthLoginResponse expect = OAuthLoginResponse.of(accessToken, refreshToken, oAuthProfile);
final OAuthLoginResponse actual = oAuthService.login(request);
final OAuthLoginResult expect = OAuthLoginResult.of(accessToken, refreshToken, oAuthProfile);
final OAuthLoginResult actual = oAuthService.login(request);
assertThat(expect).isEqualTo(actual);
}

Expand All @@ -122,8 +122,8 @@ public void authenticateWhenExistingMember() throws Exception {
doReturn(refreshToken).when(refreshTokenProvider).createToken(userDetails.getUsername());
doReturn(refreshToken).when(refreshTokenRepository).save(any());

final OAuthLoginResponse expect = OAuthLoginResponse.of(accessToken, refreshToken, oAuthProfile);
final OAuthLoginResponse actual = oAuthService.login(request);
final OAuthLoginResult expect = OAuthLoginResult.of(accessToken, refreshToken, oAuthProfile);
final OAuthLoginResult actual = oAuthService.login(request);
assertThat(expect).isEqualTo(actual);
}

Expand Down
Loading