Skip to content
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

issue/252 👷 Ci : 릴리즈 인프라 구축 #255

Merged
merged 1 commit into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .ebextensions-release/00-makeFiles.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
files:
"/sbin/appstart" :
mode: "000755"
owner: webapp
group: webapp
content: |
#!/usr/bin/env bash
JAR_PATH=/var/app/current/application.jar

# run app
killall java
java -Dfile.encoding=UTF-8 -Dspring.profiles.active=release -jar $JAR_PATH
3 changes: 3 additions & 0 deletions .ebextensions-release/01-set-timezone.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
commands:
set_time_zone:
command: ln -f -s /usr/share/zoneinfo/Asia/Seoul /etc/localtime
61 changes: 61 additions & 0 deletions .github/workflows/release_deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: zipdabang Release CI/CD

on:
pull_request:
types: [closed]
workflow_dispatch: # (2).수동 실행도 가능하도록

jobs:
build:
runs-on: ubuntu-latest # (3).OS환경
if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'release'

steps:
- name: Checkout
uses: actions/checkout@v2 # (4).코드 check out

- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: 11 # (5).자바 설치
distribution: 'adopt'

- name: Grant execute permission for gradlew
run: chmod +x ./gradlew
shell: bash # (6).권한 부여

- name: Build with Gradle
run: ./gradlew clean build -x test
shell: bash # (7).build 시작

- name: Get current time
uses: 1466587594/get-current-time@v2
id: current-time
with:
format: YYYY-MM-DDTHH-mm-ss
utcOffset: "+09:00" # (8).build 시점의 시간확보

- name: Show Current Time
run: echo "CurrentTime=$"
shell: bash # (9).확보한 시간 보여주기

- name: Generate deployment package
run: |
mkdir -p deploy
cp build/libs/*.jar deploy/application.jar
cp Procfile deploy/Procfile
cp -r .ebextensions-release deploy/.ebextensions
cp -r .platform deploy/.platform
cd deploy && zip -r deploy.zip .

- name: Beanstalk Deploy
uses: einaregilsson/beanstalk-deploy@v20
with:
aws_access_key: ${{ secrets.AWS_ACTION_ACCESS_KEY_ID }}
aws_secret_key: ${{ secrets.AWS_ACTION_SECRET_ACCESS_KEY }}
application_name: zipdabang-release
environment_name: Zipdabang-release-env
version_label: github-action-${{ steps.current-time.outputs.formattedTime }}
region: ap-northeast-2
deployment_package: deploy/deploy.zip
wait_for_deployment: false
93 changes: 93 additions & 0 deletions src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -198,3 +198,96 @@ fcm:
url: ${FCM_URL}
project-num: ${FCM_PROJECT_NUMBER}

---
spring:
config:
activate:
on-profile: release
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
username: ${aws.db.username}
password: ${aws.db.password}
url: ${aws.db.url}
output:
ansi:
enabled: always

## # local redis
redis:
host: zipdabang-release.osattk.ng.0001.apn2.cache.amazonaws.com

batch:
jdbc:
initialize-schema: always
job:
names: myJob

jpa:
properties:
hibernate:
dialect: org.hibernate.dialect.MySQL8Dialect
use_sql_comments: true
hbm2ddl:
auto: update
default_batch_fetch_size: 1000
show_sql: true
format_sql: true

logging:
level:
# root: info
org.hibernate.SQL: DEBUG
org.hibernate.type: trace

servlet:
multipart:
maxFileSize: 20MB
maxRequestSize: 30MB
enabled: true

oauth:
kakao:
baseUrl: ${KAKAO_BASE_URL}
clientId: ${KAKAO_CLIENT_ID}
secretKeyREST: ${KAKAO_SECRET_REST}
secretKeyAndroid: ${KAKAO_SECRET_ANDROID}
google:

cloud:
aws:
s3:
bucket: zipdabang
folder:
zipdabang-recipe-thumbNail: recipe/thumbnail
zipdabang-recipe-steps: recipe/steps
zipdabang-proifile: user
zipdabang-inquery: inquery
# zipdabang-facilities : facilities
user-default-image: ${USER_DEFAULT_IMAGE}
region:
static: ap-northeast-2
stack:
auto: false
credentials:
accessKey: ${AWS_ACCESS_KEY_ID}
secretKey: ${AWS_SECRET_ACCESS_KEY}

jwt:
header: Authorization
secret: ${JWT_SECRET}
authorities-key: ${JWT_AUTHORITIES_KEY}
access-token-validity-in-seconds: 1800 # 30 m
refresh-token-validity-in-seconds: 1210000000 # 14 d

paging:
size: 10

naver-sms:
accessKey: ${NAVER_SMS_ACCESSKEY}
secretKey: ${NAVER_SMS_SECRET}
serviceId: ${NAVER_SMS_SERVICEID}
senderPhone: ${NAVER_SMS_PHONE}

fcm:
url: ${FCM_URL}
project-num: ${FCM_PROJECT_NUMBER}
Loading