48
Social Enterprise Java Apps on Heroku Kazuyuki Kawamura Technical Solu-on Architect Tetsuo Ajima Technical Solu-on Architect Ayumu Aizawa Heroku Evangelist h=p://www.developerforce.com/jp/events/webinars/20120803/registraKon.php

Social Enterprise Java Apps on Heroku Webinar

Embed Size (px)

DESCRIPTION

8月3日に開催された「Social Enterprise Java Apps on Heroku Webinar」の資料です。

Citation preview

Page 1: Social Enterprise Java Apps on Heroku Webinar

Social  Enterprise  Java  Apps  on  Heroku

Kazuyuki  Kawamura  Technical  Solu-on  Architect  

Tetsuo  Ajima  Technical  Solu-on  Architect  

Ayumu  Aizawa  Heroku  Evangelist  

h=p://www.developerforce.com/jp/events/webinars/2012-­‐08-­‐03/registraKon.php

Page 2: Social Enterprise Java Apps on Heroku Webinar

Safe  harbor  statement  under  the  Private  Securi-es  Li-ga-on  Reform  Act  of  1995.  This  presenta-on  may  contain  forward-­‐looking  statements  that  involve  risks,  uncertain-es,  and  assump-ons.  If  any  such  uncertain-es  materialize  or  if  any  of  the  assump-ons  proves  incorrect,  the  results  of  salesforce.com,  inc.  could  differ  materially  from  the  results  expressed  or  implied  by  the  forward  looking-­‐statements  we  make.  All  statements  other  than  statements  of  historical  fact  could  be  deemed  forward-­‐looking,  including  any  projec-ons  of  product  or  service  availability,  subscriber  growth,  earnings,  revenues,  or  other  financial  items  and  any  statements  regarding  strategies  or  plans  of  management  for  future  opera-ons,  statements  of  belief,  any  statements  concerning  new,  planned,  or  upgraded  services  or  technology  developments  and  customer  contracts  or  use  of  our  services.  The  risks  and  uncertain-es  referred  to  above  include  -­‐  but  are  not  limited  to  -­‐  risks  associated  with  developing  and  delivering  new  func-onality  for  our  service,  new  products  and  services,  our  new  business  model,  our  past  opera-ng  losses,  possible  fluctua-ons  in  our  opera-ng  results  and  rate  of  growth,  interrup-ons  or  delays  in  our  Web  hos-ng,  breach  of  our  security  measures,  the  outcome  of  intellectual  property  and  other  li-ga-on,  risks  associated  with  possible  mergers  and  acquisi-ons,  the  immature  market  in  which  we  operate,  our  rela-vely  limited  opera-ng  history,  our  ability  to  expand,  retain,  and  mo-vate  our  employees  and  manage  our  growth,  new  releases  of  our  service  and  successful  customer  deployment,  our  limited  history  reselling  non-­‐salesforce.com  products,  and  u-liza-on  and  selling  to  larger  enterprise  customers.  Further  informa-on  on  poten-al  factors  that  could  affect  the  financial  results  of  salesforce.com,  inc.  is  included  in  our  annual  report  on  Form  10-­‐Q  for  the  most  recent  fiscal  quarter  ended.  This  documents  and  others  containing  important  disclosures  are  available  on  the  SEC  Filings  sec-on  of  the  Investor  Informa-on  sec-on  of  our  Web  site.  Any  unreleased  services  or  features  referenced  in  this  or  other  presenta-ons,  press  releases  or  public  statements  are  not  currently  available  and  may  not  be  delivered  on  -me  or  at  all.  Customers  who  purchase  our  services  should  make  the  purchase  decisions  based  upon  features  that  are  currently  available.  Salesforce.com,  inc.  assumes  no  obliga-on  and  does  not  intend  to  update  these  forward-­‐looking  statements.  

Safe  Harbor  Statement  

Page 3: Social Enterprise Java Apps on Heroku Webinar

@herokujp  @developerforcej  

facebook.com/HerokuJP  facebook.com/DeveloperforceJapan  

Page 4: Social Enterprise Java Apps on Heroku Webinar

§ 導入事例

§ 価格

§ サポート

§ 技術資料

§ 日本での情報

success.heroku.com  

price.heroku.com  

help.heroku.com  

devcenter.heroku.com  

facebook.com/herokujp  

twi=er.com/herokujp  

Page 5: Social Enterprise Java Apps on Heroku Webinar

#herokujp  

Page 6: Social Enterprise Java Apps on Heroku Webinar

