diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 86e66a0..d413c29 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -20,6 +20,9 @@ jobs: distribution: 'temurin' java-version: '17' + - name: application.yml 파일 생성 + run: echo "${{ secrets.APPLICATION_ENV }}" > ./src/main/resources/application-prod.yml + - name: Gradle 명령 실행을 위해 권한을 부여한다 run: chmod +x gradlew @@ -32,23 +35,10 @@ jobs: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_PASSWORD }} - - name: 환경변수 파일 생성 - run: echo "${{ secrets.APPLICATION_ENV }}" > ./.env - - - name: ubuntu Docker image build and push + - name: Docker 이미지 빌드 & 푸쉬 run: | docker-compose -f ./docker-compose.yml build docker-compose -f ./docker-compose.yml push -# - name: ubuntu Docker image build -# run: docker build -t ${{ secrets.DOCKER_NAME }}/we-share-wish-hair:latest -f Dockerfile-server . -# -# - name: Redis Docker image build -# run: docker build -t ${{ secrets.DOCKER_NAME }}/we-share-wish-hair:redis -f Dockerfile-redis . -# -# - name: ubuntu docker Hub 푸쉬 -# run: docker push ${{ secrets.DOCKER_NAME }}/we-share-wish-hair:latest -# - name: Redis docker Hub 푸쉬 -# run: docker push ${{ secrets.DOCKER_NAME }}/we-share-wish-hair:redis - name: Deploy with push uses: appleboy/ssh-action@v1.0.0 diff --git a/.gitignore b/.gitignore index 39420aa..1d78010 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ build/ !**/src/main/**/build/ !**/src/test/**/build/ /src/main/generated/ +src/main/resources/application*.yml ### sql ### **/src/main/resources/sql/ diff --git a/docker-compose.yml b/docker-compose.yml index f661b38..a88ca8e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,13 +3,9 @@ services: server: image: openjdk:17-alpine restart: always - env_file: - - .env volumes: - ./build/libs:/home - command: ["java", "-jar", - "-Dspring.profiles.active=prod", - "/home/advanced-we-share-wish-hair-0.0.1-SNAPSHOT.jar"] + command: ["java", "-jar", "-Dspring.profiles.active=prod", "/home/advanced-we-share-wish-hair-0.0.1-SNAPSHOT.jar"] ports: - '8080:8080' platform: linux/amd64 diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml deleted file mode 100644 index ff4e3d5..0000000 --- a/src/main/resources/application-dev.yml +++ /dev/null @@ -1,91 +0,0 @@ -server: - port: 8090 - - -spring: - data: - redis: - host: localhost - port: 6379 - expire-time: 21600000 - - datasource: - master: - hikari: - driver-class-name: com.mysql.cj.jdbc.Driver - jdbc-url: jdbc:mysql://localhost:3306/db - username: root - password: 1234 - slave: - hikari: - driver-class-name: com.mysql.cj.jdbc.Driver - jdbc-url: jdbc:mysql://localhost:3307/db - username: root - password: 1234 - - jpa: - hibernate: - ddl-auto: update - - properties: - hibernate: - default_batch_fetch_size: 100 - show_sql: true - format_sql: true - - open-in-view: false - - mail: - host: smtp.gmail.com - port: 587 - username: namhm23@kyonggi.ac.kr - password: qkvpxhpgyuywcbgh - protocol: smtp - properties: - mail: - smtp: - starttls: - enable: true - auth: true - - servlet: - multipart: - max-file-size: 10MB - -# 포인트 메일 수신자 # -mail: - point-mail-receiver: namhm23@naver.com - -# Flask domain # -flask: - domain: http://domain/ - -#p6spy 설정 -decorator: - datasource: - p6spy: - enable-logging: true - -#JWT key -jwt: - secret-key: abcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabcabc - access-token-validity: 180000000 - refresh-token-validity: 259200000 - -# 네이버 클라우드 오브젝트 스토리지 -cloud: - aws: - credentials: - access-key: N3JCSJUtgse4alKEaOqX - secret-key: rRamLrfUV8v6ZziJFEN4CVLjE9rl4kCBnEOLje5f - stack: - auto: false - region: - static: ap-northeast-2 - s3: - endpoint: https://kr.object.ncloudstorage.com - bucket: wswh-storage - -logging: - level: - root: info \ No newline at end of file diff --git a/src/main/resources/application-prod.yml b/src/main/resources/application-prod.yml deleted file mode 100644 index 6a9088a..0000000 --- a/src/main/resources/application-prod.yml +++ /dev/null @@ -1,82 +0,0 @@ -server: - port: 8080 - - -spring: - data: - redis: - host: 3.21.14.25 - port: 6379 - expire-time: 21600000 - - datasource: - driver-class-name: com.mysql.cj.jdbc.Driver - url: ${URL} - username: ${USERNAME} - password: ${PW} - - jpa: - hibernate: - ddl-auto: create - - properties: - hibernate: - default_batch_fetch_size: 100 - show_sql: true - format_sql: true - - open-in-view: false - - mail: - host: smtp.gmail.com - port: 587 - username: ${MAIL_USERNAME} - password: ${MAIL_PW} - protocol: smtp - properties: - mail: - smtp: - starttls: - enable: true - auth: true - - servlet: - multipart: - max-file-size: 10MB - -# 포인트 메일 수신자 # -mail: - point-mail-receiver: namhm23@naver.com - -# Flask domain # -flask: - domain: http://domain/ - -#p6spy 설정 -decorator: - datasource: - p6spy: - enable-logging: true - -#JWT key -jwt: - secret-key: ${JWT_KEY} - access-token-validity: ${ACCESS_VALIDITY} - refresh-token-validity: ${REFRESH_VALIDITY} - -# 네이버 클라우드 오브젝트 스토리지 -cloud: - aws: - credentials: - access-key: ${S3_ACCESS_KEY} - secret-key: ${S3_SECRET_KEY} - stack: - auto: false - region: - static: ap-northeast-2 - s3: - endpoint: https://kr.object.ncloudstorage.com - bucket: ${S3_BUCKET} -logging: - level: - root: info \ No newline at end of file diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml deleted file mode 100644 index fd37abb..0000000 --- a/src/main/resources/application.yml +++ /dev/null @@ -1,87 +0,0 @@ -server: - port: 8080 - -spring: - datasource: - url: jdbc:mysql://localhost:3306/wish_hair_db - username: root - password: 1234! - driver-class-name: com.mysql.cj.jdbc.Driver - jpa: - hibernate: - ddl-auto: update - - properties: - hibernate: - default_batch_fetch_size: 100 -# show_sql: true -# format_sql: true - dialect: org.hibernate.dialect.MySQLDialect - - open-in-view: false - - data: - redis: - host: localhost - port: 6379 - expire-time: 21600000 - - mail: - host: smtp.gmail.com - port: 587 - username: ${MAIL} - password: ${MAIL_PW} - protocol: smtp - properties: - mail: - smtp: - starttls: - enable: true - auth: true - - servlet: - multipart: - max-file-size: 10MB - -# 포인트 메일 수신자 # -mail: - point-mail-receiver: ${POINT_MAIL} #namhm23@naver.com - -# Flask domain # -flask: - domain: ${FLASK_DOMAIN} - -# 서버 런시 발생하는 에러 로그 방지 -logging: - com: - amazonaws: - util: - EC2MetadataUtils: error - level: - root: warn - -#p6spy 설정 -decorator: - datasource: - p6spy: - enable-logging: false - -#JWT key -jwt: - secret-key: ${JWT_SECRET_KEY} - access-token-validity: ${ACCESS_TOKEN_VALIDITY} - refresh-token-validity: ${REFRESH_TOKEN_VALIDITY} - -# 네이버 클라우드 오브젝트 스토리지 -cloud: - aws: - credentials: - access-key: ${S3_ACCESS_KEY} # N3JCSJUtgse4alKEaOqX - secret-key: ${S3_SECRET_KEY} #rRamLrfUV8v6ZziJFEN4CVLjE9rl4kCBnEOLje5f - stack: - auto: false - region: - static: ap-northeast-2 - s3: - endpoint: https://kr.object.ncloudstorage.com - bucket: ${BUCKET_NAME} # wswh-storage