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

Build/#10 backend cicd #11

Merged
merged 16 commits into from
Apr 15, 2024
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
10 changes: 6 additions & 4 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,19 @@ permissions:
jobs:
build:
runs-on: ubuntu-22.04
if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'Dev-backend'
if: ${{ github.event.pull_request.base.ref == 'Dev-backend' || github.event_name == 'push' }}

steps:
# ์ง€์ •ํ•œ ์ €์žฅ์†Œ(ํ˜„์žฌ REPO)์—์„œ ์ฝ”๋“œ๋ฅผ ์›Œํฌํ”Œ๋กœ์šฐ ํ™˜๊ฒฝ์œผ๋กœ ๊ฐ€์ ธ์˜ค๋„๋ก ํ•˜๋Š” github action
- name: Checkout
- uses: actions/checkout@v3

# open jdk 17 ๋ฒ„์ „ ํ™˜๊ฒฝ์„ ์„ธํŒ…
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: "adopt"
distribution: "temurin"

# Github secrets๋กœ๋ถ€ํ„ฐ ๋ฐ์ดํ„ฐ๋ฅผ ๋ฐ›์•„์„œ, ์›Œํฌ ํ”Œ๋กœ์šฐ์— ํŒŒ์ผ์„ ์ƒ์„ฑ
- name: Make application.yml
Expand Down Expand Up @@ -71,5 +72,6 @@ jobs:
script: |
sudo docker rm -f $(docker ps -qa)
sudo docker pull ${{ secrets.DOCKER_REPO }}/backend-dev
docker-compose up -d
docker image prune -f
cd ~/JinJiHan
sudo docker-compose -f docker-compose.yml down
sudo docker-compose -f docker-compose.yml up --build -d
4 changes: 4 additions & 0 deletions backend/core/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM eclipse-temurin:17-jdk-jammy AS build
WORKDIR /app
COPY . /app
CMD ["gradle", "bootRun"]
39 changes: 39 additions & 0 deletions backend/core/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
version: "3.9"
services:
redis:
image: redis:latest
container_name: redis
ports:
- "6379:6379"
networks:
backend:
restart: always
tty: true

rabbitmq:
image: rabbitmq:3-management
container_name: rabbitmq
entrypoint: >
/bin/bash -c "
rabbitmq-server &
sleep 10 && rabbitmq-plugins enable rabbitmq_web_stomp &
tail -f /dev/null
"
environment:
RABBITMQ_DEFAULT_USER: ${RABBITMQ_DEFAULT_USER}
RABBITMQ_DEFAULT_PASS: ${RABBITMQ_DEFAULT_PASS}
ports:
- "5672:5672"
- "15672:15672"
volumes:
- data_rabbitmq:/rabbitmq
networks:
- backend
restart: always
tty: true

networks:
backend:

volumes:
data_rabbitmq: null
64 changes: 64 additions & 0 deletions backend/core/src/main/resources/application-prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
spring:
datasource:
driver-class-name: ${DRIVER_CLASS_NAME}
url: ${DATASOURCE_URL}
username: ${DATABASE_USERNAME}
password: ${DATABASE_PASSWORD}
jpa:
database-platform: org.hibernate.dialect.MySQLDialect
show-sql: true
hibernate:
ddl-auto: none
security:
oauth2:
client:
registration:
kakao:
client-id: ${KAKAO_CLIENT_ID} #rest api ํ‚ค ๊ฐ’
client-secret: ${KAKAO_CLIENT_SECRET}
redirect-uri: ${KAKAO_REDIRECT_URI}
client-authentication-method: client_secret_post
authorization-grant-type: authorization_code
client-name: Kakao
scope:
- profile_nickname
- profile_image
- account_email
provider:
kakao:
authorization-uri: ${KAKAO_AUTHORIZATION_URI}
token-uri: ${KAKAO_TOKEN_URI}
user-info-uri: ${KAKAO_USER_INFO_URI}
user-name-attribute: id
data:
redis:
host: ${REDIS_HOST}
port: ${REDIS_PORT}

rabbitmq:
host: ${RABBITMQ_HOST}
port: ${RABBITMQ_PORT}
username: ${RABBITMQ_USERNAME}
password: ${RABBITMQ_PASSWORD}
listener:
simple:
prefetch: 50

jwt:
secret-key: ${JWT_SECRET_KEY}
access:
expiration: 3600000 #1hours
header: Authorization
refresh:
expiration: 604800000 #7days
header: Authorization-refresh

rabbitmq:
summary:
queue.name: ${SUMMARY_QUEUE_NAME}
exchange.name: ${SUMMARY_EXCHANGE_NAME}
routing.key: ${SUMMARY_ROUTING_KEY}
store:
queue.name: ${STORE_QUEUE_NAME}
exchange.name: ${STORE_EXCHANGE_NAME}
routing.key: ${STORE_ROUTING_KEY}
3 changes: 3 additions & 0 deletions backend/core/src/main/resources/application.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
spring:
profiles:
active: dev