Notice
Recent Posts
Recent Comments
Link
250x250
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
Tags
- 프론트 엔드
- 클론코딩
- Redux
- 풀스택
- JPA
- 코딩
- github actions
- 스프링 부트
- 리엑트
- 개발
- 무중단 배포
- 백엔드
- react native
- 스타트업
- 개발자
- spring boot
- 서버 개발자
- Java
- react-native
- docker
- 스프링
- 자바
- 리엑트 네이티브
- 프론트엔드
- 서버 배포
- 비전공자
- 국비지원
- SQL
- Spring
- react
Archives
- Today
- Total
오티스의개발일기
무중단 배포 (2) [ SQL 설정 편 ] spring boot + mysql + docker + github actions 본문
개발/spring boot
무중단 배포 (2) [ SQL 설정 편 ] spring boot + mysql + docker + github actions
안되면 될때까지.. 2025. 1. 20. 10:03728x90
오늘은 저번 글을이어 SQL 설정을 해보겠습니다.
목차
1. 프로젝트 생성
2. SQL 설정 😀
3. git 생성
4. aws EC2 생성
8. spring boot HealthcheckController 작업 및 yml + Dockerfile 작업
10. 최종 배포
전체 코드는 여기에 올라와있습니다.
https://github.com/1domybest/Spring_none_stop_deploy
2. SQL 설정
mysql 설치는 여러분들이 알아서 하셨을거라 생각하고
mysql db 설정 부터 시작하겠습니다
처음 프로젝트가 열리면
yml 이 아닌 properties가 존재하는데요 저희는 이거를
이렇게 뒤 확장자만 변경하여 사용하도록 하겠습니다.
그리고 안에있는 내용을 지워주시고
아래와 같이 작성해주세요
application.yml
spring:
datasource:
url: jdbc:mysql://localhost:3306/데이터베이스 이름?useSSL=false&useUnicode=true&serverTimezone=Asia/Seoul&allowPublicKeyRetrieval=true
username: mysql아이디 넣으시면됩나다 예) root
password: mysql비밀번호를 넣으시면됩니다 예) 1234
driver-class-name: com.mysql.cj.jdbc.Driver
jpa:
hibernate:
naming:
physical-strategy: org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
ddl-auto: create
properties:
hibernate:
format_sql: true
open-in-view: false
위설정은 db의 커넥션에대한 정보와
Jpa의 설정정보입니다.
그리고 데이터 베이스 이름은
MYSQL WorkBench에서 스캐마를 만들고 그 스캐마 이름을 넣으면 된다
저는 spring_noneStop_deploy 이 이름을 사용하였습니다
이제 Entity 1개를 생성해주겠습니다
이 Entity는 단순히 배포를위해 확인용으로 제작하는 엔티티입니다
package com.example.spring_noneStop_deploy.entity;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.GenerationType;
import jakarta.persistence.Id;
@Entity
public class User {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
}
이렇게하시고 build를 진행해주시고 아래처럼 문제없이 실행된다면 완성입니다!
/Users/onseoktae/Library/Java/JavaVirtualMachines/jbr-17.0.12/Contents/Home/bin/java -XX:TieredStopAtLevel=1 -Dspring.output.ansi.enabled=always -Dcom.sun.management.jmxremote -Dspring.jmx.enabled=true -Dspring.liveBeansView.mbeanDomain -Dspring.application.admin.enabled=true -Dmanagement.endpoints.jmx.exposure.include=* -javaagent:/Applications/IntelliJ IDEA.app/Contents/lib/idea_rt.jar=54182:/Applications/IntelliJ IDEA.app/Contents/bin -Dfile.encoding=UTF-8 -classpath /Users/onseoktae/Documents/GitHub/SpringBoot/Spring_none_stop_deploy/build/classes/java/main:/Users/onseoktae/Documents/GitHub/SpringBoot/Spring_none_stop_deploy/build/resources/main:/Users/onseoktae/.gradle/caches/modules-2/files-2.1/org.springframework.boot/spring-boot-starter-data-jpa/3.4.1/f06be4354c339f3f880a5c66a6913cd2366eb225/spring-boot-starter-data-jpa-3.4.1.jar:/Users/onseoktae/.gradle/caches/modules-2/files-2.1/org.springframework.boot/spring-boot-starter-web/3.4.1/ff7227fc62338e0f6eba3f9f94c12eb952d4da95/spring-boot-starter-web-3.4.1.jar:/Users/onseoktae/.gradle/caches/modules-2/files-2.1/org.springframework.boot/spring-boot-starter-jdbc/3.4.1/307db83ee5f33fe810565cf980f73747b8f8f43b/spring-boot-starter-jdbc-3.4.1.jar:/Users/onseoktae/.gradle/caches/modules-2/files-2.1/org.springframework.boot/spring-boot-starter/3.4.1/2c97b6fdc451ea69cd04dcfa54980439b7c7cb34/spring-boot-starter-3.4.1.jar:/Users/onseoktae/.gradle/caches/modules-2/files-2.1/org.hibernate.orm/hibernate-core/6.6.4.Final/95c6d2d58c40dbbfbbd58084941e5cbca4ddef2f/hibernate-core-6.6.4.Final.jar:/Users/onseoktae/.gradle/caches/modules-2/files-2.1/org.springframework.data/spring-data-jpa/3.4.1/1c704fa9169ea3745775568e733fddd0132070b2/spring-data-jpa-3.4.1.jar:/Users/onseoktae/.gradle/caches/modules-2/files-2.1/org.springframework/spring-aspects/6.2.1/50350218608abf215ae40ef00c87cc666737e199/spring-aspects-6.2.1.jar:/Users/onseoktae/.gradle/caches/modules-2/files-2.1/org.springframework.boot/spring-boot-starter-json/3.4.1/c1d084f65d8d9f2de9daccab47c4f452fb0464de/spring-boot-starter-json-3.4.1.jar:/Users/onseoktae/.gradle/caches/modules-2/files-2.1/org.springframework.boot/spring-boot-starter-tomcat/3.4.1/ac4bb51582c57cfb0d2beb102a76fe1a4d8b8b21/spring-boot-starter-tomcat-3.4.1.jar:/Users/onseoktae/.gradle/caches/modules-2/files-2.1/org.springframework/spring-webmvc/6.2.1/44bdf7e5641d44044ac52d7bb5c1fc46004e7754/spring-webmvc-6.2.1.jar:/Users/onseoktae/.gradle/caches/modules-2/files-2.1/org.springframework/spring-web/6.2.1/877acb94c5b3a0c92e652b6bebdfdc7c60922ac8/spring-web-6.2.1.jar:/Users/onseoktae/.gradle/caches/modules-2/files-2.1/org.springframework/spring-jdbc/6.2.1/def8d3d9bebafc36c19f8407645eddde32454c8a/spring-jdbc-6.2.1.jar:/Users/onseoktae/.gradle/caches/modules-2/files-2.1/com.zaxxer/HikariCP/5.1.0/8c96e36c14461fc436bb02b264b96ef3ca5dca8c/HikariCP-5.1.0.jar:/Users/onseoktae/.gradle/caches/modules-2/files-2.1/org.springframework.boot/spring-boot-autoconfigure/3.4.1/f17b54cc5816ec8f06d0aca9df11c330ead97f2a/spring-boot-autoconfigure-3.4.1.jar:/Users/onseoktae/.gradle/caches/modules-2/files-2.1/org.springframework.boot/spring-boot/3.4.1/5fb9890a5eb7c4e86c8f5c0f6960b79240daf3d5/spring-boot-3.4.1.jar:/Users/onseoktae/.gradle/caches/modules-2/files-2.1/org.springframework.boot/spring-boot-starter-logging/3.4.1/5cd01e208b15113c7f88b3ea40e843ea9989f38a/spring-boot-starter-logging-3.4.1.jar:/Users/onseoktae/.gradle/caches/modules-2/files-2.1/jakarta.annotation/jakarta.annotation-api/2.1.1/48b9bda22b091b1f48b13af03fe36db3be6e1ae3/jakarta.annotation-api-2.1.1.jar:/Users/onseoktae/.gradle/caches/modules-2/files-2.1/org.springframework/spring-core/6.2.1/f42e6b51d9c0c2fcf95df9e5848470d173adc9af/spring-core-6.2.1.jar:/Users/onseoktae/.gradle/caches/modules-2/files-2.1/org.yaml/snakeyaml/2.3/936b36210e27320f920536f695cf1af210c44586/snakeyaml-2.3.jar:/Users/onseoktae/.gradle/caches/modules-2/files-2.1/jakarta.persistence/jakarta.persistence-api/3.1.0/66901fa1c373c6aff65c13791cc11da72060a8d6/jakarta.persistence-api-3.1.0.jar:/Users/onseoktae/.gradle/caches/modules-2/files-2.1/jakarta.transaction/jakarta.transaction-api/2.0.1/51a520e3fae406abb84e2e1148e6746ce3f80a1a/jakarta.transaction-api-2.0.1.jar:/Users/onseoktae/.gradle/caches/modules-2/files-2.1/org.springframework/spring-orm/6.2.1/7fd75b4984d92c3c5e46ee94365cfc79d2daa821/spring-orm-6.2.1.jar:/Users/onseoktae/.gradle/caches/modules-2/files-2.1/org.springframework.data/spring-data-commons/3.4.1/3ae5f19bc2b1b30de85b0610ae25818c2e7c295a/spring-data-commons-3.4.1.jar:/Users/onseoktae/.gradle/caches/modules-2/files-2.1/org.springframework/spring-context/6.2.1/f56c7431b03860bfdb016e68f484c5c35531ef2e/spring-context-6.2.1.jar:/Users/onseoktae/.gradle/caches/modules-2/files-2.1/org.springframework/spring-aop/6.2.1/a9384de38fc00751084446ba014a0c4962240244/spring-aop-6.2.1.jar:/Users/onseoktae/.gradle/caches/modules-2/files-2.1/org.springframework/spring-tx/6.2.1/5ffde4fee85ff021ad613b9e86a9be893fb52572/spring-tx-6.2.1.jar:/Users/onseoktae/.gradle/caches/modules-2/files-2.1/org.springframework/spring-beans/6.2.1/ab57ec03ba6900075bf28e3cd70ccce173205b8d/spring-beans-6.2.1.jar:/Users/onseoktae/.gradle/caches/modules-2/files-2.1/org.antlr/antlr4-runtime/4.13.0/5a02e48521624faaf5ff4d99afc88b01686af655/antlr4-runtime-4.13.0.jar:/Users/onseoktae/.gradle/caches/modules-2/files-2.1/org.slf4j/slf4j-api/2.0.16/172931663a09a1fa515567af5fbef00897d3c04/slf4j-api-2.0.16.jar:/Users/onseoktae/.gradle/caches/modules-2/files-2.1/org.aspectj/aspectjweaver/1.9.22.1/bca243d0af0db4758fbae45c5f4995cb5dabb612/aspectjweaver-1.9.22.1.jar:/Users/onseoktae/.gradle/caches/modules-2/files-2.1/com.fasterxml.jackson.datatype/jackson-datatype-jsr310/2.18.2/7b6ff96adf421f4c6edbd694e797dd8fe434510a/jackson-datatype-jsr310-2.18.2.jar:/Users/onseoktae/.gradle/caches/modules-2/files-2.1/com.fasterxml.jackson.module/jackson-module-parameter-names/2.18.2/72960cb3277347a748911d100c3302d60e8a616a/jackson-module-parameter-names-2.18.2.jar:/Users/onseoktae/.gradle/caches/modules-2/files-2.1/com.fasterxml.jackson.datatype/jackson-datatype-jdk8/2.18.2/9ed6d538ebcc66864e114a7040953dce6ab6ea53/jackson-datatype-jdk8-2.18.2.jar:/Users/onseoktae/.gradle/caches/modules-2/files-2.1/com.fasterxml.jackson.core/jackson-databind/2.18.2/deef8697b92141fb6caf7aa86966cff4eec9b04f/jackson-databind-2.18.2.jar:/Users/onseoktae/.gradle/caches/modules-2/files-2.1/org.apache.tomcat.embed/tomcat-embed-websocket/10.1.34/eef6d430f34b6e393b8d9e40f10db9043732b4e5/tomcat-embed-websocket-10.1.34.jar:/Users/onseoktae/.gradle/caches/modules-2/files-2.1/org.apache.tomcat.embed/tomcat-embed-core/10.1.34/f610f84be607fbc82e393cc220f0ad45f92afc91/tomcat-embed-core-10.1.34.jar:/Users/onseoktae/.gradle/caches/modules-2/files-2.1/org.apache.tomcat.embed/tomcat-embed-el/10.1.34/d2b2daca3bc999c62e58ae36b45ba0582530fb25/tomcat-embed-el-10.1.34.jar:/Users/onseoktae/.gradle/caches/modules-2/files-2.1/org.springframework/spring-expression/6.2.1/91fcf6b9501705c31c8337e2713fe823bb512b24/spring-expression-6.2.1.jar:/Users/onseoktae/.gradle/caches/modules-2/files-2.1/io.micrometer/micrometer-observation/1.14.2/a9cad29cc04c0f7e30e3e58b454d4cd47ccc54bd/micrometer-observation-1.14.2.jar:/Users/onseoktae/.gradle/caches/modules-2/files-2.1/ch.qos.logback/logback-classic/1.5.12/3790d1a62e868f7915776dfb392bd9a29ce8d954/logback-classic-1.5.12.jar:/Users/onseoktae/.gradle/caches/modules-2/files-2.1/org.apache.logging.log4j/log4j-to-slf4j/2.24.3/da1143e2a2531ee1c2d90baa98eb50a28a39d5a7/log4j-to-slf4j-2.24.3.jar:/Users/onseoktae/.gradle/caches/modules-2/files-2.1/org.slf4j/jul-to-slf4j/2.0.16/6d57da3e961daac65bcca0dd3def6cd11e48a24a/jul-to-slf4j-2.0.16.jar:/Users/onseoktae/.gradle/caches/modules-2/files-2.1/org.springframework/spring-jcl/6.2.1/a5d662d64470aff0ae51d210147bb6ede31a8ea3/spring-jcl-6.2.1.jar:/Users/onseoktae/.gradle/caches/modules-2/files-2.1/com.fasterxml.jackson.core/jackson-annotations/2.18.2/985d77751ebc7fce5db115a986bc9aa82f973f4a/jackson-annotations-2.18.2.jar:/Users/onseoktae/.gradle/caches/modules-2/files-2.1/com.fasterxml.jackson.core/jackson-core/2.18.2/fb64ccac5c27dca8819418eb4e443a9f496d9ee7/jackson-core-2.18.2.jar:/Users/onseoktae/.gradle/caches/modules-2/files-2.1/io.micrometer/micrometer-commons/1.14.2/69c454dbec59c7842cf59a534b7ec03618d75b91/micrometer-commons-1.14.2.jar:/Users/onseoktae/.gradle/caches/modules-2/files-2.1/ch.qos.logback/logback-core/1.5.12/65b1fa25fe8d8e4bdc140e79eb67ac6741f775e2/logback-core-1.5.12.jar:/Users/onseoktae/.gradle/caches/modules-2/files-2.1/org.apache.logging.log4j/log4j-api/2.24.3/b02c125db8b6d295adf72ae6e71af5d83bce2370/log4j-api-2.24.3.jar:/Users/onseoktae/.gradle/caches/modules-2/files-2.1/com.mysql/mysql-connector-j/9.1.0/5fb1d513278e1a9767dfa80ea9d8d7ee909f1a/mysql-connector-j-9.1.0.jar:/Users/onseoktae/.gradle/caches/modules-2/files-2.1/org.jboss.logging/jboss-logging/3.6.1.Final/886afbb445b4016a37c8960a7aef6ebd769ce7e5/jboss-logging-3.6.1.Final.jar:/Users/onseoktae/.gradle/caches/modules-2/files-2.1/org.hibernate.common/hibernate-commons-annotations/7.0.3.Final/e183c4be8bb41d12e9f19b374e00c34a0a85f439/hibernate-commons-annotations-7.0.3.Final.jar:/Users/onseoktae/.gradle/caches/modules-2/files-2.1/io.smallrye/jandex/3.2.0/f17ad860f62a08487b9edabde608f8ac55c62fa7/jandex-3.2.0.jar:/Users/onseoktae/.gradle/caches/modules-2/files-2.1/com.fasterxml/classmate/1.7.0/e98374da1f2143ac8e6e0a95036994bb19137a3/classmate-1.7.0.jar:/Users/onseoktae/.gradle/caches/modules-2/files-2.1/net.bytebuddy/byte-buddy/1.15.11/f61886478e0f9ee4c21d09574736f0ff45e0a46c/byte-buddy-1.15.11.jar:/Users/onseoktae/.gradle/caches/modules-2/files-2.1/org.glassfish.jaxb/jaxb-runtime/4.0.5/ca84c2a7169b5293e232b9d00d1e4e36d4c3914a/jaxb-runtime-4.0.5.jar:/Users/onseoktae/.gradle/caches/modules-2/files-2.1/jakarta.xml.bind/jakarta.xml.bind-api/4.0.2/6cd5a999b834b63238005b7144136379dc36cad2/jakarta.xml.bind-api-4.0.2.jar:/Users/onseoktae/.gradle/caches/modules-2/files-2.1/jakarta.inject/jakarta.inject-api/2.0.1/4c28afe1991a941d7702fe1362c365f0a8641d1e/jakarta.inject-api-2.0.1.jar:/Users/onseoktae/.gradle/caches/modules-2/files-2.1/org.glassfish.jaxb/jaxb-core/4.0.5/7b4b11ea5542eea4ad55e1080b23be436795b3/jaxb-core-4.0.5.jar:/Users/onseoktae/.gradle/caches/modules-2/files-2.1/jakarta.activation/jakarta.activation-api/2.1.3/fa165bd70cda600368eee31555222776a46b881f/jakarta.activation-api-2.1.3.jar:/Users/onseoktae/.gradle/caches/modules-2/files-2.1/org.eclipse.angus/angus-activation/2.0.2/41f1e0ddd157c856926ed149ab837d110955a9fc/angus-activation-2.0.2.jar:/Users/onseoktae/.gradle/caches/modules-2/files-2.1/org.glassfish.jaxb/txw2/4.0.5/f36a4ef12120a9bb06d766d6a0e54b144fd7ed98/txw2-4.0.5.jar:/Users/onseoktae/.gradle/caches/modules-2/files-2.1/com.sun.istack/istack-commons-runtime/4.1.2/18ec117c85f3ba0ac65409136afa8e42bc74e739/istack-commons-runtime-4.1.2.jar com.example.spring_noneStop_deploy.SpringNoneStopDeployApplication
. ____ _ __ _ _
/\\\\ / ___'_ __ _ _(_)_ __ __ _ \\ \\ \\ \\
( ( )\\___ | '_ | '_| | '_ \\/ _` | \\ \\ \\ \\
\\\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v3.4.1)
2025-01-19T15:57:40.948+09:00 INFO 20895 --- [ main] c.e.s.SpringNoneStopDeployApplication : Starting SpringNoneStopDeployApplication using Java 17.0.12 with PID 20895 (/Users/onseoktae/Documents/GitHub/SpringBoot/Spring_none_stop_deploy/build/classes/java/main started by onseoktae in /Users/onseoktae/Documents/GitHub/SpringBoot/Spring_none_stop_deploy)
2025-01-19T15:57:40.949+09:00 INFO 20895 --- [ main] c.e.s.SpringNoneStopDeployApplication : No active profile set, falling back to 1 default profile: "default"
2025-01-19T15:57:41.265+09:00 INFO 20895 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.
2025-01-19T15:57:41.278+09:00 INFO 20895 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 7 ms. Found 0 JPA repository interfaces.
2025-01-19T15:57:41.552+09:00 INFO 20895 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port 8080 (http)
2025-01-19T15:57:41.565+09:00 INFO 20895 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2025-01-19T15:57:41.566+09:00 INFO 20895 --- [ main] o.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/10.1.34]
2025-01-19T15:57:41.600+09:00 INFO 20895 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2025-01-19T15:57:41.600+09:00 INFO 20895 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 631 ms
2025-01-19T15:57:41.683+09:00 INFO 20895 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [name: default]
2025-01-19T15:57:41.713+09:00 INFO 20895 --- [ main] org.hibernate.Version : HHH000412: Hibernate ORM core version 6.6.4.Final
2025-01-19T15:57:41.731+09:00 INFO 20895 --- [ main] o.h.c.internal.RegionFactoryInitiator : HHH000026: Second-level cache disabled
2025-01-19T15:57:41.877+09:00 INFO 20895 --- [ main] o.s.o.j.p.SpringPersistenceUnitInfo : No LoadTimeWeaver setup: ignoring JPA class transformer
2025-01-19T15:57:41.893+09:00 INFO 20895 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
2025-01-19T15:57:41.989+09:00 INFO 20895 --- [ main] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Added connection com.mysql.cj.jdbc.ConnectionImpl@2a19a0fe
2025-01-19T15:57:41.990+09:00 INFO 20895 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed.
2025-01-19T15:57:42.040+09:00 INFO 20895 --- [ main] org.hibernate.orm.connections.pooling : HHH10001005: Database info:
Database JDBC URL [Connecting through datasource 'HikariDataSource (HikariPool-1)']
Database driver: undefined/unknown
Database version: 9.1
Autocommit mode: undefined/unknown
Isolation level: undefined/unknown
Minimum pool size: undefined/unknown
Maximum pool size: undefined/unknown
2025-01-19T15:57:42.433+09:00 INFO 20895 --- [ main] o.h.e.t.j.p.i.JtaPlatformInitiator : HHH000489: No JTA platform available (set 'hibernate.transaction.jta.platform' to enable JTA platform integration)
2025-01-19T15:57:42.477+09:00 INFO 20895 --- [ main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2025-01-19T15:57:42.717+09:00 INFO 20895 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port 8080 (http) with context path '/'
2025-01-19T15:57:42.723+09:00 INFO 20895 --- [ main] c.e.s.SpringNoneStopDeployApplication : Started SpringNoneStopDeployApplication in 1.973 seconds (process running for 2.23)
다음글은 git 생성 에대해 포스팅해보겠습니다!
다음글
728x90
'개발 > spring boot' 카테고리의 다른 글
Comments