Kazuyuki  Kawamura  Technical  Solu-on  Architect  @kazkawamura  /facebook.com/kaz.kawamura    

Tetsuo  Ajima  Technical  Solu-on  Architect  @liebejudith  facebook.com/tetsuo.ajima    

Ayumu  Aizawa  Developper  Marke-ng,  Heroku  @ayumin  /facebook.com/ayumu.aizawa  

Page 7: Social Enterprise Java Apps on Heroku Webinar

アジェンダ

• “ソーシャル・エンタープライズアプリケーション”とは  

• Herokuの紹介  

• Java  on  Heroku  ハンズオン  

• ソーシャル・エンタープライズアプリケーションの構築  

• Q&A  

Page 8: Social Enterprise Java Apps on Heroku Webinar

アジェンダ

• “ソーシャル・エンタープライズアプリケーション”とは  

• Herokuの紹介  

• Java  on  Heroku  ハンズオン  

• ソーシャル・エンタープライズアプリケーションの構築  

• Q&A  

Page 9: Social Enterprise Java Apps on Heroku Webinar

従業員 ソーシャル

ネットワーク

顧客の ソーシャル ネットワーク ソーシャル

プロファイル コラボレーション

人材

販売

サービス サポート

マーケティング

拡張

 ソーシャルエンタープライズ

Page 10: Social Enterprise Java Apps on Heroku Webinar

従業員 ソーシャル

ネットワーク

顧客の ソーシャル ネットワーク ソーシャル

プロファイル コラボレーション

人材

販売

サービス サポート

マーケティング

拡張

 ソーシャルエンタープライズ

Page 11: Social Enterprise Java Apps on Heroku Webinar

 ソーシャルマーケティング

Today  関連的でアクティブな

エンゲージメント

Yesterday  静的、受動的な マーケティング

 マーケティングにおけるソーシャルの重要性は高まっている

Page 12: Social Enterprise Java Apps on Heroku Webinar

ソーシャルエンタープライズ・アプリケーションをつくるには、

どのような部品が必要でしょうか?

Page 13: Social Enterprise Java Apps on Heroku Webinar
Page 14: Social Enterprise Java Apps on Heroku Webinar

 エンタープライズアプリケーション

堅牢な基盤

耐障害性

運用性

高可用性

フェールオーバー クラスタリング

負荷分散 SSLドメイン

データベース ロールバック

冗長化

WEBサーバ アプリケーションサーバ

DBサーバ 他

稼動監視 ログ解析

サーバ管理者 ネットワーク管理者

システム管理者 サーバ管理者 DBA

システム管理者 DBA

オペレーター 製品サポート

Page 15: Social Enterprise Java Apps on Heroku Webinar

アジェンダ

• “ソーシャル・エンタープライズアプリケーション”とは  

• Herokuの紹介  

• Java  on  Heroku  ハンズオン  

• ソーシャル・エンタープライズアプリケーションの構築  

• Q&A  

Page 16: Social Enterprise Java Apps on Heroku Webinar

$  heroku  ps  $  heroku  create   worker:  java  -­‐jar  ..   $  heroku  logs  -­‐-­‐tail  

 Herokuの特徴

Trust  &  Manage  Forget  Servers   Run    Anything   See  Everything  

Page 17: Social Enterprise Java Apps on Heroku Webinar

 Herokuのアーキテクチャ

Elas-c  Load  Balancing  

Control  Surface  

APIs  

Developer    Code  • Java  • …    Deploy  • GIT  

Manage  • Heroku  CLI  • Scaling  • Monitoring  

User  •  Web  browser  Acces  •  API  access  

