_2011-09-29_12

Looks familiar? It’s not Google+. It’s DIASPORA. An open source project that implements a distributed social networking service. This project was announced on APRIL 24, 2010 (Just right after Facebook f8 2010 that is at APRIL 21). Alpha version was released at NOV 23, 2010 (two days before my birthday :P). 

According to this, Mark Zuckerbug also donated to it just because it’s a cool idea.

It’s built on Ruby on rails. So it might be not so difficult to port it to Heroku platform which is a nice RoR host (althrough it still took me some time). It might be easier than build from scratch on a Linux. 

I’m a newbie to these two (Heroku and DIASPORA). I’m also not familar with RoR. Here records steps I tried. 

create an application on heroku

First, you need to create an application on Heroku. There are several platform stack on Heroku. Cedar stack might be the newest and most powerful one. It supports several languages and frameworks. And It also makes it very easy to deploy RoR applications. 

You need to install heroku CLI before creating an application. And use “heroku login” to login to your heroku account.

Run the following command to create a new cedar application (assume application name is “mysocialy”) –

heroku create –stack cedar mysocialy

After the application created, you’ll have a url “http://mysocialy.herokuapp.com/” for your site. And a git repository: [email protected]:mysocialy.git

import source codes

Get DIASPORA* source codes from git hub:

git clone git://github.com/diaspora/diaspora.git

Get your source codes from Heroku git repository (you’ll get an empty folder):

git clone [email protected]:mysocialy.git

If you have trouble to download from Heroku. Try to use “heroku keys:add” to add your ssh public key and try again.

Copy all files except “.git” folder from “diaspora” to “mysocialy”.

Initial configuration

Make new configuration files from example.

cd config

mv application.yml.example application.yml  

mv database.yml.example database.yml

Edit application.yml. Make “pod_url” to your host. In this case:

pod_url: “http://mysocialy.herokuapp.com/”

Deploy codes

Add and commit files:

git add .

git commit -am ‘initial import’

Push them to Heroku

git push origin master

The coolest thing that Heroku does is that it makes deploy codes so easy. All you need to do is to push your codes to its git repository. And it could also install all related modules for you (that is configured in Gemfile). Super easy.

Ok, I must admit that I lie a little bit. There might be some problems. After I pushes all codes to Heroku, I found there is an error that it couldn’t find 'pg’ (postgresSQL). Looks like it does not install into gem.

I found the answer that it might be problem with gem version. Need to run “bundle install” at local.  This will generate a new Gemfile.lock. Push this new file to Heroku might solve this problem

Ok, that’s all?

Not sure if I missed anything (I might). Anyway, what I did is alive at “http://mysocialy.herokuapp.com/”.

我們的生活周遭不外乎就是以人、事、時、地、物 所構成, 人與人之間的互動, 事件的發生 等等

每個Social Network Service正是在想辦法把我們的生活的縮影給數位化, 網路化

  1. 人: Personal profile, Friends, Lists, Group….虛擬著人與人之間互動的關係
  2. 事: What’s on your mind? What’s happening? 什麼事情即將發生或發生過(events)
  3. 時: 每個事件, 動作都會帶著時間
  4. 地: Check in是沒意義的動作, 只是好玩, 但如果事件或想法帶著地點就不同了, 那代表事情的發生地點, 或是你在啥地方激發了你的想法
  5. 物: 吃食物, 看電影, 聽音樂, 讀一本書…我們時時刻刻無不跟東西在互動

Google+對Social network的解答是隱私權(Circle), 是分享(Reshare, auto upload), 是溝通(Hangout), 但Facebook卻是從人出發(Profile, Timeline, 最早由Profile), 到Open Graph (與物的互動), 想盡辦法縮影我們的生活, 雖然有很多爭議點, 我認為, 現階段G+還是無法抗衡, 比較起來, Facebook目前還是比Google懂社群 (純個人意見抒發)

  1. Go to Facebook developer : https://developers.facebook.com/apps
  2. Select your app
  3. Click “Edit Setting”
  4. Choose “Translate your app” at left hand side
  5. You’ll see a form as following. Select your language and translate all messages:
_2011-09-26_6

Open graph的確是個好物, 雖然說早在去年的f8就已經推出了, 但現在更加完備了, 其實也等不及看會有啥應用推出了, 當然自己也想來玩看看,  本想照Tutorial依樣畫葫蘆抄一個體驗看看, 又覺這樣太無聊, 又想說試看看heroku + node.js, 沒真的玩過node.js, 就拿這題目試試

今天剛好在Facebook上講到拉麵, 所以就拿我最愛吃的拉麵來當題目了.. :P

web.js和兩個views(index.ejs, men.js)的sources放在這

實作筆記:

  1. Tutorial裡的範例是拿Heroku + PHP, 但其實這跟拿哪一種來實作沒太大差異, 裡面的範例幾乎全部都是javascript辦到的, 所以就算把範例放到其他平台也適用
  2. Tutorial裡的範例比較靜態, 全部實作在html內就好, 我把它改成"/ramen/id"當一個物件, 但每一個物件都還是透過"men.ejs"去render
  3. heroku提供的node.js連結Facebook的範本是透過server side的everyauth+facebook-client, 我把這些都拿掉, 純用Facebook javascript api
  4. 在web.js裡實作兩個uri, “/” (index.ejs) 和 “/ramen/id” (men.ejs), 拉麵資料由web.js在render時傳給template, 目前先寫死
  5. Object debugger是蠻好用的東西, meta data寫錯一直post不出去, 剛開始沒用這抓錯還真不知道錯哪
  6. Social plugin的activity feed似乎不包含自己的

最後在Timeline上呈現的樣子:

用Graph API取得自己的Activities:

https://graph.facebook.com/me/[name_space]:[action_type]/ramen

ex. https://graph.facebook.com/me/soulogramen:eat/ramen

 

test