11月 14 2009

OpenSocial’s Architecture Slide

Published by Eiji under Conference, Event, OpenSocial

I’ve made a presentation about OpenSocial’s Architecture an event: Tokyo GTUG #4. Here I publish the slide I’ve used though it’s all in Japanese. Hope this will help someone.

Comments add to hatena hatena.comment (5) add to del.icio.us (0) add to livedoor.clip (0) add to Yahoo!Bookmark (0) Total: 5

9月 11 2009

Installing MySQL on Snow Leopard

Published by Eiji under Mac

Snow Leopard has got PHP 5.3, so it’s nice to install Partuza and Shindig. Because you can do without installing entropy.

But I needed to do a little tweak to get MySQL work on Snow Leopard. Here’s a memo.

Download MySQL

Download binary of MySQL from here. Choose Mac OS 10.5(x86_64) on download list close to the bottom.

Install MySQL

Installing can be done only with GUI. Install Prefpane and Startup Item as well. Configure PATH too.

Create ~/.bash_profile and paste, or append following:

PATH=$PATH:/usr/local/mysql/bin
export PATH

You can utilize it by doing:

> source ~/.bash_profile

Do the tweak

You have to do following to get MySQL properly work on PHP:

>  cd /usr/local/mysql
>  sudo ./script/mysql_install_db

then…

>  sudo cp /etc/php.ini.default /etc/php/ini
>  sudo vim /etc/php.ini

change following part:

mysqli.default_socket = /var/mysql/mysql.sock

to something like this:

mysqli.default_socket = /tmp/mysql.sock

That’s it! Now you should be able to start MySQL from Preference Pane and see MySQL working on PHP.

Note: This makes Partuza working, but if you want to do something else, you may need some more work.

Comments add to hatena hatena.comment (8) add to del.icio.us (0) add to livedoor.clip (0) add to Yahoo!Bookmark (0) Total: 8

8月 29 2009

I have become an Apache Shindig committer

Published by Eiji under OpenSocial, SocialWeb

“Web will become more social” This has been what I kept telling people after 2005, when I’d joined goo. There’s so much things we can do when we make social graphs as a platform.  First thing I tried was to make a social platform on a portal site, which turns out to be goo Home.

I already had an image of the future at that time: the social graph will be expanded to external web and it will tie any other services into one with social connections. It was before we laungh goo Home when Facebook emerged.

What Facebook was trying to do was not like what I initially imagined: getting external services into their service. It was totally opposite to what I was imagining, but I realized our ultimate goal must be the same. Making web social. After a few month, OpenSocial got announced.

OpenSocial decides its spec democratic and open. Openness is good. Imagine you want to tie 2 systems social. Needless to say, it’s easier when the spec is something standard. You can omit communication cost as well as technical endeavor.

On top of that, with open spec, a lot of product may be expected. Taking OpenSocial as example, there’s Yoichiro Tanaka’s OpenSocial Development EnvironmentOpenSocial Client Library, OAuth related libraries, OpenSocial Signed Request Library which I developed… Whole bunch of open source products help latter joining developers.

And the primal open source product among OpenSocial is Shindig, OpenSocial container’s reference implementation.

Shindig was my textbook to learn existing spec of OpenSocial. There was almost no one else in Japan who looked into Shindig, so I was invited to become an Google API Expert.

I’ve also wrote a lot of patches to Shindig on my way to developing goo Home. And 1 and half years have passed…

I have become a committer of Apache Shindig

I made my first contact with Mr. Chris Chabot who has been the main committer of PHP Shindig. I met him in person at Google IO 2008, occasionally chatting on messenger, he recommended me to become Shindig committer.

To become a committer in Apache Software Foundation, you have to get voted. And luckily, I was approved.

PHP Shindig is said to be used be more than 26 SNS with 5 million users. I was really excited to know that.

To me, OpenSocial is just a tool to make my ideal social web possible. But at least in Japan, there’s no other choice now and OpenSocial IS the standard. And Shindig which is used in mixi and goo, is the one which support its core.

I’m hoping to make Social Web happen in Japan and support it as a Shindig committer.

Comments add to hatena hatena.comment (7) add to del.icio.us (0) add to livedoor.clip (2) add to Yahoo!Bookmark (1) Total: 10

1月 12 2009

OpenSocial(Shindig)’s Server Architecture

Published by Eiji under OpenSocial

There’s some ways to get involved into OpenSocial

  • Be the container
  • Develop gadgets
  • Develop a service that uses OpenSocial RESTful API

It is quite important to know architecture of OpenSocial whichever you choose. Especially when you choose to develop a gadget, there’ll be a lot of situations you get better result by knowing it.

This entry will try to explain what OpenSocial architecture is like by looking at reference implementation Shindig.

Relationship between gadget and SNS

Did you know how iGoogle renders gadgets secure? In fact, gadgets are rendered inside iframes which is on different domain.

The reason for that is, security. It is quite dangerous to have third party scripts on same domain because it could steal cookies, do XSS, etc. I’ve written an article about Caja and there’s some details about same domain security (sorry only in japanese).

OpenSocial Gadget Rendering

Where’s APIs?

OpenSocial have 4 APIs People, Group, Activity and Persistent. Each of them is provided using RESTful in JSON, XML, AtomPub representation, or using RPC in JSON representation. Shindig’s JavaScript API is using RPC in JSON format.

I’ve mentioned about 2 domains on gadget architecture. In this situation, you know that API will be on Shindig domain because it’s using Ajax.

OpenSocial Server Architecture

Gadget rendering process

OK. Now you know the basic architecture. Let’s take look at the gadget rendering process.

