Skip to content

Commit

Permalink
Merge pull request #27 from FourCut-Diary/develop
Browse files Browse the repository at this point in the history
RELEASE 2024-12-05 21:39:30
  • Loading branch information
dev-Crayon authored Dec 6, 2024
2 parents 487dcf4 + f23e3b1 commit 11db2f6
Show file tree
Hide file tree
Showing 8 changed files with 162 additions and 2 deletions.
78 changes: 78 additions & 0 deletions .github/workflows/API-Server-CD.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle

name: API-Server CD

on:
push:
branches: [ "main" ]

jobs:
ci-workflow:
runs-on: ubuntu-latest
env:
working-directory: ./

steps:

- name: checkout
uses: actions/checkout@v3

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'

- name: make application.yml 파일 생성
run: |
## create application.yml
cd ./module-api/src/main/resources
# application.yml 파일 생성
touch ./application-prod.yml
# GitHub-Actions 에서 설정한 값을 application.yml 파일에 쓰기
echo "${{ secrets.FOURCUTDIARY_APPLICATION }}" >> ./application-prod.yml
shell: bash

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Build with Gradle
run: ./gradlew build

- name: docker build 가능하도록 환경 설정
uses: docker/[email protected]

- name: docker hub에로그인
uses: docker/[email protected]
with:
username: ${{ secrets.DOCKERHUB_LOGIN_USER }}
password: ${{ secrets.DOCKERHUB_LOGIN_ACCESS_TOKEN }}

- name: docker image 빌드 및 푸시
run: |
docker build --platform linux/amd64 -t lsh328328/fourcutdiary .
docker push lsh328328/fourcutdiary
working-directory: ${{ env.working-directory }}

cd-workflow:
needs: ci-workflow
runs-on: ubuntu-latest

steps:
- name: 도커 컨테이너 실행
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.RELEASE_SERVER_IP }}
username: ${{ secrets.RELEASE_SERVER_USER }}
key: ${{ secrets.RELEASE_SERVER_KEY }}
script: |
cd ~
sudo ./deploy.sh
2 changes: 1 addition & 1 deletion .github/workflows/API-Server-CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@ jobs:
run: chmod +x gradlew

- name: Build with Gradle # 실제 application build(-x 옵션을 통해 test는 제외)
run: ./gradlew build -x test
run: ./gradlew build
7 changes: 7 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
FROM amd64/amazoncorretto:17

WORKDIR /app

COPY ./module-api/build/libs/module-api-0.0.1-SNAPSHOT.jar /app/fourcutdiary.jar

CMD ["java", "-Duser.timezone=Asia/Seoul", "-jar", "-Dspring.profiles.active={profile}", "fourcutdiary.jar"]
3 changes: 3 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ subprojects {
// Test
testImplementation 'org.springframework.boot:spring-boot-starter-test'

// Actuator
implementation 'org.springframework.boot:spring-boot-starter-actuator'

// Lombok
compileOnly 'org.projectlombok:lombok'
annotationProcessor 'org.projectlombok:lombok'
Expand Down
16 changes: 16 additions & 0 deletions module-api/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,22 @@ jwt:
refresh-token:
expiration-time: test

management:
server:
port: 0000
endpoints:
enabled-by-default: false
jmx:
exposure:
exclude: test
web:
exposure:
include: test
base-path: /test
endpoint:
health:
enabled: true

kakao:
clientId: test
redirectUri: test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public class SecurityConfig {
private static final String[] AUTH_WHITELIST = {
"/user/social-signup",
"/user/social-login",
"/secret/info/health"
};

@Bean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ public class CustomJwtAuthenticationFilter extends OncePerRequestFilter {
private final JwtTokenManager jwtTokenManager;
private static final List<String> AUTH_WHITELIST = List.of(
"/user/social-signup",
"/user/social-login"
"/user/social-login",
"/secret/info/health"
);

@Override
Expand Down
54 changes: 54 additions & 0 deletions module-domain/src/main/java/com/fourcut/diary/diary/Diary.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
package com.fourcut.diary.diary;

import com.fourcut.diary.common.AuditingTimeEntity;
import com.fourcut.diary.user.domain.User;
import jakarta.persistence.*;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.NoArgsConstructor;

import java.time.LocalDate;

@Entity
@Getter
@NoArgsConstructor(access = AccessLevel.PROTECTED)
public class Diary extends AuditingTimeEntity {

@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;

@Column(nullable = false)
private String title;

@Column(nullable = false)
private LocalDate date;

@Column
private String firstPicture;

@Column
private String secondPicture;

@Column
private String thirdPicture;

@Column
private String fourthPicture;

@Column
private String firstComment;

@Column
private String secondComment;

@Column
private String thirdComment;

@Column
private String fourthComment;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "user_id", nullable = false)
private User user;
}

0 comments on commit 11db2f6

Please sign in to comment.