spring 클라우드 서비스 이용하기
VMWare에서 SpringSource를 인수한 덕분에 스프링 프레임워크를 이용한 웹 애플리케이션을 호스팅해주는 서비스가 생겼습니다. 클라우드파운드리입니다.
아래 내용과 관련된 이야기를 제10회 공감세미나에서 들려드립니다.
http://onoffmix.com/event/11138
01 vmc 명령
vmc(virtual machine console? command?) 명령을 이용해서 제어하기 때문에 vmc의 설치가 필요합니다. ruby언어로 만들어져 있습니다.
02 http://www.cloudfoundry.com/
http://www.cloudfoundry.com 사이트에 접속하면 자세한 안내를 볼 수 있습니다. 영어로!!! ^^b 영어 10년 이상 배우셨으니 다들 괜찮지요.
03 couldfoundry 회원가입
서비스를 이용하기 위해서는 이메일로 서비스를 가입할 수 있습니다. 실명인증 안해도 됩니다.
04 Ruby 인스톨
http://docs.cloudfoundry.com/frameworks/ruby/installing-ruby.html#windows
앞의 링크를 따라 가면 windows에서 ruby를 설치할 수 있는 가이드가 나옵니다.
05 RubyInstaller
rubyinstaller를 다운로드 받아서 설치합니다.
06 gem update --system
ruby의 모듈 매니저인 gem 명령을 통해서 모듈을 최신으로 업데이트합니다. 맥이나 리눅스에서는 sudo gem update --system 이라고 하셔야 합니다.
07 gem install vmc
드디어 vmc 명령을 설치할 수 있게 됩니다. 맥이나 리눅스에서는 sudo gem install vmc 라고 하셔야 합니다.
08
샘플로 만들어진 spring-mvc.war는 http://www.okjsp.pe.kr/seq/205560 를 참고하세요. 달라진 곳은 html 파일과 / 대신 /app 으로 주소가 변경되었습니다.
아래 명령어들은 순차적으로 실행한 것입니다.
C:\tmp>dir /b
spring-mvc.war
C:\tmp>vmc target https://api.cloudfoundry.com
Setting target to https://api.cloudfoundry.com... OK
C:\tmp>vmc target
target: https://api.cloudfoundry.com
C:\tmp>vmc login
target: https://api.cloudfoundry.com
Email> kenu@okjsp.pe.kr
Password> ********
Authenticating... OK
C:\tmp>vmc info
VMware's Cloud Application Platform
target: https://api.cloudfoundry.com
version: 0.999
support: http://support.cloudfoundry.com
user: kenu@okjsp.pe.kr
C:\tmp>vmc help
Showing basic command set. Pass --all to list all commands.
Getting Started
info Display information on the current target, user, etc.
login [USERNAME] Authenticate with the target
logout Log out from the target
target [URL] Set or display the target cloud, organization, and space
Applications
app [APP] Show app information
apps List your applications
Management
delete APPS... Delete an application
push [NAME] Push an application, syncing changes if it exists
restart APPS... Stop and start an application
start APPS... Start an application
stop APPS... Stop an application
Services
service INSTANCE Show service instance information
services List your service instances
Management
bind-service [INSTANCE] [APP] Bind a service instance to an application
unbind-service SERVICE APP Unbind a service from an application
create-service [SERVICE] [NAME] Create a service
delete-service [INSTANCE] Delete a service
tunnel [INSTANCE] [CLIENT] Tells you to install tunnel-vmc-plugin
Organizations
create-org [NAME] Create an organization
delete-org [ORGANIZATION] Delete an organization
org [ORGANIZATION] Show organization information
orgs List available organizations
Spaces
create-space [NAME] [ORGANIZATION] Create a space in an organization
delete-space SPACES... Delete a space and its contents
space [SPACE] Show space information
spaces [ORGANIZATION] List spaces in an organization
Routes
create-route [URL] Create a route
delete-route [ROUTE] Delete a route
routes List routes in a space
Domains
add-domain NAME Add a domain to a space
create-domain NAME Create a domain
delete-domain [DOMAIN] Delete a domain
domains [SPACE] List domains in a space
remove-domain [DOMAIN] Remove a domain from a space
Options:
--[no-]color Use colorful output
--[no-]script Shortcut for --quiet and --force
-V, --verbose Print extra information
-f, --[no-]force Skip interaction when possible
-h, --help Show command usage & instructions
-m, --manifest FILE Path to manifest file to use
-q, --[no-]quiet Simplify output format
-t, --trace Show API requests and responses
-u, --proxy EMAIL Act as another user (admin only)
-v, --version Print version number
C:\tmp>
C:\tmp>vmc push
Name> okspring
Instances> 1
1: grails
2: java_web
3: lift
4: node
5: play
6: rack
7: rails3
8: sinatra
9: spring
10: standalone
Framework> 9
1: java
2: java7
3: node
4: node06
5: node08
6: ruby18
7: ruby19
Runtime> 1
1: 64M
2: 128M
3: 256M
4: 512M
5: 1G
Memory Limit> 4
Creating okspring... OK
1: okspring.cloudfoundry.com
2: none
URL> okspring.cloudfoundry.com
Updating okspring... OK
Create services for application?> n
Save configuration?> n
Uploading okspring... OK
Starting okspring... OK
Checking okspring... OK
C:\tmp>vmc apps
Getting applications... OK
name status usage runtime url
okjsp running 1 x 512M java okjsp.cloudfoundry.com
okspring running 1 x 512M java okspring.cloudfoundry.com
C:\tmp>

