-
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.
- Loading branch information
Showing
12 changed files
with
182 additions
and
58 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,64 @@ | ||
name: CD Pipeline | ||
|
||
on: | ||
push: | ||
branches: | ||
- develop # develop ๋ธ๋์น์ merge๋ ๋ ํธ๋ฆฌ๊ฑฐ | ||
- 'weekly/**' | ||
pull_request: | ||
branches: | ||
- develop | ||
- 'weekly/**' | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Java 21 | ||
uses: actions/setup-java@v3 | ||
with: | ||
distribution: 'temurin' | ||
java-version: '21' | ||
|
||
- name: Build with Gradle # Spring Boot๋ฅผ ์ฌ์ฉํ๋ ๊ฒฝ์ฐ | ||
run: ./gradlew build | ||
|
||
- name: Set up Docker | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Log in to Docker Hub | ||
run: echo "${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}" | docker login -u "${{ secrets.DOCKER_HUB_USERNAME }}" --password-stdin | ||
|
||
- name: Set Image Tag | ||
id: image_tag | ||
run: echo "IMAGE_TAG=$(date +'%Y%m%d%H%M%S')" >> $GITHUB_ENV | ||
|
||
- name: Build and Push Docker image | ||
run: docker buildx build --push --platform linux/amd64 -t kimsongmok/splanet:${{ env.IMAGE_TAG }} . | ||
|
||
- name: Deploy to EC2 | ||
uses: appleboy/[email protected] | ||
with: | ||
host: ${{ secrets.EC2_HOST }} | ||
username: ubuntu | ||
key: ${{ secrets.EC2_SSH_KEY }} | ||
script: | | ||
sudo docker pull kimsongmok/splanet:${{ env.IMAGE_TAG }} | ||
sudo docker stop splanet || true | ||
sudo docker rm splanet || true | ||
sudo docker run -d --name splanet \ | ||
--network splanet \ | ||
-e MYSQL_PROD_URL=${{ secrets.MYSQL_PROD_URL }} \ | ||
-e MYSQL_PROD_USER=${{ secrets.MYSQL_PROD_USER }} \ | ||
-e MYSQL_PROD_PASSWORD=${{ secrets.MYSQL_PROD_PASSWORD }} \ | ||
-e MYSQL_DATABASE=${{ secrets.MYSQL_DATABASE }} \ | ||
-e CLIENT_ID=${{ secrets.CLIENT_ID }} \ | ||
-e CLIENT_SECRET=${{ secrets.CLIENT_SECRET }} \ | ||
-e JWT_SECRET=${{ secrets.JWT_SECRET }} \ | ||
-e REDIRECT_URL=${{ secrets.REDIRECT_URL }} \ | ||
-p 80:8080 --restart unless-stopped kimsongmok/splanet:${{ env.IMAGE_TAG }}\ | ||
-v ./src/main/resources/env.properties |
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
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 |
---|---|---|
@@ -1,50 +1,50 @@ | ||
version: '3' | ||
|
||
services: | ||
mysql: | ||
container_name: mysql | ||
image: mysql:8.0 | ||
restart: always | ||
environment: | ||
MYSQL_USER: ${MYSQL_USER} | ||
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD} | ||
MYSQL_PASSWORD: ${MYSQL_PASSWORD} | ||
MYSQL_DATABASE: ${MYSQL_DATABASE} | ||
volumes: | ||
- ./splanet-db/mysql:/var/lib/mysql | ||
ports: | ||
- 3306:3306 | ||
networks: | ||
- splanet | ||
|
||
redis: | ||
container_name: redis | ||
image: redis | ||
ports: | ||
- 6379:6379 | ||
networks: | ||
- splanet | ||
|
||
|
||
# ๊ฐ๋ฐํ ๋๋ ์ฃผ์์ฒ๋ฆฌํ์ฌ ๋ก์ปฌ๋ก ๊ฐ๋ฐํฉ๋๋ค. | ||
# springboot: | ||
# container_name: springboot_splanet | ||
# build: | ||
# context: . | ||
# dockerfile: Dockerfile | ||
# mysql: | ||
# container_name: mysql | ||
# image: mysql:8.0 | ||
# restart: always | ||
# depends_on: | ||
# - mysql | ||
# ports: | ||
# - 8080:8080 | ||
# environment: | ||
# SPRING_DATASOURCE_URL: ${SPRING_DATASOURCE_URL} | ||
# SPRING_DATASOURCE_USERNAME: ${SPRING_DATASOURCE_USERNAME} | ||
# SPRING_DATASOURCE_PASSWORD: ${SPRING_DATASOURCE_PASSWORD} | ||
# SPRING_PROFILES_ACTIVE: ${SPRING_PROFILES_ACTIVE} | ||
# MYSQL_USER: ${MYSQL_USER} | ||
# MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD} | ||
# MYSQL_PASSWORD: ${MYSQL_PASSWORD} | ||
# MYSQL_DATABASE: ${MYSQL_DATABASE} | ||
# volumes: | ||
# - ./splanet-db/mysql:/var/lib/mysql | ||
# ports: | ||
# - 3306:3306 | ||
# networks: | ||
# - splanet | ||
# | ||
# redis: | ||
# container_name: redis | ||
# image: redis | ||
# ports: | ||
# - 6379:6379 | ||
# networks: | ||
# - splanet | ||
|
||
|
||
# ๊ฐ๋ฐํ ๋๋ ์ฃผ์์ฒ๋ฆฌํ์ฌ ๋ก์ปฌ๋ก ๊ฐ๋ฐํฉ๋๋ค. | ||
springboot: | ||
container_name: springboot_splanet | ||
build: | ||
context: . | ||
dockerfile: Dockerfile | ||
restart: always | ||
depends_on: | ||
- mysql | ||
ports: | ||
- 8080:8080 | ||
environment: | ||
SPRING_DATASOURCE_URL: ${SPRING_DATASOURCE_URL} | ||
SPRING_DATASOURCE_USERNAME: ${SPRING_DATASOURCE_USERNAME} | ||
SPRING_DATASOURCE_PASSWORD: ${SPRING_DATASOURCE_PASSWORD} | ||
SPRING_PROFILES_ACTIVE: ${SPRING_PROFILES_ACTIVE} | ||
networks: | ||
- splanet | ||
|
||
networks: | ||
splanet: | ||
driver: bridge |
14 changes: 14 additions & 0 deletions
14
src/main/java/com/splanet/splanet/core/properties/JwtProperties.java
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,14 @@ | ||
package com.splanet.splanet.core.properties; | ||
|
||
import lombok.Getter; | ||
import lombok.Setter; | ||
import org.springframework.boot.context.properties.ConfigurationProperties; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
@Getter | ||
@Setter | ||
@Configuration | ||
@ConfigurationProperties(prefix = "jwt") | ||
public class JwtProperties { | ||
private String secret; | ||
} |
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,17 @@ | ||
spring: | ||
datasource: | ||
url: jdbc:mysql://localhost:3306/${MYSQL_DATABASE} | ||
username: ${MYSQL_USER} | ||
password: ${MYSQL_PASSWORD} | ||
driver-class-name: com.mysql.cj.jdbc.Driver | ||
data: | ||
redis: | ||
host: localhost | ||
port: 6379 | ||
security: | ||
oauth2: | ||
redirect-url: http://localhost:5173/oauth2/redirect | ||
client: | ||
registration: | ||
kakao: | ||
redirect-uri: http://localhost:8080/login/oauth2/code/kakao |
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,17 @@ | ||
spring: | ||
datasource: | ||
url: jdbc:mysql://${MYSQL_PROD_URL}:3306/${MYSQL_DATABASE} | ||
username: ${MYSQL_PROD_USER} | ||
password: ${MYSQL_PROD_PASSWORD} | ||
driver-class-name: com.mysql.cj.jdbc.Driver | ||
data: | ||
redis: | ||
host: redis | ||
port: 6379 | ||
security: | ||
oauth2: | ||
redirect-url: https://splanet.co.kr/oauth2/redirect | ||
client: | ||
registration: | ||
kakao: | ||
redirect-uri: https://splanet.co.kr/login/oauth2/code/kakao |
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
Empty file.