diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 50a8ea7..4d16282 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -49,12 +49,16 @@ jobs: - name: SSH로 EC2에 접속하기 uses: appleboy/ssh-action@v1.0.3 with: - host: ${{ secrets.DEVSYNC_EC2_HOST}} - username: ${{ secrets.DEVSYNC_EC2_USERNAME}} - key: ${{ secrets.DEVSYNC_EC2_PRIVATE_KEY}} + host: ${{ secrets.DEVSYNC_EC2_HOST }} + username: ${{ secrets.DEVSYNC_EC2_USERNAME }} + key: ${{ secrets.DEVSYNC_EC2_PRIVATE_KEY }} script_stop: true script: | cd ~/devsync - docker compose down || true + echo "복사한 .env 파일을 준비합니다." + echo "RDS_ENDPOINT=${{ secrets.RDS_ENDPOINT }}" > .env + echo "RDS_USERNAME=${{ secrets.RDS_USERNAME }}" >> .env + echo "RDS_PASSWORD=${{ secrets.RDS_PASSWORD }}" >> .env + docker-compose down || true docker pull ${{ secrets.DEVSYNC_ECR_REGISTRY }}/devsync:latest - docker compose up -d --build \ No newline at end of file + docker-compose up -d --build \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..8de00f4 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,3 @@ +FROM openjdk:17-jdk +COPY build/libs/devsync.jar devsync.jar +ENTRYPOINT ["java", "-jar", "devsync.jar"] \ No newline at end of file diff --git a/build.gradle b/build.gradle index 5438257..67159c8 100644 --- a/build.gradle +++ b/build.gradle @@ -57,8 +57,8 @@ dependencies { testImplementation 'org.assertj:assertj-core:3.24.2' testRuntimeOnly 'org.junit.platform:junit-platform-launcher' - // Swagger - implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.1.0' + // swagger + implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.7.0' // JWT implementation 'io.jsonwebtoken:jjwt-api:0.11.5' @@ -70,3 +70,9 @@ dependencies { tasks.named('test') { useJUnitPlatform() } + +bootJar { + archiveBaseName.set("devsync") + archiveVersion.set("") + archiveClassifier.set("") +} \ No newline at end of file diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 9ac50a9..4fa4af0 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1,19 +1,18 @@ -spring.application.name=devsync - -# Swagger -swagger.server.url=http://localhost:8080 - -# H2 Database ?? -spring.datasource.url=jdbc:h2:mem:testdb -spring.datasource.driver-class-name=org.h2.Driver -spring.datasource.username=sa -spring.datasource.password= -spring.h2.console.enabled=true - -# JWT Secret Key -spring.jwt.secret=nH3Hj8aTgFz1vB3LgKm2t4zWk9YqL1D6abcdefghiJklmnopQ= - -# Redis -spring.data.redis.host=localhost -spring.data.redis.port=6379 - +#spring.application.name=devsync +# +## Swagger +#swagger.server.url=http://localhost:8080 +# +## H2 Database ?? +#spring.datasource.url=jdbc:h2:mem:testdb +#spring.datasource.driver-class-name=org.h2.Driver +#spring.datasource.username=sa +#spring.datasource.password= +#spring.h2.console.enabled=true +# +## JWT Secret Key +#spring.jwt.secret=nH3Hj8aTgFz1vB3LgKm2t4zWk9YqL1D6abcdefghiJklmnopQ= +# +## Redis +#spring.data.redis.host=localhost +#spring.data.redis.port=6379 \ No newline at end of file diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml new file mode 100644 index 0000000..1139c1d --- /dev/null +++ b/src/main/resources/application.yml @@ -0,0 +1,52 @@ +spring: + application: + name: devsync + profiles: + active: # 기본 프로파일 설정 + +# 공통 설정 +--- +spring: + jpa: + show-sql: true + jwt: + secret: nH3Hj8aTgFz1vB3LgKm2t4zWk9YqL1D6abcdefghiJklmnopQ= + +# 개발용 설정 (dev) +--- +spring: + config.activate.on-profile: dev + datasource: + url: jdbc:h2:mem:testdb + username: sa + password: + driver-class-name: org.h2.Driver + h2: + console: + enabled: true + path: /h2-console + swagger: + server: + url: http://localhost:8080 + data: + redis: + host: localhost + port: 6379 + sql: + init: + mode: + + +# 배포용 설정 (prod) +--- +spring: + config.activate.on-profile: prod + datasource: + driver-class-name: com.mysql.cj.jdbc.Driver + url: jdbc:mysql://${RDS_ENDPOINT}:3306/issuemap + username: ${RDS_USERNAME} + password: ${RDS_PASSWORD} + data: + redis: + host: localhost + port: 6379 \ No newline at end of file