diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index c4dddfa0..158c6808 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -3,21 +3,22 @@ name: CI/CD Github Action on: push: branches: [ "Master", "Weekly/*" ] - pull_request_target: - branches: [ "Master", "Weekly/*" ] permissions: contents: read env: + DATASOURCE_URL : ${{ secrets.ENV_DATASOURCE_URL }} + DATASOURCE_USERNAME : ${{ secrets.ENV_DATASOURCE_USERNAME }} + DATASOURCE_PASSWORD : ${{ secrets.ENV_DATASOURCE_PASSWORD }} GOOGLE_CLIENT_ID : ${{ secrets.ENV_GOOGLE_CLIENT_ID }} GOOGLE_CLIENT_SECRET: ${{ secrets.ENV_GOOGLE_CLIENT_SECRET }} - GOOGLE_REDIRECT_URI : ${{ secrets.ENV_GOOGLE_REDIRECT_URI }} + IMAGE_UPLOAD_PATH : ${{ secrets.ENV_IMAGE_UPLOAD_PATH }} JWT_SECRET : ${{ secrets.ENV_JWT_SECRET }} KAKAO_CLIENT_ID : ${{ secrets.ENV_KAKAO_CLIENT_ID }} KAKAO_CLIENT_SECRET : ${{ secrets.ENV_KAKAO_CLIENT_SECRET }} - KAKAO_REDIRECT_URI : ${{ secrets.ENV_KAKAO_REDIRECT_URI }} KAKAOPAY_SECRET_KEY : ${{ secrets.ENV_KAKAOPAY_SECRET_KEY }} + SERVER_DOMAIN_NAME : ${{ secrets.ENV_SERVER_DOMAIN_NAME }} jobs: ## 1단계: 프로젝트 빌드 @@ -137,14 +138,17 @@ jobs: key: ${{ secrets.SSH_PRIVATE_KEY }} port: ${{ secrets.SSH_PORT }} script: | - echo "GOOGLE_CLIENT_ID=${{ secrets.ENV_GOOGLE_CLIENT_ID }}" > ~/.env + echo "DATASOURCE_URL=${{ secrets.ENV_DATASOURCE_URL }}" > ~/.env + echo "DATASOURCE_USERNAME=${{ secrets.ENV_DATASOURCE_USERNAME }}" >> ~/.env + echo "DATASOURCE_PASSWORD=${{ secrets.ENV_DATASOURCE_PASSWORD }}" >> ~/.env + echo "GOOGLE_CLIENT_ID=${{ secrets.ENV_GOOGLE_CLIENT_ID }}" >> ~/.env echo "GOOGLE_CLIENT_SECRET=${{ secrets.ENV_GOOGLE_CLIENT_SECRET }}" >> ~/.env - echo "GOOGLE_REDIRECT_URI=${{ secrets.ENV_GOOGLE_REDIRECT_URI }}" >> ~/.env echo "JWT_SECRET=${{ secrets.ENV_JWT_SECRET }}" >> ~/.env + echo "IMAGE_UPLOAD_PATH=${{ secrets.ENV_IMAGE_UPLOAD_PATH }}" >> ~/.env echo "KAKAO_CLIENT_ID=${{ secrets.ENV_KAKAO_CLIENT_ID }}" >> ~/.env echo "KAKAO_CLIENT_SECRET=${{ secrets.ENV_KAKAO_CLIENT_SECRET }}" >> ~/.env - echo "KAKAO_REDIRECT_URI=${{ secrets.ENV_KAKAO_REDIRECT_URI }}" >> ~/.env echo "KAKAOPAY_SECRET_KEY=${{ secrets.ENV_KAKAOPAY_SECRET_KEY }}" >> ~/.env + echo "SERVER_DOMAIN_NAME=${{ secrets.ENV_SERVER_DOMAIN_NAME }}" >> ~/.env echo "Environment setup has been completed." - name: Pull New Docker Image @@ -175,7 +179,7 @@ jobs: key: ${{ secrets.SSH_PRIVATE_KEY }} port: ${{ secrets.SSH_PORT }} envs: GITHUB_SHA - script: sudo docker run --rm -d -p 80:8080 --env-file ~/.env --name would-you-in ${{ secrets.DOCKER_REPO_FULLNAME }} + script: sudo docker run --rm -d -p 80:8080 --env-file ~/.env --name would-you-in -v would-you-in-image-volume:${{ secrets.ENV_IMAGE_UPLOAD_PATH }} ${{ secrets.DOCKER_REPO_FULLNAME }} - name: Clean-Up Docker Image uses: appleboy/ssh-action@master diff --git a/build.gradle b/build.gradle index 3595fa08..316b8018 100644 --- a/build.gradle +++ b/build.gradle @@ -29,13 +29,11 @@ dependencies { implementation 'org.springframework.boot:spring-boot-starter-web' implementation 'org.springframework.boot:spring-boot-starter-security' implementation 'org.springframework.boot:spring-boot-starter-oauth2-client' - implementation 'com.h2database:h2' implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310' implementation 'com.fasterxml.jackson.core:jackson-databind' compileOnly 'org.projectlombok:lombok' developmentOnly 'org.springframework.boot:spring-boot-devtools' runtimeOnly 'com.mysql:mysql-connector-j' - runtimeOnly 'com.h2database:h2' annotationProcessor 'org.projectlombok:lombok' testImplementation 'org.springframework.boot:spring-boot-starter-test' testImplementation 'org.springframework.security:spring-security-test' diff --git a/src/main/resources/application-create.yml b/src/main/resources/application-create.yml index 019b5eda..477bcadd 100644 --- a/src/main/resources/application-create.yml +++ b/src/main/resources/application-create.yml @@ -7,6 +7,5 @@ spring: activate: on-profile: create jpa: - show-sql: true hibernate: ddl-auto: create diff --git a/src/main/resources/application-deploy.yml b/src/main/resources/application-deploy.yml index d7b6971f..a23c61e7 100644 --- a/src/main/resources/application-deploy.yml +++ b/src/main/resources/application-deploy.yml @@ -7,9 +7,5 @@ spring: activate: on-profile: deploy jpa: - show-sql: false hibernate: - ddl-auto: create - -# log4j log level setting -logging.level.org.ktc2.cokaen.wouldyouin: info \ No newline at end of file + ddl-auto: update \ No newline at end of file diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml index d0202301..36fa911f 100644 --- a/src/main/resources/application-dev.yml +++ b/src/main/resources/application-dev.yml @@ -7,6 +7,5 @@ spring: activate: on-profile: dev jpa: - show-sql: true hibernate: - ddl-auto: update + ddl-auto: create-drop \ No newline at end of file diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 9ff4c855..aa633fa1 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -9,7 +9,6 @@ spring: max-file-size: 10MB max-request-size: 10MB - # 임시 프로젝트 url profiles: default: dev @@ -22,31 +21,29 @@ spring: restart: enabled: false - # h2 database settings - h2: - console: - enabled: true - datasource: - url: jdbc:h2:mem:test - driver-class-name: org.h2.Driver + driver-class-name: com.mysql.cj.jdbc.Driver + url: ${DATASOURCE_URL}?useSSL=false&useUnicode=true&serverTimezone=Asia/Seoul + username: ${DATASOURCE_USERNAME} + password: ${DATASOURCE_PASSWORD} jpa: + database: mysql + database-platform: org.hibernate.dialect.MySQLDialect properties: hibernate: format_sql: true default_batch_fetch_size: 100 show-sql: true - hibernate.ddl-auto: create # log4j log level setting logging.level.org.ktc2.cokaen.wouldyouin: debug # for image storage path image: - api-url: http://52.78.71.136/api/images + api-url: ${SERVER_DOMAIN_NAME}/api/images upload: - parent-path: src/main/resources/static/images + parent-path: ${IMAGE_UPLOAD_PATH} curation: child-path: curation member: @@ -75,7 +72,7 @@ oauth: client: id: ${KAKAO_CLIENT_ID} secret: ${KAKAO_CLIENT_SECRET} - redirect_uri: ${KAKAO_REDIRECT_URI} + redirect_uri: ${SERVER_DOMAIN_NAME}/api/auth/social/redirect/kakao google: uri: login: @@ -87,14 +84,14 @@ oauth: client: id: ${GOOGLE_CLIENT_ID} secret: ${GOOGLE_CLIENT_SECRET} - redirect_uri: ${GOOGLE_REDIRECT_URI} + redirect_uri: ${SERVER_DOMAIN_NAME}/api/auth/social/redirect/google scope: - email - profile payment: - "approval_url": "http://localhost:8080/api/events" - "cancel_url": "http://localhost:8080/api/events" - "fail_url": "http://localhost:8080/api/events" + "approval_url": ${SERVER_DOMAIN_NAME}/api/events + "cancel_url": ${SERVER_DOMAIN_NAME}/api/events + "fail_url": ${SERVER_DOMAIN_NAME}/api/events "secret_key": ${KAKAOPAY_SECRET_KEY} - "kakao_pay_single_payment_url": "online/v1/payment/ready" - "kakao-pay-request-host": "https://open-api.kakaopay.com" \ No newline at end of file + "kakao_pay_single_payment_url": online/v1/payment/ready + "kakao-pay-request-host": https://open-api.kakaopay.com \ No newline at end of file