-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* [FEAT]: ci.yml 기능 추가 (#23) * [FEAT]: cd.yml 생성(#23) * [FIX]: Klint 수정 (#23) * [FEAT]: ContextTest 임시 삭제 (#23) * [FEAT]: Docker File 생성 (#23) * [FIX]: ci.yml configuration files 생성 bad substitution 오류 수정(#23) * [FIX]: 직접 파일을 생성하는 것에서 환경변수로 치환하는 것으로 변경 (#23) * [DOCS]: git ignore 수정 (#23) * [DOCS]: yml 파일을 개발자 공통으로 관리 할 수 있도록 Ignore에서 제외, 부분 환경변수로 암호화 (#23) * [FEAT]: 도커 잉여 이미지 제거 스크립트 추가 (#23)
- Loading branch information
Showing
15 changed files
with
1,632 additions
and
22 deletions.
There are no files selected for viewing
This file contains 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,48 @@ | ||
name: CD | ||
|
||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
types: [closed] | ||
branches: [develop] | ||
|
||
jobs: | ||
deploy: | ||
if: github.event.pull_request.merged == true | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v1 | ||
|
||
- name: Login to DockerHub | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
|
||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v2 | ||
with: | ||
context: . | ||
push: true | ||
tags: ${{ secrets.DOCKER_USERNAME }}/dev:latest | ||
|
||
- name: Add SSH key | ||
uses: webfactory/[email protected] | ||
with: | ||
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} | ||
|
||
- name: Deploy to server | ||
run: | | ||
ssh ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} << 'EOF' | ||
docker pull ${{ secrets.DOCKER_USERNAME }}/dev:latest | ||
docker stop app || true | ||
docker rm app || true | ||
docker run -d --name app -p 80:80 ${{ secrets.DOCKER_USERNAME }}/dev:latest | ||
docker image prune -f | ||
EOF | ||
This file contains 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 |
---|---|---|
@@ -1,30 +1,56 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
pull_request: | ||
branches: [ "main" ] | ||
branches: [ "develop" ] | ||
workflow_dispatch: | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
build: | ||
build-and-test: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Set up JDK | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '21' | ||
distribution: 'adopt' | ||
|
||
- name: Cache Gradle packages | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.gradle/caches | ||
~/.gradle/wrapper | ||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | ||
restore-keys: | | ||
${{ runner.os }}-gradle- | ||
- name: Set environment variables | ||
env: | ||
KAKAO_ADMIN_KEY: ${{ secrets.KAKAO_ADMIN_KEY }} | ||
JWT_ACCESS_TOKEN_SECRET: ${{ secrets.JWT_ACCESS_TOKEN_SECRET }} | ||
JWT_REFRESH_TOKEN_SECRET: ${{ secrets.JWT_REFRESH_TOKEN_SECRET }} | ||
STORAGE_DATABASE_CORE_DB_URL: ${{ secrets.STORAGE_DATABASE_CORE_DB_URL }} | ||
STORAGE_DATABASE_CORE_DB_USERNAME: ${{ secrets.STORAGE_DATABASE_CORE_DB_USERNAME }} | ||
STORAGE_DATABASE_CORE_DB_PASSWORD: ${{ secrets.STORAGE_DATABASE_CORE_DB_PASSWORD }} | ||
AWS_IOT_ENDPOINT: ${{ secrets.AWS_IOT_ENDPOINT }} | ||
AWS_IOT_CLIENTID: ${{ secrets.AWS_IOT_CLIENTID }} | ||
AWS_IOT_CERTIFICATE: ${{ secrets.AWS_IOT_CERTIFICATE }} | ||
AWS_IOT_PRIVATE_KEY: ${{ secrets.AWS_IOT_PRIVATE_KEY }} | ||
run: echo "Environment variables are set" | ||
|
||
- name: Lint | ||
uses: gradle/gradle-build-action@67421db6bd0bf253fb4bd25b31ebb98943c375e1 | ||
uses: gradle/gradle-build-action@v2 | ||
with: | ||
arguments: ktlintCheck | ||
|
||
- name: Test | ||
uses: gradle/gradle-build-action@67421db6bd0bf253fb4bd25b31ebb98943c375e1 | ||
uses: gradle/gradle-build-action@v2 | ||
with: | ||
arguments: test |
This file contains 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 |
---|---|---|
|
@@ -10,5 +10,3 @@ build/ | |
*.iml | ||
*.ipr | ||
out/ | ||
**/resources/*.yml | ||
/certs/ |
This file contains 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,7 @@ | ||
FROM openjdk:21-jdk-slim | ||
|
||
WORKDIR /app | ||
|
||
COPY build/libs/MyongjiWay.jar app.jar | ||
|
||
ENTRYPOINT ["java", "-jar", "app.jar"] |
This file contains 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,36 @@ | ||
kakao: | ||
url: https://kapi.kakao.com | ||
admin-key: ${KAKAO_ADMIN_KEY} | ||
|
||
spring.cloud.openfeign: | ||
client: | ||
config: | ||
example-api: | ||
connectTimeout: 2100 | ||
readTimeout: 5000 | ||
loggerLevel: full | ||
compression: | ||
response: | ||
enabled: false | ||
httpclient: | ||
max-connections: 2000 | ||
max-connections-per-route: 500 | ||
|
||
--- | ||
spring.config.activate.on-profile: local | ||
|
||
--- | ||
spring.config.activate.on-profile: | ||
- local-dev | ||
- dev | ||
|
||
--- | ||
spring.config.activate.on-profile: | ||
- staging | ||
- live | ||
|
||
example: | ||
api: | ||
url: https://live.example.example | ||
|
||
|
This file contains 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,6 @@ | ||
spring.application.name: client-kakao-test | ||
|
||
spring: | ||
config: | ||
import: | ||
- client-kakao.yml |
This file contains 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 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,6 @@ | ||
aws: | ||
iot: | ||
endpoint: ${AWS_IOT_ENDPOINT} | ||
clientId: ${AWS_IOT_CLIENTID} | ||
certificateFile: ${AWS_IOT_CERTIFICATE} | ||
privateKeyFile: ${AWS_IOT_PRIVATE_KEY} |
This file contains 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,46 @@ | ||
spring.application.name: core-api | ||
spring.profiles.active: local | ||
|
||
spring: | ||
config: | ||
import: | ||
- monitoring.yml | ||
- logging.yml | ||
- db-core.yml | ||
- client-kakao.yml | ||
- client-mqtt.yml | ||
web.resources.add-mappings: false | ||
|
||
server: | ||
tomcat: | ||
max-connections: 20000 | ||
threads: | ||
max: 600 | ||
min-spare: 100 | ||
|
||
jwt: | ||
access-token: | ||
secret: ${JWT_ACCESS_TOKEN_SECRET} | ||
expiration: 3600000 | ||
refresh-token: | ||
secret: ${JWT_REFRESH_TOKEN_SECRET} | ||
expiration: 1209600000 | ||
|
||
--- | ||
spring.config.activate.on-profile: local | ||
|
||
|
||
--- | ||
spring.config.activate.on-profile: local-dev | ||
|
||
|
||
--- | ||
spring.config.activate.on-profile: dev | ||
|
||
|
||
--- | ||
spring.config.activate.on-profile: staging | ||
|
||
|
||
--- | ||
spring.config.activate.on-profile: live |
Oops, something went wrong.