Skip to content

Conversation

@nayonsoso
Copy link
Collaborator

@nayonsoso nayonsoso commented Feb 16, 2025

작업 내용 1 - spring profile 한 곳에서 설정하기

스테이지 서버에 돌아가는 app 의 profile이 prod 로 지정되는 이슈가 있었습니다.
image

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를 외부에 가지게 하는건 비효율적인 것 같습니다.
"최대한 비슷한 환경이되, 어느 정도 타협을 해야한다"는 생각이 들었습니다.

리뷰 요구사항 (선택)

Copy link
Member

@wibaek wibaek left a comment

Choose a reason for hiding this comment

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

lgtm

@nayonsoso nayonsoso changed the title chore: spring profile을 docker file에서 지정하지 않도록 chore: stage, prod docker-compose 파일 분리 Feb 16, 2025
@nayonsoso nayonsoso marked this pull request as draft February 16, 2025 09:16
@nayonsoso nayonsoso force-pushed the chore/delete-docker-file-spring-profile branch from eccdbf5 to 5cde0f3 Compare February 16, 2025 13:49
@nayonsoso nayonsoso marked this pull request as ready for review February 16, 2025 13:49
@nayonsoso nayonsoso self-assigned this Feb 16, 2025
@wibaek wibaek self-requested a review February 16, 2025 23:59
Copy link
Member

@wibaek wibaek left a comment

Choose a reason for hiding this comment

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

최종적으로 DB를 localhost로 연결하는 것이 아닌 도커간 연결로 선택하신 것 같네요. 어떤점이 복잡했는지 궁금하네요! 👍

@nayonsoso nayonsoso merged commit c54ce99 into solid-connection:develop Feb 17, 2025
nayonsoso added a commit that referenced this pull request Feb 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants