This is a memo for myself.
・ Windows 10 ・ OpenJDK 1.8 ・ SpringBoot 2.2.4 ・ Gradle 6.3 ・ MySQL5.7 ・ AWS (EC2 ・ RDS ・ VPC)
This can be anything, so you can use your own app
I will post this later
Log in to EC2 and update yum
# yum update
Check and install Git version
# yum search git
# yum install git
Check once Git is installed
# git --version
Install Java 8
# yum install -y java-1.8.0-openjdk-devel
Install and relocate tomcat For more information here
Clone git
# git clone https://github.com/sample.git
Move to the cloned directory and spread gradlew permissions
# chmod 755 gradlew
I want to build as it is, but move to application.properties and change the settings application.properties is an environment-dependent relationship
# cd src/main/resources
# vim application.properties
I think the URL of MySQL is localhost, so change here
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://"Localhost" ← here!:3306/sample?serverTimezone=JST
spring.datasource.username=root
spring.datasource.password=password
spring.datasource.initialization-mode=always
Change localhost part to RDS endpoint
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://~~~~~~~~~~:3306/sample?serverTimezone=JST
spring.datasource.username=root
spring.datasource.password=password
spring.datasource.initialization-mode=always
I changed it so that I can connect to RDS. We will build from here! !!
# ./gradlew build
Move to under libs of build as soon as build is completed I think there is an application that I built, so loosen the permissions Change owner and group to tomcat
# chmod 755 sample.war
# chown tomcat:tomcat sample.war
Then move it under webapps and start tomcat
# mv sample.war /opt/apache-tomcat/webapps
# systemctl start tomcat.service
If you connect to the URL set by EC2 ...
that's all
Recommended Posts