chore: stage, prod docker-compose 파일 분리 #218
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
작업 내용 1 - spring profile 한 곳에서 설정하기
스테이지 서버에 돌아가는 app 의 profile이 prod 로 지정되는 이슈가 있었습니다.

cd 에서
./gradlew bootJar -Dspring.profiles.active=stage를 해주었음에도prod profile로 실행되는게 이상해서 코드를 더 봐보니,
docker file 에서 추가적으로 profile을 prod로 지정하고 있었습니다.
이때 profile 이 덮어쓰기되어 prod로 실행되었습니다.
profile 을 한곳에서 지정하도록 Dockerfile에서 지정하는 부분은 없앴습니다.
작업 내용 2 - stage의 DB를 docker의 mysql로 설정
stage 서버의 mysql을 처음에는 localhost에 설치했습니다.
그랬더니 [docker위에 동작하는 스프링 어플리케이션] → [host 의 mysql] 로의 통신이 되어서
도커 네트워크 설정이 복잡해지더라고요😓
심지어 커멘트로 직접 설정하는거라, 비슷한 상황에서 적용되기도 힘들 것 같다 생각했습니다.
고민한 내용 : docker-compose 분리가 맞을까?
위 이슈에서 보시다시피, stage의 인프라 구성과 prod의 구성이 100%일치하진 않습니다.
그래서 docker-compose 파일을 분리했습니다.
stage 서버는 prod 와 최대한 가은 환경이어야 한다고 생각해서
처음에는 최대한 docker-compose도 하나로 가려고 했었는데요,
현실적으로 이들이 100% 일치하기는 어려우니까 분리를 하는게 맞다고 생각했습니다.
stage 서버도 prod처럼 그 자체만을 위한 db를 외부에 가지게 하는건 비효율적인 것 같습니다.
"최대한 비슷한 환경이되, 어느 정도 타협을 해야한다"는 생각이 들었습니다.
리뷰 요구사항 (선택)