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

5주차 배포 #5

Merged
merged 27 commits into from
Mar 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
78dae18
feat: EurekaApplication @EnableEurekaServer 등록
minsu11 Feb 16, 2024
d3350bf
feat: SecurityConfig 작성
minsu11 Feb 16, 2024
3c49f20
feat: application.properties 환경 설정
minsu11 Feb 16, 2024
6410ff2
feat: Dockerfile 생성 및 구현
minsu11 Feb 17, 2024
4137289
feat: maven.yml github action 환경 설정
minsu11 Feb 17, 2024
5844f85
Merge pull request #1 from nhnacademy-be4-My-Books/github-action
minsu11 Feb 17, 2024
0580b12
refactor: applicartion.properties url.defaultZone url 수정
minsu11 Feb 17, 2024
fbc4f2e
Merge pull request #2 from nhnacademy-be4-My-Books/github-action
minsu11 Feb 17, 2024
ee91ba3
docs: application.properties dev prod 분리
minsu11 Feb 18, 2024
b493a5d
docs: Dockerfile 변경
minsu11 Feb 18, 2024
958dd36
docs: application.properties active, url 설정 삭제
minsu11 Feb 18, 2024
091a534
docs: application.properties url.defaultZone 환경설정 변경
minsu11 Feb 18, 2024
a7fd7c7
docs: eureka 테스트를 위해 yml파일에 branches 명 수정
minsu11 Feb 18, 2024
c23ea97
docs: eureka test를 위한 properties 환경설정 변경
minsu11 Feb 18, 2024
d123b14
docs: eureka test를 위한 properties 환경 설정 변경
minsu11 Feb 18, 2024
00f68b3
docs: properties server address 삭제
minsu11 Feb 18, 2024
6fec86b
docs: eureka test를 위한 application.properties, prod 변경
minsu11 Feb 18, 2024
4f29a03
docs: eureka 설정 후 gateway와 resource 연동 테스트를 위한 properites 설정
minsu11 Feb 18, 2024
15e5045
docs: eureka 설정 후 gateway와 resource 연동 테스트를 위한 properites 설정
minsu11 Feb 18, 2024
f5e052d
docs: eureka 설정 후 gateway와 resource 연동 테스트를 위한 properites 설정
minsu11 Feb 18, 2024
faaadfd
docs: 유레카 비밀번호 변경
minsu11 Feb 21, 2024
24bd818
docs: yml 파일 설정 변경
minsu11 Feb 21, 2024
327e28d
Merge pull request #3 from nhnacademy-be4-My-Books/eureka-test
minsu11 Feb 21, 2024
dfe8aa3
docs: eureka 비밀번호 변경
minsu11 Feb 22, 2024
5de758d
Merge pull request #4 from nhnacademy-be4-My-Books/eureka-test
minsu11 Feb 22, 2024
6dde897
docs: yml파일 git branch dev 제거 및 properties 유레카 비번 오타 수정
minsu11 Feb 28, 2024
37d3bc7
docs: 유레카 application-dev.properties 설정 변경
minsu11 Feb 28, 2024
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
60 changes: 60 additions & 0 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# This workflow will build a Java project with Maven, 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-maven

# 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.

name: Docker Image CI

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

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

# jdk 11 세팅
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
cache: maven

# 패키징
- name: Build with Maven
run: mvn -B package --file pom.xml

# 도커 로그인
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

# 도커 이미지 빌드
- name: Build the Docker image
run: docker build -t 10m24s/eureka .

# 이미지 띄우기
- name: push Docker image
run: docker push 10m24s/eureka

# 쉘 스크립트 실행
- name: execute shell script
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SSH_IP }}
username: ${{ secrets.SSH_ID }}
key: ${{ secrets.SSH_KEY }}
port: ${{ secrets.SSH_PORT }}
script_stop: true
script: "./startup.sh"
6 changes: 6 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
FROM eclipse-temurin:11
ARG JAR_FILE=./target/*.jar
COPY ${JAR_FILE} app.jar
COPY src/main/resources/application-prod.properties application-prod.properties

ENTRYPOINT ["java", "-jar", "app.jar"]
8 changes: 5 additions & 3 deletions src/main/java/store/mybooks/eureka/EurekaApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;

@EnableEurekaServer
@SpringBootApplication
public class EurekaApplication {

public static void main(String[] args) {
SpringApplication.run(EurekaApplication.class, args);
}
public static void main(String[] args) {
SpringApplication.run(EurekaApplication.class, args);
}

}
36 changes: 36 additions & 0 deletions src/main/java/store/mybooks/eureka/config/SecurityConfig.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package store.mybooks.eureka.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.web.SecurityFilterChain;

/**
* packageName : store.mybooks.eureka.config
* fileName : SecurityConfig
* author : minsu11
* date : 2/16/24
* description :
* ===========================================================
* DATE AUTHOR NOTE
* -----------------------------------------------------------
* 2/16/24 minsu11 최초 생성
*/
@EnableWebSecurity(debug = false)
@Configuration
public class SecurityConfig {
@Bean
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
http
.csrf()
.disable()
.authorizeRequests()
.anyRequest().authenticated()
.and()
.httpBasic();

return http.build();

}
}
6 changes: 6 additions & 0 deletions src/main/resources/application-dev.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
spring.security.user.name=admin
spring.security.user.password=1234
server.port=5050
eureka.server.my-url=eureka
eureka.client.service-url.defaultZone=\
http://${spring.security.user.name}:${spring.security.user.password}@localhost:${server.port}/${eureka.server.my-url}
5 changes: 5 additions & 0 deletions src/main/resources/application-prod.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
spring.security.user.name=admin
spring.security.user.password=chzhvkdlrkwhgdkdy!12
server.port=5050
eureka.server.my-url=eureka
eureka.client.service-url.defaultZone=http://${spring.security.user.name}:${spring.security.user.password}@180.210.82.248:${server.port}/${eureka.server.my-url}/
6 changes: 5 additions & 1 deletion src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@

server.shutdown=graceful
spring.lifecycle.timeout-per-shutdown-phase=10s
eureka.client.register-with-eureka=false
eureka.client.fetch-registry=false
spring.profiles.active=dev
Loading