diff --git a/.travis.yml b/.travis.yml index 31fdc6a..7d6317d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,19 +15,19 @@ cache: script: "./gradlew clean build" before_deploy: - - mkdir -p before-deploy # zip에 포함시킬 파일들을 담을 디렉토리 생성 + - mkdir -p before-deploy #zip에 포함시킬 파일들을 담을 디렉토리 생성 - cp scripts/*.sh before-deploy/ - cp appspec.yml before-deploy/ - cp build/libs/*.jar before-deploy/ - - cd before-deploy && zip -r before-deploy * # before-deploy로 이동후 전체 압축 - - cd ../ && mkdir -p deploy # 상위 디렉토리로 이동후 deploy 디렉토리 생성 - - mv before-deploy/before-deploy.zip deploy/freelec-springboot2-webservice.zip # deploy로 zip파일 이동 + - cd before-deploy && zip -r before-deploy * #before-deploy로 이동 후 전체압축 + - cd ../ && mkdir -p deploy + - mv before-deploy/before-deploy.zip deploy/freelec-springboot2-webservice.zip deploy: - provider: s3 access_key_id: $AWS_ACCESS_KEY # Travis repo settings에 설정된 값 secret_access_key: $AWS_SECRET_KEY # Travis repo settings에 설정된 값 - bucket: freelec-springboot-build # S3 버킷 + bucket: freelec-springboot-builddd # S3 버킷 region: ap-northeast-2 skip_cleanup: true acl: private # zip 파일 접근을 private으로 @@ -37,7 +37,7 @@ deploy: - provider: codedeploy access_key_id: $AWS_ACCESS_KEY # Travis repo settings에 설정된 값 secret_access_key: $AWS_SECRET_KEY # Travis repo settings에 설정된 값 - bucket: freelec-springboot-build # S3 버킷 + bucket: freelec-springboot-builddd # S3 버킷 key: freelec-springboot2-webservice.zip # 빌드 파일을 압축해서 전달 bundle_type: zip application: freelec-springboot2-webservice # 웹 콘솔에서 등록한 CodeDeploy 어플리케이션 @@ -49,4 +49,4 @@ deploy: notifications: email: recipients: - - jojoldu@gmail.com \ No newline at end of file + - kbh11051@gmail.com \ No newline at end of file diff --git a/appspec.yml b/appspec.yml index 59260b1..0bfea24 100644 --- a/appspec.yml +++ b/appspec.yml @@ -2,7 +2,7 @@ version: 0.0 os: linux files: - source: / - destination: /home/ec2-user/app/step3/zip/ + destination: /home/ec2-user/app/step2/zip/ overwrite: yes permissions: @@ -12,15 +12,7 @@ permissions: group: ec2-user hooks: - AfterInstall: - - location: stop.sh # 엔진엑스와 연결되어 있지 않은 스프링 부트를 종료합니다. - timeout: 60 - runas: ec2-user - ApplicationStart: - - location: start.sh # 엔진엑스와 연결되어 있지 않은 Port로 새 버전의 스프링 부트를 시작합니다. - timeout: 60 - runas: ec2-user - ValidateService: - - location: health.sh # 새 스프링 부트가 정상적으로 실행됐는지 확인 합니다. - timeout: 60 - runas: ec2-user + ApplicationStart: + - location : deploy.sh + timeout : 60 + runas: ec2-user diff --git a/build.gradle b/build.gradle index 682b4a8..388d031 100644 --- a/build.gradle +++ b/build.gradle @@ -17,7 +17,7 @@ apply plugin: 'org.springframework.boot' apply plugin: 'io.spring.dependency-management' group 'com.jojoldu.book' -version '1.0.4-SNAPSHOT-'+new Date().format("yyyyMMddHHmmss") +version '1.0.5-SNAPSHOT-'+new Date().format("yyyyMMddHHmmss") sourceCompatibility = 1.8 repositories { @@ -31,6 +31,7 @@ dependencies { compile('org.springframework.boot:spring-boot-starter-data-jpa') compile('org.springframework.boot:spring-boot-starter-mustache') compile('com.h2database:h2') + compile('org.mariadb.jdbc:mariadb-java-client') compile('org.springframework.boot:spring-boot-starter-oauth2-client') compile('org.springframework.session:spring-session-jdbc') diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000..2427fd0 --- /dev/null +++ b/gradle.properties @@ -0,0 +1 @@ +org.gradle.jvmargs=-Xmx1536m \ No newline at end of file diff --git a/src/main/java/com/jojoldu/book/springboot/config/auth/LoginUser.java b/src/main/java/com/jojoldu/book/springboot/config/auth/LoginUser.java index b12dc56..10e9277 100644 --- a/src/main/java/com/jojoldu/book/springboot/config/auth/LoginUser.java +++ b/src/main/java/com/jojoldu/book/springboot/config/auth/LoginUser.java @@ -4,7 +4,7 @@ import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; - +//login annotation @Target(ElementType.PARAMETER) @Retention(RetentionPolicy.RUNTIME) public @interface LoginUser { diff --git a/src/main/resources/application-oauth.properties b/src/main/resources/application-oauth.properties index ca6e250..58f593b 100644 --- a/src/main/resources/application-oauth.properties +++ b/src/main/resources/application-oauth.properties @@ -1,10 +1,10 @@ -spring.security.oauth2.client.registration.google.client-id=구글클라이언트ID -spring.security.oauth2.client.registration.google.client-secret=구글클라이언트시크릿 +spring.security.oauth2.client.registration.google.client-id=282098600293-elskch6lntksqvq3a73cde38ss9g9bno.apps.googleusercontent.com +spring.security.oauth2.client.registration.google.client-secret=H9jjsbkYA3To0WamEGBrj_MR spring.security.oauth2.client.registration.google.scope=profile,email # registration -spring.security.oauth2.client.registration.naver.client-id=네이버클라이언트ID -spring.security.oauth2.client.registration.naver.client-secret=네이버클라이언트시크릿 +spring.security.oauth2.client.registration.naver.client-id=2tcXMT6_qOGw3PxjYM4p +spring.security.oauth2.client.registration.naver.client-secret=ld0WuBgvCb spring.security.oauth2.client.registration.naver.redirect-uri={baseUrl}/{action}/oauth2/code/{registrationId} spring.security.oauth2.client.registration.naver.authorization-grant-type=authorization_code spring.security.oauth2.client.registration.naver.scope=name,email,profile_image @@ -16,3 +16,5 @@ spring.security.oauth2.client.provider.naver.token-uri=https://nid.naver.com/oau spring.security.oauth2.client.provider.naver.user-info-uri=https://openapi.naver.com/v1/nid/me spring.security.oauth2.client.provider.naver.user-name-attribute=response + + diff --git a/src/main/resources/application-real-db.properties b/src/main/resources/application-real-db.properties deleted file mode 100644 index 85449a4..0000000 --- a/src/main/resources/application-real-db.properties +++ /dev/null @@ -1,6 +0,0 @@ -spring.jpa.hibernate.ddl-auto=none - -spring.datasource.url=jdbc:mariadb://rds주소:포트명(기본은 3306)/database명 -spring.datasource.username=db계정 -spring.datasource.password=db계정 비밀번호 -spring.datasource.driver-class-name=org.mariadb.jdbc.Driver \ No newline at end of file diff --git a/src/main/resources/application-real.properties b/src/main/resources/application-real.properties index bec6465..89e6000 100644 --- a/src/main/resources/application-real.properties +++ b/src/main/resources/application-real.properties @@ -1,3 +1,5 @@ spring.profiles.include=oauth,real-db +spring.jpa.show_sql=true spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect -spring.session.store-type=jdbc +spring.h2.console.enabled=true +spring.session.store-type=jdbc \ No newline at end of file diff --git a/src/main/resources/application-real1.properties b/src/main/resources/application-real1.properties deleted file mode 100644 index 04cef5a..0000000 --- a/src/main/resources/application-real1.properties +++ /dev/null @@ -1,4 +0,0 @@ -server.port=8081 -spring.profiles.include=oauth,real-db -spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect -spring.session.store-type=jdbc \ No newline at end of file diff --git a/src/main/resources/application-real2.properties b/src/main/resources/application-real2.properties deleted file mode 100644 index 39aaa94..0000000 --- a/src/main/resources/application-real2.properties +++ /dev/null @@ -1,4 +0,0 @@ -server.port=8082 -spring.profiles.include=oauth,real-db -spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect -spring.session.store-type=jdbc \ No newline at end of file diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 11e4e61..c22daf5 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1,4 +1,4 @@ -spring.profiles.include=real-oauth +spring.profiles.include=oauth spring.jpa.show_sql=true spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect spring.h2.console.enabled=true diff --git a/src/main/resources/templates/index.mustache b/src/main/resources/templates/index.mustache index bb4975d..ea829d2 100644 --- a/src/main/resources/templates/index.mustache +++ b/src/main/resources/templates/index.mustache @@ -1,6 +1,6 @@ {{>layout/header}} -