forked from Kernel360/f1-Yigil
-
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.
Merge pull request #3 from Kernel360/develop
Update latest version
- Loading branch information
Showing
67 changed files
with
13,234 additions
and
3,160 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,16 @@ | ||
--- | ||
name: 이길어때 이슈 템플릿⭐️ | ||
about: 이길어때 개발 시 진행사항 공유를 위한 이슈 템플릿 | ||
title: '' | ||
labels: '' | ||
assignees: '' | ||
|
||
--- | ||
|
||
### 📝Description | ||
|
||
### ✅Task | ||
- [ ] task1 | ||
- [ ] task2 | ||
|
||
### ✍️Additional |
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,11 @@ | ||
## Motivation 🧐 | ||
|
||
- | ||
|
||
<br> | ||
|
||
## Key Changes 🔑 | ||
|
||
<br> | ||
|
||
## To Reviewers 🙏 |
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,61 @@ | ||
# This workflow uses actions that are not certified by GitHub. | ||
# They are provided by a third-party and are governed by | ||
# separate terms of service, privacy policy, and support | ||
# documentation. | ||
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time | ||
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle | ||
name: Java CD with Gradle | ||
on: | ||
push: | ||
branches: [ "main" ] | ||
permissions: | ||
contents: read | ||
defaults: | ||
run: | ||
working-directory: ./backend | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
## jdk setting | ||
- uses: actions/checkout@v3 | ||
- name: Set up JDK 21 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '21' | ||
distribution: 'temurin' | ||
## application.yml 생성 후 secret 값 복붙 | ||
# Gradle Build를 위한 권한 부여 | ||
- name: Grant execute permission for gradlew | ||
run: chmod +x gradlew | ||
# Gradle Build (test 제외) | ||
- name: Build with Gradle | ||
run: ./gradlew clean build -x test | ||
# DockerHub 로그인 | ||
- name: DockerHub Login | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_PASSWORD }} | ||
# Docker 이미지 빌드 | ||
- name: Docker Image Build | ||
run: docker build -t ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.PROJECT_NAME }} . --platform=linux/amd64 | ||
# DockerHub Push | ||
- name: DockerHub Push | ||
run: docker push ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.PROJECT_NAME }} | ||
|
||
# EC2 인스턴스 접속 및 애플리케이션 실행 | ||
- name: Application Run | ||
uses: appleboy/[email protected] | ||
with: | ||
host: ${{ secrets.EC2_HOST }} | ||
username: ${{ secrets.EC2_USERNAME }} | ||
key: ${{ secrets.EC2_KEY }} | ||
|
||
script: | | ||
sudo docker kill ${{ secrets.PROJECT_NAME }} | ||
sudo docker rm -f ${{ secrets.PROJECT_NAME }} | ||
sudo docker rmi ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.PROJECT_NAME }} | ||
sudo docker pull ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.PROJECT_NAME }} | ||
sudo docker run -p ${{ secrets.PORT }}:${{ secrets.PORT }} -v postgre-volume:/data --name ${{ secrets.PROJECT_NAME }} -d ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.PROJECT_NAME }} |
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,53 @@ | ||
# This workflow uses actions that are not certified by GitHub. | ||
# They are provided by a third-party and are governed by | ||
# separate terms of service, privacy policy, and support | ||
# documentation. | ||
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time | ||
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle | ||
|
||
name: Java CI with Gradle | ||
|
||
on: | ||
push: | ||
pull_request: | ||
branches: [ "develop" ] | ||
|
||
permissions: | ||
contents: read | ||
|
||
defaults: | ||
run: | ||
working-directory: ./backend | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
## jdk setting | ||
- uses: actions/checkout@v3 | ||
- name: Set up JDK 21 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '21' | ||
distribution: 'temurin' | ||
## application.yml 생성 후 secret 값 복붙 | ||
|
||
- name: make properties files | ||
shell: bash | ||
env: | ||
JASYPT_SECRET_KEY: ${{ secrets.JASYPT_SECRET_KEY }} | ||
KAKAO_TOKEN_INFO_URL: ${{ secrets.KAKAO_TOKEN_INFO_URL }} | ||
run: | | ||
echo "Jasypt-Secret-Key=$JASYPT_SECRET_KEY" > ./src/main/resources/config.properties | ||
echo "kakao.token.info.url=$KAKAO_TOKEN_INFO_URL" > ./src/main/resources/url.properties | ||
cat ./src/main/resources/* | ||
# Gradle Build를 위한 권한 부여 | ||
- name: Grant execute permission for gradlew | ||
run: chmod +x gradlew | ||
|
||
# Gradle Build (test 제외) | ||
- name: Build with Gradle | ||
run: ./gradlew clean build | ||
|
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,22 @@ | ||
# .github/workflows/cr.yml 파일 생성 | ||
|
||
name: Code Review | ||
|
||
permissions: | ||
contents: read | ||
pull-requests: write | ||
|
||
on: | ||
pull_request: | ||
types: [opened, synchronize] | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: anc95/ChatGPT-CodeReview@main | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | ||
LANGUAGE: Korean | ||
PROMPT: 당신은 10년차 시니어 개발자입니다. 우리가 작성한 코드에 문제가 없는지 리뷰해주세요. 대답은 한국어로 작성해주시고 보안 이슈, 버그, 변수명 체크는 꼭 해주세요. 단순한 부분이나 큰 이슈가 없는 부분은 리뷰해주지 않아도 되요. 대답 잘하면 200$ tip 줄게요. |
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,31 @@ | ||
name: Frontend CI | ||
|
||
on: | ||
push: | ||
pull_request: | ||
branches: [ "develop" ] | ||
|
||
defaults: | ||
run: | ||
working-directory: ./frontend | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 15 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
sparse-checkout: | ||
frontend | ||
|
||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20 | ||
cache: 'npm' | ||
cache-dependency-path: '**/package-lock.json' | ||
|
||
- run: npm ci | ||
- name: Run test | ||
run: npm run 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 |
---|---|---|
@@ -1 +1,3 @@ | ||
# f1-Yigil | ||
# f1-Yigil | ||
|
||
## 이길 |
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,2 @@ | ||
FROM postgres:latest | ||
RUN apt-get update && apt-get install -y postgis postgresql-16-postgis-3 |
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,10 @@ | ||
version: '3' | ||
services: | ||
postgres-master: | ||
build: . | ||
ports: | ||
- "5432:5432" | ||
postgres-slave: | ||
build: . | ||
ports: | ||
- "5433:5432" |
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 |
---|---|---|
|
@@ -45,4 +45,5 @@ private FileType determineFileType(MultipartFile file) { | |
|
||
throw new FileException(INVALID_FILE_TYPE); | ||
} | ||
|
||
} |
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
2 changes: 1 addition & 1 deletion
2
backend/src/main/java/kr/co/yigil/follow/domain/repository/FollowCountRepository.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 |
---|---|---|
@@ -1,11 +1,11 @@ | ||
package kr.co.yigil.follow.domain.repository; | ||
|
||
|
||
|
||
import java.util.Optional; | ||
import kr.co.yigil.follow.domain.FollowCount; | ||
import org.springframework.data.repository.CrudRepository; | ||
|
||
public interface FollowCountRepository extends CrudRepository<FollowCount, Long> { | ||
|
||
Optional<FollowCount> findByMemberId(Long memberId); | ||
} |
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 |
---|---|---|
|
@@ -8,6 +8,5 @@ | |
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class FollowResponse { | ||
|
||
private String message; | ||
} |
5 changes: 5 additions & 0 deletions
5
backend/src/main/java/kr/co/yigil/global/config/datasource/DataSourceType.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,5 @@ | ||
package kr.co.yigil.global.config.datasource; | ||
|
||
public enum DataSourceType { | ||
Master, Slave | ||
} |
22 changes: 22 additions & 0 deletions
22
backend/src/main/java/kr/co/yigil/global/config/datasource/MasterDataSourceConfig.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,22 @@ | ||
package kr.co.yigil.global.config.datasource; | ||
|
||
import com.zaxxer.hikari.HikariDataSource; | ||
import javax.sql.DataSource; | ||
import org.springframework.boot.context.properties.ConfigurationProperties; | ||
import org.springframework.boot.jdbc.DataSourceBuilder; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.context.annotation.Primary; | ||
|
||
@Configuration | ||
public class MasterDataSourceConfig { | ||
|
||
@Primary | ||
@Bean(name = "masterDataSource") | ||
@ConfigurationProperties(prefix = "spring.datasource.master.hikari") | ||
public DataSource masterDataSource() { | ||
return DataSourceBuilder.create() | ||
.type(HikariDataSource.class) | ||
.build(); | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
backend/src/main/java/kr/co/yigil/global/config/datasource/SlaveDataSourceConfig.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,20 @@ | ||
package kr.co.yigil.global.config.datasource; | ||
|
||
import com.zaxxer.hikari.HikariDataSource; | ||
import javax.sql.DataSource; | ||
import org.springframework.boot.context.properties.ConfigurationProperties; | ||
import org.springframework.boot.jdbc.DataSourceBuilder; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
@Configuration | ||
public class SlaveDataSourceConfig { | ||
|
||
@Bean(name= "slaveDataSource") | ||
@ConfigurationProperties(prefix = "spring.datasource.slave.hikari") | ||
public DataSource slaveDataSource() { | ||
return DataSourceBuilder.create() | ||
.type(HikariDataSource.class) | ||
.build(); | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
...end/src/main/java/kr/co/yigil/global/config/replication/ReplicationRoutingDataSource.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 kr.co.yigil.global.config.replication; | ||
|
||
import kr.co.yigil.global.config.datasource.DataSourceType; | ||
import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource; | ||
import org.springframework.transaction.support.TransactionSynchronizationManager; | ||
|
||
public class ReplicationRoutingDataSource extends AbstractRoutingDataSource { | ||
|
||
@Override | ||
protected Object determineCurrentLookupKey() { | ||
return TransactionSynchronizationManager.isCurrentTransactionReadOnly() ? | ||
DataSourceType.Slave : DataSourceType.Master; | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
backend/src/main/java/kr/co/yigil/global/config/replication/RoutingDataSourceConfig.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,34 @@ | ||
package kr.co.yigil.global.config.replication; | ||
|
||
import java.util.Map; | ||
import javax.sql.DataSource; | ||
import kr.co.yigil.global.config.datasource.DataSourceType; | ||
import org.springframework.beans.factory.annotation.Qualifier; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy; | ||
|
||
@Configuration | ||
public class RoutingDataSourceConfig { | ||
|
||
@Bean(name= "routingDataSource") | ||
public DataSource routingDataSource(@Qualifier("masterDataSource") DataSource masterDataSource, | ||
@Qualifier("slaveDataSource") DataSource slaveDataSource) { | ||
ReplicationRoutingDataSource routingDataSource = new ReplicationRoutingDataSource(); | ||
|
||
Map<Object, Object> dataSourceMap = Map.of( | ||
DataSourceType.Master, masterDataSource, | ||
DataSourceType.Slave, slaveDataSource | ||
); | ||
|
||
routingDataSource.setTargetDataSources(dataSourceMap); | ||
routingDataSource.setDefaultTargetDataSource(masterDataSource); | ||
|
||
return routingDataSource; | ||
} | ||
|
||
@Bean(name = "dataSource") | ||
public DataSource dataSource(@Qualifier("routingDataSource") DataSource routingDataSource) { | ||
return new LazyConnectionDataSourceProxy(routingDataSource); | ||
} | ||
} |
Oops, something went wrong.