05.2.Clouds‐GoormIDE - yojulab/learn_DevOps GitHub Wiki
GoormIDE
Apply spring-boot on html/CSS Container : offical
install java 17
$ sudo apt-get update
$ sudo apt install -y ca-certificates-java
$ sudo apt-get install -y openjdk-17-jdk
$ java -version
openjdk version "17.0.5" ...
install As Maven
$ cd ..
$ bash
wget https://dlcdn.apache.org/maven/maven-3/3.8.7/binaries/apache-maven-3.8.7-bin.tar.gz
$ sudo tar xf ./apache-maven-3.8.7-bin.tar.gz -C /opt
$ sudo ln -s /opt/apache-maven-3.8.7 /opt/maven
$ export PATH=/opt/maven/bin:$PATH
$ mvn --version
Apache Maven 3.8.7 ...
$ vi ~/.bashrc # add PATH
... # press 'o'
export PATH=/opt/maven/bin:$PATH
:wq!
$ . ~/.bashrc
$ cd ./project_springboots
$ mvn spring-boot:run # 폴더 안에 pom.xml 있는지 확인 필요
install As Gradle
$ cd ..
$ wget https://services.gradle.org/distributions/gradle-8.1.1-bin.zip
$ sudo unzip -d /opt/gradle ./gradle-8.1.1-bin.zip
$ sudo vi /etc/profile.d/gradle.sh
export GRADLE_HOME=/opt/gradle/gradle-8.1.1
export PATH=${GRADLE_HOME}/bin:${PATH}
$ source /etc/profile.d/gradle.sh
$ gradle -v
Welcome to Gradle 8.8.1!
...
$ cd ./project_springboots
$ ./gradlew bootRun
Setup Container
- init script에서 service nginx starts 삭제
- Change Container port 8080
use MySQL 5.7
접근 권한 및 PW 설정
$ service mysql restart
$ mysql -u root -p
Enter password : # just Enter
mysql> select user, host from mysql.user;
...
| root | localhost |
mysql> GRANT ALL ON *.* TO 'root'@'localhost'; // 권한 부여
mysql> UPDATE mysql.user SET authentication_string=PASSWORD('비밀번호') WHERE user='root'; # 비밀번호는 변경 필요
mysql> UPDATE mysql.user SET plugin="mysql_native_password" WHERE User='root';
mysql> FLUSH PRIVILEGES;
mysql> exit;
$ mysql -u root -p
Enter password : # 다른 점은 패스워드 입력 해야 접속 가능.
원격 접속자 생성과 설정
$ mysql -u root -p
Enter password :
mysql> CREATE USER 'yojulab'@'%' IDENTIFIED BY '!yojulab*';
mysql> GRANT ALL PRIVILEGES ON *.* TO 'yojulab'@'%' WITH GRANT OPTION;
mysql> FLUSH PRIVILEGES;
대소문자 구분 없게 설정 : lower_case_table_names을 1
mysql> show variables like 'lower_case_table_names';
mysql> exit;
$ vi /etc/mysql/mysql.cnf
[mysqld]
lower_case_table_names=1
$ service mysql restart
한글 포함된 Tables 생성 및 확인
$ vi /etc/mysql/mysql.cnf
...
$ mysql -u yojulab -p < ./DDL.sql
...
$ mysql -u yojulab -p < ./DML.sql
$ service mysql restart
$ mysql -u root -p
Enter password :
mysql> select * from db_yojulab.QUESTIONS_LIST ;
...
| Q5 | 해당 매장을 다음에도 재방문 하실 의향이 있으십니까? | 5 |
...
mysql> exit;