-
Notifications
You must be signed in to change notification settings - Fork 0
fix(#0): Merge 방법 변경 #16
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
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| name: CD - PROD | ||
|
|
||
| on: | ||
| push: | ||
| branches: [ main ] | ||
|
|
||
| jobs: | ||
| deploy: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - uses: actions/setup-java@v4 | ||
| with: | ||
| java-version: "21" | ||
| distribution: "temurin" | ||
|
|
||
| - uses: gradle/actions/setup-gradle@v3 | ||
|
|
||
| - name: Grant execute permission | ||
| run: chmod +x gradlew | ||
|
|
||
| - name: Build JAR | ||
| run: ./gradlew build -x test | ||
|
|
||
| - name: Docker Login | ||
| uses: docker/login-action@v3 | ||
| with: | ||
| username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
| password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
|
||
| - name: Build & Push | ||
| uses: docker/build-push-action@v5 | ||
| with: | ||
| context: . | ||
| push: true | ||
| tags: | | ||
| ${{ secrets.DOCKERHUB_USERNAME }}/realmatch-backend:prod | ||
| ${{ secrets.DOCKERHUB_USERNAME }}/realmatch-backend:${{ github.sha }} | ||
|
|
||
| - name: Deploy | ||
| uses: appleboy/ssh-action@v1.0.3 | ||
| with: | ||
| host: ${{ secrets.PROD_SERVER_IP }} | ||
| username: ubuntu | ||
| key: ${{ secrets.PROD_SERVER_SSH_KEY }} | ||
| script: | | ||
| cd /home/ubuntu/realmatch | ||
| git pull origin main | ||
|
|
||
| docker compose pull | ||
| docker compose up -d | ||
|
|
||
| echo "Waiting for app to start..." | ||
| sleep 10 | ||
|
|
||
| if ! docker compose ps | grep "Up"; then | ||
| echo "❌ Container is not running" | ||
| docker compose logs | ||
| exit 1 | ||
| fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,10 +6,10 @@ services: | |
| container_name: mysql_db | ||
| restart: always | ||
| environment: | ||
| MYSQL_DATABASE: myapp_db | ||
| MYSQL_USER: admin | ||
| MYSQL_PASSWORD: secret | ||
| MYSQL_ROOT_PASSWORD: rootsecret | ||
| MYSQL_DATABASE: ${MYSQL_DATABASE} | ||
| MYSQL_USER: ${MYSQL_USER} | ||
| MYSQL_PASSWORD: ${MYSQL_PASSWORD} | ||
| MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD} | ||
| ports: | ||
| - "3306:3306" | ||
| volumes: | ||
|
|
@@ -30,16 +30,17 @@ services: | |
| dockerfile: Docker/Dockerfile | ||
| container_name: spring_app | ||
| ports: | ||
| - "8080:8080" | ||
| - "6000:6000" | ||
| depends_on: | ||
| - db | ||
| - redis | ||
| env_file: | ||
| - .env | ||
| environment: | ||
| - SPRING_DATASOURCE_URL=jdbc:mysql://db:3306/myapp_db?useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Seoul | ||
| - SPRING_DATASOURCE_USERNAME=admin | ||
| - SPRING_DATASOURCE_PASSWORD=secret | ||
| - SPRING_DATASOURCE_DRIVER_CLASS_NAME=com.mysql.cj.jdbc.Driver | ||
| - SPRING_REDIS_HOST=redis | ||
| - SPRING_REDIS_PORT=6379 | ||
| - SPRING_PROFILES_ACTIVE=dev | ||
|
|
||
| SPRING_DATASOURCE_URL: ${SPRING_DATASOURCE_URL} | ||
| SPRING_DATASOURCE_USERNAME: ${SPRING_DATASOURCE_USERNAME} | ||
| SPRING_DATASOURCE_PASSWORD: ${SPRING_DATASOURCE_PASSWORD} | ||
| SPRING_DATASOURCE_DRIVER_CLASS_NAME: ${SPRING_DATASOURCE_DRIVER_CLASS_NAME} | ||
| SPRING_REDIS_HOST: ${SPRING_REDIS_HOST} | ||
| SPRING_REDIS_PORT: ${SPRING_REDIS_PORT} | ||
| SPRING_PROFILES_ACTIVE: ${SPRING_PROFILES_ACTIVE} | ||
|
Comment on lines
39
to
+46
Contributor
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. |
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
24 changes: 24 additions & 0 deletions
24
src/main/java/com/example/RealMatch/global/common/BaseEntity.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| package com.example.RealMatch.global.common; | ||
|
|
||
| import java.time.LocalDateTime; | ||
|
|
||
| import org.springframework.data.annotation.CreatedDate; | ||
| import org.springframework.data.jpa.domain.support.AuditingEntityListener; | ||
|
|
||
| import jakarta.persistence.Column; | ||
| import jakarta.persistence.EntityListeners; | ||
| import jakarta.persistence.MappedSuperclass; | ||
| import lombok.Getter; | ||
| import lombok.NoArgsConstructor; | ||
|
|
||
| @Getter | ||
| @MappedSuperclass | ||
| @EntityListeners(AuditingEntityListener.class) | ||
| @NoArgsConstructor(access = lombok.AccessLevel.PROTECTED) | ||
| public abstract class BaseEntity { | ||
|
Comment on lines
+14
to
+18
Contributor
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. |
||
|
|
||
| @CreatedDate | ||
| @Column(name = "created_at", updatable = false, nullable = false) | ||
| private LocalDateTime createdAt; | ||
|
|
||
| } | ||
42 changes: 42 additions & 0 deletions
42
src/main/java/com/example/RealMatch/global/common/UpdateBaseEntity.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| package com.example.RealMatch.global.common; | ||
|
|
||
| import java.time.LocalDateTime; | ||
|
|
||
| import org.springframework.data.annotation.LastModifiedDate; | ||
| import org.springframework.data.jpa.domain.support.AuditingEntityListener; | ||
|
|
||
| import jakarta.persistence.Column; | ||
| import jakarta.persistence.EntityListeners; | ||
| import jakarta.persistence.MappedSuperclass; | ||
| import lombok.Getter; | ||
|
|
||
| @Getter | ||
| @MappedSuperclass | ||
| @EntityListeners(AuditingEntityListener.class) | ||
| public abstract class UpdateBaseEntity extends BaseEntity { | ||
|
|
||
| @LastModifiedDate | ||
| @Column(name = "updated_at") | ||
| private LocalDateTime updatedAt; | ||
|
|
||
| @Column(name = "deleted_at") | ||
| private LocalDateTime deletedAt; | ||
|
|
||
| @Column(name = "is_deleted", nullable = false) | ||
| private boolean isDeleted; | ||
|
|
||
| protected UpdateBaseEntity() { | ||
| super(); | ||
| this.isDeleted = false; | ||
| } | ||
|
|
||
| public void softDelete(Integer deletedBy, LocalDateTime deletedAt) { | ||
|
Contributor
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. |
||
| this.isDeleted = true; | ||
| this.deletedAt = deletedAt; | ||
| } | ||
|
|
||
| public void restore() { | ||
| this.isDeleted = false; | ||
| this.deletedAt = null; | ||
| } | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
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.
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.
테스트 관련 의존성이 중복으로 선언되어 있습니다. 중복을 제거하고 그룹화하여 가독성을 높이는 것이 좋습니다.