-
Notifications
You must be signed in to change notification settings - Fork 0
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
#4 배포 파이프라인 구성 #7
Changes from all commits
f8209a8
32d80d3
0c581b4
e72442b
e19d0d7
c6ff9c6
d2fd21d
8e00c01
7a44f09
fd68635
df4c5dd
3867c0b
2240aef
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,42 @@ | ||
name: Deploy to Develop Environment | ||
|
||
on: | ||
push: | ||
branches: | ||
- develop | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup Java 17 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '17' | ||
distribution: 'adopt' | ||
|
||
- name: Update Git submodules | ||
run: git submodule update --remote --recursive | ||
|
||
- name: Build and test with Gradle | ||
run: ./gradlew test | ||
|
||
- name: Build and push Docker image | ||
run: ./gradlew clean bootBuildImage -PDOCKERHUB_ID=${{ secrets.DOCKERHUB_ID }} -PDOCKERHUB_TOKEN=${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: SSH into EC2 instance | ||
uses: appleboy/ssh-action@master | ||
with: | ||
host: ${{ secrets.DEV_EC2_HOST }} | ||
username: ${{ secrets.DEV_EC2_USERNAME }} | ||
key: ${{ secrets.DEV_EC2_PRIVATE_KEY }} | ||
port: ${{ secrets.DEV_EC2_SSH_PORT }} | ||
script: | | ||
docker pull mungmnb777/tteokguk:latest | ||
docker ps -f name=be-server -q | xargs --no-run-if-empty docker container stop | ||
docker ps -a -f name=be-server -q | xargs --no-run-if-empty docker container rm | ||
docker run -d --name be-server -p 80:8080 mungmnb777/tteokguk:latest |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,3 +41,6 @@ out/ | |
|
||
### VS Code ### | ||
.vscode/ | ||
|
||
### local properties ### | ||
/src/main/resources/application.yml | ||
Comment on lines
+45
to
+46
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. 서브모듈 핸들링 이슈 ㅠ |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,21 +48,38 @@ dependencies { | |
annotationProcessor "com.querydsl:querydsl-apt:${dependencyManagement.importedProperties['querydsl.version']}:jakarta" | ||
annotationProcessor "jakarta.annotation:jakarta.annotation-api" | ||
annotationProcessor "jakarta.persistence:jakarta.persistence-api" | ||
|
||
// Actuator | ||
implementation 'org.springframework.boot:spring-boot-starter-actuator' | ||
} | ||
|
||
tasks.named('test') { | ||
systemProperty "spring.profiles.active", "test" | ||
useJUnitPlatform() | ||
} | ||
|
||
task copyGitSubmodule(type: Copy) { | ||
tasks.register('copyGitSubmodule', Copy) { | ||
from './tteokguk-config' | ||
include '*.yml' | ||
into './src/main/resources' | ||
} | ||
|
||
test { | ||
systemProperty "spring.profiles.active", "test" | ||
useJUnitPlatform() | ||
tasks.named('bootBuildImage') { | ||
environment["BPE_DELIM_JAVA_TOOL_OPTIONS"] = " " | ||
environment["BPE_APPEND_JAVA_TOOL_OPTIONS"] = "-XX:+ExitOnOutOfMemoryError -XX:MaxDirectMemorySize=10M " + | ||
"-XX:MaxMetaspaceSize=100M -XX:ReservedCodeCacheSize=60M -Xss256K" | ||
|
||
def dockerhubId = project.property("DOCKERHUB_ID") | ||
def dockerhubToken = project.property("DOCKERHUB_TOKEN") | ||
|
||
imageName = dockerhubId + "/${project.name}" | ||
publish = true | ||
docker { | ||
publishRegistry { | ||
username = dockerhubId | ||
password = dockerhubToken | ||
} | ||
} | ||
Comment on lines
+67
to
+82
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.
보통 EC2 컨테이너를 사용하더라도, 도커 컨테이너를 띄우지 않고 작업을 했던 경험이 많아요. 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. 저희가 사용 중인 프리티어 인스턴스 하나로 사용하면 Standalone이 더 유리했겠네용 제가 항상 도커로 배포하는 것만 진행해서 이 부분은 생각하지 못했습니다.. 그래도 도커를 사용했을 때 얻을 수 있는 장점에 대해 확장성이 있겠네요. 그러면 혹시 의견을 주실 수 있을까요? 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. 음.. 일단 질문의 본질은, 도커의 확장성 부분에 있어서 여쭈었던 질문입니다! 현재 개발 환경에서는 EC2 환경에서 말씀주신 standalone도 나쁘지 않을 것 같다는 의견도 있는데요. |
||
} | ||
|
||
processResources { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.tteokguk.tteokguk.global.security; | ||
|
||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.security.config.annotation.web.builders.HttpSecurity; | ||
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; | ||
import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer; | ||
import org.springframework.security.web.SecurityFilterChain; | ||
|
||
@Configuration | ||
@EnableWebSecurity | ||
public class SecurityConfig { | ||
|
||
@Bean | ||
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { | ||
return http | ||
.csrf(AbstractHttpConfigurer::disable) | ||
.formLogin(AbstractHttpConfigurer::disable) | ||
.build(); | ||
} | ||
} |
This file was deleted.
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.
P2
Develop 브랜치에 푸쉬되는 트리거를 기점으로, 개발서버 EC2에 서버를 올리는 플로우로 인식했어요.
다만
./gradlew test
만으로, 해당 코드의 정상적인 빌드와 실행 여부를 모두 파악하기에는 어려울 수도 있다고 생각이 들어요../gradlew clean build -i
와 같이, 깃허브 액션으로 빌드 테스트 + 로그까지한 번에 확인할 수 있는 방식도 좋을 것 같아 제안드립니다 :)
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.
bootBuildImage
가 빌드에 필요한 태스크를 진행해주기 때문에 따로build
태스크를 넣지 않았습니다!