Top Banner
Eclipse Orion を使って Cloud Foundry PaaSにア プリケーションをデプロイ 日本アイ・ビー・エム株式会社 東京ソフトウェア開発研究所 天野武彦
15

Deploy application from web editor 20140326 public

May 28, 2015

Download

Technology

Takehiko Amano
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Deploy application from web editor 20140326 public

Eclipse Orion を使ってCloud Foundry PaaS にアプリケーションをデプロイ

日本アイ・ビー・エム株式会社東京ソフトウェア開発研究所

天野武彦

Page 2: Deploy application from web editor 20140326 public

© 2014 IBM Corporation

自己紹介 ~

名前: 天野 武彦

所属:IBM 東京ソフトウェア開発研究所

主な活動: 先端開発技術の推進・啓蒙(エリア: Cloud Foundry, Orion, Jazz, DevOps)

趣味: 目下のところ育児に没頭

ブログ: http://amanoblog.wordpress.com

Page 3: Deploy application from web editor 20140326 public

© 2014 IBM Corporation

Orion ~ オライオン(オリオン) について

� Eclipse の Web 版を目指したプロジェクト– IBM, Pivotal (VMWare), HP, Mozilla, SAP 等の有志が開発

� 目玉機能

– WEB ブラウザ上でソース開発• JavaScript, Ruby, CSS, HTML

– Git リポジトリ連携

– Cloud Foundry 連携 (V5 New !)

Page 4: Deploy application from web editor 20140326 public

© 2014 IBM Corporation

エディター

キーバインディング

• syntax highlight 、JavaScript/CSS は control+<space> で作成アシスト

• GO 言語版も開発中

Page 5: Deploy application from web editor 20140326 public

© 2014 IBM Corporation

Gitリポジトリー連携

Git リポジトリ clone, push, rebase, merge などが WEBでできる

Page 6: Deploy application from web editor 20140326 public

© 2014 IBM Corporation

Cloud Foundry 連携

アプリ

URL

アプリ

ログ

今回の目玉: Cloud Foundry (v2) へのデプロイ

おや!

Page 7: Deploy application from web editor 20140326 public

© 2014 IBM Corporation

シェル

� cf ベースのコマンドを用意– なぜか cfo コマンド

Page 8: Deploy application from web editor 20140326 public

© 2014 IBM Corporation

Page 9: Deploy application from web editor 20140326 public

© 2014 IBM Corporation

Orion / Cloud Foundry 連携の内部構造

� REST API を利用している

– http://docs.cloudfoundry.com/docs/reference/cc-api.html

/* create cloud foundry application */URI targetURI = URIUtil.toURI(target.getUrl());URI appsURI = targetURI.resolve("/v2/apps"); //$NON-NLS-1$

PostMethod createAppMethod = new PostMethod(appsURI.toString());HttpUtil.configureHttpMethod(createAppMethod, target);

/* set request body */JSONObject createAppRequst = new JSONObject();createAppRequst.put(CFProtocolConstants.V2_KEY_SPACE_GUID, target.getSpace().getCFJSON().getJSONObject(CFProtocolConstants.V2_KEY_METADATA).getString(CFProtocolConstants.V2_KEY_GUID));createAppRequst.put(CFProtocolConstants.V2_KEY_NAME, appName);createAppRequst.put(CFProtocolConstants.V2_KEY_INSTANCES, appInstances);createAppRequst.put(CFProtocolConstants.V2_KEY_BUILDPACK, buildPack != null ? buildPack : JSONObject.NULL);createAppRequst.put(CFProtocolConstants.V2_KEY_COMMAND, appCommand);createAppRequst.put(CFProtocolConstants.V2_KEY_MEMORY, appMemory);createAppRequst.put(CFProtocolConstants.V2_KEY_STACK_GUID, JSONObject.NULL);createAppMethod.setRequestEntity(new StringRequestEntity(createAppRequst.toString(), "application/json", "utf-8")); //$NON-NLS-1$ //$NON-NLS-2$

ServerStatus status = HttpUtil.executeMethod(createAppMethod);if (!status.isOK())

return status;

CF アプリケーションの作成 “/v2/apps” に対して Post 実行

Page 10: Deploy application from web editor 20140326 public

© 2014 IBM Corporation

Eclipse Orionの導入

� http://download.eclipse.org/orion/

� Java JREの導入– eclipse フォルダー直下に放り込む

� orion.ini の修正– JREの場所(eclipseフォルダ以外の場合)– -data : ファイル保管場所

� Node 版 Orion もあります。(※ Cloud Foundry への連携機能はありません)% npm install orion% node node_modules¥orion¥server.js

どれかダウ

ンロード

Page 11: Deploy application from web editor 20140326 public

© 2014 IBM Corporation

Eclipse Orion の起動

� orionの実行

Page 12: Deploy application from web editor 20140326 public

© 2014 IBM Corporation

まとめ� クラウドにホスティングして、WEBブラウザだけで開発できる

– 特に、スクリプト⾔語系に役に⽴つ– Gitリポジトリログ取得、 pull, push サポート– タブレット等でも利⽤可能

� 自分のPCで動かしてもよい– Node版はお⼿軽なので、簡易 Explorer + Editor になる– node node_modules¥orion¥server.js -workspace c:/temp

� Cloud Foundry の評価につかってもらえる ??– PC環境を用意する必要がないので、お手軽に評価– GitHub などにサンプルをおいて、PaaS にデプロイ

Orionは JazzHub (https://hub.jazz.net) でもホスティング中です!

Page 13: Deploy application from web editor 20140326 public

© 2014 IBM Corporation

【参考】 Orion Editor についてもう少し詳しく� http://www.eclipse.org/orion/

– 本家

� http://planetorion.org/news/– Orion開発チームブログ

� Node開発ネタ & トビビア– http://kenwalker.github.io/OrionOnNode/

• Orion Node 版は Node アプリケーション実⾏機能付き

Page 14: Deploy application from web editor 20140326 public

© 2014 IBM Corporation

小ネタ� Orion Editor機能を WEB で利⽤する<!DOCTYPE html><!--Sample that shows how to use the edit.js file to create an editor. For a complete listof editor configuration options, see orion.editor#edit.--><html><head><title>Orion Editor Sample</title><link rel="stylesheet" type="text/css" href="http://eclipse.org/orion/editor/releases/5.0/built-editor.css"/><script src="http://eclipse.org/orion/editor/releases/5.0/built-editor.min.js"></script><script>

require(["orion/editor/edit"], function(edit) {edit({className: "editor"});

});</script>

</head><body spellcheck="false"><pre class="editor" data-editor-lang="js">/** This is an Orion editor sample.*/function() {

var a = 'hi there!';window.console.log(a);

}</pre></body></html>

エディターになっている

Page 15: Deploy application from web editor 20140326 public

© 2014 IBM Corporation

ご清聴ありがとうございました!!