Choosing which gadget to render

First of all, you can’t render a gadget without request :) On iGoogle, user picks one’s favorite gadget from gadget directory, then display it on iGoogle page. The service has to render an iframe to display gadget, then, it needs to know what the gadget is like. Shindig has an API to return detailed information about the gadget. Metadata API.

Retrieving metadata

Receiving request to metadata API, Shindig looks at its cache first of all. If no cache found, it fetches gadget XML and returns information to the service.

Rendering iframe

Once getting information about the gadget, service will render an iframe to display the gadget. By doing this, Shindig will receive request to render the gadget.

Gadget XML’s contents will be rendered as it is basically, but it will be convinient if you know that:

  • Specified features(tab, minimessage, etc.) will be concatenated and added to the HTML.
  • External links to JavaScript, CSS, images will be replaced with cache url inside Shinidig if configured.

That’s all how gadgets are rendered. You can check that requests are sent to Shindig when trying out with Firebug.

External APIs

If you want to use External APIs, you can use gadgets.io.makeRequest. If you choose FEED as content type, JavaScript API will return abstract object as response regardless of content format(RSS, RDF or Atom). If you choose JSON, JS API will return JSON object even if the returned content is stringified.

You have a few choices on security too.

  • Regular Request
  • Signed Request
  • OAuth

Regular Request is chosen when you don’t need any kind of authorizations on accessing API. Signed Request is OAuth Consumer Request in other words. By using it, external server can restrict requests from approved gadgets. OAuth is OAuth Core in other words. External server can know who’s accessing to the API using credential securely, on top of assuring that it’s coming from approved server.

Please refer to articles like this or this, I’ve written regarding OAuth. (If you can read japanese! :P)

Note that all external accesses are using proxy and Shindig has a strong cache functionality. You will have to take care of caches when developing a gadget. I’ll explain in detail about caches on coming entry.

Comments add to hatena hatena.comment (17) add to del.icio.us (0) add to livedoor.clip (2) add to Yahoo!Bookmark (0) Total: 19

6月 03 2008

オープンソースのShindig対応SNS – Partuza!

Published by Eiji under OpenSocial

OpenSocialのコンテナと言えばShindigですが、PHP版は既にOpenSocial v0.7への対応を完了しています。Partuza!はPHP版Shindigの開発者であるChris Chabot氏がオープンソースで開発したShindig対応SNSです。

Shindigがコンテナなのに、じゃあPartuza!は何をするの?と思われるかもしれません。今回はインストール方法と、Shindigとの関係について解説します。

Partuza!をインストールする

Shindigのインストール方法は以前解説しましたので、ここでは割愛します。仮に、Shindigが~/shindig配下にインストールされ、http://localhost:8080/gadgets/…でアクセスできるものとします。

まず、環境としてApache、PHP5(要mcrypt)、MySQL5が必須となります。

レポジトリからチェックアウト

Google CodeのレポジトリからSVNでチェックアウトします。

> svn checkout http://partuza.googlecode.com/svn/trunk/ ~/partuza

データベースを用意

適当なデータベース名、ユーザー名、パスワードで空のDBを作ってください。ひとまずここではそれぞれ、partuza、root、パスワードなしとします。この状態で、~/partuza/partuza.sqlをダンプします。

> mysql -u root partuza < partuza.sql

DocumentRootを設定

Apacheの設定(httpd.conf)でDocumentRootを~/partuza/htmlに設定し、http://localhost/でアクセスできるようにします。もちろん、Shindigとは別ドメインを用意する必要がありますので、バーチャルホストを使う等してください。

設定ファイルを修正

~/partuza/html/config.phpを編集します。ここでは先程作成したデータベース関連の情報とガジェットサーバーのルートURL(gadget_server)を設定します。ガジェットサーバーのURLが、ここではShindigのURLとなりますので、http://localhost:8080/になります。

データベースハンドラをコピー

~/partuza/Shindig/PartuzaDbFetcher.phpと~/partuza/Shindig/PartuzaHandler.phpを~/shindig/php/src/socialにコピーします。

> cp ~/partuza/Shindig/Partuza* ~/shindig/php/src/social

Shindigのデータベース設定を修正

~/shindig/php/src/social/PartuzaDbFetcher.phpにもデータベース関連の情報があるので修正します。加えてShindigがデータベースハンドラを利用するよう、~/shindig/php/config.phpも修正します。ここでは、”handlers => PartuzaHandler”としてください。

これで一通りの準備は完了。http://localhost/にアクセスしてウェルカム画面が出れば成功です。このまま登録し、Orkutライクな一般的なSNSとして利用することができます。

Partuza!とShindigの関係

OpenSocialのガジェットがiframeを介して表示されていることは以前も解説しましたが、簡単に言ってしまえば、iframeの手前がPartuza、後ろがShindigになります。Shindigでは以前から下記のURLにアクセスすることで簡易的なHTMLからOpenSocialぽい表示を行うことはできていましたが、Partuzaを使うことで完全なSNSとなります。

http://localhost:8080/gadgets/files/samplecontainer/samplecontainer.html

とはいえ、PartuzaHandlerを指定したところからも想像できるように、データベースは共有されます。なお、Chris Chabot氏のサイトで実際に動いているものを確認することができます。

Partuza!を使うことで、どうすればShindigをSNSに組み込むことができるかの解析をすることができるだけでなく、そのままちょっとしたSNSを開発することもできてしまいます。ぜひお試しください。

Comments add to hatena hatena.comment (4) add to del.icio.us (0) add to livedoor.clip (2) add to Yahoo!Bookmark (0) Total: 6

Next »