SlideShare una empresa de Scribd logo
1 de 37
Descargar para leer sin conexión
JSUG  Spring勉強会資料料
    Spring  on  Cloud  Foundry  SpringユーザのためのCloud  
                          Foundry講座
                                           2012年9月26日	
                                       ヴイエムウェア株式会社	




Confidential
                                               © 2009 VMware Inc. All rights reserved
アジェンダ
    n  はじめに
    n  Cloud  Foundry概要
    n  Spring  On  Cloud  Foundry【知っておくべき事】
     •  環境変数
     •  Auto  Reconfiguration
     •  Cloud  Namespace
     •  Spring  Profile
    n  まとめ




2                              Confidential
はじめに




3   Confidential
VMwareのクラウドへのアプローチ


                                                   セキュアな                           VMware 対応の      独立した
                                                 プライベート クラウド                       パブリック クラウド    パブリック クラウド



                                                        エンドユーザーコンピューティング
                                                                                      SaaS        他の SaaS
                                     View          Thin App           Zimbra
       End User Computing                                                          アプリケーション       プロバイダー


             SaaS
                                                    クラウドアプリケーションプラットフォーム                         NTTコミュニケー
                                                                                                    ション
                                    Spring          vFabric           Hyperic
                                                                                  CloudFoundry     他のクラウド
        Cloud Applications                                                                       インフラプロバイダ



            PaaS
                                        クラウドインフラストラクチャと管理ソリューション
                                                                                     vCloud
                                                                       vCloud       Datacenter
                                  vSphere    vCenter        vShield
    Public/Private/Hybrid Cloud                                        Director
                                                                                     vCloud
     Virtualized Infrastructure                                                      Express

            IaaS
4                                            Confidential
The complexity IT and developers face today
 〜~Before〜~  Webアプリケーション展開プロセス(workflow)	




* An actual application provisioning/update flow in a large enterprise. Image is blurred for privacy reasons
5                                                 Confidential
4
The complexity IT and developers face today
 〜~After〜~    Webアプリケーション展開プロセス(workflow)




                                target  <any  cloud>

                                    push  <my  app>

                                bind  <my  serivces>

                       instances  <my  app>  +  100
                                                     	
* An actual application provisioning/update flow in a large enterprise. Image is blurred for privacy reasons
6                                                 Confidential
4
〜~Before〜~  Webアプリケーション展開プロセス


      Webアプリケーションをクラウド上に展開するに約3ヶ⽉月程度度の期間が必要




                                                                 tomcat




 サーバ調達             ネットワーク      OSインストール&
 (1カ⽉月)            /ストレージ                       DBインストール&    JVM/Web/Appサーバ  アプリケーション
                              パラメータ設定(4⽇日)
                /サーバの構築(1ヶ⽉月)                   パラメータ設定/        インストール/     運⽤用監視設定(7⽇日)
                                              チューニング作業(7⽇日) アプリケーションデプロイ
                                                               パラメータ設定/
                                                            チューニング作業(10⽇日)



  インフラ調達&構築(2ヶ⽉月)                          ミドルウェア構築&アプリケションの配布(1ヶ⽉月)




©2010 VMware, Inc. All right reserved.	
         -7-
〜~After〜~    Webアプリケーション展開プロセス

  Webアプリケーションをクラウド上に展開するに要する時間は、わずか5分以内
                   で完了了




                               アプリケション
                                 コード

                                                vmc  target  <any  cloud>
                                                     push  <m  app>
                                                  bind  <my  services>
                                                 instances  <my  app>  +  
                                                           100



                                    開発者	
           vmcコマンド                    Cloud  Foundry  
                                             Cloud  Foundry展開⽤用コマンド


                                            アプリケションコード展開時間
                                               約数分(5分以内)

©2010 VMware, Inc. All right reserved.	
          -8-
PaaSクラウドのあるべき姿  
p  開発が容易易なフレームワークと開発ツール、開発・実⾏行行環境の提供
p  開発者はOS以下、インフラを意識識することなくアプリケーションをPaaSへデプロイするだけ
p  アプリケーションサーバ、データベース、フレームワークなどのランタイム設定は、アプリケ
    ーション/運⽤用ポリシーに応じて⾃自動設定(Auto  Config)
p  アプリケーションのユーザーアクセス増加に伴いスケールアウト


                                                       開発ツールと開発・
                                                        実行環境提供
アプリケーション           アプリケーション            開発者
  ユーザ                 開発	


 負荷に応じてス
  ケールアウト	




                         Eclipse  PlugIn   Deployツール




                                           フレーム
                         データベース             ワーク        APサーバ   JVM
Cloud  Foundry概要




    10
Copyright © 2011 VMware, Inc. All rights reserved. This product is protected by U.S. and international copyright and intellectual property laws. VMware products are covered by one or more patents listed at http://www.vmware.com/go/patents .
Open  PaaS  Cloud  Foundry


                                                          VMwareのイニシアティブよる業界初のオープンPaaSプロジェクト

                                                                                                                                                                                                                       Beta
                                                                    開発者向けのPaaSサービス提供(www.cloudfoundry.com)

                                                         オープンソースコミュニティを設⽴立立、PaaS基盤をオープンソースと
                                                                して提供(www.cloudfoundry.org)



                           ロックインされたクラウド                                                                                                                    オープンなクラウド

                    q  独⾃自⾔言語                                                                                                            q  豊富な選択肢  
                    q  独⾃自技術                                                                                                             q  標準的な技術
                    q  ブラックボックス                                                                                                          q  オープンソース


                                                                                                                                                                                プライベート

                                                                                                                                                                                      Other


    11
Copyright © 2011 VMware, Inc. All rights reserved. This product is protected by U.S. and international copyright and intellectual property laws. VMware products are covered by one or more patents listed at http://www.vmware.com/go/patents .
PaaSクラウドのあるべき姿  Open  PaaS  Cloud  Foundry


                                                               アプリケーションの⽤用途に応じてフレ
                                         Your  Application
                                               Logic           ームワーク、開発⾔言語を⾃自由に選択



                                   開発者




                          Java      Node.js         Ruby  VM     Groovy/Grails
アプリケーションサービスの豊富            VM                                                    システムSLAに応じてプラットフ
      な選択                                                                           ォーム(IaaS)を選択
                          Logic     Logic           Logic           Logic

⼤大量量データトランザ                                                                          コスト重視
    クション
              GemFIre/                                                                 パブリッククラウド	
  
                Redis                           データ関連サービスのバインディング                        RightScale	
  



RDMS、三層型アプリ
   ケーション

               MySQL
                                              メッセージ関連サービスのバインディング

ドキュメント指向DB                                                                            プライベートクラウド	
  
⼤大量量データ、スキー                                                                                    仮想マシン(OVF)
     マレス
              Mongo  DB                                                            セキュリティガ
                                                                                    バナンス重視


                                                                                           VMware vCloud
                                                                                             Director
システム間連携のメ
  ッセージ
                                                                                               VMware
              RabbitMQ                                                                         vSphere
Cloud  Foundry  アーキテクチャ・スタック

                                                                                               Cloud  Foundry

                                                                                   Clients  (VMC,STS,Browser)


                                                                                                   CF  Kernel  (VCAP)


                                                                                               Orchestrator(BOSH)



                                                                  IaaS(vSphere,AWS,vCloud  Director…)


                                                        Hardware  Server/Network/Memory/Storage  



    13
Copyright © 2011 VMware, Inc. All rights reserved. This product is protected by U.S. and international copyright and intellectual property laws. VMware products are covered by one or more patents listed at http://www.vmware.com/go/patents .
Cloud  Foundry  Clients  (vmcツール、eclipse⽤用プラグイン)




                                      Eclipse⽤用
                                    プラグインi




                                                             Cloud  Foundry  

                                     vmcツールi




