Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
104 commits
Select commit Hold shift + click to select a range
cec5d7c
feat: Initialize .gitignore
May 3, 2021
e97d626
feat: 스프링 초기화를 함
malaheaven May 3, 2021
04deaeb
Merge pull request #3 from ghojeong/feature/be/2
May 3, 2021
d5d1b6e
feat: 로그인 용 React 앱 초기화
May 3, 2021
5584889
feat: react-router 설정
May 3, 2021
e07f62a
feat: 간단한 로그인 페이지 템플릿 작성
May 3, 2021
59452a7
feat: 간단한 로그인 예제 구현
May 3, 2021
7f98314
feat: react-google-login 모듈 설치
May 3, 2021
6abe0b6
feat: notistack 으로 alert 를 예쁘게 변경
May 3, 2021
23b566d
fix: 로깅이 되지 않던 버그 수정
May 4, 2021
dce9136
Merge pull request #5 from ghojeong/feature/be/4
malaheaven May 4, 2021
54ee500
feat: mysql 도커화 성공
May 4, 2021
e91d041
feat: nginx 도커화 성공
May 4, 2021
0f10bac
docs: 도커와 관련된 README 작성
May 4, 2021
90eac60
feat: GET 에 대한 Controller, Service, Dto 구현
malaheaven May 4, 2021
596acdb
refactor: dto 안의 멤버 모두 private final이 될 수 있도록 변경 및 setter 메서드 삭제
malaheaven May 4, 2021
2c12e92
refactor: 배열이 아닌 List로 변경
malaheaven May 4, 2021
917390e
Merge pull request #15 from ghojeong/feature/be/8
May 4, 2021
439d9c7
Merge pull request #14 from ghojeong/feature/be/7
May 4, 2021
f34d1d1
feat: Swagger 로 API 문서화
May 4, 2021
1886cbe
docs: 배포 관련 README 설명 보완
May 5, 2021
8244ce4
docs: Nginx 설정 관련 README 설명 보완
May 5, 2021
4a77b65
feat: swagger 문서로 redirect 하는 Controller 작성
May 5, 2021
8ce173a
docs: spring 프로세스를 죽이는 커멘드 작성
May 5, 2021
7363119
docs: sdkman 에 관한 설명 추가
May 6, 2021
f712d05
feat: 배포 스크립트 작성
May 6, 2021
8cf39c5
chore: fix typo
May 6, 2021
d30b3a8
chore: 서버 로그관련 파일을 gitignore 처리함
May 6, 2021
b340d24
docs: progress id 에 관한 설명 추가
May 6, 2021
cbf7838
Merge pull request #17 from ghojeong/feature/be/16
malaheaven May 6, 2021
e9ec9b1
Add domain/Match
May 6, 2021
e416b8d
feat: dto를 기반으로 domain 및 repository 구현
malaheaven May 6, 2021
1e69583
Merge pull request #20 from ghojeong/feature/be/18
May 6, 2021
d35c81e
chore: Rename deploy.sh to deploy-local.sh
May 6, 2021
97819eb
feat: deploy-remote.sh 작성
May 6, 2021
d605ac4
Merge pull request #24 from ghojeong/feature/be/23
malaheaven May 7, 2021
e269a2c
test: 참가가능한 게임 목록에 대한 스냅샷 테스트 작성
May 7, 2021
aa2fda4
refactor: 홈팀과 어웨이팀의 테스트 분리
malaheaven May 7, 2021
0f1dfe1
test: 미래에 구현해야할 테스트 시나리오 주석으로 작성
malaheaven May 7, 2021
fa3b16e
test: 미래에 구현해야할 테스트 주석 수정
malaheaven May 7, 2021
c59121e
feat: inningInfoDto 및 inningInfo 도메인 추가, MatchInfoDto 수정
malaheaven May 7, 2021
56e5e1b
test: 서비스 레이어에서의 인수 테스트 작성
malaheaven May 7, 2021
8c0e95a
test: 첫 이닝에서 hit가 나왔을 경우에 대한 스냅샷 테스트 pitcher의 hit(피안타)와 better의 평균에 대…
malaheaven May 8, 2021
aba8c44
Merge pull request #32 from ghojeong/feature/be/25
May 9, 2021
d19076d
refactor: Batter 와 Pitcher 가 Player 를 상속 받도록 함
May 9, 2021
9a0761d
refactor: MatchRepostiroy 를 BaseballRepository 로 통합
May 9, 2021
b8028f0
refactor: GameInfoRepostiroy 를 BaseballRepository 와 통합
May 9, 2021
413f0bd
refactor: MatchInfoRepostiroy 를 BaseballRepository 와 통합
May 9, 2021
d93de26
refactor: Service 에서 teamId 파라미터 제거
May 9, 2021
f1f4b85
refactor: awayTeam 과 homeTeam 을 Teams 클래스로 묶음
May 9, 2021
d9737ff
feat: 랜덤하게 BALL, STRIKE, HIT 이 발생하는 기능 구현
May 9, 2021
321619f
chore: 잘못된 목업 데이터 수정
May 9, 2021
13637ee
chore: 테스트 디렉토리와 java 디렉토리가 갖도록 수정
May 9, 2021
c7da6b4
fix: userOffense 계산이 잘못 되는 버그 수정
May 9, 2021
3dbb32d
refactor: pitchResult 로 인한 상태변화의 책임을 Match 클래스에서 분리
May 10, 2021
6aa9434
Merge pull request #40 from ghojeong/feature/be/22
malaheaven May 10, 2021
2640308
chore: 스크립트에서 nohup 제거
May 10, 2021
9cecc08
feat: Pitcher 를 TDD 로 구현
May 10, 2021
54d2b5d
feat: ScoreDto 요구사항 변경 반영
May 10, 2021
96837df
feat: 모바일팀의 요구사항 대로 baseOnBalls, Innings의 타입 float로 변경
malaheaven May 10, 2021
7bc372a
fix: strike가 1인경우 innings은 0으로 표시, strike가 9일때 innings는 1로 표시
malaheaven May 10, 2021
4e78f89
refactor: PitcherResult -> PlayResult로 이름 변경
malaheaven May 10, 2021
66333cf
feat: Better를 TDD로 구현
malaheaven May 10, 2021
18e23aa
fix: 모바일팀에서 baseOnBalls에 대한 요구한 내용 float에서 integer로 적용
malaheaven May 10, 2021
b00001a
test: 모바일팀의 요구사항 baseOnBalls에 대한 요구한 내용 float에서 integer로 적용에 대한 관련 테스…
malaheaven May 10, 2021
658c32c
test: 배터의 아웃이 3번이 나는 경우 테스트 추가
malaheaven May 10, 2021
734ec1a
test: MatchInfoTest 작성
malaheaven May 10, 2021
6aff006
feat: Pitcher 와 Batter 가 변경가능하도록 유연성 확보
May 11, 2021
df35f56
refactor: matchInfo에서 hit에 대한 내용 변경 및 batterTest 수정
malaheaven May 11, 2021
df9d38b
feat: Teams 객체에 점수를 증가시키는 로직을 추가
May 11, 2021
e6ba2ea
fix: 경기에 참여 중이지 않은 better에게도 plateAppearances가 모두 1이 되는 경우 경기를 참여하는 b…
malaheaven May 11, 2021
bdbf05a
fix : batter가 항상 1이면 안된다
malaheaven May 11, 2021
2f93d5c
fix: userOffsense 값이 이상하게 나오던 버그 수정
May 11, 2021
8ebf142
fix: 스냅샷 테스트에 대한 내용 수정
malaheaven May 11, 2021
0581fa6
Merge pull request #48 from ghojeong/feature/be/33
ghojeong May 11, 2021
0c74b96
feat: 게임 진행을 위한 컨트롤러 추가
May 11, 2021
e5ce843
feat: Team Score 의 업데이트를 간단하게 구현, 검증 필요
May 11, 2021
a3c409a
test: 구현해야할 테스트들에 대한 DisplayName 작성
May 11, 2021
978904f
fix: 랜덤한 PlayResult 가 나오지 않던 버그 수정
May 11, 2021
47379a4
refactor: 복사본을 재할당하는 닌자 안티패턴 삭제
May 11, 2021
5a791cd
test: 테스트 코드 강화
May 11, 2021
f852df9
chore: 스크립트의 pem 키 정보 업데이트
May 11, 2021
afe36d5
refactor: 테스트 의도를 알기 쉽도록 메서드명 다시 작성
May 11, 2021
2da414f
fix: 만루가 아니라, 3루가 true 일 때 점수가 증가하도록 수정
May 12, 2021
2d2806e
feat: strike 와 ball 초기화 되어도, out 는 초기화 되지 않도록 버그 픽스
May 12, 2021
3a8588d
chore: 만루 라는 표현 삭제
May 12, 2021
d4b7cd4
fix: 공수가 바꾸었을 경우 초기화 되는 상태 변경
May 12, 2021
1192e98
Revert "fix: 공수가 바꾸었을 경우 초기화 되는 상태 변경"
May 12, 2021
85ed8a4
test: 테스트의 DisplayName 보완
May 12, 2021
c517d43
test: PlayResultTest 2가지 테스트 완료
malaheaven May 12, 2021
1a1ee77
test: TeamTest 5가지 상황 구현
malaheaven May 12, 2021
de9c9ce
feat: 첫 게임 시작할 때 awayTeam에 pushScore를 하도록 추가와 관련 테스트 작성
malaheaven May 12, 2021
7af2b49
refactor: SoftAssertions 적용
malaheaven May 12, 2021
babc112
test: MatchInfo 3가지 시나리오 테스트 추가
malaheaven May 12, 2021
1153a06
fix: MatchInfo에서 outCount StrikeCount가 3일 경우에만 outCount가 1이 올라가던 내용 S…
malaheaven May 12, 2021
3211c32
fix: strikeCount가 0일때도 outCount가 1이 증가하는 버그와, isThirdBase인덱스 3을 2로 수정
malaheaven May 12, 2021
4fd6a0a
fix: MatchInfo에서 알맞지 않는 단위 테스트 삭제
malaheaven May 12, 2021
aa699fa
test: MatchInfo에서 하던 테스트 옮기고, 11개의 테스트 추가
malaheaven May 12, 2021
53794b0
fix: 도메인 테스트를 통과하지 못하던 버그 수정
May 12, 2021
9c45b6b
test: 불필요한 스냅샷 테스트 삭제
May 13, 2021
35057d5
Merge pull request #50 from ghojeong/feature/be/35
malaheaven May 13, 2021
6666198
fix: 아웃 발생 후 strike 가 초기화 되지 않던 버그 수정
May 13, 2021
007206f
fix: hit 이 발생했을 때 strikeCount 가 초기화 되지 않던 버그 수정
May 13, 2021
5aeca15
Fix typo
ghojeong Jun 3, 2021
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
279 changes: 279 additions & 0 deletions be/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,279 @@

