-
Notifications
You must be signed in to change notification settings - Fork 1
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
16 changed files
with
489 additions
and
86 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,103 @@ | ||
# 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: Ohhanahana CD Pipeline | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
# Build를 위한 JDK 설치 | ||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v2 | ||
with: | ||
distribution: 'adopt' | ||
java-version: '17' | ||
|
||
# 서브모듈을 포함하여 소스 코드 체크아웃 | ||
- name: Checkout submodule | ||
uses: actions/checkout@v4 | ||
with: | ||
submodules: true | ||
token: ${{ secrets.ACTIONS_TOKEN }} | ||
|
||
# 서브모듈을 업데이트 | ||
- name: Update submodule | ||
run: | | ||
git submodule update --remote --recursive | ||
# 권한 부여 | ||
- name: Grant execute permission for gradlew | ||
run: chmod +x gradlew | ||
|
||
# 빌드 | ||
- name: Build with Gradle | ||
run: ./gradlew clean build -x test | ||
|
||
# Docker 이미지 빌드 | ||
- name: Docker image build | ||
run: docker build --build-arg SPRING_PROFILE=main -t ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKERHUB_REPO }}:latest . | ||
|
||
# DockerHub 로그인 | ||
- name: DockerHub login | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_PASSWORD }} | ||
|
||
# Docker Hub 이미지 푸시 | ||
- name: Docker Hub push | ||
run: docker push ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKERHUB_REPO }}:latest | ||
|
||
# Deploy to EC2 | ||
- name: Deploy to EC2 | ||
uses: appleboy/ssh-action@master | ||
with: | ||
host: ${{ secrets.EC2_HOST }} | ||
username: ubuntu | ||
key: ${{ secrets.SSH_KEY }} | ||
script: | | ||
sudo docker stop $(docker ps -a -q --filter "name=ohhanahana-app") || true | ||
sudo docker rm $(docker ps -a -q --filter "name=ohhanahana-app") || true | ||
sudo docker pull ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKERHUB_REPO }}:latest | ||
docker run -d --name ohhanahana-app -p 8080:8080 -e SPRING_PROFILE=main -e TZ=Asia/Seoul ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKERHUB_REPO }}:latest | ||
# # AWS CLI 설치 | ||
# - name: Install AWS CLI | ||
# run: | | ||
# sudo apt-get update | ||
# sudo apt-get install -y awscli | ||
# | ||
# - name: Configure AWS credentials | ||
# uses: aws-actions/configure-aws-credentials@v1 | ||
# with: | ||
# aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
# aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
# aws-region: ${{ secrets.AWS_REGION }} | ||
|
||
# # CodeDeploy를 사용하여 EC2에 배포 | ||
# - name: Deploy to EC2 using CodeDeploy | ||
# env: | ||
# AWS_REGION: ${{ secrets.AWS_REGION }} | ||
# APPLICATION_NAME: ${{ secrets.CODEDEPLOY_APP_NAME }} | ||
# DEPLOYMENT_GROUP_NAME: ${{ secrets.CODEDEPLOY_GROUP_NAME }} | ||
# | ||
# run: | | ||
# aws deploy create-deployment \ | ||
# --application-name $APPLICATION_NAME \ | ||
# --deployment-group-name $DEPLOYMENT_GROUP_NAME \ | ||
# --deployment-config-name CodeDeployDefault.OneAtATime \ | ||
# --description "Deploying the latest Docker image" \ | ||
# --region $AWS_REGION | ||
# --revision location=GitHub,repository=${{ github.repository }},commitId=${{ github.sha }} | ||
|
||
|
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,49 @@ | ||
# 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: Ohhanahana CI Pipeline | ||
|
||
on: | ||
push: | ||
branches: [ "develop" ] | ||
pull_request: | ||
branches: [ "develop" ] | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
|
||
- name: checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: '17' | ||
distribution: 'temurin' | ||
|
||
- name: checkout submodule | ||
uses: actions/checkout@v4 | ||
with: | ||
submodules: true | ||
token: ${{ secrets.ACTIONS_TOKEN }} | ||
|
||
- name: Update submodule | ||
run: | | ||
git submodule update --remote --recursive | ||
- name: Grant execute permission for gradlew | ||
run: chmod +x ./gradlew | ||
|
||
- name: Build with Gradle | ||
run: ./gradlew clean build -x test | ||
env: | ||
SPRING_PROFILES_ACTIVE: main | ||
|
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 @@ | ||
FROM openjdk:17 | ||
|
||
ARG JAR_FILE=build/libs/*.jar | ||
COPY ${JAR_FILE} app.jar | ||
|
||
ENTRYPOINT ["java", "-jar", "-Dspring.profiles.active=${SPRING_PROFILE}", "/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,14 @@ | ||
#version: 0.0 | ||
#os: linux | ||
#files: | ||
# - source: / | ||
# destination: /home/ubuntu/deployment | ||
#hooks: | ||
# BeforeInstall: | ||
# - location: scripts/env.sh | ||
# timeout: 300 | ||
# runas: ubuntu | ||
# AfterInstall: | ||
# - location: scripts/deploy.sh | ||
# timeout: 300 | ||
# runas: ubuntu |
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,18 @@ | ||
##!/bin/bash | ||
# | ||
## 환경변수 로드 | ||
#source /home/ubuntu/deployment/scripts/env.sh | ||
# | ||
#cd /home/ubuntu/deployment | ||
# | ||
## 기존에 실행 중인 컨테이너 중지 | ||
#sudo docker stop $(docker ps -a -q --filter "name=ohhanahana-app") || true | ||
# | ||
## 기존에 중지된 컨테이너 삭제 | ||
#sudo docker rm $(docker ps -a -q --filter "name=ohhanahana-app") || true | ||
# | ||
## 최신 Docker 이미지 가져오기 | ||
#sudo docker pull $DOCKERHUB_USERNAME/$DOCKERHUB_REPO:latest | ||
# | ||
## 새로운 컨테이너 실행 | ||
#docker run -d --name ohhanahana-app -p 8080:8080 -e SPRING_PROFILE=main -e TZ=Asia/Seoul $DOCKERHUB_USERNAME/$DOCKERHUB_REPO:latest |
28 changes: 28 additions & 0 deletions
28
src/main/java/com/cloudcomputing/ohhanahana/config/RestTemplateConfig.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,28 @@ | ||
package com.cloudcomputing.ohhanahana.config; | ||
|
||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.http.client.ClientHttpRequestFactory; | ||
import org.springframework.http.client.SimpleClientHttpRequestFactory; | ||
import org.springframework.http.converter.StringHttpMessageConverter; | ||
import org.springframework.web.client.RestTemplate; | ||
|
||
import java.nio.charset.StandardCharsets; | ||
|
||
@Configuration | ||
public class RestTemplateConfig { | ||
|
||
@Bean | ||
public RestTemplate restTemplate() { | ||
RestTemplate restTemplate = new RestTemplate(clientHttpRequestFactory()); | ||
restTemplate.getMessageConverters().add(0, new StringHttpMessageConverter(StandardCharsets.UTF_8)); | ||
return restTemplate; | ||
} | ||
|
||
private ClientHttpRequestFactory clientHttpRequestFactory() { | ||
SimpleClientHttpRequestFactory factory = new SimpleClientHttpRequestFactory(); | ||
factory.setConnectTimeout(3000); | ||
factory.setReadTimeout(3000); | ||
return factory; | ||
} | ||
} |
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
35 changes: 35 additions & 0 deletions
35
src/main/java/com/cloudcomputing/ohhanahana/dto/response/BusResponse.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,35 @@ | ||
package com.cloudcomputing.ohhanahana.dto.response; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
@Getter | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public class BusResponse { | ||
// 셔틀버스 | ||
private BusStop shuttle; | ||
// 독정이고개 | ||
private BusStop ddg; | ||
// 용현고가교 | ||
private BusStop yg; | ||
// 인하대정문 | ||
private BusStop inhaFrontGate; | ||
|
||
|
||
@Getter | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
public static class BusStop { | ||
private String busStopName; | ||
private String busStopNumber; | ||
private String busNumber; | ||
private int remainTime; | ||
private int remainBusStop; | ||
private int congestion; | ||
private String des; | ||
private int estimatedTime; | ||
private Boolean isTransfer; | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
src/main/java/com/cloudcomputing/ohhanahana/dto/response/RecommendResponse.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
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
14 changes: 14 additions & 0 deletions
14
src/main/java/com/cloudcomputing/ohhanahana/enums/Destination.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.cloudcomputing.ohhanahana.enums; | ||
|
||
import lombok.Getter; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
@Getter | ||
@RequiredArgsConstructor | ||
public enum Destination { | ||
JUAN("주안역"), | ||
JEMULPO("제물포역"), | ||
SIMINGONGONE("시민공원역") | ||
; | ||
private final String toKorean; | ||
} |
Oops, something went wrong.