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

[20기_남승현, 문서영] spring-vote 미션 제출합니다. #7

Open
wants to merge 38 commits into
base: photo-ground
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
a1140b1
✨ feat : 초기세팅
sh0311 Dec 27, 2024
3e41670
✨ feat : entity 생성
sh0311 Dec 28, 2024
73c6029
Merge pull request #1 from photo-ground/feature/vote
sh0311 Dec 28, 2024
0a133ee
Create cicd.yml
sh0311 Dec 29, 2024
e7ed737
Update cicd.yml
sh0311 Dec 29, 2024
b45f9aa
feat : Dockerfile 생성
sh0311 Dec 29, 2024
3c50dec
Merge pull request #2 from photo-ground/feature/vote
sh0311 Dec 29, 2024
a17f0ee
🚚 move : 폴더구조 변경
sh0311 Dec 29, 2024
c9f512b
Update cicd.yml
sh0311 Dec 29, 2024
f3e0ab4
Merge pull request #3 from photo-ground/feature/vote
sh0311 Dec 29, 2024
3c5e419
Update cicd.yml
sh0311 Dec 29, 2024
154e7f0
Update Dockerfile
sh0311 Dec 29, 2024
7af69c6
✨ feat : 후보 조회
sh0311 Dec 30, 2024
378058a
✨ feat : 파트장 투표
sh0311 Dec 30, 2024
248b31a
✨ feat : 파트장 투표 결과 조회
sh0311 Dec 30, 2024
75be3fd
Update cicd.yml
sh0311 Dec 30, 2024
d183049
Merge pull request #5 from photo-ground/feature/vote
seona-moon Dec 31, 2024
8e5e881
🛠️ build : gradle 업데이트 및 필요 없는 파일 삭제
seona-moon Dec 31, 2024
129d524
✨ feat : 회원가입 및 로그인 기능 구현
seona-moon Dec 31, 2024
ebddea6
✨ feat : 로그아웃 기능 구현
seona-moon Dec 31, 2024
ae99443
✨ feat : 팀 투표결과 조회
sh0311 Dec 31, 2024
2c23ac0
Merge branch 'feature/vote' of https://github.com/photo-ground/spring…
sh0311 Dec 31, 2024
e6c3e87
Merge pull request #6 from photo-ground/feature/vote
sh0311 Dec 31, 2024
f55c19e
✨ feat : AuthenticationPrincipal 적용
sh0311 Dec 31, 2024
af61017
Merge pull request #7 from photo-ground/feature/vote
seona-moon Dec 31, 2024
6366a95
충돌 해결
sh0311 Jan 1, 2025
fe649a5
✨ feat : 경로 권한 수정
sh0311 Jan 1, 2025
d848409
✨ feat : 후보자는 candidate 엔티티로 분리
sh0311 Jan 3, 2025
7e4fc7f
Merge pull request #8 from photo-ground/feature/vote
sh0311 Jan 3, 2025
e14284a
✨ feat : 아이디, 이메일 중복 예외처리
seona-moon Jan 3, 2025
dd5324c
Merge pull request #9 from photo-ground/feature/login
sh0311 Jan 3, 2025
aafc338
🔧 chore : 엑세스 토큰 만료시간 수정
seona-moon Jan 3, 2025
9d4747e
🔧 chore : ExposedHeaders 수정
sh0311 Jan 4, 2025
eadb600
Merge pull request #10 from photo-ground/feature/vote
sh0311 Jan 4, 2025
eb1820a
🔧 chore : 도메인 주소 추가
sh0311 Jan 4, 2025
feb87cd
Merge pull request #11 from photo-ground/feature/vote
sh0311 Jan 4, 2025
ff8df25
Update README.md
sh0311 Jan 5, 2025
71bddbb
Update README.md
sh0311 Jan 5, 2025
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
Binary file added .DS_Store
Binary file not shown.
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/gradlew text eol=lf
*.bat text eol=crlf
*.jar binary
68 changes: 68 additions & 0 deletions .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: CICD

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3 #github actions의 탬플릿(자동으로 pull받음)
- name: Install JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'

- name: Verify files and directories
run: |
echo "Current directory:"
pwd
echo "Files in current directory:"
ls -al

- name: Build with Gradle
run: |
mkdir -p ./src/main/resources
echo ${{ secrets.APPLICATION }} | base64 --decode > ./src/main/resources/application.yml
echo ${{ secrets.APPLICATION_PROD }} | base64 --decode > ./src/main/resources/application-prod.yml
echo ${{ secrets.APPLICATION_LOCAL }} | base64 --decode > ./src/main/resources/application-local.yml
chmod 777 ./gradlew
./gradlew clean build -x test #jar파일 생성

- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build Docker (create Docker image)
run: docker build --platform linux/amd64 -t ${{ secrets.DOCKERHUB_USERNAME }}/ceos_vote:latest .
- name: Push Docker
run: docker push ${{ secrets.DOCKERHUB_USERNAME }}/ceos_vote:latest