# Created by https://www.toptal.com/developers/gitignore/api/intellij+all,intellij+iml,intellij,java-web,java,gradle,maven
# Edit at https://www.toptal.com/developers/gitignore?templates=intellij+all,intellij+iml,intellij,java-web,java,gradle,maven

### Intellij ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf

# Generated files
.idea/**/contentModel.xml

# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml

# Gradle
.idea/**/gradle.xml
.idea/**/libraries

# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/artifacts
# .idea/compiler.xml
# .idea/jarRepositories.xml
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr

# CMake
cmake-build-*/

# Mongo Explorer plugin
.idea/**/mongoSettings.xml

# File-based project format
*.iws

# IntelliJ
out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Cursive Clojure plugin
.idea/replstate.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties

# Editor-based Rest Client
.idea/httpRequests

# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser

### Intellij Patch ###
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721

# *.iml
# modules.xml
# .idea/misc.xml
# *.ipr

# Sonarlint plugin
# https://plugins.jetbrains.com/plugin/7973-sonarlint
.idea/**/sonarlint/

# SonarQube Plugin
# https://plugins.jetbrains.com/plugin/7238-sonarqube-community-plugin
.idea/**/sonarIssues.xml

# Markdown Navigator plugin
# https://plugins.jetbrains.com/plugin/7896-markdown-navigator-enhanced
.idea/**/markdown-navigator.xml
.idea/**/markdown-navigator-enh.xml
.idea/**/markdown-navigator/

# Cache file creation bug
# See https://youtrack.jetbrains.com/issue/JBR-2257
.idea/$CACHE_FILE$

# CodeStream plugin
# https://plugins.jetbrains.com/plugin/12206-codestream
.idea/codestream.xml

### Intellij+all ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff

# Generated files

# Sensitive or high-churn files

# Gradle

# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/artifacts
# .idea/compiler.xml
# .idea/jarRepositories.xml
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr

# CMake

# Mongo Explorer plugin

# File-based project format

# IntelliJ

# mpeltonen/sbt-idea plugin

# JIRA plugin

# Cursive Clojure plugin

# Crashlytics plugin (for Android Studio and IntelliJ)

# Editor-based Rest Client

# Android studio 3.1+ serialized cache file

### Intellij+all Patch ###
# Ignores the whole .idea folder and all .iml files
# See https://github.com/joeblau/gitignore.io/issues/186 and https://github.com/joeblau/gitignore.io/issues/360

.idea/

# Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-249601023

*.iml
modules.xml
.idea/misc.xml
*.ipr

# Sonarlint plugin
.idea/sonarlint

### Intellij+iml ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff

# Generated files

# Sensitive or high-churn files

# Gradle

# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/artifacts
# .idea/compiler.xml
# .idea/jarRepositories.xml
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr

# CMake

# Mongo Explorer plugin

# File-based project format

# IntelliJ

# mpeltonen/sbt-idea plugin

# JIRA plugin

# Cursive Clojure plugin

# Crashlytics plugin (for Android Studio and IntelliJ)

# Editor-based Rest Client

# Android studio 3.1+ serialized cache file

### Intellij+iml Patch ###
# Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-249601023


### Java ###
# Compiled class file
*.class

# Log file
*.log

# BlueJ files
*.ctxt

# Mobile Tools for Java (J2ME)
.mtj.tmp/

# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*

### Java-Web ###
## ignoring target file
target/