©2010 VMware, Inc. All right reserved.	
          - 14 -
vmcツール

 n vmc target [URL]!
       •  現在設定しているターゲットURLの表⽰示、新しいURLの設定

 n vmc login [email]!
       •  ユーザのログイン処理理

 n vmc push!
       •  Cloud  Foundryへのアプリケーションの配布

 n vmc instances [appname]!
       •      アプリケーションのインスタンス数の設定

 n vmc start/stop/restart/delete[appname]!
       •  アプリケーションのstart/stop/restart/delete


©2010 VMware, Inc. All right reserved.	
   - 15 -
Cloud  Foundry  アーキテクチャ・スタック

                                                                                               Cloud  Foundry

                                                                                      Clients  (vmc,sts,Browser)


                                                                                                   CF  Kernel  (VCAP)


                                                                                               Orchestrator(BOSH)



                                                                  IaaS(vSphere,AWS,vCloud  Director…)


                                                        Hardware  Server/Network/Memory/Storage  



    16
Copyright © 2011 VMware, Inc. All rights reserved. This product is protected by U.S. and international copyright and intellectual property laws. VMware products are covered by one or more patents listed at http://www.vmware.com/go/patents .
Cloud  Foundry  vcap  内部アーキテクチャ



                                                                                                                                                                                                                     db
                                                                                                                 Cloud Controller




                                                                                                                                     Nats                                                      Health Manager
                                Router



                                                                                                                                                    Dea



                               Service                                                                          app                    app


    17
Copyright © 2011 VMware, Inc. All rights reserved. This product is protected by U.S. and international copyright and intellectual property laws. VMware products are covered by one or more patents listed at http://www.vmware.com/go/patents .
Cloud  Foundry  アーキテクチャ・スタック

                                                                                               Cloud  Foundry

                                                                                      Clients  (vmc,sts,Browser)


                                                                                                   CF  Kernel  (VCAP)


                                                                                               Orchestrator(BOSH)



                                                                  IaaS(vSphere,AWS,vCloud  Director…)


                                                        Hardware  Server/Network/Memory/Storage  



    18
Copyright © 2011 VMware, Inc. All rights reserved. This product is protected by U.S. and international copyright and intellectual property laws. VMware products are covered by one or more patents listed at http://www.vmware.com/go/patents .
Cloud  Foundry  本番稼働における課題




    19
Copyright © 2011 VMware, Inc. All rights reserved. This product is protected by U.S. and international copyright and intellectual property laws. VMware products are covered by one or more patents listed at http://www.vmware.com/go/patents .
Deploy  PaaS  with  BOSH    

                                                                                                            Sends droplet
                                                                                                           heart beats and
                                                                                                            exit messages


                                                                                                                                                                              Router
                                                                                                                                                                               Router

                                                                                                                                           Registers and                                                        Registers and
                                                                                                                                            unregisters                                                          unregisters




                      CLI                                                                                                                            Routes REST API                               Routes droplet
                                                                                                                                                                                                     requests
                                                                                                                                                         requests
                                                                                                                     Droplet change
                                                                                                                      notifications

                                                                                                                         Droplet
                                                                                                                                            Cloud Controller                Orchestrates
                                                                                            Health Manager              start/stop            Cloud Controller            (Start, Stop, Find)                Droplet Execution
                                                                                                                        requests
                                                                                                                                                                                                               Agent (DEA)



                                                                                           Periodically scans                                Persists droplets
                                                                                            for consistency                                  and provisioned                                              Guest applications
                                                                                                                                                                         Advertise
                                                                                                                                                 services                                                    consume
                                                                                                                         Cloud                                            Service
                                                                                                                        Controller
                                                                                                                                                          Provision and
                                                                                                                        Database
                                                                                                                                                           unprovision




                                                                                                                                                              Service "A"
                                                                                                                                                                                        Provision               Service
                                                                                                                                                                                           and                    "A"
                                                                                                                                                           Provisioning Agent
                                                                                                                                                                                       unprovision



                   BOSH

                                                                                                                                                             IaaS


    20
Copyright © 2011 VMware, Inc. All rights reserved. This product is protected by U.S. and international copyright and intellectual property laws. VMware products are covered by one or more patents listed at http://www.vmware.com/go/patents .
BOSHによるIaaSの選択




                                                                                             Cloud Foundry BOSH


                                                                                   Cloud Provider Interface(CPI)




                                                                                                                                                                                             https://github.com/piston/
                                                                                                                                                                                                openstack-bosh-cpi


    21
Copyright © 2011 VMware, Inc. All rights reserved. This product is protected by U.S. and international copyright and intellectual property laws. VMware products are covered by one or more patents listed at http://www.vmware.com/go/patents .
Spring  On  Cloud  Foundry【知っておくべき事項】




    22
Copyright © 2011 VMware, Inc. All rights reserved. This product is protected by U.S. and international copyright and intellectual property laws. VMware products are covered by one or more patents listed at http://www.vmware.com/go/patents .
Spring  On  Cloud  Foundry【知っておくべき事項】	

                                                       アプリケーションのポータビリティ性の向上
                                CloudFoundryサービスとのバイディングに伴う設定の軽減

n  環境変数
             Cloud  foundryサービスの環境設定情報をアプリケーションでどのように取得できるか?
n  Auto-‐‑‒Reconfiguration
             DI機能を活かしたAuto-‐‑‒Reconfigurationの仕組み
n  <cloud>ネームスペース
             Auto-‐‑‒Reconfigurationを使わないバイディングの⽅方法
n  Spring  Profile
             アプリケーションの動作環境によって、設定情報を切切り替える仕組み




    23
Copyright © 2011 VMware, Inc. All rights reserved. This product is protected by U.S. and international copyright and intellectual property laws. VMware products are covered by one or more patents listed at http://www.vmware.com/go/patents .
環境変数(サービス・バイディングに必要なパラメータ情報)
@RequestMapping("/env")!!
public void env(HttpServletResponse response) throws IOException {                                                                                                                                                                           !!
    response.setContentType("text/plain");     !!
    PrintWriter out = response.getWriter();    !!
    out.println("System Environment:");!!
    for (Map.Entry<String, String> envvar : System.getenv().entrySet()) {
        out.println(envvar.getKey() + ": " + envvar.getValue()); !!
    }!
}      !!

                                      System().getenv().〜~  JSON形式の環境変数の取得
{
    "postgresql-9.0": [{ !!
        "name": "env-postgresql", !!
        "label": "postgresql-9.0",!
……!
……      !       !!
            "username": "u50ce600bba434bacbc99e034bb415644",                                                                                                                                                      !!
            "password": "pf4dca5bd449d4732841f0c4ae3f299d0"!!
        }       !!
    }] !!
}       !!
!
    24
Copyright © 2011 VMware, Inc. All rights reserved. This product is protected by U.S. and international copyright and intellectual property laws. VMware products are covered by one or more patents listed at http://www.vmware.com/go/patents .
環境変数(サービス・バイディングに必要なパラメータ情報)

  サービスとのバインディグなし
       	
"
 VCAP_SERVICES: {}
      ""
    Postgresqlサービスとのバインディグ
{      	
	
    "postgresql-9.0": [{     ""
        "name": "env-postgresql",    ""
        "label": "postgresql-9.0", ""
        "plan": "free",      ""
        "credentials": {     ""
            "name": "de24667f9344b4eeaad6b5a2326d52faa",   ""
            "host": "172.30.48.122", ""
            "hostname": "172.30.48.122",    ""
            "port": 5432,    ""
            "user": "u50ce600bba434bacbc99e034bb415644",   ""
            "username": "u50ce600bba434bacbc99e034bb415644",                                                                                                                                                                                 ""
            "password": "pf4dca5bd449d4732841f0c4ae3f299d0"""
        }     ""
    }] ""
}      "      ""

    25
Copyright © 2011 VMware, Inc. All rights reserved. This product is protected by U.S. and international copyright and intellectual property laws. VMware products are covered by one or more patents listed at http://www.vmware.com/go/patents .
DI機能を活かしたAuto-‐‑‒Reconfigurationの仕組み




 Cloud Foundry !         Jar  file                                                                                                     Cloud Foundry !
     MySQL 	
    cloudfoundry-‐‑‒runtime                                                                                                  MySQL 	
                                                                                                                                                                                                                書換え
                            CLOUD MySQL Bean                            BeanFactoryPostProc                                                                                                                                         web.xml
                           (__appCloudDataSource)	
                           essor
                                                                                                                                                                                             Spring  App

                                                                            プロパティ書換え                                                                                           cloudfoundry-‐‑‒runtime
CloudFoundry環境	
                                                                                                                                                 CLOUD MySQL Bean                           BeanFactoryPostProc
                                                                                                                               デプロイ	
                           (__appCloudDataSource)	
                          essor
ローカル開発環境	
                                              WAR  file(Web  App)
                                                                                                    web.xml
                                MySQL Bean                                                                                                                                            Spring Framework	
                           (javax.sql.DataSource)	
                                                                             Spring  App
                                                                                                                                                                                      Application  Context.xml

                                                                                                                                                                                               参照/書換え
                                                Spring Framework	
                                              Application  Context.xml

Local MySQL 	




     26
 Copyright © 2011 VMware, Inc. All rights reserved. This product is protected by U.S. and international copyright and intellectual property laws. VMware products are covered by one or more patents listed at http://www.vmware.com/go/patents .
Auto-‐‑‒Reconfiguration機能(リプレス対象Bean)
        Application  Contextファイル
 !
 <bean class="org.apache.commons.dbcp.BasicDataSource" id="dataSource">      !!
     <property name="driverClassName" value="com.mysql.jdbc.Driver"/>!!
     <property name="url" value="jdbc:mysql://localhost:3306/inventory-db"/> !!
     <property name="username" value="myuser"/>    !!
     <property name="password" value="mypass"/>    !!
 </bean> !       "        ""


                                                                                                                                        構築環境によって変更更するプロパティ値

                  Service  Type                                                                                          置換え対象となるBean  type
     Mysql,Postgres                                                       javax.sql.DataSource
     Redis                                                                org.springframework.data.redis.connection.RedisConnecti
                                                                          onFactory
     MongoDB                                                              org.springframework.data.document.mongodb.MongoDbF
                                                                          actory
     RabbitMQ                                                             org.springframework.amqp.rabbit.connection.Connection
                                                                          Factory


    27
Copyright © 2011 VMware, Inc. All rights reserved. This product is protected by U.S. and international copyright and intellectual property laws. VMware products are covered by one or more patents listed at http://www.vmware.com/go/patents .
Auto-‐‑‒Reconfiguration機能(制限事項)	

n  複数サービスのバインディングは利利⽤用不不可
             複数のサービスタイプから⼀一つのサービスだけ使うとき有効になります。例例えば、
             アプリケーションが⼀一つのリレーショナルデータベースサービス(MySQLもし
             くはPostgres)だけをバイディングできます。


n  複数のマッチングタイプのBeanは利利⽤用不不可
             複数のマッチングタイプのbeanから⼀一つのbeanだけ使うとき有効になります。
             例例えば、Spring  アプリケーション・コンテキストが複数のデータソースbeanを
             使う事はできません。




    28
Copyright © 2011 VMware, Inc. All rights reserved. This product is protected by U.S. and international copyright and intellectual property laws. VMware products are covered by one or more patents listed at http://www.vmware.com/go/patents .
Auto-‐‑‒Reconfiguration機能(Auto-‐‑‒Reconfigurationの無効化)	

n  Springアプリケーションでない”JavaWeb”のデプロイ
        Springアプリケーションでない”JavaWeb”のアプリケーションをcf上にデプロイ
        するとき。Auto-‐‑‒reconfiguration機能は有効でなくなり、アプリケーションの変
        更更も⾏行行われません。


n  <cloud>  のエレメントが使われている場合
        <cloud>ネームスペースエレメントをベースとしたBeanがアプリケーションに含
        まれていた場合、Auto-‐‑‒reconfiguration機能は適⽤用外となります。




     29
 Copyright © 2011 VMware, Inc. All rights reserved. This product is protected by U.S. and international copyright and intellectual property laws. VMware products are covered by one or more patents listed at http://www.vmware.com/go/patents .
<cloud>ネームスペースエレメント	

    Auto-‐‑‒Reconfiguration機能の制限で使えないとき、<cloud>ネームスペース
  エレメントを利利⽤用する。


ローカル環境	
                                                                                                                                              CloudFoundry環境	
                           WAR  file(Web  App)

                                     Spring  App                                                                                                                                       Spring  App

                       cloudfoundry-‐‑‒runtime                                                                                                                           cloudfoundry-‐‑‒runtime

                        BeanFactoryPostProcessor                                                                                                                          BeanFactoryPostProcessor
                                                                                                                     デプロイ	

                 MySQL Bean                             MongoDBFactoryBean                                                                                        MySQL Bean                              MongoDBFactoryBean




                              Spring Framework	
                                                                                                                               Spring Framework	
                                                                                                                                                                                             接続可能




                                                                                                                                                                        MySQL                                        Mongo  DB




    30
Copyright © 2011 VMware, Inc. All rights reserved. This product is protected by U.S. and international copyright and intellectual property laws. VMware products are covered by one or more patents listed at http://www.vmware.com/go/patents .
<cloud>ネームスペースエレメント  使うための事前準備	
org.cloudfoundry:cloudfoundry-‐‑‒runtimeをdependencyとして含める必要。pom.xmlの
dependencyに追加。
<dependencies>"
     <dependency>"
          <groupId>org.cloudfoundry</groupId>"
          <artifactId>cloudfoundry-runtime</artifactId>"
          <version>0.8.1</version>"
     </dependency>"
"
     <!-- additional dependency declarations -->"
</dependencies>"
        ""
 pom.xmlにSpring  Framework  Milestone  Repositoryを持たせる必要。
<repositories>"
    <repository>"
        <id>org.springframework.maven.milestone</id>"
        <name>Spring Framework Maven Milestone Repository</name>"
        <url>http://maven.springframework.org/milestone</url>"
    </repository>"
"
    <!-- additional repository declarations -->"
</repositories>""

    31
Copyright © 2011 VMware, Inc. All rights reserved. This product is protected by U.S. and international copyright and intellectual property laws. VMware products are covered by one or more patents listed at http://www.vmware.com/go/patents .
<cloud>ネームスペースエレメント  <cloud:data-‐‑‒source>  	
n  <cloud:data-‐‑‒source>
SpringアプリケーションでJDBC  DataSourceの設定をするときに利利⽤用
            •  id  –  デフォルトのサービス名
            •  service-‐‑‒name  –  複数のデータベースサービスをアプリケーションに接続させると
               きに必要

<cloud:data-‐‑‒source  id="dataSource"  />

<bean  id="jdbcTemplate"  class="org.springframework.jdbc.core.JdbcTemplate">
    <property  name="dataSource"  ref="dataSource"  />