deploy:
needs: build
runs-on: ubuntu-latest
steps:
- name: Docker compose #ec2로 이동해서 ec2에 접속
uses: appleboy/ssh-action@master
with:
username: ubuntu
host: ${{ secrets.VOTE_SERVER_IP }}
key: ${{ secrets.EC2_SSH_KEY }}
script: |
sudo docker pull ${{ secrets.DOCKERHUB_USERNAME }}/ceos_vote:latest
if [ $(sudo docker ps -q --filter "name=ceos_vote") ]; then
echo "Stopping and removing existing container..."
sudo docker stop ceos_vote
sudo docker rm ceos_vote
fi
sudo docker run -d --name ceos_vote -p 8080:8080 ${{ secrets.DOCKERHUB_USERNAME }}/ceos_vote:latest

44 changes: 44 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/resources
application.yml
application-local.yml
application-prod.yml



vote/HELP.md
.gradle
build/
!../gradle/wrapper/gradle-wrapper.jar
!**/src/main/**/build/
!**/src/test/**/build/

### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
bin/
!**/src/main/**/bin/
!**/src/test/**/bin/

### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
out/
!**/src/main/**/out/
!**/src/test/**/out/

### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/

### VS Code ###
.vscode/
15 changes: 15 additions & 0 deletions .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 26 additions & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# 1. Java 이미지를 기반으로 설정
FROM openjdk:17-jdk

ARG JAR_FILE=/build/libs/*.jar

# 3. JAR 파일 복사
COPY ${JAR_FILE} app.jar

# 4. 환경 변수로 Spring Profile 설정 (기본값: local)
ENV SPRING_PROFILES_ACTIVE=prod

# 5. 애플리케이션 실행
ENTRYPOINT ["java", "-Dspring.profiles.active=${SPRING_PROFILES_ACTIVE}", "-jar", "app.jar"]
25 changes: 25 additions & 0 deletions HELP.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Getting Started

### Reference Documentation
For further reference, please consider the following sections:

* [Official Gradle documentation](https://docs.gradle.org)
* [Spring Boot Gradle Plugin Reference Guide](https://docs.spring.io/spring-boot/3.4.1/gradle-plugin)
* [Create an OCI image](https://docs.spring.io/spring-boot/3.4.1/gradle-plugin/packaging-oci-image.html)
* [Spring Web](https://docs.spring.io/spring-boot/3.4.1/reference/web/servlet.html)
* [Spring Data JPA](https://docs.spring.io/spring-boot/3.4.1/reference/data/sql.html#data.sql.jpa-and-spring-data)

### Guides
The following guides illustrate how to use some features concretely:

* [Building a RESTful Web Service](https://spring.io/guides/gs/rest-service/)
* [Serving Web Content with Spring MVC](https://spring.io/guides/gs/serving-web-content/)
* [Building REST services with Spring](https://spring.io/guides/tutorials/rest/)
* [Accessing Data with JPA](https://spring.io/guides/gs/accessing-data-jpa/)
* [Accessing data with MySQL](https://spring.io/guides/gs/accessing-data-mysql/)

### Additional Links
These additional references should also help you:

* [Gradle Build Scans – insights for your project's build](https://scans.gradle.com#gradle)

44 changes: 43 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,43 @@
# spring_vote_20th
# spring_vote_20th

### ERD

<img width="721" alt="image" src="https://github.com/user-attachments/assets/e38efc2f-f7ad-4266-9b1e-d2758adaa009" />

### API 명세서

<img width="1052" alt="image" src="https://github.com/user-attachments/assets/c0f83d2a-32fc-46dc-8f7c-4c3d47537f60" />


### 테스트

<팀 조회>

<img width="736" alt="image" src="https://github.com/user-attachments/assets/b7e66706-92bf-49a5-a736-07fcf70e6786" />


<팀 투표>

<img width="741" alt="image" src="https://github.com/user-attachments/assets/e0039c7d-8079-42e3-bb5d-fd0e3ab462a8" />


<본인 팀 투표>

<img width="732" alt="image" src="https://github.com/user-attachments/assets/c63a7c1a-a4ae-4153-ad84-55a811848fb3" />


<후보자 조회>

<img width="731" alt="image" src="https://github.com/user-attachments/assets/f3e096a2-adaa-409c-9675-f8f0897a2ed3" />


<중복 투표>

<img width="738" alt="image" src="https://github.com/user-attachments/assets/bd4e4f13-1272-465e-b3b4-3f00ad63e04e" />


<투표 결과 조회>

<img width="743" alt="image" src="https://github.com/user-attachments/assets/5396da7a-a336-49b6-b9a2-6339adcce1a1" />


43 changes: 43 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
plugins {
id 'java'
id 'org.springframework.boot' version '3.4.1'
id 'io.spring.dependency-management' version '1.1.7'
}

group = 'photoground.ceos'
version = '0.0.1-SNAPSHOT'

java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}

configurations {
compileOnly {
extendsFrom annotationProcessor
}
}

repositories {
mavenCentral()
}

dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-web'
compileOnly 'org.projectlombok:lombok'
runtimeOnly 'com.mysql:mysql-connector-j'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
implementation 'io.jsonwebtoken:jjwt-api:0.12.3'
implementation 'io.jsonwebtoken:jjwt-impl:0.12.3'
implementation 'io.jsonwebtoken:jjwt-jackson:0.12.3'
implementation 'org.springframework.boot:spring-boot-starter-security'

}

tasks.named('test') {
useJUnitPlatform()
}
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
7 changes: 7 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading