From 6127a939f0976fe9348220e98ac2ac1498749638 Mon Sep 17 00:00:00 2001 From: KangJiSseok Date: Tue, 20 Feb 2024 03:54:02 +0900 Subject: [PATCH 1/9] =?UTF-8?q?fix=20:=20login=20Json=EB=B0=A9=EC=8B=9D?= =?UTF-8?q?=EC=9C=BC=EB=A1=9C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../webchat/config/MemberConfig.java | 9 +++--- .../member/controller/MemberController.java | 10 +++--- .../member/dto/request/LoginRequest.java | 16 ++++++++++ .../repository/JpaMemberRepository.java | 31 ++++++++++--------- .../SpringDataJpaMemberRepository.java | 1 + .../member/service/MemberServiceV2.java | 13 ++++++++ .../member/service/MemberServiceV3.java | 2 ++ 7 files changed, 60 insertions(+), 22 deletions(-) create mode 100644 BackEnd/webChat/src/main/java/springwebsocket/webchat/member/dto/request/LoginRequest.java diff --git a/BackEnd/webChat/src/main/java/springwebsocket/webchat/config/MemberConfig.java b/BackEnd/webChat/src/main/java/springwebsocket/webchat/config/MemberConfig.java index 0dbaa1d..c2ed2c2 100644 --- a/BackEnd/webChat/src/main/java/springwebsocket/webchat/config/MemberConfig.java +++ b/BackEnd/webChat/src/main/java/springwebsocket/webchat/config/MemberConfig.java @@ -1,10 +1,12 @@ package springwebsocket.webchat.config; import jakarta.persistence.EntityManager; +import lombok.RequiredArgsConstructor; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import springwebsocket.webchat.member.repository.JpaMemberRepository; import springwebsocket.webchat.member.repository.MemberRepository; +import springwebsocket.webchat.member.repository.springdata.SpringDataJpaMemberRepository; import springwebsocket.webchat.member.service.MemberService; import springwebsocket.webchat.member.service.MemberServiceV1; import springwebsocket.webchat.member.service.MemberServiceV2; @@ -12,13 +14,12 @@ @Configuration +@RequiredArgsConstructor public class MemberConfig { private final EntityManager em; - public MemberConfig(EntityManager em) { - this.em = em; - } + private final SpringDataJpaMemberRepository springDataJpaMemberRepository; @Bean public MemberServiceV3 userService() { @@ -27,7 +28,7 @@ public MemberServiceV3 userService() { @Bean public MemberRepository memberRepository() { - return new JpaMemberRepository(em); + return new JpaMemberRepository(em, springDataJpaMemberRepository); } } diff --git a/BackEnd/webChat/src/main/java/springwebsocket/webchat/member/controller/MemberController.java b/BackEnd/webChat/src/main/java/springwebsocket/webchat/member/controller/MemberController.java index 27a4ee7..4a6cc18 100644 --- a/BackEnd/webChat/src/main/java/springwebsocket/webchat/member/controller/MemberController.java +++ b/BackEnd/webChat/src/main/java/springwebsocket/webchat/member/controller/MemberController.java @@ -11,12 +11,14 @@ import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import springwebsocket.webchat.member.dto.request.LoginRequest; import springwebsocket.webchat.member.dto.request.SignUpRequest; import springwebsocket.webchat.member.dto.response.UserResponse; import springwebsocket.webchat.member.entity.Member; import springwebsocket.webchat.member.dto.MemberUpdataDto; import springwebsocket.webchat.member.exception.EmailDuplicatedException; import springwebsocket.webchat.member.service.MemberServiceV1; +import springwebsocket.webchat.member.service.MemberServiceV2; import springwebsocket.webchat.member.service.MemberServiceV3; import java.util.Optional; @@ -50,8 +52,8 @@ public void delete(Long id) { userService.delete(id); } -// @PostMapping("/login") -// public String login(String loginEmail, String password) { -// return userService.login(loginEmail, password); -// } + @PostMapping("/login") + public String login(@RequestBody LoginRequest request) { + return userService.login(request.getLoginEmail(), request.getPassword()); + } } diff --git a/BackEnd/webChat/src/main/java/springwebsocket/webchat/member/dto/request/LoginRequest.java b/BackEnd/webChat/src/main/java/springwebsocket/webchat/member/dto/request/LoginRequest.java new file mode 100644 index 0000000..e4ba9f8 --- /dev/null +++ b/BackEnd/webChat/src/main/java/springwebsocket/webchat/member/dto/request/LoginRequest.java @@ -0,0 +1,16 @@ +package springwebsocket.webchat.member.dto.request; + + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@Getter +@NoArgsConstructor +@AllArgsConstructor +public class LoginRequest { + + private String loginEmail; + private String password; + +} diff --git a/BackEnd/webChat/src/main/java/springwebsocket/webchat/member/repository/JpaMemberRepository.java b/BackEnd/webChat/src/main/java/springwebsocket/webchat/member/repository/JpaMemberRepository.java index bac7b88..aad691a 100644 --- a/BackEnd/webChat/src/main/java/springwebsocket/webchat/member/repository/JpaMemberRepository.java +++ b/BackEnd/webChat/src/main/java/springwebsocket/webchat/member/repository/JpaMemberRepository.java @@ -3,12 +3,15 @@ import jakarta.persistence.EntityManager; import jakarta.persistence.NoResultException; import jakarta.persistence.Query; +import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Repository; import org.springframework.transaction.annotation.Transactional; import springwebsocket.webchat.member.entity.Member; import springwebsocket.webchat.member.dto.MemberUpdataDto; +import springwebsocket.webchat.member.repository.springdata.SpringDataJpaMemberRepository; +import java.util.NoSuchElementException; import java.util.Optional; @Transactional // Jpa에서 데이터의 변경이 있을 경우 Transactional 을 써야함 @@ -16,10 +19,13 @@ @Slf4j public class JpaMemberRepository implements MemberRepository { - private EntityManager em; + private final EntityManager em; - public JpaMemberRepository(EntityManager em) { + private final SpringDataJpaMemberRepository memberRepository ; + + public JpaMemberRepository(EntityManager em,SpringDataJpaMemberRepository memberRepository) { this.em = em; + this.memberRepository = memberRepository; } @Override @@ -52,21 +58,18 @@ public void delete(Long id) { @Override public Optional findByLoginEmail(String loginEmail) { - log.info("findByLoginEmail 왔음"); - - // JPQL을 사용하여 이메일 주소로 사용자를 찾음 - String jpql = "SELECT u FROM Member u WHERE u.email = :loginEmail"; - Query query = em.createQuery(jpql, Member.class); - query.setParameter("loginEmail", loginEmail); try { - Member user = (Member) query.getSingleResult(); - log.info("user = {}", user.getClass()); - return Optional.ofNullable(user); - } catch (NoResultException e) { - // 결과가 없을 경우 NoResultException이 발생하므로 이를 잡아서 빈 Optional 반환 - return Optional.empty(); + return memberRepository.findByEmail(loginEmail); + } catch (NoSuchElementException e) { + return null; } + + // JPQL을 사용하여 이메일 주소로 사용자를 찾음 +// String jpql = "SELECT u FROM Member u WHERE u.email = :loginEmail"; +// Query query = em.createQuery(jpql, Member.class); +// query.setParameter("loginEmail", loginEmail); + } diff --git a/BackEnd/webChat/src/main/java/springwebsocket/webchat/member/repository/springdata/SpringDataJpaMemberRepository.java b/BackEnd/webChat/src/main/java/springwebsocket/webchat/member/repository/springdata/SpringDataJpaMemberRepository.java index 3645565..5d3fd65 100644 --- a/BackEnd/webChat/src/main/java/springwebsocket/webchat/member/repository/springdata/SpringDataJpaMemberRepository.java +++ b/BackEnd/webChat/src/main/java/springwebsocket/webchat/member/repository/springdata/SpringDataJpaMemberRepository.java @@ -8,4 +8,5 @@ public interface SpringDataJpaMemberRepository extends JpaRepository { Optional findByEmail(String email); + } diff --git a/BackEnd/webChat/src/main/java/springwebsocket/webchat/member/service/MemberServiceV2.java b/BackEnd/webChat/src/main/java/springwebsocket/webchat/member/service/MemberServiceV2.java index 7f5de73..756507b 100644 --- a/BackEnd/webChat/src/main/java/springwebsocket/webchat/member/service/MemberServiceV2.java +++ b/BackEnd/webChat/src/main/java/springwebsocket/webchat/member/service/MemberServiceV2.java @@ -23,6 +23,7 @@ public class MemberServiceV2 implements MemberServiceV3 { private final MemberRepository memberRepository; + @Override @Transactional public UserResponse signUp(SignUpRequest signUpRequest) { @@ -55,4 +56,16 @@ public void delete(Long id) { memberRepository.delete(id); } + public String login(String loginEmail, String password){ + Member user = memberRepository.findByLoginEmail(loginEmail) + .filter(m -> m.getPassword().equals(password)) + .orElse(null); + + if (user == null) { + return "fail"; + } + else{ + return "success"; + } + } } diff --git a/BackEnd/webChat/src/main/java/springwebsocket/webchat/member/service/MemberServiceV3.java b/BackEnd/webChat/src/main/java/springwebsocket/webchat/member/service/MemberServiceV3.java index ec58949..599980e 100644 --- a/BackEnd/webChat/src/main/java/springwebsocket/webchat/member/service/MemberServiceV3.java +++ b/BackEnd/webChat/src/main/java/springwebsocket/webchat/member/service/MemberServiceV3.java @@ -15,4 +15,6 @@ public interface MemberServiceV3 { Optional findById(Long id); void delete(Long id); + + String login(String loginEmail, String password); } From 4f6aa5564770c2402e9929e5bb34c0fc5fd3ce74 Mon Sep 17 00:00:00 2001 From: KangJiSseok Date: Wed, 21 Feb 2024 06:47:20 +0900 Subject: [PATCH 2/9] =?UTF-8?q?feat=20:=20signal=EC=86=8C=EC=BC=93?= =?UTF-8?q?=EC=97=90=20papago=EB=B2=88=EC=97=AD=20api=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BackEnd/webChat/build.gradle | 6 ++- .../webchat/config/SslConfig.java | 50 ------------------- .../webchat/naver/TranslateController.java | 18 +++++++ .../webchat/naver/TranslateResponseDto.java | 30 +++++++++++ .../webchat/naver/TranslateService.java | 34 +++++++++++++ .../webchat/rtc/handler/SignalHandler.java | 25 ++++++++++ .../src/main/resources/application.yml | 15 +++--- 7 files changed, 121 insertions(+), 57 deletions(-) delete mode 100644 BackEnd/webChat/src/main/java/springwebsocket/webchat/config/SslConfig.java create mode 100644 BackEnd/webChat/src/main/java/springwebsocket/webchat/naver/TranslateController.java create mode 100644 BackEnd/webChat/src/main/java/springwebsocket/webchat/naver/TranslateResponseDto.java create mode 100644 BackEnd/webChat/src/main/java/springwebsocket/webchat/naver/TranslateService.java diff --git a/BackEnd/webChat/build.gradle b/BackEnd/webChat/build.gradle index e7f66b4..d6193b7 100644 --- a/BackEnd/webChat/build.gradle +++ b/BackEnd/webChat/build.gradle @@ -52,7 +52,11 @@ dependencies { // json implementation 'org.json:json:20160810' - implementation 'com.h2database:h2' + //WebClient + implementation "org.springframework.boot:spring-boot-starter-webflux" + + //m1 macos를 위한 netty-resolver-dns 종속성을 추가 + implementation 'io.netty:netty-resolver-dns-native-macos:4.1.68.Final:osx-aarch_64' } tasks.named('test') { diff --git a/BackEnd/webChat/src/main/java/springwebsocket/webchat/config/SslConfig.java b/BackEnd/webChat/src/main/java/springwebsocket/webchat/config/SslConfig.java deleted file mode 100644 index 8c3d8aa..0000000 --- a/BackEnd/webChat/src/main/java/springwebsocket/webchat/config/SslConfig.java +++ /dev/null @@ -1,50 +0,0 @@ -//package springwebsocket.webchat.config; -// -//import org.apache.catalina.Context; -//import org.apache.catalina.connector.Connector; -//import org.apache.tomcat.util.descriptor.web.SecurityCollection; -//import org.apache.tomcat.util.descriptor.web.SecurityConstraint; -//import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory; -//import org.springframework.boot.web.servlet.server.ServletWebServerFactory; -//import org.springframework.context.annotation.Bean; -//import org.springframework.context.annotation.Configuration; -// -//@Configuration -//public class SslConfig { -// -// @Bean -// public ServletWebServerFactory servletContainer() { -// CustomTomcatServletWebServerFactory tomcat = new CustomTomcatServletWebServerFactory(); -// -// // Add HTTP to HTTPS redirect : http 로 요청이 들어오면 https 로 리다이렉트 -// tomcat.addAdditionalTomcatConnectors(httpToHttpsRedirectConnector()); -// -// return tomcat; -// } -// -// static class CustomTomcatServletWebServerFactory extends TomcatServletWebServerFactory { -// @Override -// protected void postProcessContext(Context context) { -// SecurityConstraint securityConstraint = new SecurityConstraint(); -// securityConstraint.setUserConstraint("CONFIDENTIAL"); -// SecurityCollection collection = new SecurityCollection(); -// collection.addPattern("/*"); -// securityConstraint.addCollection(collection); -// context.addConstraint(securityConstraint); -// } -// } -// -// /* -// http 를 https 로 리다이렉트한다. -// 즉 http://8080 으로 요청이 들어온 경우 리다이렉트를 통해서 https://8443 으로 변경해준다 -// */ -// private Connector httpToHttpsRedirectConnector() { -// Connector connector = new Connector(TomcatServletWebServerFactory.DEFAULT_PROTOCOL); -// connector.setScheme("http"); -// connector.setPort(8080); -// connector.setSecure(false); -// connector.setRedirectPort(443); -// return connector; -// } -// -//} diff --git a/BackEnd/webChat/src/main/java/springwebsocket/webchat/naver/TranslateController.java b/BackEnd/webChat/src/main/java/springwebsocket/webchat/naver/TranslateController.java new file mode 100644 index 0000000..9f154ae --- /dev/null +++ b/BackEnd/webChat/src/main/java/springwebsocket/webchat/naver/TranslateController.java @@ -0,0 +1,18 @@ +package springwebsocket.webchat.naver; + +import io.swagger.v3.oas.annotations.tags.Tag; +import lombok.RequiredArgsConstructor; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController() +@RequiredArgsConstructor +public class TranslateController { + private final TranslateService translateService; + + + @PostMapping("/api/translate") + public TranslateResponseDto.Result naverPapagoTranslate(String source, String target, String text) { + return translateService.naverPapagoTranslate(source, target, text); + } +} \ No newline at end of file diff --git a/BackEnd/webChat/src/main/java/springwebsocket/webchat/naver/TranslateResponseDto.java b/BackEnd/webChat/src/main/java/springwebsocket/webchat/naver/TranslateResponseDto.java new file mode 100644 index 0000000..d2d849f --- /dev/null +++ b/BackEnd/webChat/src/main/java/springwebsocket/webchat/naver/TranslateResponseDto.java @@ -0,0 +1,30 @@ +package springwebsocket.webchat.naver; + +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.NoArgsConstructor; + +@Getter +@AllArgsConstructor +@NoArgsConstructor +public class TranslateResponseDto { + + private Message message; + + @AllArgsConstructor + @Getter + @NoArgsConstructor + public static class Message { + private Result result; + } + + @AllArgsConstructor + @Getter + @NoArgsConstructor + public static class Result { + private String srcLangType; + private String tarLangType; + private String translatedText; + } + +} \ No newline at end of file diff --git a/BackEnd/webChat/src/main/java/springwebsocket/webchat/naver/TranslateService.java b/BackEnd/webChat/src/main/java/springwebsocket/webchat/naver/TranslateService.java new file mode 100644 index 0000000..1b1811c --- /dev/null +++ b/BackEnd/webChat/src/main/java/springwebsocket/webchat/naver/TranslateService.java @@ -0,0 +1,34 @@ +package springwebsocket.webchat.naver; + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; +import org.springframework.web.reactive.function.client.WebClient; + +@Service +public class TranslateService { + + @Value("${spring.naver.client-id}") + private String clientId; + @Value("${spring.naver.client-secret}") + private String clientSecret; + + + public TranslateResponseDto.Result naverPapagoTranslate(String source, String target, String text) { + + WebClient webClient = WebClient.builder() + .baseUrl("https://openapi.naver.com/v1/papago/n2mt") + .build(); + TranslateResponseDto response = webClient.post().uri( + uriBuilder -> uriBuilder.queryParam("source", source) + .queryParam("target", target) + .queryParam("text", text) + .build() + ) + .header("X-Naver-Client-Id", clientId) + .header("X-Naver-Client-Secret", clientSecret) + .header("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8") + .retrieve() + .bodyToMono(TranslateResponseDto.class).block(); + return response.getMessage().getResult(); + } +} diff --git a/BackEnd/webChat/src/main/java/springwebsocket/webchat/rtc/handler/SignalHandler.java b/BackEnd/webChat/src/main/java/springwebsocket/webchat/rtc/handler/SignalHandler.java index 6ae3b4c..04909ae 100644 --- a/BackEnd/webChat/src/main/java/springwebsocket/webchat/rtc/handler/SignalHandler.java +++ b/BackEnd/webChat/src/main/java/springwebsocket/webchat/rtc/handler/SignalHandler.java @@ -8,6 +8,8 @@ import org.springframework.web.socket.TextMessage; import org.springframework.web.socket.WebSocketSession; import org.springframework.web.socket.handler.TextWebSocketHandler; +import springwebsocket.webchat.naver.TranslateResponseDto; +import springwebsocket.webchat.naver.TranslateService; import springwebsocket.webchat.rtc.User; import java.io.IOException; @@ -22,6 +24,7 @@ public class SignalHandler extends TextWebSocketHandler { private final List users = new ArrayList<>(); + private final TranslateService translateService; @Override public void afterConnectionEstablished(WebSocketSession session) throws Exception { @@ -70,12 +73,34 @@ protected void handleTextMessage(WebSocketSession session, TextMessage message) log.info("ice_candidate"); handleIceCandidate(session, data); break; + case "text": + log.info("text"); + handleText(session, data); + break; default: // 처리되지 않은 유형에 대한 로직을 추가할 수 있습니다. break; } } + private void handleText(WebSocketSession session, JSONObject data) throws IOException { + String target = data.getString("target"); + Optional userToCall = findUser(target); + String message = data.getString("message"); + + String srcLang = data.getString("srcLang"); + String tarLang = data.getString("tarLang"); + String text = data.getString("text"); + + TranslateResponseDto.Result result = translateService.naverPapagoTranslate(srcLang, tarLang, text); + if (userToCall != null) { + sendMessage(session, "text", result.getTranslatedText()); + sendMessage(userToCall.get().getSession(), "text", result.getTranslatedText()); + } else { + sendMessage(session, "text", "user is not online"); + } + } + private void handleStoreUser(WebSocketSession session, JSONObject data) throws IOException { String name = data.getString("name"); Optional user = findUser(name); diff --git a/BackEnd/webChat/src/main/resources/application.yml b/BackEnd/webChat/src/main/resources/application.yml index 6153052..147b3cb 100644 --- a/BackEnd/webChat/src/main/resources/application.yml +++ b/BackEnd/webChat/src/main/resources/application.yml @@ -9,11 +9,11 @@ springdoc: operations-sorter: alpha #SSL -server: - ssl: - key-store: classpath:ssl/keystore.p12 - key-store-type: PKCS12 - key-store-password: 1234 +#server: +# ssl: +# key-store: classpath:ssl/keystore.p12 +# key-store-type: PKCS12 +# key-store-password: 1234 #MySQL spring: @@ -29,5 +29,8 @@ spring: properties: hibernate: format_sql: true + naver : + client-id : ${naver-id} + client-secret : ${naver-secret} profiles: - include: SECRET-KEY \ No newline at end of file + include: SECRET-KEY From 4c19b4e25e0115a05041c21a30e43323632e573a Mon Sep 17 00:00:00 2001 From: KangJiSseok Date: Thu, 22 Feb 2024 00:06:26 +0900 Subject: [PATCH 3/9] =?UTF-8?q?feat=20:=20=EB=B2=88=EC=97=AD=ED=95=98?= =?UTF-8?q?=EA=B8=B0=EC=9C=84=ED=95=9C=20user=20Entity=20language=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../webchat/member/entity/Member.java | 1 + .../java/springwebsocket/webchat/rtc/User.java | 14 ++++++-------- .../webchat/rtc/handler/SignalHandler.java | 1 - 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/BackEnd/webChat/src/main/java/springwebsocket/webchat/member/entity/Member.java b/BackEnd/webChat/src/main/java/springwebsocket/webchat/member/entity/Member.java index 743d832..89605a6 100644 --- a/BackEnd/webChat/src/main/java/springwebsocket/webchat/member/entity/Member.java +++ b/BackEnd/webChat/src/main/java/springwebsocket/webchat/member/entity/Member.java @@ -20,6 +20,7 @@ public class Member { private String password; private String name; private String firebaseToken; + private String language; public Member() { } diff --git a/BackEnd/webChat/src/main/java/springwebsocket/webchat/rtc/User.java b/BackEnd/webChat/src/main/java/springwebsocket/webchat/rtc/User.java index 0b3dec8..f710d22 100644 --- a/BackEnd/webChat/src/main/java/springwebsocket/webchat/rtc/User.java +++ b/BackEnd/webChat/src/main/java/springwebsocket/webchat/rtc/User.java @@ -1,23 +1,21 @@ package springwebsocket.webchat.rtc; import lombok.Data; +import lombok.Getter; +import lombok.Setter; import org.springframework.web.socket.WebSocketSession; +@Getter +@Setter public class User { private final String name; + + private String language; private final WebSocketSession session; public User(String name, WebSocketSession session) { this.name = name; this.session = session; } - - public String getName() { - return name; - } - - public WebSocketSession getSession() { - return session; - } } diff --git a/BackEnd/webChat/src/main/java/springwebsocket/webchat/rtc/handler/SignalHandler.java b/BackEnd/webChat/src/main/java/springwebsocket/webchat/rtc/handler/SignalHandler.java index 04909ae..b2fc9ae 100644 --- a/BackEnd/webChat/src/main/java/springwebsocket/webchat/rtc/handler/SignalHandler.java +++ b/BackEnd/webChat/src/main/java/springwebsocket/webchat/rtc/handler/SignalHandler.java @@ -86,7 +86,6 @@ protected void handleTextMessage(WebSocketSession session, TextMessage message) private void handleText(WebSocketSession session, JSONObject data) throws IOException { String target = data.getString("target"); Optional userToCall = findUser(target); - String message = data.getString("message"); String srcLang = data.getString("srcLang"); String tarLang = data.getString("tarLang"); From 0de898f8d589209168c402675ec5c6b653ccc21c Mon Sep 17 00:00:00 2001 From: KangJiSseok Date: Thu, 22 Feb 2024 00:37:13 +0900 Subject: [PATCH 4/9] =?UTF-8?q?feat=20:=20=EC=9A=94=EC=B2=AD=20JSON,=20?= =?UTF-8?q?=EC=9D=91=EB=8B=B5=20JSON=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 요청 JSON { "type":"stt_message", "name”:”email”, "target”:”targetEmail”, "data":"안녕. 나는 강지석이고, 백엔드 개발자야!" } 응답 JSON { "data": "Hi. I'm Ji Seok Kang, and I'm a backend developer!", "type": "translate_message" } --- .../springwebsocket/webchat/rtc/User.java | 6 ++-- .../webchat/rtc/handler/SignalHandler.java | 35 ++++++++++++------- .../repository/JpaUserRepositoryTest.java | 2 +- .../src/test/resources/application.yml | 22 +++++++++++- 4 files changed, 48 insertions(+), 17 deletions(-) diff --git a/BackEnd/webChat/src/main/java/springwebsocket/webchat/rtc/User.java b/BackEnd/webChat/src/main/java/springwebsocket/webchat/rtc/User.java index f710d22..1d31f89 100644 --- a/BackEnd/webChat/src/main/java/springwebsocket/webchat/rtc/User.java +++ b/BackEnd/webChat/src/main/java/springwebsocket/webchat/rtc/User.java @@ -11,11 +11,13 @@ public class User { private final String name; - private String language; + private final String language; + private final WebSocketSession session; - public User(String name, WebSocketSession session) { + public User(String name, WebSocketSession session,String language) { this.name = name; this.session = session; + this.language = language; } } diff --git a/BackEnd/webChat/src/main/java/springwebsocket/webchat/rtc/handler/SignalHandler.java b/BackEnd/webChat/src/main/java/springwebsocket/webchat/rtc/handler/SignalHandler.java index b2fc9ae..aca4336 100644 --- a/BackEnd/webChat/src/main/java/springwebsocket/webchat/rtc/handler/SignalHandler.java +++ b/BackEnd/webChat/src/main/java/springwebsocket/webchat/rtc/handler/SignalHandler.java @@ -8,6 +8,8 @@ import org.springframework.web.socket.TextMessage; import org.springframework.web.socket.WebSocketSession; import org.springframework.web.socket.handler.TextWebSocketHandler; +import springwebsocket.webchat.member.entity.Member; +import springwebsocket.webchat.member.repository.springdata.SpringDataJpaMemberRepository; import springwebsocket.webchat.naver.TranslateResponseDto; import springwebsocket.webchat.naver.TranslateService; import springwebsocket.webchat.rtc.User; @@ -26,6 +28,8 @@ public class SignalHandler extends TextWebSocketHandler { private final TranslateService translateService; + private final SpringDataJpaMemberRepository memberRepository; + @Override public void afterConnectionEstablished(WebSocketSession session) throws Exception { super.afterConnectionEstablished(session); @@ -73,8 +77,8 @@ protected void handleTextMessage(WebSocketSession session, TextMessage message) log.info("ice_candidate"); handleIceCandidate(session, data); break; - case "text": - log.info("text"); + case "stt_message": + log.info("stt_message"); handleText(session, data); break; default: @@ -84,17 +88,20 @@ protected void handleTextMessage(WebSocketSession session, TextMessage message) } private void handleText(WebSocketSession session, JSONObject data) throws IOException { + String name = data.getString("name"); String target = data.getString("target"); - Optional userToCall = findUser(target); - String srcLang = data.getString("srcLang"); - String tarLang = data.getString("tarLang"); - String text = data.getString("text"); + Optional user = findUser(name); + Optional targetUser = findUser(target); - TranslateResponseDto.Result result = translateService.naverPapagoTranslate(srcLang, tarLang, text); - if (userToCall != null) { - sendMessage(session, "text", result.getTranslatedText()); - sendMessage(userToCall.get().getSession(), "text", result.getTranslatedText()); + String srcLang = user.get().getLanguage(); + String tarLang = targetUser.get().getLanguage(); + String textData = data.getString("data"); + + TranslateResponseDto.Result result = translateService.naverPapagoTranslate(srcLang, tarLang, textData); + if (targetUser != null) { + sendMessage(session, "translate_message", result.getTranslatedText()); + sendMessage(targetUser.get().getSession(), "translate_message", result.getTranslatedText()); } else { sendMessage(session, "text", "user is not online"); } @@ -102,12 +109,14 @@ private void handleText(WebSocketSession session, JSONObject data) throws IOExce private void handleStoreUser(WebSocketSession session, JSONObject data) throws IOException { String name = data.getString("name"); + log.info("name ={}", name); + Member member = memberRepository.findByEmail(name).get(); Optional user = findUser(name); if (user.isPresent()) { sendMessage(session, "user already exists"); } else { // Add new user - addUser(name, session); + addUser(name, session,member.getLanguage()); } } @@ -160,8 +169,8 @@ private Optional findUser(String username) { .findFirst(); } - private void addUser(String name, WebSocketSession session) { - users.add(new User(name, session)); + private void addUser(String name, WebSocketSession session,String language) { + users.add(new User(name, session,language)); } private void sendMessage(WebSocketSession session, String type, String data) throws IOException { diff --git a/BackEnd/webChat/src/test/java/springwebsocket/webchat/repository/JpaUserRepositoryTest.java b/BackEnd/webChat/src/test/java/springwebsocket/webchat/repository/JpaUserRepositoryTest.java index b8295af..daa421f 100644 --- a/BackEnd/webChat/src/test/java/springwebsocket/webchat/repository/JpaUserRepositoryTest.java +++ b/BackEnd/webChat/src/test/java/springwebsocket/webchat/repository/JpaUserRepositoryTest.java @@ -28,7 +28,7 @@ class JpaUserRepositoryTest { @Test void save() { //given - Member user = new Member("asdf@naver.com", "1234", "강지석"); + Member user = new Member("rkdwlsgur", "1234", "강진혁"); //when Member saveUser = userRepository.save(user); diff --git a/BackEnd/webChat/src/test/resources/application.yml b/BackEnd/webChat/src/test/resources/application.yml index 7642613..147b3cb 100644 --- a/BackEnd/webChat/src/test/resources/application.yml +++ b/BackEnd/webChat/src/test/resources/application.yml @@ -1,3 +1,20 @@ +springdoc: + packages-to-scan: springwebsocket.webchat + default-consumes-media-type: application/json;charset=UTF-8 + default-produces-media-type: application/json;charset=UTF-8 + swagger-ui: + path: / + disable-swagger-default-url: true + display-request-duration: true + operations-sorter: alpha + +#SSL +#server: +# ssl: +# key-store: classpath:ssl/keystore.p12 +# key-store-type: PKCS12 +# key-store-password: 1234 + #MySQL spring: datasource: @@ -12,5 +29,8 @@ spring: properties: hibernate: format_sql: true + naver : + client-id : ${naver-id} + client-secret : ${naver-secret} profiles: - include: SECRET-KEY \ No newline at end of file + include: SECRET-KEY From 6f1917e4f4892dda66c5cfee5dfbc5596f2c6d1b Mon Sep 17 00:00:00 2001 From: KangJiSseok Date: Wed, 28 Feb 2024 22:12:19 +0900 Subject: [PATCH 5/9] =?UTF-8?q?fix=20:=20socket=20=EC=9D=91=EB=8B=B5=20JSO?= =?UTF-8?q?N=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 응답 JSON { "type" : " ", "data" : " ", "target" : "" } --- .../friend/controller/FriendshipController.java | 6 ++++-- .../webchat/friend/dto/UserIdRequest.java | 10 ++++++++++ .../webchat/rtc/handler/SignalHandler.java | 13 +++++++++++-- 3 files changed, 25 insertions(+), 4 deletions(-) create mode 100644 BackEnd/webChat/src/main/java/springwebsocket/webchat/friend/dto/UserIdRequest.java diff --git a/BackEnd/webChat/src/main/java/springwebsocket/webchat/friend/controller/FriendshipController.java b/BackEnd/webChat/src/main/java/springwebsocket/webchat/friend/controller/FriendshipController.java index a3a365b..5ebe9d9 100644 --- a/BackEnd/webChat/src/main/java/springwebsocket/webchat/friend/controller/FriendshipController.java +++ b/BackEnd/webChat/src/main/java/springwebsocket/webchat/friend/controller/FriendshipController.java @@ -2,8 +2,10 @@ import lombok.RequiredArgsConstructor; import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +import springwebsocket.webchat.friend.dto.UserIdRequest; import springwebsocket.webchat.friend.entity.Friendship; import springwebsocket.webchat.member.entity.Member; import springwebsocket.webchat.friend.service.FriendshipService; @@ -48,7 +50,7 @@ public List findByFriendIdAndStatus(Long id) { } @PostMapping("/findByUserIdAndStatusOrFriendIdAndStatus") - public List findByUserIdAndStatusOrFriendIdAndStatus(Long userId) { - return friendshipService.findByUserIdAndStatusOrFriendIdAndStatus(userId); + public List findByUserIdAndStatusOrFriendIdAndStatus(@RequestBody UserIdRequest request) { + return friendshipService.findByUserIdAndStatusOrFriendIdAndStatus(request.getUserId()); } } diff --git a/BackEnd/webChat/src/main/java/springwebsocket/webchat/friend/dto/UserIdRequest.java b/BackEnd/webChat/src/main/java/springwebsocket/webchat/friend/dto/UserIdRequest.java new file mode 100644 index 0000000..5ac09a4 --- /dev/null +++ b/BackEnd/webChat/src/main/java/springwebsocket/webchat/friend/dto/UserIdRequest.java @@ -0,0 +1,10 @@ +package springwebsocket.webchat.friend.dto; + +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +public class UserIdRequest { + private Long userId; +} diff --git a/BackEnd/webChat/src/main/java/springwebsocket/webchat/rtc/handler/SignalHandler.java b/BackEnd/webChat/src/main/java/springwebsocket/webchat/rtc/handler/SignalHandler.java index aca4336..75b10fb 100644 --- a/BackEnd/webChat/src/main/java/springwebsocket/webchat/rtc/handler/SignalHandler.java +++ b/BackEnd/webChat/src/main/java/springwebsocket/webchat/rtc/handler/SignalHandler.java @@ -100,8 +100,8 @@ private void handleText(WebSocketSession session, JSONObject data) throws IOExce TranslateResponseDto.Result result = translateService.naverPapagoTranslate(srcLang, tarLang, textData); if (targetUser != null) { - sendMessage(session, "translate_message", result.getTranslatedText()); - sendMessage(targetUser.get().getSession(), "translate_message", result.getTranslatedText()); + sendMessage(tarLang,session, "translate_message", result.getTranslatedText()); + sendMessage(tarLang, targetUser.get().getSession(), "translate_message", result.getTranslatedText()); } else { sendMessage(session, "text", "user is not online"); } @@ -180,6 +180,15 @@ private void sendMessage(WebSocketSession session, String type, String data) thr session.sendMessage(new TextMessage(message.toString())); } + private void sendMessage(String tarLang, WebSocketSession session, String translateMessage, String translatedText) throws IOException { + JSONObject message = new JSONObject(); + message.put("type", translateMessage); + message.put("data", translatedText); + message.put("target", tarLang); + session.sendMessage(new TextMessage(message.toString())); + } + + private void sendMessage(WebSocketSession session, String message) throws IOException { session.sendMessage(new TextMessage(message)); } From 757c3881a855b7ec817304ee7e84e5c602482b97 Mon Sep 17 00:00:00 2001 From: KangJiSseok Date: Thu, 29 Feb 2024 20:30:01 +0900 Subject: [PATCH 6/9] =?UTF-8?q?fix=20:=20papago=20Translation=20=EC=82=AC?= =?UTF-8?q?=EB=9D=BC=EC=A7=90.=20naver=20could=EC=97=90=20=EB=B3=91?= =?UTF-8?q?=ED=95=A9.=20=EB=94=B0=EB=9D=BC=EC=84=9C=20translation=20api=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../webchat/naver/TranslateService.java | 6 ++-- .../webchat/rtc/handler/SignalHandler.java | 30 +++++++++++++------ 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/BackEnd/webChat/src/main/java/springwebsocket/webchat/naver/TranslateService.java b/BackEnd/webChat/src/main/java/springwebsocket/webchat/naver/TranslateService.java index 1b1811c..d86aa84 100644 --- a/BackEnd/webChat/src/main/java/springwebsocket/webchat/naver/TranslateService.java +++ b/BackEnd/webChat/src/main/java/springwebsocket/webchat/naver/TranslateService.java @@ -16,7 +16,7 @@ public class TranslateService { public TranslateResponseDto.Result naverPapagoTranslate(String source, String target, String text) { WebClient webClient = WebClient.builder() - .baseUrl("https://openapi.naver.com/v1/papago/n2mt") + .baseUrl("https://naveropenapi.apigw.ntruss.com/nmt/v1/translation") .build(); TranslateResponseDto response = webClient.post().uri( uriBuilder -> uriBuilder.queryParam("source", source) @@ -24,8 +24,8 @@ public TranslateResponseDto.Result naverPapagoTranslate(String source, String ta .queryParam("text", text) .build() ) - .header("X-Naver-Client-Id", clientId) - .header("X-Naver-Client-Secret", clientSecret) + .header("X-NCP-APIGW-API-KEY-ID", clientId) + .header("X-NCP-APIGW-API-KEY", clientSecret) .header("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8") .retrieve() .bodyToMono(TranslateResponseDto.class).block(); diff --git a/BackEnd/webChat/src/main/java/springwebsocket/webchat/rtc/handler/SignalHandler.java b/BackEnd/webChat/src/main/java/springwebsocket/webchat/rtc/handler/SignalHandler.java index 75b10fb..181d684 100644 --- a/BackEnd/webChat/src/main/java/springwebsocket/webchat/rtc/handler/SignalHandler.java +++ b/BackEnd/webChat/src/main/java/springwebsocket/webchat/rtc/handler/SignalHandler.java @@ -79,7 +79,9 @@ protected void handleTextMessage(WebSocketSession session, TextMessage message) break; case "stt_message": log.info("stt_message"); - handleText(session, data); + String sttData = data.getString("data"); // data 속성을 추출합니다. + log.info("STT Data: " + sttData); // 추출한 데이터를 로그에 출력합니다. + handlestt(session, data); break; default: // 처리되지 않은 유형에 대한 로직을 추가할 수 있습니다. @@ -87,7 +89,7 @@ protected void handleTextMessage(WebSocketSession session, TextMessage message) } } - private void handleText(WebSocketSession session, JSONObject data) throws IOException { + private void handlestt(WebSocketSession session, JSONObject data) throws IOException { String name = data.getString("name"); String target = data.getString("target"); @@ -99,12 +101,14 @@ private void handleText(WebSocketSession session, JSONObject data) throws IOExce String textData = data.getString("data"); TranslateResponseDto.Result result = translateService.naverPapagoTranslate(srcLang, tarLang, textData); + if (targetUser != null) { - sendMessage(tarLang,session, "translate_message", result.getTranslatedText()); - sendMessage(tarLang, targetUser.get().getSession(), "translate_message", result.getTranslatedText()); - } else { - sendMessage(session, "text", "user is not online"); + sendMessage(session, "translate_message",result.getTranslatedText(),name,"tarLang"); + sendMessage(targetUser.get().getSession(), "translate_message",result.getTranslatedText(),name,"tarLang"); + }else { + sendMessage(session, "translate_message", "user is not exist"); } + } private void handleStoreUser(WebSocketSession session, JSONObject data) throws IOException { @@ -116,7 +120,7 @@ private void handleStoreUser(WebSocketSession session, JSONObject data) throws I sendMessage(session, "user already exists"); } else { // Add new user - addUser(name, session,member.getLanguage()); + addUser(name, session, member.getLanguage()); } } @@ -169,8 +173,8 @@ private Optional findUser(String username) { .findFirst(); } - private void addUser(String name, WebSocketSession session,String language) { - users.add(new User(name, session,language)); + private void addUser(String name, WebSocketSession session, String language) { + users.add(new User(name, session, language)); } private void sendMessage(WebSocketSession session, String type, String data) throws IOException { @@ -210,4 +214,12 @@ private void sendMessage(WebSocketSession session, String messageType, String na session.sendMessage(new TextMessage(message.toString())); } + + private void sendMessage(WebSocketSession session, String type, String data, String username, String target) throws IOException { + JSONObject message = new JSONObject(); + message.put("type", type); + message.put("data", data); + message.put("target",target); + session.sendMessage(new TextMessage(message.toString())); + } } \ No newline at end of file From bab16d3c45f6180dfa73d614b1be677e2b7933f3 Mon Sep 17 00:00:00 2001 From: KangJiSseok Date: Fri, 1 Mar 2024 02:49:28 +0900 Subject: [PATCH 7/9] =?UTF-8?q?fix=20:=20SignalHandler=20(handlestt)=20JSO?= =?UTF-8?q?N=20=EB=A6=AC=ED=84=B4=EA=B0=92=20=EC=97=90=EB=9F=AC=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../springwebsocket/webchat/rtc/handler/SignalHandler.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/BackEnd/webChat/src/main/java/springwebsocket/webchat/rtc/handler/SignalHandler.java b/BackEnd/webChat/src/main/java/springwebsocket/webchat/rtc/handler/SignalHandler.java index 181d684..6aa4eb2 100644 --- a/BackEnd/webChat/src/main/java/springwebsocket/webchat/rtc/handler/SignalHandler.java +++ b/BackEnd/webChat/src/main/java/springwebsocket/webchat/rtc/handler/SignalHandler.java @@ -103,8 +103,8 @@ private void handlestt(WebSocketSession session, JSONObject data) throws IOExcep TranslateResponseDto.Result result = translateService.naverPapagoTranslate(srcLang, tarLang, textData); if (targetUser != null) { - sendMessage(session, "translate_message",result.getTranslatedText(),name,"tarLang"); - sendMessage(targetUser.get().getSession(), "translate_message",result.getTranslatedText(),name,"tarLang"); + sendMessage(session, "translate_message",result.getTranslatedText(),name,tarLang); + sendMessage(targetUser.get().getSession(), "translate_message",result.getTranslatedText(),name,tarLang); }else { sendMessage(session, "translate_message", "user is not exist"); } From b29fb0f54df53a77afd89e5254e26b1d533280f6 Mon Sep 17 00:00:00 2001 From: KangJiSseok Date: Sat, 2 Mar 2024 17:21:45 +0900 Subject: [PATCH 8/9] =?UTF-8?q?feat=20:=20contentType=20x-www-form-urlenco?= =?UTF-8?q?ded=20=ED=98=95=EC=8B=9D=20=EC=B9=9C=EA=B5=AC=20=ED=99=95?= =?UTF-8?q?=EC=9D=B8=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../webchat/friend/controller/FriendshipController.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/BackEnd/webChat/src/main/java/springwebsocket/webchat/friend/controller/FriendshipController.java b/BackEnd/webChat/src/main/java/springwebsocket/webchat/friend/controller/FriendshipController.java index 5ebe9d9..027ce7b 100644 --- a/BackEnd/webChat/src/main/java/springwebsocket/webchat/friend/controller/FriendshipController.java +++ b/BackEnd/webChat/src/main/java/springwebsocket/webchat/friend/controller/FriendshipController.java @@ -53,4 +53,9 @@ public List findByFriendIdAndStatus(Long id) { public List findByUserIdAndStatusOrFriendIdAndStatus(@RequestBody UserIdRequest request) { return friendshipService.findByUserIdAndStatusOrFriendIdAndStatus(request.getUserId()); } + + @PostMapping("/findByUserIdAndStatusOrFriendIdAndStatusAny") + public List findByUserIdAndStatusOrFriendIdAndStatusAny(Long userId) { + return friendshipService.findByUserIdAndStatusOrFriendIdAndStatus(userId); + } } From a388fbdfcadcefdf61ad16a0a9b7072f6a6e99fb Mon Sep 17 00:00:00 2001 From: KangJiSseok Date: Mon, 11 Mar 2024 13:54:45 +0900 Subject: [PATCH 9/9] =?UTF-8?q?fix:=20=EB=B6=88=ED=95=84=EC=9A=94=ED=95=9C?= =?UTF-8?q?=20=ED=8F=B4=EB=8D=94=20=EC=82=AD=EC=A0=9C=20=EB=B0=8F=20?= =?UTF-8?q?=ED=8C=8C=EC=9D=BC=20=EC=9D=B4=EB=8F=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/deploy.yml | 51 ++++ .idea/compiler.xml | 15 ++ .idea/gradle.xml | 15 ++ .idea/jarRepositories.xml | 20 ++ .idea/modules/webChat.main.iml | 8 + .idea/modules/webChat.test.iml | 8 + BackEnd/{webChat => }/.gitignore | 0 BackEnd/{webChat => }/Dockerfile | 0 BackEnd/README.md | 220 ++++++++++++++++- BackEnd/{webChat => }/build.gradle | 0 .../gradle/wrapper/gradle-wrapper.jar | Bin .../gradle/wrapper/gradle-wrapper.properties | 0 BackEnd/{webChat => }/gradlew | 0 BackEnd/{webChat => }/gradlew.bat | 0 BackEnd/{webChat => }/settings.gradle | 0 .../webchat/WebChatApplication.java | 0 .../chat/controller/ChatController.java | 0 .../webchat/chat/dto/ChatRoom.java | 0 .../webchat/chat/entity/ChatDAO.java | 0 .../chat/handler/WebSocketChatHandler.java | 0 .../webchat/chat/service/ChatService.java | 0 .../webchat/config/ChatConfig.java | 0 .../webchat/config/FCMConfig.java | 0 .../webchat/config/FriendshipConfig.java | 0 .../webchat/config/MemberConfig.java | 0 .../webchat/config/SwaggerConfig.java | 0 .../webchat/error/ErrorCode.java | 0 .../error/exception/ApplicationException.java | 0 .../exception/InvalidValueException.java | 0 .../controller/FCMNotificationController.java | 0 .../fcm/dto/FCMNotificationRequestDto.java | 0 .../fcm/service/FCMNotificationService.java | 0 .../controller/FriendshipController.java | 0 .../webchat/friend/dto/UserIdRequest.java | 0 .../webchat/friend/entity/Friendship.java | 0 .../repository/FriendshipRepository.java | 0 .../repository/JpaFriendshipRepository.java | 0 .../SpringDataJpaFriendshipRepository.java | 0 .../friend/service/FriendshipService.java | 0 .../friend/service/FriendshipServiceV1.java | 0 .../controller/ExceptionController.java | 0 .../member/controller/MemberController.java | 0 .../webchat/member/dto/MemberUpdataDto.java | 0 .../member/dto/request/LoginRequest.java | 0 .../member/dto/request/SignUpRequest.java | 0 .../member/dto/response/UserResponse.java | 0 .../webchat/member/entity/Member.java | 0 .../exception/EmailDuplicatedException.java | 0 .../exception/response/ExceptionResponse.java | 0 .../repository/JpaMemberRepository.java | 0 .../member/repository/MemberRepository.java | 0 .../SpringDataJpaMemberRepository.java | 0 .../webchat/member/service/MemberService.java | 0 .../member/service/MemberServiceV1.java | 0 .../member/service/MemberServiceV2.java | 0 .../member/service/MemberServiceV3.java | 0 .../webchat/naver/TranslateController.java | 0 .../webchat/naver/TranslateResponseDto.java | 0 .../webchat/naver/TranslateService.java | 0 .../springwebsocket/webchat/rtc/User.java | 0 .../webchat/rtc/config/WebRtcConfig.java | 0 .../webchat/rtc/handler/SignalHandler.java | 2 +- .../main/resources/application-develop.yml | 7 +- .../main}/resources/application.yml | 8 +- .../main/resources/static/basic/peerConfig.js | 0 .../src/main/resources/static/index.html | 0 .../src/main/resources/templates/webRTC.html | 0 .../webchat/WebChatApplicationTests.java | 0 .../JpaFriendshipRepositoryTest.java | 0 .../repository/JpaUserRepositoryTest.java | 0 .../application-SECRET-KEY.properties | 10 + .../test}/resources/application.yml | 0 BackEnd/webChat/README.md | 221 ------------------ .../application-SECRET-KEY.properties | 6 - 74 files changed, 356 insertions(+), 235 deletions(-) create mode 100644 .github/workflows/deploy.yml create mode 100644 .idea/compiler.xml create mode 100644 .idea/gradle.xml create mode 100644 .idea/jarRepositories.xml create mode 100644 .idea/modules/webChat.main.iml create mode 100644 .idea/modules/webChat.test.iml rename BackEnd/{webChat => }/.gitignore (100%) rename BackEnd/{webChat => }/Dockerfile (100%) rename BackEnd/{webChat => }/build.gradle (100%) rename BackEnd/{webChat => }/gradle/wrapper/gradle-wrapper.jar (100%) rename BackEnd/{webChat => }/gradle/wrapper/gradle-wrapper.properties (100%) rename BackEnd/{webChat => }/gradlew (100%) rename BackEnd/{webChat => }/gradlew.bat (100%) rename BackEnd/{webChat => }/settings.gradle (100%) rename BackEnd/{webChat => }/src/main/java/springwebsocket/webchat/WebChatApplication.java (100%) rename BackEnd/{webChat => }/src/main/java/springwebsocket/webchat/chat/controller/ChatController.java (100%) rename BackEnd/{webChat => }/src/main/java/springwebsocket/webchat/chat/dto/ChatRoom.java (100%) rename BackEnd/{webChat => }/src/main/java/springwebsocket/webchat/chat/entity/ChatDAO.java (100%) rename BackEnd/{webChat => }/src/main/java/springwebsocket/webchat/chat/handler/WebSocketChatHandler.java (100%) rename BackEnd/{webChat => }/src/main/java/springwebsocket/webchat/chat/service/ChatService.java (100%) rename BackEnd/{webChat => }/src/main/java/springwebsocket/webchat/config/ChatConfig.java (100%) rename BackEnd/{webChat => }/src/main/java/springwebsocket/webchat/config/FCMConfig.java (100%) rename BackEnd/{webChat => }/src/main/java/springwebsocket/webchat/config/FriendshipConfig.java (100%) rename BackEnd/{webChat => }/src/main/java/springwebsocket/webchat/config/MemberConfig.java (100%) rename BackEnd/{webChat => }/src/main/java/springwebsocket/webchat/config/SwaggerConfig.java (100%) rename BackEnd/{webChat => }/src/main/java/springwebsocket/webchat/error/ErrorCode.java (100%) rename BackEnd/{webChat => }/src/main/java/springwebsocket/webchat/error/exception/ApplicationException.java (100%) rename BackEnd/{webChat => }/src/main/java/springwebsocket/webchat/error/exception/InvalidValueException.java (100%) rename BackEnd/{webChat => }/src/main/java/springwebsocket/webchat/fcm/controller/FCMNotificationController.java (100%) rename BackEnd/{webChat => }/src/main/java/springwebsocket/webchat/fcm/dto/FCMNotificationRequestDto.java (100%) rename BackEnd/{webChat => }/src/main/java/springwebsocket/webchat/fcm/service/FCMNotificationService.java (100%) rename BackEnd/{webChat => }/src/main/java/springwebsocket/webchat/friend/controller/FriendshipController.java (100%) rename BackEnd/{webChat => }/src/main/java/springwebsocket/webchat/friend/dto/UserIdRequest.java (100%) rename BackEnd/{webChat => }/src/main/java/springwebsocket/webchat/friend/entity/Friendship.java (100%) rename BackEnd/{webChat => }/src/main/java/springwebsocket/webchat/friend/repository/FriendshipRepository.java (100%) rename BackEnd/{webChat => }/src/main/java/springwebsocket/webchat/friend/repository/JpaFriendshipRepository.java (100%) rename BackEnd/{webChat => }/src/main/java/springwebsocket/webchat/friend/repository/springdata/SpringDataJpaFriendshipRepository.java (100%) rename BackEnd/{webChat => }/src/main/java/springwebsocket/webchat/friend/service/FriendshipService.java (100%) rename BackEnd/{webChat => }/src/main/java/springwebsocket/webchat/friend/service/FriendshipServiceV1.java (100%) rename BackEnd/{webChat => }/src/main/java/springwebsocket/webchat/member/controller/ExceptionController.java (100%) rename BackEnd/{webChat => }/src/main/java/springwebsocket/webchat/member/controller/MemberController.java (100%) rename BackEnd/{webChat => }/src/main/java/springwebsocket/webchat/member/dto/MemberUpdataDto.java (100%) rename BackEnd/{webChat => }/src/main/java/springwebsocket/webchat/member/dto/request/LoginRequest.java (100%) rename BackEnd/{webChat => }/src/main/java/springwebsocket/webchat/member/dto/request/SignUpRequest.java (100%) rename BackEnd/{webChat => }/src/main/java/springwebsocket/webchat/member/dto/response/UserResponse.java (100%) rename BackEnd/{webChat => }/src/main/java/springwebsocket/webchat/member/entity/Member.java (100%) rename BackEnd/{webChat => }/src/main/java/springwebsocket/webchat/member/exception/EmailDuplicatedException.java (100%) rename BackEnd/{webChat => }/src/main/java/springwebsocket/webchat/member/exception/response/ExceptionResponse.java (100%) rename BackEnd/{webChat => }/src/main/java/springwebsocket/webchat/member/repository/JpaMemberRepository.java (100%) rename BackEnd/{webChat => }/src/main/java/springwebsocket/webchat/member/repository/MemberRepository.java (100%) rename BackEnd/{webChat => }/src/main/java/springwebsocket/webchat/member/repository/springdata/SpringDataJpaMemberRepository.java (100%) rename BackEnd/{webChat => }/src/main/java/springwebsocket/webchat/member/service/MemberService.java (100%) rename BackEnd/{webChat => }/src/main/java/springwebsocket/webchat/member/service/MemberServiceV1.java (100%) rename BackEnd/{webChat => }/src/main/java/springwebsocket/webchat/member/service/MemberServiceV2.java (100%) rename BackEnd/{webChat => }/src/main/java/springwebsocket/webchat/member/service/MemberServiceV3.java (100%) rename BackEnd/{webChat => }/src/main/java/springwebsocket/webchat/naver/TranslateController.java (100%) rename BackEnd/{webChat => }/src/main/java/springwebsocket/webchat/naver/TranslateResponseDto.java (100%) rename BackEnd/{webChat => }/src/main/java/springwebsocket/webchat/naver/TranslateService.java (100%) rename BackEnd/{webChat => }/src/main/java/springwebsocket/webchat/rtc/User.java (100%) rename BackEnd/{webChat => }/src/main/java/springwebsocket/webchat/rtc/config/WebRtcConfig.java (100%) rename BackEnd/{webChat => }/src/main/java/springwebsocket/webchat/rtc/handler/SignalHandler.java (99%) rename BackEnd/{webChat => }/src/main/resources/application-develop.yml (83%) rename BackEnd/{webChat/src/test => src/main}/resources/application.yml (86%) rename BackEnd/{webChat => }/src/main/resources/static/basic/peerConfig.js (100%) rename BackEnd/{webChat => }/src/main/resources/static/index.html (100%) rename BackEnd/{webChat => }/src/main/resources/templates/webRTC.html (100%) rename BackEnd/{webChat => }/src/test/java/springwebsocket/webchat/WebChatApplicationTests.java (100%) rename BackEnd/{webChat => }/src/test/java/springwebsocket/webchat/repository/JpaFriendshipRepositoryTest.java (100%) rename BackEnd/{webChat => }/src/test/java/springwebsocket/webchat/repository/JpaUserRepositoryTest.java (100%) create mode 100644 BackEnd/src/test/resources/application-SECRET-KEY.properties rename BackEnd/{webChat/src/main => src/test}/resources/application.yml (100%) delete mode 100644 BackEnd/webChat/README.md delete mode 100644 BackEnd/webChat/src/test/resources/application-SECRET-KEY.properties diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..83f5061 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,51 @@ +name: Build and Deploy to EC2 + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +defaults: + run: + shell: bash + +env: + AWS_S3_BUCKET: 4k-backend-bucket + AWS_CODE_DEPLOY_APPLICATION: 4K-Backend-CD + AWS_CODE_DEPLOY_GROUP: 4K-Backend-CD-Group + +jobs: + deploy: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v2 + + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'corretto' + + - name: Grant execute permission for gradlew + working-directory: ./Backend + run: chmod +x ./gradlew + shell: bash + + - name: Build Project and Test + working-directory: ./Backend + + run: ./gradlew build test + - name: Setup MySQL + uses: mirromutth/mysql-action@v1.1 + with: + mysql database: 'trip' + mysql user: ${DB_USERNAME} + mysql password: ${DB_PASSWORD} + + - name: Configure AWS credential + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-region: ap-northeast-2 + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..2d8f0b4 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml new file mode 100644 index 0000000..9bf7ade --- /dev/null +++ b/.idea/gradle.xml @@ -0,0 +1,15 @@ + + + + + + \ No newline at end of file diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml new file mode 100644 index 0000000..fdc392f --- /dev/null +++ b/.idea/jarRepositories.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules/webChat.main.iml b/.idea/modules/webChat.main.iml new file mode 100644 index 0000000..8efdb31 --- /dev/null +++ b/.idea/modules/webChat.main.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/modules/webChat.test.iml b/.idea/modules/webChat.test.iml new file mode 100644 index 0000000..13c1aef --- /dev/null +++ b/.idea/modules/webChat.test.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/BackEnd/webChat/.gitignore b/BackEnd/.gitignore similarity index 100% rename from BackEnd/webChat/.gitignore rename to BackEnd/.gitignore diff --git a/BackEnd/webChat/Dockerfile b/BackEnd/Dockerfile similarity index 100% rename from BackEnd/webChat/Dockerfile rename to BackEnd/Dockerfile diff --git a/BackEnd/README.md b/BackEnd/README.md index b0d68a8..c16e08e 100644 --- a/BackEnd/README.md +++ b/BackEnd/README.md @@ -1,3 +1,221 @@ +## 도커파일 실행 하는법 + ``` -$ docker-compose up +docker build -t [username]/[image name]:tag ``` + +``` +docker tag [username]/[image name]:tag [username]/[image name]:latest +``` + + +Jenkins CI/CD 구축 참고 + +https://velog.io/@haeny01/AWS-Jenkins%EB%A5%BC-%ED%99%9C%EC%9A%A9%ED%95%9C-Docker-x-SpringBoot-CICD-%EA%B5%AC%EC%B6%95#3-publish-over-ssh-%ED%94%8C%EB%9F%AC%EA%B7%B8%EC%9D%B8-%EC%84%A4%EC%A0%95 + +2.Jenkins 설치 및 실행 확인 에러 +https://rainbound.tistory.com/entry/Ubuntu-jenkins-%EC%84%A4%EC%B9%98 + +# Jenkins x Github 연동 + +1. SSH 키 생성 + +``` +$ sudo mkdir /var/lib/jenkins/.ssh +$ sudo ssh-keygen -t rsa -f /var/lib/jenkins/.ssh/jtogkey +``` + +2. github에 Deploy key 등록하기 + +``` +$ cat /var/lib/jenkins/.ssh/jtogkey.pub +``` + +3. Jenkins Credential 등록하기 + +``` +$ sudo cat /var/lib/jenkins/.ssh/jtogkey +``` +``` +-----BEGIN OPENSSH PRIVATE KEY----- +... +... 이와 같은 형태의 key가 private key 입니다 ... +... +-----END OPENSSH PRIVATE KEY----- +``` + +# Jenkins x 배포서버 SSH연결 + +1. SSH 키 생성 +``` +$ sudo ssh-keygen -t rsa -C "jtoekey" -m PEM -P "" -f /var/lib/jenkins/.ssh/jtoekey +// "jtoekey" 여기는 주석 key의 명칭 +``` + +2. 배포서버 PublicKey 등록 +``` +// 구축 서버 +$ sudo cat /var/lib/jenkins/.ssh/jtoekey.pub + +// 배포 서버 +$ vi .ssh/authorized_keys +``` +위에서 생성했던 jtoekey를 배포서버인 인스턴스의 .ssh/authorized_keys 파일에 추가 + +3. Publish Over SSH 플러그인 설정 + +- Jenkins 플러그인에서 publish over ssh 설치 + +- Jenkins 관리 > 시스템 관리 아래 Publish Over SSH 영역의 고급 버튼을 눌러 확장하여 설정 + +### 여기서 이슈 발생 +sheel에서 [ubuntu@ip-private ipv4 주소] 일 때, + +- Path to Key 는 위에서 생성해준 private key 경로를 넣어주세요. + +` +/var/lib/jenkins/.ssh/jtoekey +` +- Key 는 Private key 파일안의 내용을 복사 붙여넣기 해주세요. + +` + $ sudo cat /var/lib/jenkins/.ssh/jtoekey +` + +- Name 는 접속할 ssh 서버의 이름을 지어주세요. + +` +그냥 접속할 이름 아무거나 써도 됌 +` +- Hostname 는 접속할 인스턴스의 주소를 넣어주세요. + +` +ec2 인스턴스 private Ipv4 주소 +` +- Username 는 접속할 유저명을 넣어주세요. + +` +ubuntu +` + + +# Jenkins x Docker 설정 + +https://velog.io/@haeny01/AWS-EC2-X-Docker + +apt 업데이트 + +``` +$ sudo apt update +``` + +apt HTTPS 설정 + +``` +$ sudo apt install apt-transport-https ca-certificates curl software-properties-common +``` + +도커 GPG키 등록 + +``` +$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - +``` + +### apt에 도커 Repository 설정 + +1. 도커 Repository 추가 + +``` +$ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable" +``` + +2. apt 업데이트 + +``` +$ sudo apt update +``` + +3. 우분투 Repo 대신 도커 Repo로 설치하는지 확인 + +``` +$ apt-cache policy docker-ce +``` + +# 도커 설치 + +- 도커 설치 + +``` +$ sudo apt install docker-ce +``` + +- 도커 확인 + +``` +$ sudo systemctl status docker +``` +Active상태가 running 이면 실행중 +``` +ubuntu@ip-172-31-17-241:~$ sudo systemctl status docker +● docker.service - Docker Application Container Engine +Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled) +Active: active (running) since Sun 2024-01-21 12:04:08 UTC; 46s ago +TriggeredBy: ● docker.socket +Docs: https://docs.docker.com +Main PID: 11459 (dockerd) +Tasks: 9 +Memory: 35.2M +CPU: 412ms +CGroup: /system.slice/docker.service +└─11459 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock +``` + +1. Docker 그룹에 젠킨스 추가 + +``` +// 추가 +$ sudo usermod -aG docker jenkins +$ su - jenkins + +// 확인 +$ id -nG +jenkins docker +``` + +``` +su - jenkins +Password: +su: Authentication failure +``` + +## 우분투 22버전부터 패스워드 생성 하고 입장해야함. + +인증이 안되면 +``` +$ sudo passwd root +> New password: +> Retype new password: +> passwd: password updated successfully + +$ sudo passwd jenkins +New password: +Retype new password: +passwd: password updated successfully +``` + + +2. docker.sock 권한 변경 + +``` +$ sudo chmod 666 /var/run/docker.sock +``` + +3. Jenkins에서 Docker login + +``` +$ sudo su - jenkins +$ docker login +``` +도커허브의 아이디와 비밀번호 입력 + +# Jenkins Item \ No newline at end of file diff --git a/BackEnd/webChat/build.gradle b/BackEnd/build.gradle similarity index 100% rename from BackEnd/webChat/build.gradle rename to BackEnd/build.gradle diff --git a/BackEnd/webChat/gradle/wrapper/gradle-wrapper.jar b/BackEnd/gradle/wrapper/gradle-wrapper.jar similarity index 100% rename from BackEnd/webChat/gradle/wrapper/gradle-wrapper.jar rename to BackEnd/gradle/wrapper/gradle-wrapper.jar diff --git a/BackEnd/webChat/gradle/wrapper/gradle-wrapper.properties b/BackEnd/gradle/wrapper/gradle-wrapper.properties similarity index 100% rename from BackEnd/webChat/gradle/wrapper/gradle-wrapper.properties rename to BackEnd/gradle/wrapper/gradle-wrapper.properties diff --git a/BackEnd/webChat/gradlew b/BackEnd/gradlew similarity index 100% rename from BackEnd/webChat/gradlew rename to BackEnd/gradlew diff --git a/BackEnd/webChat/gradlew.bat b/BackEnd/gradlew.bat similarity index 100% rename from BackEnd/webChat/gradlew.bat rename to BackEnd/gradlew.bat diff --git a/BackEnd/webChat/settings.gradle b/BackEnd/settings.gradle similarity index 100% rename from BackEnd/webChat/settings.gradle rename to BackEnd/settings.gradle diff --git a/BackEnd/webChat/src/main/java/springwebsocket/webchat/WebChatApplication.java b/BackEnd/src/main/java/springwebsocket/webchat/WebChatApplication.java similarity index 100% rename from BackEnd/webChat/src/main/java/springwebsocket/webchat/WebChatApplication.java rename to BackEnd/src/main/java/springwebsocket/webchat/WebChatApplication.java diff --git a/BackEnd/webChat/src/main/java/springwebsocket/webchat/chat/controller/ChatController.java b/BackEnd/src/main/java/springwebsocket/webchat/chat/controller/ChatController.java similarity index 100% rename from BackEnd/webChat/src/main/java/springwebsocket/webchat/chat/controller/ChatController.java rename to BackEnd/src/main/java/springwebsocket/webchat/chat/controller/ChatController.java diff --git a/BackEnd/webChat/src/main/java/springwebsocket/webchat/chat/dto/ChatRoom.java b/BackEnd/src/main/java/springwebsocket/webchat/chat/dto/ChatRoom.java similarity index 100% rename from BackEnd/webChat/src/main/java/springwebsocket/webchat/chat/dto/ChatRoom.java rename to BackEnd/src/main/java/springwebsocket/webchat/chat/dto/ChatRoom.java diff --git a/BackEnd/webChat/src/main/java/springwebsocket/webchat/chat/entity/ChatDAO.java b/BackEnd/src/main/java/springwebsocket/webchat/chat/entity/ChatDAO.java similarity index 100% rename from BackEnd/webChat/src/main/java/springwebsocket/webchat/chat/entity/ChatDAO.java rename to BackEnd/src/main/java/springwebsocket/webchat/chat/entity/ChatDAO.java diff --git a/BackEnd/webChat/src/main/java/springwebsocket/webchat/chat/handler/WebSocketChatHandler.java b/BackEnd/src/main/java/springwebsocket/webchat/chat/handler/WebSocketChatHandler.java similarity index 100% rename from BackEnd/webChat/src/main/java/springwebsocket/webchat/chat/handler/WebSocketChatHandler.java rename to BackEnd/src/main/java/springwebsocket/webchat/chat/handler/WebSocketChatHandler.java diff --git a/BackEnd/webChat/src/main/java/springwebsocket/webchat/chat/service/ChatService.java b/BackEnd/src/main/java/springwebsocket/webchat/chat/service/ChatService.java similarity index 100% rename from BackEnd/webChat/src/main/java/springwebsocket/webchat/chat/service/ChatService.java rename to BackEnd/src/main/java/springwebsocket/webchat/chat/service/ChatService.java diff --git a/BackEnd/webChat/src/main/java/springwebsocket/webchat/config/ChatConfig.java b/BackEnd/src/main/java/springwebsocket/webchat/config/ChatConfig.java similarity index 100% rename from BackEnd/webChat/src/main/java/springwebsocket/webchat/config/ChatConfig.java rename to BackEnd/src/main/java/springwebsocket/webchat/config/ChatConfig.java diff --git a/BackEnd/webChat/src/main/java/springwebsocket/webchat/config/FCMConfig.java b/BackEnd/src/main/java/springwebsocket/webchat/config/FCMConfig.java similarity index 100% rename from BackEnd/webChat/src/main/java/springwebsocket/webchat/config/FCMConfig.java rename to BackEnd/src/main/java/springwebsocket/webchat/config/FCMConfig.java diff --git a/BackEnd/webChat/src/main/java/springwebsocket/webchat/config/FriendshipConfig.java b/BackEnd/src/main/java/springwebsocket/webchat/config/FriendshipConfig.java similarity index 100% rename from BackEnd/webChat/src/main/java/springwebsocket/webchat/config/FriendshipConfig.java rename to BackEnd/src/main/java/springwebsocket/webchat/config/FriendshipConfig.java diff --git a/BackEnd/webChat/src/main/java/springwebsocket/webchat/config/MemberConfig.java b/BackEnd/src/main/java/springwebsocket/webchat/config/MemberConfig.java similarity index 100% rename from BackEnd/webChat/src/main/java/springwebsocket/webchat/config/MemberConfig.java rename to BackEnd/src/main/java/springwebsocket/webchat/config/MemberConfig.java diff --git a/BackEnd/webChat/src/main/java/springwebsocket/webchat/config/SwaggerConfig.java b/BackEnd/src/main/java/springwebsocket/webchat/config/SwaggerConfig.java similarity index 100% rename from BackEnd/webChat/src/main/java/springwebsocket/webchat/config/SwaggerConfig.java rename to BackEnd/src/main/java/springwebsocket/webchat/config/SwaggerConfig.java diff --git a/BackEnd/webChat/src/main/java/springwebsocket/webchat/error/ErrorCode.java b/BackEnd/src/main/java/springwebsocket/webchat/error/ErrorCode.java similarity index 100% rename from BackEnd/webChat/src/main/java/springwebsocket/webchat/error/ErrorCode.java rename to BackEnd/src/main/java/springwebsocket/webchat/error/ErrorCode.java diff --git a/BackEnd/webChat/src/main/java/springwebsocket/webchat/error/exception/ApplicationException.java b/BackEnd/src/main/java/springwebsocket/webchat/error/exception/ApplicationException.java similarity index 100% rename from BackEnd/webChat/src/main/java/springwebsocket/webchat/error/exception/ApplicationException.java rename to BackEnd/src/main/java/springwebsocket/webchat/error/exception/ApplicationException.java diff --git a/BackEnd/webChat/src/main/java/springwebsocket/webchat/error/exception/InvalidValueException.java b/BackEnd/src/main/java/springwebsocket/webchat/error/exception/InvalidValueException.java similarity index 100% rename from BackEnd/webChat/src/main/java/springwebsocket/webchat/error/exception/InvalidValueException.java rename to BackEnd/src/main/java/springwebsocket/webchat/error/exception/InvalidValueException.java diff --git a/BackEnd/webChat/src/main/java/springwebsocket/webchat/fcm/controller/FCMNotificationController.java b/BackEnd/src/main/java/springwebsocket/webchat/fcm/controller/FCMNotificationController.java similarity index 100% rename from BackEnd/webChat/src/main/java/springwebsocket/webchat/fcm/controller/FCMNotificationController.java rename to BackEnd/src/main/java/springwebsocket/webchat/fcm/controller/FCMNotificationController.java diff --git a/BackEnd/webChat/src/main/java/springwebsocket/webchat/fcm/dto/FCMNotificationRequestDto.java b/BackEnd/src/main/java/springwebsocket/webchat/fcm/dto/FCMNotificationRequestDto.java similarity index 100% rename from BackEnd/webChat/src/main/java/springwebsocket/webchat/fcm/dto/FCMNotificationRequestDto.java rename to BackEnd/src/main/java/springwebsocket/webchat/fcm/dto/FCMNotificationRequestDto.java diff --git a/BackEnd/webChat/src/main/java/springwebsocket/webchat/fcm/service/FCMNotificationService.java b/BackEnd/src/main/java/springwebsocket/webchat/fcm/service/FCMNotificationService.java similarity index 100% rename from BackEnd/webChat/src/main/java/springwebsocket/webchat/fcm/service/FCMNotificationService.java rename to BackEnd/src/main/java/springwebsocket/webchat/fcm/service/FCMNotificationService.java diff --git a/BackEnd/webChat/src/main/java/springwebsocket/webchat/friend/controller/FriendshipController.java b/BackEnd/src/main/java/springwebsocket/webchat/friend/controller/FriendshipController.java similarity index 100% rename from BackEnd/webChat/src/main/java/springwebsocket/webchat/friend/controller/FriendshipController.java rename to BackEnd/src/main/java/springwebsocket/webchat/friend/controller/FriendshipController.java diff --git a/BackEnd/webChat/src/main/java/springwebsocket/webchat/friend/dto/UserIdRequest.java b/BackEnd/src/main/java/springwebsocket/webchat/friend/dto/UserIdRequest.java similarity index 100% rename from BackEnd/webChat/src/main/java/springwebsocket/webchat/friend/dto/UserIdRequest.java rename to BackEnd/src/main/java/springwebsocket/webchat/friend/dto/UserIdRequest.java diff --git a/BackEnd/webChat/src/main/java/springwebsocket/webchat/friend/entity/Friendship.java b/BackEnd/src/main/java/springwebsocket/webchat/friend/entity/Friendship.java similarity index 100% rename from BackEnd/webChat/src/main/java/springwebsocket/webchat/friend/entity/Friendship.java rename to BackEnd/src/main/java/springwebsocket/webchat/friend/entity/Friendship.java diff --git a/BackEnd/webChat/src/main/java/springwebsocket/webchat/friend/repository/FriendshipRepository.java b/BackEnd/src/main/java/springwebsocket/webchat/friend/repository/FriendshipRepository.java similarity index 100% rename from BackEnd/webChat/src/main/java/springwebsocket/webchat/friend/repository/FriendshipRepository.java rename to BackEnd/src/main/java/springwebsocket/webchat/friend/repository/FriendshipRepository.java diff --git a/BackEnd/webChat/src/main/java/springwebsocket/webchat/friend/repository/JpaFriendshipRepository.java b/BackEnd/src/main/java/springwebsocket/webchat/friend/repository/JpaFriendshipRepository.java similarity index 100% rename from BackEnd/webChat/src/main/java/springwebsocket/webchat/friend/repository/JpaFriendshipRepository.java rename to BackEnd/src/main/java/springwebsocket/webchat/friend/repository/JpaFriendshipRepository.java diff --git a/BackEnd/webChat/src/main/java/springwebsocket/webchat/friend/repository/springdata/SpringDataJpaFriendshipRepository.java b/BackEnd/src/main/java/springwebsocket/webchat/friend/repository/springdata/SpringDataJpaFriendshipRepository.java similarity index 100% rename from BackEnd/webChat/src/main/java/springwebsocket/webchat/friend/repository/springdata/SpringDataJpaFriendshipRepository.java rename to BackEnd/src/main/java/springwebsocket/webchat/friend/repository/springdata/SpringDataJpaFriendshipRepository.java diff --git a/BackEnd/webChat/src/main/java/springwebsocket/webchat/friend/service/FriendshipService.java b/BackEnd/src/main/java/springwebsocket/webchat/friend/service/FriendshipService.java similarity index 100% rename from BackEnd/webChat/src/main/java/springwebsocket/webchat/friend/service/FriendshipService.java rename to BackEnd/src/main/java/springwebsocket/webchat/friend/service/FriendshipService.java diff --git a/BackEnd/webChat/src/main/java/springwebsocket/webchat/friend/service/FriendshipServiceV1.java b/BackEnd/src/main/java/springwebsocket/webchat/friend/service/FriendshipServiceV1.java similarity index 100% rename from BackEnd/webChat/src/main/java/springwebsocket/webchat/friend/service/FriendshipServiceV1.java rename to BackEnd/src/main/java/springwebsocket/webchat/friend/service/FriendshipServiceV1.java diff --git a/BackEnd/webChat/src/main/java/springwebsocket/webchat/member/controller/ExceptionController.java b/BackEnd/src/main/java/springwebsocket/webchat/member/controller/ExceptionController.java similarity index 100% rename from BackEnd/webChat/src/main/java/springwebsocket/webchat/member/controller/ExceptionController.java rename to BackEnd/src/main/java/springwebsocket/webchat/member/controller/ExceptionController.java diff --git a/BackEnd/webChat/src/main/java/springwebsocket/webchat/member/controller/MemberController.java b/BackEnd/src/main/java/springwebsocket/webchat/member/controller/MemberController.java similarity index 100% rename from BackEnd/webChat/src/main/java/springwebsocket/webchat/member/controller/MemberController.java rename to BackEnd/src/main/java/springwebsocket/webchat/member/controller/MemberController.java diff --git a/BackEnd/webChat/src/main/java/springwebsocket/webchat/member/dto/MemberUpdataDto.java b/BackEnd/src/main/java/springwebsocket/webchat/member/dto/MemberUpdataDto.java similarity index 100% rename from BackEnd/webChat/src/main/java/springwebsocket/webchat/member/dto/MemberUpdataDto.java rename to BackEnd/src/main/java/springwebsocket/webchat/member/dto/MemberUpdataDto.java diff --git a/BackEnd/webChat/src/main/java/springwebsocket/webchat/member/dto/request/LoginRequest.java b/BackEnd/src/main/java/springwebsocket/webchat/member/dto/request/LoginRequest.java similarity index 100% rename from BackEnd/webChat/src/main/java/springwebsocket/webchat/member/dto/request/LoginRequest.java rename to BackEnd/src/main/java/springwebsocket/webchat/member/dto/request/LoginRequest.java diff --git a/BackEnd/webChat/src/main/java/springwebsocket/webchat/member/dto/request/SignUpRequest.java b/BackEnd/src/main/java/springwebsocket/webchat/member/dto/request/SignUpRequest.java similarity index 100% rename from BackEnd/webChat/src/main/java/springwebsocket/webchat/member/dto/request/SignUpRequest.java rename to BackEnd/src/main/java/springwebsocket/webchat/member/dto/request/SignUpRequest.java diff --git a/BackEnd/webChat/src/main/java/springwebsocket/webchat/member/dto/response/UserResponse.java b/BackEnd/src/main/java/springwebsocket/webchat/member/dto/response/UserResponse.java similarity index 100% rename from BackEnd/webChat/src/main/java/springwebsocket/webchat/member/dto/response/UserResponse.java rename to BackEnd/src/main/java/springwebsocket/webchat/member/dto/response/UserResponse.java diff --git a/BackEnd/webChat/src/main/java/springwebsocket/webchat/member/entity/Member.java b/BackEnd/src/main/java/springwebsocket/webchat/member/entity/Member.java similarity index 100% rename from BackEnd/webChat/src/main/java/springwebsocket/webchat/member/entity/Member.java rename to BackEnd/src/main/java/springwebsocket/webchat/member/entity/Member.java diff --git a/BackEnd/webChat/src/main/java/springwebsocket/webchat/member/exception/EmailDuplicatedException.java b/BackEnd/src/main/java/springwebsocket/webchat/member/exception/EmailDuplicatedException.java similarity index 100% rename from BackEnd/webChat/src/main/java/springwebsocket/webchat/member/exception/EmailDuplicatedException.java rename to BackEnd/src/main/java/springwebsocket/webchat/member/exception/EmailDuplicatedException.java diff --git a/BackEnd/webChat/src/main/java/springwebsocket/webchat/member/exception/response/ExceptionResponse.java b/BackEnd/src/main/java/springwebsocket/webchat/member/exception/response/ExceptionResponse.java similarity index 100% rename from BackEnd/webChat/src/main/java/springwebsocket/webchat/member/exception/response/ExceptionResponse.java rename to BackEnd/src/main/java/springwebsocket/webchat/member/exception/response/ExceptionResponse.java diff --git a/BackEnd/webChat/src/main/java/springwebsocket/webchat/member/repository/JpaMemberRepository.java b/BackEnd/src/main/java/springwebsocket/webchat/member/repository/JpaMemberRepository.java similarity index 100% rename from BackEnd/webChat/src/main/java/springwebsocket/webchat/member/repository/JpaMemberRepository.java rename to BackEnd/src/main/java/springwebsocket/webchat/member/repository/JpaMemberRepository.java diff --git a/BackEnd/webChat/src/main/java/springwebsocket/webchat/member/repository/MemberRepository.java b/BackEnd/src/main/java/springwebsocket/webchat/member/repository/MemberRepository.java similarity index 100% rename from BackEnd/webChat/src/main/java/springwebsocket/webchat/member/repository/MemberRepository.java rename to BackEnd/src/main/java/springwebsocket/webchat/member/repository/MemberRepository.java diff --git a/BackEnd/webChat/src/main/java/springwebsocket/webchat/member/repository/springdata/SpringDataJpaMemberRepository.java b/BackEnd/src/main/java/springwebsocket/webchat/member/repository/springdata/SpringDataJpaMemberRepository.java similarity index 100% rename from BackEnd/webChat/src/main/java/springwebsocket/webchat/member/repository/springdata/SpringDataJpaMemberRepository.java rename to BackEnd/src/main/java/springwebsocket/webchat/member/repository/springdata/SpringDataJpaMemberRepository.java diff --git a/BackEnd/webChat/src/main/java/springwebsocket/webchat/member/service/MemberService.java b/BackEnd/src/main/java/springwebsocket/webchat/member/service/MemberService.java similarity index 100% rename from BackEnd/webChat/src/main/java/springwebsocket/webchat/member/service/MemberService.java rename to BackEnd/src/main/java/springwebsocket/webchat/member/service/MemberService.java diff --git a/BackEnd/webChat/src/main/java/springwebsocket/webchat/member/service/MemberServiceV1.java b/BackEnd/src/main/java/springwebsocket/webchat/member/service/MemberServiceV1.java similarity index 100% rename from BackEnd/webChat/src/main/java/springwebsocket/webchat/member/service/MemberServiceV1.java rename to BackEnd/src/main/java/springwebsocket/webchat/member/service/MemberServiceV1.java diff --git a/BackEnd/webChat/src/main/java/springwebsocket/webchat/member/service/MemberServiceV2.java b/BackEnd/src/main/java/springwebsocket/webchat/member/service/MemberServiceV2.java similarity index 100% rename from BackEnd/webChat/src/main/java/springwebsocket/webchat/member/service/MemberServiceV2.java rename to BackEnd/src/main/java/springwebsocket/webchat/member/service/MemberServiceV2.java diff --git a/BackEnd/webChat/src/main/java/springwebsocket/webchat/member/service/MemberServiceV3.java b/BackEnd/src/main/java/springwebsocket/webchat/member/service/MemberServiceV3.java similarity index 100% rename from BackEnd/webChat/src/main/java/springwebsocket/webchat/member/service/MemberServiceV3.java rename to BackEnd/src/main/java/springwebsocket/webchat/member/service/MemberServiceV3.java diff --git a/BackEnd/webChat/src/main/java/springwebsocket/webchat/naver/TranslateController.java b/BackEnd/src/main/java/springwebsocket/webchat/naver/TranslateController.java similarity index 100% rename from BackEnd/webChat/src/main/java/springwebsocket/webchat/naver/TranslateController.java rename to BackEnd/src/main/java/springwebsocket/webchat/naver/TranslateController.java diff --git a/BackEnd/webChat/src/main/java/springwebsocket/webchat/naver/TranslateResponseDto.java b/BackEnd/src/main/java/springwebsocket/webchat/naver/TranslateResponseDto.java similarity index 100% rename from BackEnd/webChat/src/main/java/springwebsocket/webchat/naver/TranslateResponseDto.java rename to BackEnd/src/main/java/springwebsocket/webchat/naver/TranslateResponseDto.java diff --git a/BackEnd/webChat/src/main/java/springwebsocket/webchat/naver/TranslateService.java b/BackEnd/src/main/java/springwebsocket/webchat/naver/TranslateService.java similarity index 100% rename from BackEnd/webChat/src/main/java/springwebsocket/webchat/naver/TranslateService.java rename to BackEnd/src/main/java/springwebsocket/webchat/naver/TranslateService.java diff --git a/BackEnd/webChat/src/main/java/springwebsocket/webchat/rtc/User.java b/BackEnd/src/main/java/springwebsocket/webchat/rtc/User.java similarity index 100% rename from BackEnd/webChat/src/main/java/springwebsocket/webchat/rtc/User.java rename to BackEnd/src/main/java/springwebsocket/webchat/rtc/User.java diff --git a/BackEnd/webChat/src/main/java/springwebsocket/webchat/rtc/config/WebRtcConfig.java b/BackEnd/src/main/java/springwebsocket/webchat/rtc/config/WebRtcConfig.java similarity index 100% rename from BackEnd/webChat/src/main/java/springwebsocket/webchat/rtc/config/WebRtcConfig.java rename to BackEnd/src/main/java/springwebsocket/webchat/rtc/config/WebRtcConfig.java diff --git a/BackEnd/webChat/src/main/java/springwebsocket/webchat/rtc/handler/SignalHandler.java b/BackEnd/src/main/java/springwebsocket/webchat/rtc/handler/SignalHandler.java similarity index 99% rename from BackEnd/webChat/src/main/java/springwebsocket/webchat/rtc/handler/SignalHandler.java rename to BackEnd/src/main/java/springwebsocket/webchat/rtc/handler/SignalHandler.java index 6aa4eb2..9f4750a 100644 --- a/BackEnd/webChat/src/main/java/springwebsocket/webchat/rtc/handler/SignalHandler.java +++ b/BackEnd/src/main/java/springwebsocket/webchat/rtc/handler/SignalHandler.java @@ -167,7 +167,7 @@ private void handleIceCandidate(WebSocketSession session, JSONObject data) throw } - private Optional findUser(String username) { + private Optional findUser(String username) { return users.stream() .filter(user -> user.getName() != null && user.getName().equals(username)) .findFirst(); diff --git a/BackEnd/webChat/src/main/resources/application-develop.yml b/BackEnd/src/main/resources/application-develop.yml similarity index 83% rename from BackEnd/webChat/src/main/resources/application-develop.yml rename to BackEnd/src/main/resources/application-develop.yml index 4bb21a6..96abd0d 100644 --- a/BackEnd/webChat/src/main/resources/application-develop.yml +++ b/BackEnd/src/main/resources/application-develop.yml @@ -20,7 +20,7 @@ spring: datasource: driver-class-name: com.mysql.cj.jdbc.Driver url: ${MYSQL_DATABASE_URL} - username: ${MYSQL_DATABASE_USERNAME} + username: ${MYSQL_DATABASEUSER_NAME} password: ${MYSQL_DATABASE_PASSWORD} jpa: show-sql: true @@ -29,5 +29,8 @@ spring: properties: hibernate: format_sql: true + naver : + client-id : ${NAVER_ID} + client-secret : ${NAVER_SECRET} profiles: - include: SECRET-KEY \ No newline at end of file + include: SECRET-KEY diff --git a/BackEnd/webChat/src/test/resources/application.yml b/BackEnd/src/main/resources/application.yml similarity index 86% rename from BackEnd/webChat/src/test/resources/application.yml rename to BackEnd/src/main/resources/application.yml index 147b3cb..42bfb6c 100644 --- a/BackEnd/webChat/src/test/resources/application.yml +++ b/BackEnd/src/main/resources/application.yml @@ -20,8 +20,8 @@ spring: datasource: driver-class-name: com.mysql.cj.jdbc.Driver url: jdbc:mysql://localhost:3306/JPA?characterEncoding=UTF-8&serverTimezone=UTC - username: ${mysql-id} - password: ${mysql-passwd} + username: ${MYSQL_ID} + password: ${MYSQL_PASSWORD} jpa: show-sql: true hibernate: @@ -30,7 +30,7 @@ spring: hibernate: format_sql: true naver : - client-id : ${naver-id} - client-secret : ${naver-secret} + client-id : ${NAVER_ID} + client-secret : ${NAVER_SECRET} profiles: include: SECRET-KEY diff --git a/BackEnd/webChat/src/main/resources/static/basic/peerConfig.js b/BackEnd/src/main/resources/static/basic/peerConfig.js similarity index 100% rename from BackEnd/webChat/src/main/resources/static/basic/peerConfig.js rename to BackEnd/src/main/resources/static/basic/peerConfig.js diff --git a/BackEnd/webChat/src/main/resources/static/index.html b/BackEnd/src/main/resources/static/index.html similarity index 100% rename from BackEnd/webChat/src/main/resources/static/index.html rename to BackEnd/src/main/resources/static/index.html diff --git a/BackEnd/webChat/src/main/resources/templates/webRTC.html b/BackEnd/src/main/resources/templates/webRTC.html similarity index 100% rename from BackEnd/webChat/src/main/resources/templates/webRTC.html rename to BackEnd/src/main/resources/templates/webRTC.html diff --git a/BackEnd/webChat/src/test/java/springwebsocket/webchat/WebChatApplicationTests.java b/BackEnd/src/test/java/springwebsocket/webchat/WebChatApplicationTests.java similarity index 100% rename from BackEnd/webChat/src/test/java/springwebsocket/webchat/WebChatApplicationTests.java rename to BackEnd/src/test/java/springwebsocket/webchat/WebChatApplicationTests.java diff --git a/BackEnd/webChat/src/test/java/springwebsocket/webchat/repository/JpaFriendshipRepositoryTest.java b/BackEnd/src/test/java/springwebsocket/webchat/repository/JpaFriendshipRepositoryTest.java similarity index 100% rename from BackEnd/webChat/src/test/java/springwebsocket/webchat/repository/JpaFriendshipRepositoryTest.java rename to BackEnd/src/test/java/springwebsocket/webchat/repository/JpaFriendshipRepositoryTest.java diff --git a/BackEnd/webChat/src/test/java/springwebsocket/webchat/repository/JpaUserRepositoryTest.java b/BackEnd/src/test/java/springwebsocket/webchat/repository/JpaUserRepositoryTest.java similarity index 100% rename from BackEnd/webChat/src/test/java/springwebsocket/webchat/repository/JpaUserRepositoryTest.java rename to BackEnd/src/test/java/springwebsocket/webchat/repository/JpaUserRepositoryTest.java diff --git a/BackEnd/src/test/resources/application-SECRET-KEY.properties b/BackEnd/src/test/resources/application-SECRET-KEY.properties new file mode 100644 index 0000000..bdc1c73 --- /dev/null +++ b/BackEnd/src/test/resources/application-SECRET-KEY.properties @@ -0,0 +1,10 @@ +MYSQL_DATABASE_URL = jdbc:mysql://15.165.160.78:3306/ringodb?characterEncoding=UTF-8&serverTimezone=UTC +MYSQL_DATABASE_USERNAME = 4k +MYSQL_DATABASE_PASSWORD = qaz7410 + +mysql-id = springDB +mysql-passwd = + + +naver-id = t5z0hs5paa +naver-secret = 2lfbctxyyn4DN28rkDfHTLFHuqohLmD8qwZLHe75 \ No newline at end of file diff --git a/BackEnd/webChat/src/main/resources/application.yml b/BackEnd/src/test/resources/application.yml similarity index 100% rename from BackEnd/webChat/src/main/resources/application.yml rename to BackEnd/src/test/resources/application.yml diff --git a/BackEnd/webChat/README.md b/BackEnd/webChat/README.md deleted file mode 100644 index c16e08e..0000000 --- a/BackEnd/webChat/README.md +++ /dev/null @@ -1,221 +0,0 @@ -## 도커파일 실행 하는법 - -``` -docker build -t [username]/[image name]:tag -``` - -``` -docker tag [username]/[image name]:tag [username]/[image name]:latest -``` - - -Jenkins CI/CD 구축 참고 - -https://velog.io/@haeny01/AWS-Jenkins%EB%A5%BC-%ED%99%9C%EC%9A%A9%ED%95%9C-Docker-x-SpringBoot-CICD-%EA%B5%AC%EC%B6%95#3-publish-over-ssh-%ED%94%8C%EB%9F%AC%EA%B7%B8%EC%9D%B8-%EC%84%A4%EC%A0%95 - -2.Jenkins 설치 및 실행 확인 에러 -https://rainbound.tistory.com/entry/Ubuntu-jenkins-%EC%84%A4%EC%B9%98 - -# Jenkins x Github 연동 - -1. SSH 키 생성 - -``` -$ sudo mkdir /var/lib/jenkins/.ssh -$ sudo ssh-keygen -t rsa -f /var/lib/jenkins/.ssh/jtogkey -``` - -2. github에 Deploy key 등록하기 - -``` -$ cat /var/lib/jenkins/.ssh/jtogkey.pub -``` - -3. Jenkins Credential 등록하기 - -``` -$ sudo cat /var/lib/jenkins/.ssh/jtogkey -``` -``` ------BEGIN OPENSSH PRIVATE KEY----- -... -... 이와 같은 형태의 key가 private key 입니다 ... -... ------END OPENSSH PRIVATE KEY----- -``` - -# Jenkins x 배포서버 SSH연결 - -1. SSH 키 생성 -``` -$ sudo ssh-keygen -t rsa -C "jtoekey" -m PEM -P "" -f /var/lib/jenkins/.ssh/jtoekey -// "jtoekey" 여기는 주석 key의 명칭 -``` - -2. 배포서버 PublicKey 등록 -``` -// 구축 서버 -$ sudo cat /var/lib/jenkins/.ssh/jtoekey.pub - -// 배포 서버 -$ vi .ssh/authorized_keys -``` -위에서 생성했던 jtoekey를 배포서버인 인스턴스의 .ssh/authorized_keys 파일에 추가 - -3. Publish Over SSH 플러그인 설정 - -- Jenkins 플러그인에서 publish over ssh 설치 - -- Jenkins 관리 > 시스템 관리 아래 Publish Over SSH 영역의 고급 버튼을 눌러 확장하여 설정 - -### 여기서 이슈 발생 -sheel에서 [ubuntu@ip-private ipv4 주소] 일 때, - -- Path to Key 는 위에서 생성해준 private key 경로를 넣어주세요. - -` -/var/lib/jenkins/.ssh/jtoekey -` -- Key 는 Private key 파일안의 내용을 복사 붙여넣기 해주세요. - -` - $ sudo cat /var/lib/jenkins/.ssh/jtoekey -` - -- Name 는 접속할 ssh 서버의 이름을 지어주세요. - -` -그냥 접속할 이름 아무거나 써도 됌 -` -- Hostname 는 접속할 인스턴스의 주소를 넣어주세요. - -` -ec2 인스턴스 private Ipv4 주소 -` -- Username 는 접속할 유저명을 넣어주세요. - -` -ubuntu -` - - -# Jenkins x Docker 설정 - -https://velog.io/@haeny01/AWS-EC2-X-Docker - -apt 업데이트 - -``` -$ sudo apt update -``` - -apt HTTPS 설정 - -``` -$ sudo apt install apt-transport-https ca-certificates curl software-properties-common -``` - -도커 GPG키 등록 - -``` -$ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - -``` - -### apt에 도커 Repository 설정 - -1. 도커 Repository 추가 - -``` -$ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu focal stable" -``` - -2. apt 업데이트 - -``` -$ sudo apt update -``` - -3. 우분투 Repo 대신 도커 Repo로 설치하는지 확인 - -``` -$ apt-cache policy docker-ce -``` - -# 도커 설치 - -- 도커 설치 - -``` -$ sudo apt install docker-ce -``` - -- 도커 확인 - -``` -$ sudo systemctl status docker -``` -Active상태가 running 이면 실행중 -``` -ubuntu@ip-172-31-17-241:~$ sudo systemctl status docker -● docker.service - Docker Application Container Engine -Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled) -Active: active (running) since Sun 2024-01-21 12:04:08 UTC; 46s ago -TriggeredBy: ● docker.socket -Docs: https://docs.docker.com -Main PID: 11459 (dockerd) -Tasks: 9 -Memory: 35.2M -CPU: 412ms -CGroup: /system.slice/docker.service -└─11459 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock -``` - -1. Docker 그룹에 젠킨스 추가 - -``` -// 추가 -$ sudo usermod -aG docker jenkins -$ su - jenkins - -// 확인 -$ id -nG -jenkins docker -``` - -``` -su - jenkins -Password: -su: Authentication failure -``` - -## 우분투 22버전부터 패스워드 생성 하고 입장해야함. - -인증이 안되면 -``` -$ sudo passwd root -> New password: -> Retype new password: -> passwd: password updated successfully - -$ sudo passwd jenkins -New password: -Retype new password: -passwd: password updated successfully -``` - - -2. docker.sock 권한 변경 - -``` -$ sudo chmod 666 /var/run/docker.sock -``` - -3. Jenkins에서 Docker login - -``` -$ sudo su - jenkins -$ docker login -``` -도커허브의 아이디와 비밀번호 입력 - -# Jenkins Item \ No newline at end of file diff --git a/BackEnd/webChat/src/test/resources/application-SECRET-KEY.properties b/BackEnd/webChat/src/test/resources/application-SECRET-KEY.properties deleted file mode 100644 index 7a63c27..0000000 --- a/BackEnd/webChat/src/test/resources/application-SECRET-KEY.properties +++ /dev/null @@ -1,6 +0,0 @@ -MYSQL_DATABASE_URL = jdbc:mysql://15.165.160.78:3306/JPA?characterEncoding=UTF-8&serverTimezone=UTC -MYSQL_DATABASE_USERNAME = 4k -MYSQL_DATABASE_PASSWORD = qaz7410 - -mysql-id = springDB -mysql-passwd =