</bean>
"
n  オプションが追加されたDataSourceの設定例例
 <cloud:data-source id="mydatasource">"
               <cloud:connection properties="charset=utf-8;" />"
               <cloud:pool pool-size="5-10" max-wait-time="2000" />"
 </cloud:data-source>"




    32
Copyright © 2011 VMware, Inc. All rights reserved. This product is protected by U.S. and international copyright and intellectual property laws. VMware products are covered by one or more patents listed at http://www.vmware.com/go/patents .
Spring  Profile

    アプリケーションにポータビリティ性を持たせるために、動作環境によって、
  設定情報を切切り替える仕組み


                                                                                                         Spring App


                                                                                           Spring Framework	
                                                                                                                    スイッチ
                                                                                                           (Spring  Profile)
                                                 <profile=”default”>                                                                                 <profile=”cloud”>

                                                                                                                                                cloudfoundry-‐‑‒runtime

                                     MySQL Bean                                                                                                  BeanFactoryPostProcessor
                                                                               MongoDB Bean
                                (javax.sql.DataSource)	

                                                                                                                                            MySQL Bean                       MongoDBFactoryBean
                                                    ローカル開発環境
                                                                                                                                                   Cloud  Foundry環境




                                             MySQL                                      Mongo  DB                                                 MySQL                                  Mongo  DB




    33
Copyright © 2011 VMware, Inc. All rights reserved. This product is protected by U.S. and international copyright and intellectual property laws. VMware products are covered by one or more patents listed at http://www.vmware.com/go/patents .
Spring  Profile
n  <beans  profile=“cloud”>
  Springアプリケーションは、Cloud  Foundryにデプロイされると”cloud”のプロファイルを
⾃自動に選択し、その環境情報が適⽤用される。

<bean id="mongoTemplate"
class="org.springframework.data.mongodb.core.MongoTemplate">                                                                                                                                                        !!
    <constructor-arg ref="mongoDbFactory" />      !!
</bean> !!
<beans profile="default">!!
    <mongo:db-factory id="mongoDbFactory" dbname="pwdtest" host="127.0.0.1"
port="27017" username="test_user" password="efgh" />       !!
</beans>!!
<beans profile="cloud">      ""
    <cloud:mongo-db-factory id="mongoDbFactory" /> ""
</beans>      ""
"




    34
Copyright © 2011 VMware, Inc. All rights reserved. This product is protected by U.S. and international copyright and intellectual property laws. VMware products are covered by one or more patents listed at http://www.vmware.com/go/patents .
まとめ




    35
Copyright © 2011 VMware, Inc. All rights reserved. This product is protected by U.S. and international copyright and intellectual property laws. VMware products are covered by one or more patents listed at http://www.vmware.com/go/patents .
まとめ


n  VMwareのイニシアティブよる業界初のオープンPaaSプロジ
    ェクトとしてOpen  PaaS  Cloud  foundryが誕⽣生
n  Spring  On  Cloud  Foundry【知っておくべき事】
       •  環境変数
       •  Auto  Reconfiguration
       •  Cloud  Namespace
       •  Spring  Profile




    36
Copyright © 2011 VMware, Inc. All rights reserved. This product is protected by U.S. and international copyright and intellectual property laws. VMware products are covered by one or more patents listed at http://www.vmware.com/go/patents .
Springon cloudfoundry

Más contenido relacionado

La actualidad más candente

V cd5.1 basichandson_v3
V cd5.1 basichandson_v3V cd5.1 basichandson_v3
V cd5.1 basichandson_v3
Yoshinori Sato
 

La actualidad más candente (20)

Developer summit continuous deliveryとjenkins
Developer summit   continuous deliveryとjenkinsDeveloper summit   continuous deliveryとjenkins
Developer summit continuous deliveryとjenkins
 
NSX-T IaC プロジェクト @ VMware DevOps meetup #4
NSX-T IaC プロジェクト @ VMware DevOps meetup #4NSX-T IaC プロジェクト @ VMware DevOps meetup #4
NSX-T IaC プロジェクト @ VMware DevOps meetup #4
 
AWSではじめるDNSSEC
AWSではじめるDNSSECAWSではじめるDNSSEC
AWSではじめるDNSSEC
 
[AWS Developers Meetup 2017] Developerのための ライブAWSウォークスルー 〜 AWS SDKの使い方 〜
[AWS Developers Meetup 2017] DeveloperのためのライブAWSウォークスルー 〜 AWS SDKの使い方 〜[AWS Developers Meetup 2017] DeveloperのためのライブAWSウォークスルー 〜 AWS SDKの使い方 〜
[AWS Developers Meetup 2017] Developerのための ライブAWSウォークスルー 〜 AWS SDKの使い方 〜
 
AWSのPCI DSSへの取り組みと 押さえておきたい耳寄り情報
AWSのPCI DSSへの取り組みと 押さえておきたい耳寄り情報AWSのPCI DSSへの取り組みと 押さえておきたい耳寄り情報
AWSのPCI DSSへの取り組みと 押さえておきたい耳寄り情報
 
V cd5.1 basichandson_v3
V cd5.1 basichandson_v3V cd5.1 basichandson_v3
V cd5.1 basichandson_v3
 
セキュリティ設計の頻出論点
セキュリティ設計の頻出論点セキュリティ設計の頻出論点
セキュリティ設計の頻出論点
 
20140605_じどうかの窓口_CloudBees_Jenkins
20140605_じどうかの窓口_CloudBees_Jenkins20140605_じどうかの窓口_CloudBees_Jenkins
20140605_じどうかの窓口_CloudBees_Jenkins
 
Windows Server Container and Windows Subsystem for Linux
Windows Server Container and Windows Subsystem for LinuxWindows Server Container and Windows Subsystem for Linux
Windows Server Container and Windows Subsystem for Linux
 
ついに始まるJava EE 7時代のアプリケーション開発
ついに始まるJava EE 7時代のアプリケーション開発ついに始まるJava EE 7時代のアプリケーション開発
ついに始まるJava EE 7時代のアプリケーション開発
 
VMwareとIBMクラウドの提携で広がるハイブリッド・クラウドの世界
VMwareとIBMクラウドの提携で広がるハイブリッド・クラウドの世界VMwareとIBMクラウドの提携で広がるハイブリッド・クラウドの世界
VMwareとIBMクラウドの提携で広がるハイブリッド・クラウドの世界
 
オンプレ環境と連携するハイブリッドクラウド活用事例 (2014.8.8 AWS Japan Tour 2014 福岡)
オンプレ環境と連携するハイブリッドクラウド活用事例 (2014.8.8 AWS Japan Tour 2014 福岡)オンプレ環境と連携するハイブリッドクラウド活用事例 (2014.8.8 AWS Japan Tour 2014 福岡)
オンプレ環境と連携するハイブリッドクラウド活用事例 (2014.8.8 AWS Japan Tour 2014 福岡)
 
Deploying secure service mesh for applications on k8s with using A10's Lighti...
Deploying secure service mesh for applications on k8s with using A10's Lighti...Deploying secure service mesh for applications on k8s with using A10's Lighti...
Deploying secure service mesh for applications on k8s with using A10's Lighti...
 
VMware Cloud Disaster Recovery の概要
VMware Cloud Disaster Recovery の概要VMware Cloud Disaster Recovery の概要
VMware Cloud Disaster Recovery の概要
 
JJUG CCC 2015 Spring: Liberty Profile Technical Deepdive:IBMの新しいアプリケーションサーバーの...
JJUG CCC 2015 Spring: Liberty Profile Technical Deepdive:IBMの新しいアプリケーションサーバーの...JJUG CCC 2015 Spring: Liberty Profile Technical Deepdive:IBMの新しいアプリケーションサーバーの...
JJUG CCC 2015 Spring: Liberty Profile Technical Deepdive:IBMの新しいアプリケーションサーバーの...
 
