More Related Content
Similar to Deploy application from web editor 20140326 public (20)
More from Takehiko Amano (9)
Deploy application from web editor 20140326 public
- 2. © 2014 IBM Corporation
自己紹介 ~
名前: 天野 武彦
所属:IBM 東京ソフトウェア開発研究所
主な活動: 先端開発技術の推進・啓蒙
(エリア: Cloud Foundry, Orion, Jazz, DevOps)
趣味: 目下のところ育児に没頭
ブログ: http://amanoblog.wordpress.com
- 3. © 2014 IBM Corporation
Orion ~ オライオン(オリオン) について
Eclipse の Web 版を目指したプロジェクト
– IBM, Pivotal (VMWare), HP, Mozilla, SAP 等の有志が開発
目玉機能
– WEB ブラウザ上でソース開発
• JavaScript, Ruby, CSS, HTML
– Git リポジトリ連携
– Cloud Foundry 連携 (V5 New !)
- 4. © 2014 IBM Corporation
エディター
キーバインディン
グ
• syntax highlight 、JavaScript/CSS は control+<space> で作成アシスト
• GO 言語版も開発中
- 5. © 2014 IBM Corporation
Gitリポジトリー連携
Git リポジトリ clone, push, rebase, merge などが WEBでできる
- 6. © 2014 IBM Corporation
Cloud Foundry 連携
アプリ
URL
アプリ
ログ
今回の目玉: Cloud Foundry (v2) への デプロイ
おや!
- 7. © 2014 IBM Corporation
シェル
cf ベースのコマンドを用意
– なぜか cfo コマンド
- 9. © 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).getSt
ring(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 実行
- 10. © 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
どれかダウ
ンロード
- 11. © 2014 IBM Corporation
Eclipse Orion の起動
orion の実行
- 12. © 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) でもホスティング中です !
- 13. © 2014 IBM Corporation
【参考】 Orion Editor についてもう少し詳しく
http://www.eclipse.org/orion/
– 本家
http://planetorion.org/news/
– Orion開発チームブログ
Node開発ネタ & トビビア
– http://kenwalker.github.io/OrionOnNode/
• Orion Node 版は Node アプリケーション実⾏機能付き
- 14. © 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 list
of 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>
エディターになっている