AWS 기본 배포 프로세스

[AWS] 로컬과 EC2로 배포 해보기
박찬혁's avatar
Mar 04, 2024
AWS 기본 배포 프로세스
Iaas

로컬에서 테스트

log의 종류

@GetMapping("/") public String home(){ log.trace("get /"); log.debug("get /"); log.info("get /"); log.warn("get /"); log.error("get /"); return "home"; }
실행을 하고 http://localhost:8080/ 확인
notion image
로그에 info, warn, error가 뜬다.
notion image
logging: level: '[com.example.aws2]': DEBUG
다시 요청을 하면
notion image

굽기

notion image
notion image
dependencies { implementation 'org.springframework.boot:spring-boot-starter-web' compileOnly 'org.projectlombok:lombok:1.18.30' developmentOnly 'org.springframework.boot:spring-boot-devtools' annotationProcessor 'org.projectlombok:lombok:1.18.30' testImplementation 'org.springframework.boot:spring-boot-starter-test' }
notion image
실행 파일이 생김
./gradlew clean build -x test // Test 없이 build
notion image
주석처리 (배포할 때 자동화 하기 위해 필요한 코드)
notion image
다시 빌드
notion image
notion image
-plain 안생기게
jar { enabled = false }
plain은 순수 자바 소스코드만 있는 파일(라이브러리가 없다)
notion image
버전을 1.1로 변경
notion image
파일이 또 생겨남
notion image
clean build를 해야 파일이 다 삭제되고 다시 빌드를 만든다.
notion image
notion image
notion image
notion image
notion image
빌드하면 파일 명이 바뀜

실행

notion image
java -jar build/libs/*.jar
http://localhost:8080/ 호출하면 실행된다.

AWS에서 실행

git —version 으로 설치 확인

notion image

메뉴판 업데이트

notion image

JDK 검색 후 설치

notion image
notion image

git clone

notion image

aws-2 로 이동 후 내용 확인

notion image
현재 실행 권한이 없다

실행 권한 부여

notion image

실행하기

notion image
notion image
notion image
 
Share article
RSSPowered by inblog