Easy avi deploy_ver2.0.4
Easy avi deploy_ver2.0.4Easy avi deploy_ver2.0.4
Easy avi deploy_ver2.0.4
 
Microsoft Azure Stack Overview and Roadmap - March 7th, 2019.
Microsoft Azure Stack Overview and Roadmap - March 7th, 2019.Microsoft Azure Stack Overview and Roadmap - March 7th, 2019.
Microsoft Azure Stack Overview and Roadmap - March 7th, 2019.
 
GoodBye AD FS - Azure Active Directory Only の認証方式へ切り替えよう!
GoodBye AD FS - Azure Active Directory Only の認証方式へ切り替えよう!GoodBye AD FS - Azure Active Directory Only の認証方式へ切り替えよう!
GoodBye AD FS - Azure Active Directory Only の認証方式へ切り替えよう!
 
.NETアプリケーションのクラウド最適化
.NETアプリケーションのクラウド最適化.NETアプリケーションのクラウド最適化
.NETアプリケーションのクラウド最適化
 
[Modern Cloud Day Tokyo 2019] Oracle CloudでDevOps!?Javaアプリケーションのモダン開発を支援するOra...
[Modern Cloud Day Tokyo 2019] Oracle CloudでDevOps!?Javaアプリケーションのモダン開発を支援するOra...[Modern Cloud Day Tokyo 2019] Oracle CloudでDevOps!?Javaアプリケーションのモダン開発を支援するOra...
[Modern Cloud Day Tokyo 2019] Oracle CloudでDevOps!?Javaアプリケーションのモダン開発を支援するOra...
 

Similar a Springon cloudfoundry

20111026 switch on福岡(クラウドコンピューティング)
20111026 switch on福岡(クラウドコンピューティング)20111026 switch on福岡(クラウドコンピューティング)
20111026 switch on福岡(クラウドコンピューティング)
dekakin
 
MSC 2010 T5-1 クラウド時代の最新アプリケーション プラットフォーム「Windows Azure」概要
MSC 2010 T5-1 クラウド時代の最新アプリケーション プラットフォーム「Windows Azure」概要MSC 2010 T5-1 クラウド時代の最新アプリケーション プラットフォーム「Windows Azure」概要
MSC 2010 T5-1 クラウド時代の最新アプリケーション プラットフォーム「Windows Azure」概要
kumo2010
 
ニフティクラウドC4SA_ご紹介資料ver.1.1
ニフティクラウドC4SA_ご紹介資料ver.1.1ニフティクラウドC4SA_ご紹介資料ver.1.1
ニフティクラウドC4SA_ご紹介資料ver.1.1
Satoshi Ueno
 
ニフティクラウド C4 sa ご紹介資料ver.1.2
ニフティクラウド C4 sa ご紹介資料ver.1.2ニフティクラウド C4 sa ご紹介資料ver.1.2
ニフティクラウド C4 sa ご紹介資料ver.1.2
Satoshi Ueno
 
Google Compute EngineとPipe API
Google Compute EngineとPipe APIGoogle Compute EngineとPipe API
Google Compute EngineとPipe API
maruyama097
 
Google Compute EngineとGAE Pipeline API
Google Compute EngineとGAE Pipeline APIGoogle Compute EngineとGAE Pipeline API
Google Compute EngineとGAE Pipeline API
maruyama097
 

Similar a Springon cloudfoundry (20)

Japan Developer Summit (jp) - Cloud Foundry, the Open Platform As A Service
Japan Developer Summit (jp) - Cloud Foundry, the Open Platform As A ServiceJapan Developer Summit (jp) - Cloud Foundry, the Open Platform As A Service
Japan Developer Summit (jp) - Cloud Foundry, the Open Platform As A Service
 
20111026 switch on福岡(クラウドコンピューティング)
20111026 switch on福岡(クラウドコンピューティング)20111026 switch on福岡(クラウドコンピューティング)
20111026 switch on福岡(クラウドコンピューティング)
 
CloudSpiral 2014年度 Webアプリ講義(2日目)
CloudSpiral 2014年度 Webアプリ講義(2日目)CloudSpiral 2014年度 Webアプリ講義(2日目)
CloudSpiral 2014年度 Webアプリ講義(2日目)
 
Cloudianと連携するCloudStack (Cloudian Summit 2012)
Cloudianと連携するCloudStack (Cloudian Summit 2012)Cloudianと連携するCloudStack (Cloudian Summit 2012)
Cloudianと連携するCloudStack (Cloudian Summit 2012)
 
OpenStackプロジェクトの全体像~詳細編~
OpenStackプロジェクトの全体像~詳細編~OpenStackプロジェクトの全体像~詳細編~
OpenStackプロジェクトの全体像~詳細編~
 
Twilio x SendGrid x Bluemix 実践ハンズオン
Twilio x SendGrid x Bluemix 実践ハンズオンTwilio x SendGrid x Bluemix 実践ハンズオン
Twilio x SendGrid x Bluemix 実践ハンズオン
 
Wakame Project - 自作クラウド研究会
Wakame Project - 自作クラウド研究会Wakame Project - 自作クラウド研究会
Wakame Project - 自作クラウド研究会
 
【検証してみた】いま話題のVMware on IBM Cloud SoftLayer 配布版
【検証してみた】いま話題のVMware on IBM Cloud SoftLayer 配布版【検証してみた】いま話題のVMware on IBM Cloud SoftLayer 配布版
【検証してみた】いま話題のVMware on IBM Cloud SoftLayer 配布版
 
OpenStackベースのオープン・クラウドでビジネス価値を高める秘訣 @201402
OpenStackベースのオープン・クラウドでビジネス価値を高める秘訣 @201402OpenStackベースのオープン・クラウドでビジネス価値を高める秘訣 @201402
OpenStackベースのオープン・クラウドでビジネス価値を高める秘訣 @201402
 
cross2012a fujya
cross2012a fujyacross2012a fujya
cross2012a fujya
 
MSC 2010 T5-1 クラウド時代の最新アプリケーション プラットフォーム「Windows Azure」概要
MSC 2010 T5-1 クラウド時代の最新アプリケーション プラットフォーム「Windows Azure」概要MSC 2010 T5-1 クラウド時代の最新アプリケーション プラットフォーム「Windows Azure」概要
MSC 2010 T5-1 クラウド時代の最新アプリケーション プラットフォーム「Windows Azure」概要
 
パッケージソフトウェアを簡単にSaaS化!?既存の資産を使ったSaaS化手法のご紹介
パッケージソフトウェアを簡単にSaaS化!?既存の資産を使ったSaaS化手法のご紹介パッケージソフトウェアを簡単にSaaS化!?既存の資産を使ったSaaS化手法のご紹介
パッケージソフトウェアを簡単にSaaS化!?既存の資産を使ったSaaS化手法のご紹介
 
ニフティクラウドC4SA_ご紹介資料ver.1.1
ニフティクラウドC4SA_ご紹介資料ver.1.1ニフティクラウドC4SA_ご紹介資料ver.1.1
ニフティクラウドC4SA_ご紹介資料ver.1.1
 
VMware Cloud on AWS のご紹介 -セキュリティ風味-
VMware Cloud on AWS のご紹介  -セキュリティ風味- VMware Cloud on AWS のご紹介  -セキュリティ風味-
VMware Cloud on AWS のご紹介 -セキュリティ風味-
 
