FOLIOのコードを動かしてみた
Futoshi Tanuma
田沼 太 (@futot1)
• EBSCO Information Services Japan、及び日本UNIXユーザ会所属
• 横浜市在住、現在49歳
• 四捨五入すると来年は100歳、誕生日は先代将軍様(金正日)と同じ日
• ハンダ付け少年、マイコン少年→…→電子工作&コンピュータおじさん
• 「こっち側の道」を順調に歩んできた結果、この仕上がり。
• 初めて使ったパソコン→ 1982年に SHARP MZ-80B
• 家に古いSun workstationがある(もちろんSPARC機)
• 好きなOS→もちろん Solaris
• 母国語→日本語, Python
• まあまあ喋る→英語, JavaScript, Perl, PHP, C, SQL, VHDL/Verilog-HDL etc.
• 最近はKickstarter等でいろいろ入手
• ArduBoy, Piccolino, GOLE 1, PINE64等の電子工作系オモチャ(いい意味で)もの
• いま注目のオモチャ chibi:bit (micro:bit互換機)
さて、今日のお題
FOLIOのコード (OKAPI) を動かしてみました
FOLIOって??
Future
Of
Library
IS
Open
OKAPIって??
間違いじゃないけど。。。
今日の話はこっちの方
System Layer
データストレージ
(SQL, NoSQL,
キーバリュー型, ロギング,
テナント管理等)
OKAPI (API Gateway)
API群、メッセージバス
テナントの分離
Apps
基本アプリと拡張アプリ
開発言語は自由
UI Toolkit
デフォルトは
React.JS、新規作成も可
VuFind, Blacklight, EDS UI,
各社さまILSシステムのUI等
Open Library Platform
プラットフォーム
最初のコードがリリースされました
TIME-LINE
Mid-2016 2017 2018 >>
Community
Open Platform
Code on Github
Base platform
release
1st apps release
Service
organizations
LSP release
2015 development began
Marketplace
Open Library
Foundation
イマココ
http://github.com/folio-org/
OKAPI (API Gateway)
• OKAPIはFOLIOの基盤となるAPI Gateway
• モジュールやテナントの管理
• 動的に構成、拡張可能となるように設計
• 各マイクロサービスにとってのエンドポイント
• Proxy/Discovery/Deployment
現状のFOLIOのコード
• 現状(2016年9月初旬時点)GitHubで公開されているコード
• okapi
• Okapi API Gateway proxy/discovery/deployment service.
• raml-module-builder
• framework facilitating easy module creation based on RAML files.
• mod-*
• 各種サンプルモジュール
• mod-auth – Prototype of a JWT-based authentication/authorization module. Will be
superseded by a more capable set of modules handling authentication by various methods,
and generalized permissions-handling.
• mod-acquisitions – demo acquisitions module, based on the raml-module-builder
framework, exposing acquisition APIs and objects against MongoDB.
• mod-circulation – circulation demo based on the raml-module-builder and a set of
RAML and JSON Schemas. Represents some of the necessary circulation functionality
against MongoDB.
• mod-metadata – Initial work on a FOLIO metadata store and related knowledge
base/cataloging concepts.
動かしてみましょう
• OKAPIはわりと簡単に動かせます
• Java Development Kit 8, Apache maven, Git をご用意ください
git clone git://github.com/folio-org/okapi.git
cd okapi
mvn clean install
mvn exec:exec
いじょ
• Solaris 11, Linux, MacOS X, Windows 7 で動きました
• docの下に okapi-examples.sh があります。
• 動作確認スクリプト
• Windowsで動かすなら、Cygwin等が必要
• これより先に okapi を動かしておく(上記 mvn exec:exec かあるいは↓)
java –jar okapi-core/target/okapi-core-fat.jar dev
• さあ実行してみるぞ!
実行結果
dd
ん?
お気に召しません?
いまはこれが精一杯…
でもちょっと待って
これただの It worksではないのです
このテストスクリプトでやっていること
• test-basicモジュールをOkapiに登録
• こいつは It works と出力するだけ(本当はもうちょっと違うこともできるど)
id: test-basic
version: 2.2.3
path: /testb [GET/POST]
level: 30
実行コマンド:
java -Dport=%p -jar okapi-test-module/target/okapi-test-module-fat.jar
• test-authモジュールをOkapiに登録
• こいつは認証通ったら認証トークンを返す(イメージ)
id: test-auth
version: 3.4.5
requires: test-basicモジュールのバージョン2.2.1以上を要求
path: /login [POST]
level: 20
実行コマンド:
java -Dport=%p -jar okapi-test-auth-module/target/okapi-test-auth-module-fat.jar
• testlibというテナントをOkapiに登録
• testlibテナントにtest-basic/test-auth両モジュールをenable
* 各モジュールのlevelが実行時の優先度、値が低い方から呼び出される
このテストスクリプトでやっていること (cont’d)
• test-authモジュールに認証データを送信
• 認証トークンを返されるので、それをおぼえておく
• http://localhost:9130/testb にアクセス
• テナントを指定しないとエラー(Okapiはマルチテナント前提)
• HTTPリクエスト時にヘッダに X-Okapi-Tenant: testlib を追加してtestlibテナントを指定
• この時に認証トークンを指定しないと、認証エラー
• 認証トークンをHTTPヘッダに追加してアクセスすると。。。
ここでようやく It works が表示される!
ほらね、ちゃんと動いてるでしょ?
Apache起動直後のIt worksとはワケがちがうのです
注:これらのモジュールはコンセプトデモ。実際のモジュールのベースとすべきではありません
okapi以外も動かしてみましょう?
• Okapi以外のレポジトリは若干難易度高めかも
• 環境作るのがけっこうめんどい
• Bundler, Gradle, Groovy 等の他のビルドツール
• SDKmanは便利(Windows PowerShellでうごく版もある)
• そもそも私自身がJavaよく知らない
• mod-metadata をなんとか動かせました
• ビルド時、実行時にエラーがたくさん出るけど、でもなんとなく動い
ているみたい
• MacOS X El Capitan上とRaspberry Pi 3 model B!!!上で動かせました。
http://www.folio.org/
こちらよりご登録を!
http://www.folio.org/
http://dev.folio.org/
是非ともみなさまもご登録のうえ、お試しください!

FOLIOのコードを動かしてみた

Editor's Notes

  • #12 Next I will share some high-level architecture diagrams to point out features of the platform design. First is that its essentially "APIs all the way down" -- it is based upon layered APIs and every layer is available to the developer.
  • #14 OLF being spun up, board primarily academics (but no real power ie just id future projects). Under OLF is FOLIO and a few other projects (mention OLE, Gokb yet?) Governance – Apache lazy consensus, move fwd fast Board – evangelizing… hands dirty folk, practitioners (not deans) Index Data has been working on this since 2015. We hope to have initial release of platform software in mid-2016, on Github, People will be able to look at it, see the documentation, provide feedback. People will then be able to start developing against the APIs. Not only will we start developing apps, but other organizations will tune their apps to run against the platform. When we met with other large companies, one of the companies said – can we host this platform? We said – that would be great. Then they said, we are developing all our new software in a modular framework so they are in fact apps. Can we, they asked, develop our apps to run against your platform – and maybe we can sell some of these to libraries? We said perfect. So this is an indication of how the platform can change and transform library services. So by late 2017 early 2018 we will have a system that is up and running, to run your library.