At SSAFY, they gave us 1 EC2 instance (no AWS Console access either....) so I deployed in a similar manner to the previous time
- Port
80- React.js frontend serve- Port
8000- SpringBoot backend serve
- The Frontend deployment is the same method as when deploying the
Django-Vueproject, so follow steps 1-9 from this link- Of course, when installing required packages, skip steps that are unrelated to this project, such as Python installation!
sudo apt-get install openjdk-11-jdk- This command also installs the
openjdk-11-jrepackage which contains the Java runtime environment!
$ java -version
openjdk version "11.0.8" 2020-07-14
OpenJDK Runtime Environment (build 11.0.8+10-post-Ubuntu-0ubuntu118.04.1)
OpenJDK 64-Bit Server VM (build 11.0.8+10-post-Ubuntu-0ubuntu118.04.1, mixed mode, sharing)sudo apt-get install mavenmvn -N io.takari:maven:wrapperNavigate to the location where
mvnwis visible and execute the following command
./mvnw clean package- Executing this command cleans the previous build records of the mvnw file in the current directory and builds a new package
- This takes a long time! FYI!
- If you see the
BUILD SUCCESSmessage, it was successful!
Go into the
targetdirectory and execute the following command
nohup java -jar [generated jar file name] &nohup- A program in Linux/Unix that runs shell script files (*.sh) in daemon mode
- Keeps running even when the terminal session is disconnected
- A program in Linux/Unix that runs shell script files (*.sh) in daemon mode
- Adding
&after the command means separating the current command from other commands!- You can execute other commands while the server is running from the jar file
- The jar file runs in the background!
mysql> CREATE USER 'root'@'[server address]' IDENTIFIED BY '[root account password]';
mysql> GRANT ALL PRIVILEGES ON . TO 'root'@'[server address]' WITH GRANT OPTION;
mysql> FLUSH PRIVILEGES;+
As I wrote in the previous deployment notes, this is very inefficient!!! Planning to apply CI/CD!!!
-> Applied it!
$ lsof -i :8000
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
java 3972 ubuntu 22u IPv6 325640 0t0 TCP *:8000 (LISTEN)sudo kill -9 [pid number confirmed above]git pull origin master./mvnw clean packagejava -jar [generated jar file name] &git pull origin master
cd frontend
npm run build
sudo service nginx restart