ニフティクラウド C4 sa ご紹介資料ver.1.2
ニフティクラウド C4 sa ご紹介資料ver.1.2ニフティクラウド C4 sa ご紹介資料ver.1.2
ニフティクラウド C4 sa ご紹介資料ver.1.2
 
Springの今
Springの今Springの今
Springの今
 
Google Compute EngineとPipe API
Google Compute EngineとPipe APIGoogle Compute EngineとPipe API
Google Compute EngineとPipe API
 
Google Compute EngineとGAE Pipeline API
Google Compute EngineとGAE Pipeline APIGoogle Compute EngineとGAE Pipeline API
Google Compute EngineとGAE Pipeline API
 
20200811 AWS Black Belt Online Seminar CloudEndure
20200811 AWS Black Belt Online Seminar CloudEndure20200811 AWS Black Belt Online Seminar CloudEndure
20200811 AWS Black Belt Online Seminar CloudEndure
 
Circle of Code with Cloud Foundry
Circle of Code with Cloud FoundryCircle of Code with Cloud Foundry
Circle of Code with Cloud Foundry
 

Springon cloudfoundry

  • 1. JSUG  Spring勉強会資料料 Spring  on  Cloud  Foundry  SpringユーザのためのCloud   Foundry講座 2012年9月26日 ヴイエムウェア株式会社 Confidential © 2009 VMware Inc. All rights reserved
  • 2. アジェンダ n  はじめに n  Cloud  Foundry概要 n  Spring  On  Cloud  Foundry【知っておくべき事】 •  環境変数 •  Auto  Reconfiguration •  Cloud  Namespace •  Spring  Profile n  まとめ 2 Confidential
  • 3. はじめに 3 Confidential
  • 4. VMwareのクラウドへのアプローチ セキュアな        VMware 対応の 独立した プライベート クラウド パブリック クラウド パブリック クラウド エンドユーザーコンピューティング SaaS 他の SaaS View Thin App Zimbra End User Computing アプリケーション プロバイダー SaaS クラウドアプリケーションプラットフォーム NTTコミュニケー ション Spring vFabric Hyperic CloudFoundry 他のクラウド Cloud Applications インフラプロバイダ PaaS クラウドインフラストラクチャと管理ソリューション vCloud vCloud Datacenter vSphere vCenter vShield Public/Private/Hybrid Cloud Director vCloud Virtualized Infrastructure Express IaaS 4 Confidential
  • 5. The complexity IT and developers face today 〜~Before〜~  Webアプリケーション展開プロセス(workflow) * An actual application provisioning/update flow in a large enterprise. Image is blurred for privacy reasons 5 Confidential 4
  • 6. The complexity IT and developers face today 〜~After〜~    Webアプリケーション展開プロセス(workflow) target  <any  cloud> push  <my  app> bind  <my  serivces> instances  <my  app>  +  100 * An actual application provisioning/update flow in a large enterprise. Image is blurred for privacy reasons 6 Confidential 4
  • 7. 〜~Before〜~  Webアプリケーション展開プロセス Webアプリケーションをクラウド上に展開するに約3ヶ⽉月程度度の期間が必要 tomcat サーバ調達 ネットワーク OSインストール& (1カ⽉月) /ストレージ DBインストール& JVM/Web/Appサーバ アプリケーション パラメータ設定(4⽇日) /サーバの構築(1ヶ⽉月) パラメータ設定/ インストール/ 運⽤用監視設定(7⽇日) チューニング作業(7⽇日) アプリケーションデプロイ パラメータ設定/ チューニング作業(10⽇日) インフラ調達&構築(2ヶ⽉月) ミドルウェア構築&アプリケションの配布(1ヶ⽉月) ©2010 VMware, Inc. All right reserved. -7-
  • 8. 〜~After〜~    Webアプリケーション展開プロセス Webアプリケーションをクラウド上に展開するに要する時間は、わずか5分以内 で完了了 アプリケション コード vmc  target  <any  cloud> push  <m  app> bind  <my  services> instances  <my  app>  +   100 開発者 vmcコマンド    Cloud  Foundry   Cloud  Foundry展開⽤用コマンド アプリケションコード展開時間 約数分(5分以内) ©2010 VMware, Inc. All right reserved. -8-
  • 9. PaaSクラウドのあるべき姿   p  開発が容易易なフレームワークと開発ツール、開発・実⾏行行環境の提供 p  開発者はOS以下、インフラを意識識することなくアプリケーションをPaaSへデプロイするだけ p  アプリケーションサーバ、データベース、フレームワークなどのランタイム設定は、アプリケ ーション/運⽤用ポリシーに応じて⾃自動設定(Auto  Config) p  アプリケーションのユーザーアクセス増加に伴いスケールアウト 開発ツールと開発・ 実行環境提供 アプリケーション アプリケーション 開発者 ユーザ 開発 負荷に応じてス ケールアウト Eclipse  PlugIn Deployツール フレーム データベース ワーク APサーバ JVM
  • 10. Cloud  Foundry概要 10 Copyright © 2011 VMware, Inc. All rights reserved. This product is protected by U.S. and international copyright and intellectual property laws. VMware products are covered by one or more patents listed at http://www.vmware.com/go/patents .
  • 11. Open  PaaS  Cloud  Foundry VMwareのイニシアティブよる業界初のオープンPaaSプロジェクト Beta 開発者向けのPaaSサービス提供(www.cloudfoundry.com) オープンソースコミュニティを設⽴立立、PaaS基盤をオープンソースと して提供(www.cloudfoundry.org) ロックインされたクラウド  オープンなクラウド q  独⾃自⾔言語   q  豊富な選択肢   q  独⾃自技術 q  標準的な技術 q  ブラックボックス q  オープンソース プライベート Other 11 Copyright © 2011 VMware, Inc. All rights reserved. This product is protected by U.S. and international copyright and intellectual property laws. VMware products are covered by one or more patents listed at http://www.vmware.com/go/patents .
  • 12. PaaSクラウドのあるべき姿  Open  PaaS  Cloud  Foundry アプリケーションの⽤用途に応じてフレ Your  Application Logic ームワーク、開発⾔言語を⾃自由に選択 開発者 Java   Node.js Ruby  VM Groovy/Grails アプリケーションサービスの豊富 VM システムSLAに応じてプラットフ な選択 ォーム(IaaS)を選択 Logic Logic Logic Logic ⼤大量量データトランザ コスト重視 クション GemFIre/ パブリッククラウド   Redis データ関連サービスのバインディング RightScale   RDMS、三層型アプリ ケーション MySQL メッセージ関連サービスのバインディング ドキュメント指向DB プライベートクラウド   ⼤大量量データ、スキー 仮想マシン(OVF) マレス Mongo  DB セキュリティガ バナンス重視 VMware vCloud Director システム間連携のメ ッセージ VMware RabbitMQ vSphere
  • 13. Cloud  Foundry  アーキテクチャ・スタック Cloud  Foundry Clients  (VMC,STS,Browser) CF  Kernel  (VCAP) Orchestrator(BOSH) IaaS(vSphere,AWS,vCloud  Director…) Hardware  Server/Network/Memory/Storage   13 Copyright © 2011 VMware, Inc. All rights reserved. This product is protected by U.S. and international copyright and intellectual property laws. VMware products are covered by one or more patents listed at http://www.vmware.com/go/patents .
  • 14. Cloud  Foundry  Clients  (vmcツール、eclipse⽤用プラグイン) Eclipse⽤用 プラグインi  Cloud  Foundry   vmcツールi ©2010 VMware, Inc. All right reserved. - 14 -
  • 15. vmcツール n vmc target [URL]! •  現在設定しているターゲットURLの表⽰示、新しいURLの設定 n vmc login [email]! •  ユーザのログイン処理理 n vmc push! •  Cloud  Foundryへのアプリケーションの配布 n vmc instances [appname]! •  アプリケーションのインスタンス数の設定 n vmc start/stop/restart/delete[appname]! •  アプリケーションのstart/stop/restart/delete ©2010 VMware, Inc. All right reserved. - 15 -
  • 16. Cloud  Foundry  アーキテクチャ・スタック Cloud  Foundry Clients  (vmc,sts,Browser) CF  Kernel  (VCAP) Orchestrator(BOSH) IaaS(vSphere,AWS,vCloud  Director…) Hardware  Server/Network/Memory/Storage   16 Copyright © 2011 VMware, Inc. All rights reserved. This product is protected by U.S. and international copyright and intellectual property laws. VMware products are covered by one or more patents listed at http://www.vmware.com/go/patents .
  • 17. Cloud  Foundry  vcap  内部アーキテクチャ db Cloud Controller Nats Health Manager Router Dea Service app app 17 Copyright © 2011 VMware, Inc. All rights reserved. This product is protected by U.S. and international copyright and intellectual property laws. VMware products are covered by one or more patents listed at http://www.vmware.com/go/patents .
  • 18. Cloud  Foundry  アーキテクチャ・スタック Cloud  Foundry Clients  (vmc,sts,Browser) CF  Kernel  (VCAP) Orchestrator(BOSH) IaaS(vSphere,AWS,vCloud  Director…) Hardware  Server/Network/Memory/Storage   18 Copyright © 2011 VMware, Inc. All rights reserved. This product is protected by U.S. and international copyright and intellectual property laws. VMware products are covered by one or more patents listed at http://www.vmware.com/go/patents .
  • 19. Cloud  Foundry  本番稼働における課題 19 Copyright © 2011 VMware, Inc. All rights reserved. This product is protected by U.S. and international copyright and intellectual property laws. VMware products are covered by one or more patents listed at http://www.vmware.com/go/patents .
  • 20. Deploy  PaaS  with  BOSH     Sends droplet heart beats and exit messages Router Router Registers and Registers and unregisters unregisters CLI Routes REST API Routes droplet requests requests Droplet change notifications Droplet Cloud Controller Orchestrates Health Manager start/stop Cloud Controller (Start, Stop, Find) Droplet Execution requests Agent (DEA) Periodically scans Persists droplets for consistency and provisioned Guest applications Advertise services consume Cloud Service Controller Provision and Database unprovision Service "A" Provision Service and "A" Provisioning Agent unprovision BOSH IaaS 20 Copyright © 2011 VMware, Inc. All rights reserved. This product is protected by U.S. and international copyright and intellectual property laws. VMware products are covered by one or more patents listed at http://www.vmware.com/go/patents .
  • 21. BOSHによるIaaSの選択 Cloud Foundry BOSH Cloud Provider Interface(CPI) https://github.com/piston/ openstack-bosh-cpi 21 Copyright © 2011 VMware, Inc. All rights reserved. This product is protected by U.S. and international copyright and intellectual property laws. VMware products are covered by one or more patents listed at http://www.vmware.com/go/patents .
  • 22. Spring  On  Cloud  Foundry【知っておくべき事項】 22 Copyright © 2011 VMware, Inc. All rights reserved. This product is protected by U.S. and international copyright and intellectual property laws. VMware products are covered by one or more patents listed at http://www.vmware.com/go/patents .
  • 23. Spring  On  Cloud  Foundry【知っておくべき事項】 アプリケーションのポータビリティ性の向上 CloudFoundryサービスとのバイディングに伴う設定の軽減 n  環境変数 Cloud  foundryサービスの環境設定情報をアプリケーションでどのように取得できるか? n  Auto-‐‑‒Reconfiguration DI機能を活かしたAuto-‐‑‒Reconfigurationの仕組み n  <cloud>ネームスペース Auto-‐‑‒Reconfigurationを使わないバイディングの⽅方法 n  Spring  Profile アプリケーションの動作環境によって、設定情報を切切り替える仕組み 23 Copyright © 2011 VMware, Inc. All rights reserved. This product is protected by U.S. and international copyright and intellectual property laws. VMware products are covered by one or more patents listed at http://www.vmware.com/go/patents .
  • 24. 環境変数(サービス・バイディングに必要なパラメータ情報) @RequestMapping("/env")!! public void env(HttpServletResponse response) throws IOException { !!     response.setContentType("text/plain"); !!     PrintWriter out = response.getWriter(); !!     out.println("System Environment:");!!     for (Map.Entry<String, String> envvar : System.getenv().entrySet()) {         out.println(envvar.getKey() + ": " + envvar.getValue()); !!     }! } !! System().getenv().〜~  JSON形式の環境変数の取得 {     "postgresql-9.0": [{ !!         "name": "env-postgresql", !!         "label": "postgresql-9.0",! ……! …… ! !!             "username": "u50ce600bba434bacbc99e034bb415644", !!             "password": "pf4dca5bd449d4732841f0c4ae3f299d0"!!         } !!     }] !! } !! ! 24 Copyright © 2011 VMware, Inc. All rights reserved. This product is protected by U.S. and international copyright and intellectual property laws. VMware products are covered by one or more patents listed at http://www.vmware.com/go/patents .
  • 25. 環境変数(サービス・バイディングに必要なパラメータ情報) サービスとのバインディグなし "  VCAP_SERVICES: {} "" Postgresqlサービスとのバインディグ {     "postgresql-9.0": [{ ""         "name": "env-postgresql", ""         "label": "postgresql-9.0", ""         "plan": "free", ""         "credentials": { ""             "name": "de24667f9344b4eeaad6b5a2326d52faa", ""             "host": "172.30.48.122", ""             "hostname": "172.30.48.122", ""             "port": 5432, ""             "user": "u50ce600bba434bacbc99e034bb415644", ""             "username": "u50ce600bba434bacbc99e034bb415644", ""             "password": "pf4dca5bd449d4732841f0c4ae3f299d0"""         } ""     }] "" } " "" 25 Copyright © 2011 VMware, Inc. All rights reserved. This product is protected by U.S. and international copyright and intellectual property laws. VMware products are covered by one or more patents listed at http://www.vmware.com/go/patents .
  • 26. DI機能を活かしたAuto-‐‑‒Reconfigurationの仕組み Cloud Foundry ! Jar  file Cloud Foundry ! MySQL cloudfoundry-‐‑‒runtime MySQL 書換え CLOUD MySQL Bean BeanFactoryPostProc web.xml (__appCloudDataSource) essor Spring  App プロパティ書換え cloudfoundry-‐‑‒runtime CloudFoundry環境 CLOUD MySQL Bean BeanFactoryPostProc デプロイ (__appCloudDataSource) essor ローカル開発環境 WAR  file(Web  App) web.xml MySQL Bean Spring Framework (javax.sql.DataSource) Spring  App Application  Context.xml 参照/書換え Spring Framework Application  Context.xml Local MySQL 26 Copyright © 2011 VMware, Inc. All rights reserved. This product is protected by U.S. and international copyright and intellectual property laws. VMware products are covered by one or more patents listed at http://www.vmware.com/go/patents .
  • 27. Auto-‐‑‒Reconfiguration機能(リプレス対象Bean) Application  Contextファイル ! <bean class="org.apache.commons.dbcp.BasicDataSource" id="dataSource"> !!     <property name="driverClassName" value="com.mysql.jdbc.Driver"/>!!     <property name="url" value="jdbc:mysql://localhost:3306/inventory-db"/> !!     <property name="username" value="myuser"/> !!     <property name="password" value="mypass"/> !! </bean> ! " "" 構築環境によって変更更するプロパティ値 Service  Type 置換え対象となるBean  type Mysql,Postgres javax.sql.DataSource Redis org.springframework.data.redis.connection.RedisConnecti onFactory MongoDB org.springframework.data.document.mongodb.MongoDbF actory RabbitMQ org.springframework.amqp.rabbit.connection.Connection Factory 27 Copyright © 2011 VMware, Inc. All rights reserved. This product is protected by U.S. and international copyright and intellectual property laws. VMware products are covered by one or more patents listed at http://www.vmware.com/go/patents .
  • 28. Auto-‐‑‒Reconfiguration機能(制限事項) n  複数サービスのバインディングは利利⽤用不不可 複数のサービスタイプから⼀一つのサービスだけ使うとき有効になります。例例えば、 アプリケーションが⼀一つのリレーショナルデータベースサービス(MySQLもし くはPostgres)だけをバイディングできます。 n  複数のマッチングタイプのBeanは利利⽤用不不可 複数のマッチングタイプのbeanから⼀一つのbeanだけ使うとき有効になります。 例例えば、Spring  アプリケーション・コンテキストが複数のデータソースbeanを 使う事はできません。 28 Copyright © 2011 VMware, Inc. All rights reserved. This product is protected by U.S. and international copyright and intellectual property laws. VMware products are covered by one or more patents listed at http://www.vmware.com/go/patents .
  • 29. Auto-‐‑‒Reconfiguration機能(Auto-‐‑‒Reconfigurationの無効化) n  Springアプリケーションでない”JavaWeb”のデプロイ Springアプリケーションでない”JavaWeb”のアプリケーションをcf上にデプロイ するとき。Auto-‐‑‒reconfiguration機能は有効でなくなり、アプリケーションの変 更更も⾏行行われません。 n  <cloud>  のエレメントが使われている場合 <cloud>ネームスペースエレメントをベースとしたBeanがアプリケーションに含 まれていた場合、Auto-‐‑‒reconfiguration機能は適⽤用外となります。 29 Copyright © 2011 VMware, Inc. All rights reserved. This product is protected by U.S. and international copyright and intellectual property laws. VMware products are covered by one or more patents listed at http://www.vmware.com/go/patents .
  • 30. <cloud>ネームスペースエレメント   Auto-‐‑‒Reconfiguration機能の制限で使えないとき、<cloud>ネームスペース エレメントを利利⽤用する。 ローカル環境 CloudFoundry環境 WAR  file(Web  App) Spring  App Spring  App cloudfoundry-‐‑‒runtime cloudfoundry-‐‑‒runtime BeanFactoryPostProcessor BeanFactoryPostProcessor デプロイ MySQL Bean MongoDBFactoryBean MySQL Bean MongoDBFactoryBean Spring Framework Spring Framework 接続可能 MySQL Mongo  DB 30 Copyright © 2011 VMware, Inc. All rights reserved. This product is protected by U.S. and international copyright and intellectual property laws. VMware products are covered by one or more patents listed at http://www.vmware.com/go/patents .
  • 31. <cloud>ネームスペースエレメント  使うための事前準備 org.cloudfoundry:cloudfoundry-‐‑‒runtimeをdependencyとして含める必要。pom.xmlの dependencyに追加。 <dependencies>" <dependency>" <groupId>org.cloudfoundry</groupId>" <artifactId>cloudfoundry-runtime</artifactId>" <version>0.8.1</version>" </dependency>" " <!-- additional dependency declarations -->" </dependencies>" "" pom.xmlにSpring  Framework  Milestone  Repositoryを持たせる必要。 <repositories>" <repository>" <id>org.springframework.maven.milestone</id>" <name>Spring Framework Maven Milestone Repository</name>" <url>http://maven.springframework.org/milestone</url>" </repository>" " <!-- additional repository declarations -->" </repositories>"" 31 Copyright © 2011 VMware, Inc. All rights reserved. This product is protected by U.S. and international copyright and intellectual property laws. VMware products are covered by one or more patents listed at http://www.vmware.com/go/patents .
  • 32. <cloud>ネームスペースエレメント  <cloud:data-‐‑‒source>   n  <cloud:data-‐‑‒source> SpringアプリケーションでJDBC  DataSourceの設定をするときに利利⽤用 •  id  –  デフォルトのサービス名 •  service-‐‑‒name  –  複数のデータベースサービスをアプリケーションに接続させると きに必要 <cloud:data-‐‑‒source  id="dataSource"  /> <bean  id="jdbcTemplate"  class="org.springframework.jdbc.core.JdbcTemplate">    <property  name="dataSource"  ref="dataSource"  /> </bean> " n  オプションが追加されたDataSourceの設定例例 <cloud:data-source id="mydatasource">" <cloud:connection properties="charset=utf-8;" />" <cloud:pool pool-size="5-10" max-wait-time="2000" />" </cloud:data-source>" 32 Copyright © 2011 VMware, Inc. All rights reserved. This product is protected by U.S. and international copyright and intellectual property laws. VMware products are covered by one or more patents listed at http://www.vmware.com/go/patents .
  • 33. Spring  Profile   アプリケーションにポータビリティ性を持たせるために、動作環境によって、 設定情報を切切り替える仕組み Spring App Spring Framework スイッチ (Spring  Profile) <profile=”default”> <profile=”cloud”> cloudfoundry-‐‑‒runtime MySQL Bean BeanFactoryPostProcessor MongoDB Bean (javax.sql.DataSource) MySQL Bean MongoDBFactoryBean ローカル開発環境 Cloud  Foundry環境 MySQL Mongo  DB MySQL Mongo  DB 33 Copyright © 2011 VMware, Inc. All rights reserved. This product is protected by U.S. and international copyright and intellectual property laws. VMware products are covered by one or more patents listed at http://www.vmware.com/go/patents .
  • 34. Spring  Profile n  <beans  profile=“cloud”>  Springアプリケーションは、Cloud  Foundryにデプロイされると”cloud”のプロファイルを ⾃自動に選択し、その環境情報が適⽤用される。 <bean id="mongoTemplate" class="org.springframework.data.mongodb.core.MongoTemplate"> !!     <constructor-arg ref="mongoDbFactory" /> !! </bean> !! <beans profile="default">!!     <mongo:db-factory id="mongoDbFactory" dbname="pwdtest" host="127.0.0.1" port="27017" username="test_user" password="efgh" /> !! </beans>!! <beans profile="cloud"> ""     <cloud:mongo-db-factory id="mongoDbFactory" /> "" </beans> "" " 34 Copyright © 2011 VMware, Inc. All rights reserved. This product is protected by U.S. and international copyright and intellectual property laws. VMware products are covered by one or more patents listed at http://www.vmware.com/go/patents .
  • 35. まとめ 35 Copyright © 2011 VMware, Inc. All rights reserved. This product is protected by U.S. and international copyright and intellectual property laws. VMware products are covered by one or more patents listed at http://www.vmware.com/go/patents .
  • 36. まとめ n  VMwareのイニシアティブよる業界初のオープンPaaSプロジ ェクトとしてOpen  PaaS  Cloud  foundryが誕⽣生 n  Spring  On  Cloud  Foundry【知っておくべき事】 •  環境変数 •  Auto  Reconfiguration •  Cloud  Namespace •  Spring  Profile 36 Copyright © 2011 VMware, Inc. All rights reserved. This product is protected by U.S. and international copyright and intellectual property laws. VMware products are covered by one or more patents listed at http://www.vmware.com/go/patents .