- 개발환경과 운영환경은 다름
- OS, 폴더의 위치와 이름, JDK 버전,
1. properties 분리
application.properteis : 개발환경
application-prod.properties : 운영환경
2. 배포파일 빌드
1. STS에서 빌드
1)프로젝트 우클릭 -> run as -> maven clean : target폴더내의 정보 삭제
2)프로젝트 우클릭 -> run as -> maven install : target폴더내의 war 생성
2. CMD 명령어로 빌드
./mvnw clean install
- mvnw permission deny 발생한다면
- 권한변경 chmod 777 mvnw
3. 운영서버 배포
1. 공유폴더에 war파일 공유
2. 운영서버에서 Github 파일을 pull 한 다음 빌드
1) Repository 별 각각의 폴더 생성
2) 해당 폴더 이동 git init (해당 폴더에 git을 설정)
3) global username,,등등을 했다면 pass
4) repository와 branch 등록 (git add remote 브랜치명 주소)
5) 파일을 복사 (git pull 주소 브랜치명)
6) build
4. 폴더 구성
1. 공유 폴더
1) Host와 Container사이에 파일 전송 쉽게
2) Container 새로 생성시 이전 Data들을 유지(백업)
2. 운영 폴더
war이 있는 폴더
app별로 각각 폴더 생성
5. 보안
- DB 연결 정보는 properties에 작성 후 Github에 등록하면 보안에 문제가 발생할 수 있음
1. GitHub에서 public이 아닌 private으로 Repository 생성
2. 민감한 정보는 Github에 올리지 않음(ignore파일)
1) 공유 폴더 이용
2) FTP 서버 이용
3. War이 포함된 container를 Image로 변경 후에 DockerHub에 private등록
6. Mapper Not Found Error
<build>
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.xml</include> <!-- 모든 XML 파일을 포함 -->
</includes>
</resource>
<resource>
<directory>src/main/resources</directory>
</resource>
</resources>
</build>