-
Notifications
You must be signed in to change notification settings - Fork 46
[BE][Team02] TDD 로 Baseball 서버 구현 #32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: ghojeong
Are you sure you want to change the base?
Changes from all commits
cec5d7c
e97d626
04deaeb
d5d1b6e
5584889
e07f62a
59452a7
7f98314
6abe0b6
23b566d
dce9136
54ee500
e91d041
0f10bac
90eac60
596acdb
2c12e92
917390e
439d9c7
f34d1d1
1886cbe
8244ce4
4a77b65
8ce173a
7363119
f712d05
8cf39c5
d30b3a8
b340d24
cbf7838
e9ec9b1
e416b8d
1e69583
d35c81e
97819eb
d605ac4
e269a2c
aa2fda4
0f1dfe1
fa3b16e
c59121e
56e5e1b
8c0e95a
aba8c44
d19076d
9a0761d
b8028f0
413f0bd
d93de26
f1f4b85
d9737ff
321619f
13637ee
c7da6b4
3dbb32d
6aa9434
2640308
9cecc08
54d2b5d
96837df
7bc372a
4e78f89
66333cf
18e23aa
b00001a
658c32c
734ec1a
6aff006
df35f56
df9d38b
e6ba2ea
bdbf05a
2f93d5c
8ebf142
0581fa6
0c74b96
e5ce843
a3c409a
978904f
47379a4
5a791cd
f852df9
afe36d5
2da414f
2d2806e
3a8588d
d4b7cd4
1192e98
85ed8a4
c517d43
1a1ee77
de9c9ce
7af2b49
babc112
1153a06
3211c32
4fd6a0a
aa699fa
53794b0
9c45b6b
35057d5
6666198
007206f
5aeca15
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| 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 | ||
| 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 | ||
| ``` |
| 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 |
| 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" | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. cronjob을 돌려서 주기적으로 체크하고 배포하는것도 해보면 좋겠네요.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 넵. S3 에 올려서 CI/CD 환경을 구축해보는데도 시간을 더 투자해보겠습니다.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. S3에 올리지 않고도 cronjob을 로컬에서 돌려도 되지 않을까요? |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| .DS_Store | ||
|
|
||
| ### MySQL | ||
| db/data/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
너무 길지 않나? 하는 생각이 드네요. 한 번 중복되는 줄이 있는지, 불필요한 주석은 그냥 제거하는게 어떤지도 생각해봐주세요.