이제 만든 Spring boot 프로젝트를 ec2에 올리자
그 전에 깃이랑 Mysql 설치 및 설정을 해야됨..
MySQL 설치 및 설정은 EC2 MySQL 설치 및 원격접속 설정 이거 참고하기
sudo apt-get install git
git --version
cd ~/.ssh
ssh-keygen -t rsa -C github계정 메일(gudtjr2949@naver.com)
명령어를 다 입력하고
key가 생성된 것을 확인한 다음에,
cat id_rsa.pub
여기서 출력된 key 내용을 복사해서
Github → Setting → SSH and GPG keys → key 칸에 복사한 내용을 붙여넣기
Ec2에 배포할 Spring boot 프로젝트를 클론해보자
git clone https://github.com/gudtjr2949/SSAFY_specialization.git
Java 설치 (설치 안된 경우에만)
sudo apt install openjdk-11-jdk
프로젝트 안에 있는 gradlew의 위치로 이동한 뒤 권한 부여 후, 빌드
chmod +x gradlew
./gradlew build
할라켔는데 무한로딩 걸림.. 아마 프리티어라서 그런듯
이거 참고하자
이제 빌드파일 있는 곳(/build/libs) 에 가서 이 명령어 입력
java -jar fileupload-0.0.1-SNAPSHOT.jar
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.7.15)
2023-08-31 07:40:06.695 INFO 8345 --- [ main] s3test.fileupload.FileuploadApplication : Starting FileuploadApplication using Java 11.0.20 on ip-172-31-34-58 with PID 8345 (/home/ubuntu/SSAFY_specialization/fileupload/build/libs/fileupload-0.0.1-SNAPSHOT.jar started by ubuntu in /home/ubuntu/SSAFY_specialization/fileupload/build/libs)
2023-08-31 07:40:06.702 INFO 8345 --- [ main] s3test.fileupload.FileuploadApplication : The following 2 profiles are active: "s3", "db"
2023-08-31 07:40:09.000 INFO 8345 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.
2023-08-31 07:40:09.158 INFO 8345 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 128 ms. Found 1 JPA repository interfaces.
2023-08-31 07:40:10.507 INFO 8345 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean '(inner bean)#5be46f9d' of type [com.amazonaws.auth.BasicAWSCredentials] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2023-08-31 07:40:10.511 INFO 8345 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean '(inner bean)#68df9280' of type [com.amazonaws.auth.AWSStaticCredentialsProvider] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2023-08-31 07:40:10.527 INFO 8345 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean '(inner bean)#70f02c32' of type [com.amazonaws.auth.profile.ProfileCredentialsProvider] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2023-08-31 07:40:10.538 INFO 8345 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'credentialsProvider' of type [org.springframework.cloud.aws.core.credentials.CredentialsProviderFactoryBean] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2023-08-31 07:40:10.539 INFO 8345 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'credentialsProvider' of type [com.amazonaws.auth.AWSCredentialsProviderChain] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2023-08-31 07:40:11.464 INFO 8345 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2023-08-31 07:40:11.507 INFO 8345 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2023-08-31 07:40:11.508 INFO 8345 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.79]
2023-08-31 07:40:11.719 INFO 8345 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2023-08-31 07:40:11.725 INFO 8345 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 4877 ms
2023-08-31 07:40:13.185 INFO 8345 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [name: default]
2023-08-31 07:40:13.458 INFO 8345 --- [ main] org.hibernate.Version : HHH000412: Hibernate ORM core version 5.6.15.Final
2023-08-31 07:40:13.979 INFO 8345 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.1.2.Final}
2023-08-31 07:40:14.253 INFO 8345 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
2023-08-31 07:40:14.681 INFO 8345 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed.
2023-08-31 07:40:14.793 INFO 8345 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.MySQL8Dialect
2023-08-31 07:40:16.252 INFO 8345 --- [ main] o.h.e.t.j.p.i.JtaPlatformInitiator : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform]
2023-08-31 07:40:16.273 INFO 8345 --- [ main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2023-08-31 07:40:18.556 WARN 8345 --- [ main] JpaBaseConfiguration$JpaWebConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning
2023-08-31 07:40:19.274 WARN 8345 --- [ main] ion$DefaultTemplateResolverConfiguration : Cannot find template location: classpath:/templates/ (please add some templates, check your Thymeleaf configuration, or set spring.thymeleaf.check-template-location=false)
2023-08-31 07:40:19.778 INFO 8345 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
2023-08-31 07:40:19.808 INFO 8345 --- [ main] s3test.fileupload.FileuploadApplication : Started FileuploadApplication in 14.749 seconds (JVM running for 16.294)