### Maven ###
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
pom.xml.next
release.properties
dependency-reduced-pom.xml
buildNumber.properties
.mvn/timing.properties
# https://github.com/takari/maven-wrapper#usage-without-binary-jar
.mvn/wrapper/maven-wrapper.jar
.flattened-pom.xml

### Gradle ###
.gradle
build/

# Ignore Gradle GUI config
gradle-app.setting

# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
!gradle-wrapper.jar

# Cache of project
.gradletasknamecache

# # Work around https://youtrack.jetbrains.com/issue/IDEA-116898
# gradle/wrapper/gradle-wrapper.properties

### Gradle Patch ###
**/build/

# End of https://www.toptal.com/developers/gitignore/api/intellij+all,intellij+iml,intellij,java-web,java,gradle,maven
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

너무 길지 않나? 하는 생각이 드네요. 한 번 중복되는 줄이 있는지, 불필요한 주석은 그냥 제거하는게 어떤지도 생각해봐주세요.

53 changes: 53 additions & 0 deletions be/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,56 @@
# Backend

백엔드를 위한 디렉토리

## 배포

### Spring

crontab 으로 deploy-local.sh 를 주기적으로 실행한다.

#### Nginx

- [출처: Dong 의 블로그](https://velog.io/@d-h-k/NGINX)

```
sudo apt update && sudo apt upgrade - y && sudo apt clean
sudo apt install nginx -y
sudo service nginx restart

sudo echo "server {
listen 80;
listen [::]:80;
server_name baseball.pyro-squad.com;
location / {
proxy_pass http://localhost:8080;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
}
}" >> /etc/nginx/sites-available/test.conf

sudo ln -s /etc/nginx/sites-available/test.conf /etc/nginx/sites-enabled
sudo rm /etc/nginx/sites-enabled/default
sudo service nginx reload
sudo service nginx restart
```

### 2021-05-06 목 수업 내용

`openjdk-8-*` 을 설치해보고, 자바버전 관리가 어렵다면 sdkman 을 사용해보자.

AWS 개발자 도구의 CodeBuild, CodeDeploy 를 활용해보자

CPU Credit 이 0 이 되면, ec2의 CPU 를 5%밖에 사용 못한다. 바로 이래서 서버가 갑자기 죽는다.<br>
CPU Credit 은 ec2가 놀고 있을 때, 시간이 지남에 따라 쌓인다.<br>
보통 AWS 서버가 갑자기 죽는 이유는 메모리 부족보다, CPU Credit 부족 때문인 경우가 많다.

코드 빌드와 람다는 횟수 제한만 있을 뿐, 기간 제한 없이 평생 무료이다.

```sh
# 특정 브랜치를 특정 커밋으로 강제로 이동
git branch -f 브랜치명 커밋해쉬

# 혹시라도 브랜치를 실수로 삭제했다면, HEAD 의 움직임을 추적하자
git reflog
```
14 changes: 14 additions & 0 deletions be/deploy-local.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
cd ./server
git checkout deploy/prod
git fetch

LOCAL=`git rev-parse HEAD`
REMOTE=`git rev-parse origin/deploy/prod`
if [[ $LOCAL == $REMOTE ]]; then
echo "@@@@ No need to deploy"
exit 0
fi

git merge

sh ./run.sh
18 changes: 18 additions & 0 deletions be/deploy-remote.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# 출처: https://www.notion.so/cc778488e5524e1999a1bcf0c19f0006

KEY_PATH=/Users/g/baseball-0511.pem
[email protected]
JAR_FILE=baseball.jar

cd ./server
./gradlew build -x test

# scp 명령어로 jar 파일 전송
ssh -i $KEY_PATH $AWS_PATH "rm -rf ~/$JAR_FILE"
scp -i $KEY_PATH ./build/libs/$JAR_FILE $AWS_PATH:~

# 백그라운드로 BE server 배포
TOMCAT_PROCESS=$(ssh -i $KEY_PATH $AWS_PATH "lsof -t -i tcp:8080")
ssh -i $KEY_PATH $AWS_PATH "kill -9 $TOMCAT_PROCESS"
ssh -i $KEY_PATH $AWS_PATH "java -jar ~/$JAR_FILE >> log.txt 2>&1 &"
# ssh -i $KEY_PATH $AWS_PATH "nohup java -jar ~/$JAR_FILE & >> log.txt 2>&1"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cronjob을 돌려서 주기적으로 체크하고 배포하는것도 해보면 좋겠네요.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

넵. S3 에 올려서 CI/CD 환경을 구축해보는데도 시간을 더 투자해보겠습니다.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

S3에 올리지 않고도 cronjob을 로컬에서 돌려도 되지 않을까요?

4 changes: 4 additions & 0 deletions be/docker/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.DS_Store

### MySQL
db/data/
Loading