본문 바로가기

오픈소스프레임워크/Spring

[1일차] Pivotal CF 교육

[1일차-01] Spring Boot



A new way to create Spring Applications



1. Spring Boot을 이용한 애플리케이션 개발


Spring Boot은 Spring 프레임워크를 사용하는 프로젝트를 아주 간단하게 셋업할 수 있는 스프링 프레임웍의 서브프로젝트이다.


Spring Boot은 spring-boot-starter-web 의존성만 설정하면 기본적인 웹 개발이 가능하도록 나머지 의존라이브러리를 준비해 준다


환경설정은 @Configuration, @EnableAutoConfiguration으로 기본 설정 가능하다.



2. start.spring.io 에서 프로젝트 생성하기


   Spring Boot을 이용한 프로젝트를 온라인에서 생성할 수 있다. 


생성된 Spring Boot Application은 압축파일로 다운로드 된다. STS에서 Maven 프로젝트로 import해서 실행한다.

<주의> 만들어진 Application은 Controller가 설정되어 있지 않으므로 @RestController 를 추가해주고, @RequestMapping을 설정해 준뒤 실행한다.




[1일차-02] Getting Started with Cloud Foundry


Deploying your First Application



1. CloudFoundry 는 VMWare에서 Ruby로 만든 오픈소스 PaaS이다.  


CloudFoundry 가 개발자에게 주는 핵심가치는 편리함이다.  즉 CloudFoundry를 사용하면 다음과 같은 귀챦은 일을 하지 않아도 된다.


- 관계형 데이터베이스 설치/운영

- NoSQL 설치/운영

- MQ 설치/운영

- 웹사이드 주소가 중요하지 않은 경우 도메인 등록

- 웹서버의 가상 호스트 설정

- 웹서버와 애플리케이션 서버간의 프록시 설정

- 트래픽에 따라 WAS개수 줄이거나 늘이기

- 배포




2.  Cloud Foundry 와 Pivotal CF 개요




3.  public cloud에서 PCF 사용 따라하기



CF CLI 설치:

http://pivotal.io/platform/pcf-tutorials/getting-started-with-pivotal-cloud-foundry/install-the-cf-cli


샘플 애플리케이션 Deploy:

http://pivotal.io/platform/pcf-tutorials/getting-started-with-pivotal-cloud-foundry/deploy-the-sample-app


로그 보기:

http://pivotal.io/platform/pcf-tutorials/getting-started-with-pivotal-cloud-foundry/view-the-logs


데이터베이스 연결하기:

http://pivotal.io/platform/pcf-tutorials/getting-started-with-pivotal-cloud-foundry/connect-a-database



애플리케이션 확장(Scale) :

http://pivotal.io/platform/pcf-tutorials/getting-started-with-pivotal-cloud-foundry/scale-the-app



기타참고 자료:

How PCF Works 
https://docs.pivotal.io/pivotalcf/concepts

PCF Documentation 
https://docs.pivotal.io/pivotalcf/installing/pcf-docs.html

Installing PCF (IaaS-specific guides for installing PCF) 
https://docs.pivotal.io/pivotalcf/installing/

Learn more about the Spring Framework 
https://spring.io/guides

Explore and download more Cloud Foundry sample apps 
https://github.com/cloudfoundry-samples/


 

4.  프로젝트를 빌드하여 PWS에 업로드하기


mvn package 

> cf push <some-app-name> -p target/hello-korea-0.0.1-SNAPSHOT.jar.

업로드후 애플리케이션이 Running 상태가 되면 브라우저에서

http://hello-korea.cfapps.io/hello  로 접속하여 정상적으로 서비스가 되는지 확인한다.



[1일차-02] Building Microservices with Spring Data Rest


Spring Data Rest


1. MicroSerices

loosely coupled SOA with Bounded Context 






Spring Cloud Connector



작성중......