wiki:jazz/Comet/08-10-30

2008-10-30

  • 根據 Orbited 的相依說明,我們會需要這幾個套件
    • python2.5 - An interactive high-level object-oriented language (version 2.5)
      • [註一] 用 Python 2.4 在執行 orbited 時會遇到一些 Runtime Error~
      • [註二] 由於安裝之後,Etch 預設還是用 Python2.4,很難改變預設 Runtime,因此網路上建議直接用 tarball 安裝。另一個解法就是升級到 lenny。
        ~$ echo "deb http://free.nchc.org.tw/debian/ lenny main contrib non-free" > /tmp/lenny.list
        ~$ sudo mv /tmp/lenny.list /etc/apt/sources.list.d/
        ~$ sudo rm /etc/apt/sources.list
        ~$ sudo apt-get update
        ~$ sudo apt-get -t lenny -y upgrade
        ~$ sudo apt-get -t lenny -y dist-upgrade
        
    • python-setuptools - Python Distutils Enhancements
    • python-twisted - Event-based framework for internet applications (transitional package)
    • python-simplejson - Simple, fast, extensible JSON encoder/decoder for Python
  • 安裝 Orbited 相關套件
    ~$ sudo apt-get install python-setuptools python-twisted python-simplejson
    ~$ wget http://pypi.python.org/packages/source/o/orbited/orbited-0.7.0.tar.gz
    ~$ tar zxvf orbited-0.7.0.tar.gz
    ~$ sudo easy_install orbited-0.7.0
    ~$ sudo cp orbited-0.7.0/orbited.cfg /etc/
    
  • 測試 Orbited
    ~$ python
    Python 2.5.2 (r252:60911, Sep 29 2008, 21:15:13)
    [GCC 4.3.2] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import orbited
    >>> [Ctrl+D]
    
  • 如果沒有錯誤訊息就可以繼續跑測試了。參考Scalable Real-Time Web Architecture, Part 2: A Live Graph with Orbited, MorbidQ, and js.io,我們在 Lenny 的環境下,成功重現這個範例。註:請自行取代 ${NEW_IP_ADDRESS} 為主機的 IP 位址。
    ~$ sudo easy_install stompservice 
    ~$ wget http://cometdaily.com/wp-content/uploads/2008/10/graph_demo.tgz
    ~$ tar zxvf graph_demo.tgz
    ~$ cd graph_demo/
    ~/graph_demo$ for i in `find . -type f`; do sed "s#localhost#${NEW_IP_ADDRESS}#g" $i > $i.bak; mv $i.bak $i; done
    ~/graph_demo$ orbited --config graph.cfg
    10/30/08 16:08:02:525 INFO   orbited.start      proxy protocol active
    10/30/08 16:08:02:525 INFO   orbited.start      Listening http@9000
    10/30/08 16:08:02:527 INFO   orbited.start      Listening stomp@61613
    
  • 連線到 http://${NEW_IP_ADDRESS}:9000/graph ,並在另一個 console 下執行 data_producer.py,就會看到圖表一直在變化。
    ~/graph_demo$ python data_producer.py
    Connected; producing data
    
Last modified 16 years ago Last modified on May 15, 2009, 5:17:46 AM

Attachments (1)

Download all attachments as: .zip