Micro Services with Docker or OSv - Part2: ClojureをOSv上で動かす
Posted on
CoreOS,SmartOS,OSvといったMicro OSの台頭はとても重要だと思います。さっそくIDCFクラウドで試してみようとOVA for VMWare ESXiをダウンロードしてデプロイしてみましたが失敗してしまいました。ovaをuntatarしてみるとovfのVirtualSystemTypeがvmx-08でです。PackerのOVAで確認したように、ESXi4にデプロイする場合はvmx-07にする必要があります。他にも嵌まりそうなので、とりあえずローカルのOSXでOSvを動かしてみようと思います。
CoreOS,SmartOS,OSvといったMicro OSの台頭はとても重要だと思います。さっそくIDCFクラウドで試してみようとOVA for VMWare ESXiをダウンロードしてデプロイしてみましたが失敗してしまいました。ovaをuntatarしてみるとovfのVirtualSystemTypeがvmx-08です。PackerのOVAで確認したように、ESXi4にデプロイする場合はvmx-07にする必要があります。他にも嵌まりそうなので、とりあえずローカルのOSXでOSvを動かしてみようと思います。
$ brew doctor Warning: You have uncommitted modifications to Homebrew If this a surprise to you, then you should stash these modifications. Stashing returns Homebrew to a pristine state but can be undone should you later need to do so for some reason. cd /usr/local/Library && git stash && git clean -d -f Warning: Your Xcode (5.1.1) is outdated Please update to Xcode 6.0.1. Xcode can be updated from the App Store.
Xcodeのアップデートなど、Warningの修正をしていきます。
$ brew prune Pruned 0 dead formulae Pruned 54 symbolic links and 14 directories from /usr/local $ sudo xcodebuild -license $ brew link git Linking /usr/local/Cellar/git/2.1.2... 207 symlinks created
$ source ~/.bash_profile $ curl https://raw.githubusercontent.com/cloudius-systems/capstan/master/scripts/download | bash % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 563 100 563 0 0 848 0 --:--:-- --:--:-- --:--:-- 847 Downloading Capstan binary: http://osv.capstan.s3.amazonaws.com/capstan/v0.1.2/darwin_amd64/capstan ######################################################################## 100.0% $ which capstan /Users/mshimizu/bin/capstan
$ brew cask search java ==> Exact match java ==> Partial matches eclipse-java javafx-scene-builder $ java -version java version "1.8.0_20" Java(TM) SE Runtime Environment (build 1.8.0_20-b26) Java HotSpot(TM) 64-Bit Server VM (build 25.20-b23, mixed mode)
brewでLeiningenをインストールします。
$ brew install leiningen $ lein --version Leiningen 2.5.0 on Java 1.8.0_20 Java HotSpot(TM) 64-Bit Server VM
Leiningenでアプリ作成
leinのcapstanテンプレートを使いサンプルアプリを作成します。
$ cd $ lein new capstan new-app Retrieving capstan/lein-template/0.1.0/lein-template-0.1.0.pom from clojars Retrieving capstan/lein-template/0.1.0/lein-template-0.1.0.jar from clojars Generating a fresh Capstan project. $ cd new-app
作成されたClojureアプリです。
~/new~app/src/new_app/core.clj
(ns new-app.core (:gen-class))
(defn-main [& args] (println"Hello from new-app: clojure on OSv project"))