h`p(s)  

REST  

Page 18: Social Enterprise Java Apps on Heroku Webinar

 ソーシャル・エンタープライズアプリケーションのアーキテクチャ

Data API

Access Management

Profiles Identity Record-Level Filtering Permissions

Data

Metadata Business Data Files

Metadata API

Addons Polyglot & Open

Process Model

Real time Visibiility

Social API

Page 19: Social Enterprise Java Apps on Heroku Webinar

アジェンダ

• “ソーシャル・エンタープライズアプリケーション”とは  

• Herokuの紹介  

• Java  on  Heroku  ハンズオン  

• ソーシャル・エンタープライズアプリケーションの構築  

• Q&A  

Page 20: Social Enterprise Java Apps on Heroku Webinar

Spring MVC アプリケーショ

ン を Heroku にデプロイしてみ

ましょう ( http://java.heroku.com )

Page 21: Social Enterprise Java Apps on Heroku Webinar

デモ /  ハンズオン (1)  

Page 22: Social Enterprise Java Apps on Heroku Webinar

JAVA.HEROKU.COM  を利用した  テンプレートアプリケーションのデプロイ  

のデモ  

Page 23: Social Enterprise Java Apps on Heroku Webinar

アジェンダ

• “ソーシャル・エンタープライズアプリケーション”とは  

• Herokuの紹介  

• Java  on  Heroku  ハンズオン  

• ソーシャル・エンタープライズアプリケーションの構築  

• Q&A  

Page 24: Social Enterprise Java Apps on Heroku Webinar

デモ /  ハンズオン (2)  

Page 25: Social Enterprise Java Apps on Heroku Webinar

$  git  push  heroku  master  

*.java  

*.jar  WAR  

Embe

dded

 Con

tainer

pom.xml  

アプリケーションのコード、依存関係、コンテナの情報を記

$  git  add  -­‐A  

ビルド、依存関係の解決などDynoへのデプロイ、起動

Page 26: Social Enterprise Java Apps on Heroku Webinar

SALESFORCE.COMとの連携デモ  

Page 27: Social Enterprise Java Apps on Heroku Webinar

Heroku と Salesforce.com をつかって、ソーシャル・エンタープライズアプリケーションをつく

りましょう

Page 28: Social Enterprise Java Apps on Heroku Webinar

Salesforce.com との統合ステップ

1.  OAuth認証の設定

2.  依存関係の更新

3.  エンティティをJSONに切り替える

4.  DAOをForce REST APIに切り替える

5.  Spring Config を Force REST + OAuth に切り替える

6.  認証のためのServlet Filterを追加する

7.  認証キーを環境情報に設定する

Page 29: Social Enterprise Java Apps on Heroku Webinar

Spring MVC App with Heroku & Salesforce.com

and Chatter APIs

Page 30: Social Enterprise Java Apps on Heroku Webinar

ソーシャルフィードリコメンド

リアルタイムプッシュ通知

ストリーミングデータ配信

分析

ソーシャルエンタープライズアプリケーション

例えば、こんなことができます

Page 31: Social Enterprise Java Apps on Heroku Webinar

アジェンダ

• “ソーシャル・エンタープライズアプリケーション”とは  

• Herokuの紹介  

• Java  on  Heroku  ハンズオン  

• ソーシャル・エンタープライズアプリケーションの構築  

• Q&A  

Page 32: Social Enterprise Java Apps on Heroku Webinar

ご質問をどうぞ

Page 33: Social Enterprise Java Apps on Heroku Webinar

@herokujp  @developerforcej  

facebook.com/HerokuJP  facebook.com/DeveloperforceJapan  

Page 34: Social Enterprise Java Apps on Heroku Webinar

is GA

Java

Page 35: Social Enterprise Java Apps on Heroku Webinar

Heroku Labs •  WAR deployment (http://bit.ly/war-deploy )

•  Jenkins plugin for Heroku(http://bit.ly/heroku-ci )

•  Heroku.jar- Java Wrapper (http://bit.ly/heroku-jar ) •  Atlassian Bamboo plugin for Heroku (Email

[email protected] for more details)

you can try these out now.

We would love your feedback

Page 36: Social Enterprise Java Apps on Heroku Webinar

= like  +

Coming Soon

Page 37: Social Enterprise Java Apps on Heroku Webinar

Coming Soon

All day HEROKU ENTERPRISE DEVELOPER

WORKSHOP

Email [email protected] if you are interested

Page 38: Social Enterprise Java Apps on Heroku Webinar

Resources Ø  Getting Started -

§  http://java.heroku.com

§  http://bit.ly/heroku-java

Ø  Toolbelt (http://toolbelt.herokuapp.com )

Ø  Heroku Dev Center : http://devcenter.heroku.com

Ø  Heroku Add-ons: http://addons.heroku.com

Ø  Git: http://help.github.com/

Ø  Webinar Source code:

§  Spring MVC - Force.com : http://bit.ly/KZB68y

§  Chatter - http://bit.ly/KgMlPP

§  Pusher integration - http://bit.ly/KMVInx

Page 39: Social Enterprise Java Apps on Heroku Webinar

James  Ward  @_JamesWard  Developer  Evangelist  at  Heroku  

[email protected]  

Anand  Narasimhan  @anand_bn  Sr.  Product  Manager  at  Heroku  

[email protected]    

Survey:  http://bit.ly/herokujavasurvey

Heroku  Devcenter:  http://devcenter.heroku.com  

Page 40: Social Enterprise Java Apps on Heroku Webinar

APPENDIX SFDC Integration Steps

Page 41: Social Enterprise Java Apps on Heroku Webinar

1. Setup OAuth i.  Salesforce.com > Setup > Develop > Remote

Access

ii.  Add Remote Access for Dev & Prod

•  Dev Callback URL: http://localhost:8080/_auth  

•  Prod Callback URL: https://some-­‐app-­‐1234.herokuapp.com/_auth    

Page 42: Social Enterprise Java Apps on Heroku Webinar

2. Update dependencies <repositories>      <repository>          <id>force-­‐rest-­‐api</id>          <name>force-­‐rest-­‐api  repository  on  GitHub</name>          <url>          http://jesperfj.github.com/force-­‐rest-­‐api/repository/          </url>      </repository>  </repositories>  

Page 43: Social Enterprise Java Apps on Heroku Webinar

2. Update dependencies <dependency>          <groupId>com.force.api</groupId>          <artifactId>force-­‐rest-­‐api</artifactId>          <version>0.0.15</version>  </dependency>  <dependency>          <groupId>com.force.sdk</groupId>          <artifactId>force-­‐oauth</artifactId>          <version>22.0.8-­‐BETA</version>  </dependency>  <dependency>          <groupId>com.force.sdk</groupId>          <artifactId>force-­‐springsecurity</artifactId>          <version>22.0.8-­‐BETA</version>  </dependency>  

Page 44: Social Enterprise Java Apps on Heroku Webinar

3. Switch Entity to JSON @JsonIgnoreProperties(ignoreUnknown=true)  public  class  Person  {            @JsonProperty(value="Id")          private  String  id;            @JsonProperty(value="FirstName")          private  String  firstName;            @JsonProperty(value="LastName")          private  String  lastName;  

Page 45: Social Enterprise Java Apps on Heroku Webinar

4. Switch DAO to Force REST API private  ForceApi  getForceApi()  {          SecurityContext  sc  =  ForceSecurityContextHolder.get();          ApiSession  s  =  new  ApiSession();          s.setAccessToken(sc.getSessionId());          s.setApiEndpoint(sc.getEndPointHost());          return  new  ForceApi(s);  }    //  Add  Contact          getForceApi().createSObject("contact",  person);    //  Query  Contacts  getForceApi().query("SELECT  Id  FROM  contact",  Person.class);    //  Delete  Contact  getForceApi().deleteSObject("contact",  id);  

Page 46: Social Enterprise Java Apps on Heroku Webinar

5. Spring Config + OAuth <fss:oauth>      <fss:oauthInfo  endpoint="http://login.salesforce.com"          oauth-­‐key="#{systemEnvironment['OAUTH_CLIENT_KEY']}"          oauth-­‐secret="#{systemEnvironment['OAUTH_CLIENT_SECRET']}"/>  </fss:oauth>            <security:http  use-­‐expressions="true">      <security:intercept-­‐url  pattern="/people/*"          access="isAuthenticated()"  />  </security:http>      <!-­‐-­‐  https  redirect  support  -­‐-­‐>  <property  name="redirectHttp10Compatible"  value="false"  />  

Page 47: Social Enterprise Java Apps on Heroku Webinar

6. Add Servlet Filter for Oauth <filter>      <filter-­‐name>springSecurityFilterChain</filter-­‐name>      <filter-­‐class>          org.springframework.web.filter.DelegatingFilterProxy      </filter-­‐class>      <init-­‐param>          <param-­‐name>contextAttribute</param-­‐name>          <param-­‐value>        org.springframework.web.servlet.FrameworkServlet.CONTEXT.spring          </param-­‐value>      </init-­‐param>  </filter>  <filter-­‐mapping>      <filter-­‐name>springSecurityFilterChain</filter-­‐name>      <url-­‐pattern>/*</url-­‐pattern>  </filter-­‐mapping>  

Page 48: Social Enterprise Java Apps on Heroku Webinar

7. Add Oauth Keys export  OAUTH_CLIENT_KEY=CQ3gmEE53MVG99OxTyEMal8ytj1E3NF7...  export  OAUTH_CLIENT_SECRET=0905539091246761180  

heroku  config:add  OAUTH_CLIENT_KEY=CQ3gmEE53MVG99OxTyEMal8yt...  heroku  config:add  OAUTH_CLIENT_SECRET=0905539091246761180