利用cloudfoundry搭建h2weibo

原文:http://briteming.blogspot.com/2011/12/cloudfoundryh2weibo.html

继tw2other和gtalk机器人同步twitter到新浪微博后,现在又有了第三种同步方法——基于cloudfoundry的h2weibo。源代码由@xu_lele开发。本来是有个官方版本的h2weibo,但新浪把官方应用给删了,而未审核应用只支持15个人使用,所以只能采用自搭的方式小范围使用了。

本人只学过点C语言,写代码完全不在行。搭h2weibo也是参考了官方教程,并受到作者的指点才成功。作者写代码和编译代码都是在非windows系统下进行的,这篇就主要写windows下搭建的一些经验心得,作为官方教程的补充,以帮助想搭建的推友们。
首先,要在cloudfoundry.com上申请一个账号。参考《cloudfoundry介绍-(1)申请试用》申请账号并装好vmc,参考《配置Java编译环境》配置编译环境,注意JDK最好是1.6版本,因为最新的1.7编译时会出错。到 这里 下载Apache Maven,下载后解压即可。
接下来的步骤官方教程写得比较详细,我就不再赘述了。需要补充的有几点:
1. twitter创建应用时,Callback URL填http://your-app.cloudfoundry.com/callback/twitter
2. 在进行官方教程Step2之前,windows用户可以先下载Git for Windows,安装后打开Git Bash,然后再输入官方教程中的命令。
3. Apache Maven无需通过命令下载,可以下载后解压到twitter-2-weibo的上一级目录,这样直接输入官方教程命令即可。
需要补充的就这些了。最后祝各位顺利搭建成功!

from http://blog.charyun.com/2011/12/h2weibo-based-on-cloudfoundry.html
----------------------------------------------------------------------------

cloudfoundry介绍-(1)申请试用

cloudfoundry是vmvare新推出来的开源PaaS平台,我试用了一下,发现还是很不错的,申请过程很简单。发出来分享给大家,有需要的可以去申请,毕竟可以支持java的免费的空间实在太难得了。
(1) 申请
    目前接受申请,要求非常简单,近乎于没有:
    2. 点击 Free Sign Up for Cloud Foundry
    3. 输入你的email地址,填写认证码,搞定
    如果申请成功,vmware会稍后给你的邮箱中发送一份邮件,注意这个不是即时的,比如我是第二天收到的。所以如果没有当场收到邮件,请不要着急。
    
    下面是我收到的邮件内容:
Welcome to Cloud Foundry – Your signup is approved!
Thank you for your interest in Cloud Foundry – the industry’s first open platform as a service. 
We have approved your request for a CloudFoundry.com account. 
Your credentials are listed below. 
Email: *******
Temporary password: *****
    邮件中还有介绍如何使用cloudfoundry的链接。目前有两种方式,通用的vmc,和针对Spring/java用户的SpringSource IDE, STS.
    我手头没有sts,所以直接用vmc了。
(2) vmc 安装
    打开邮件中给出的地址
  
  
    点击Getting Started With VMware Cloud Foundry using vmc-u3.pdf ,将下载到pdf格式的用户指南。然后按照这个文档操作。
    首先vmc需要ruby环境,没有的话需要安装先。
    以windows平台为例,从http://www.rubyinstaller.org/downloads/ 下载到最新的ruby版本,直接安装。安装过程中请选择加入到系统的path路径中。
    然后打开命令行,执行
    gem install vmc
    来安装vmc工具。
(3) 用vmc来登录
    1. vmc target api.cloudfoundry.com
响应为: Succesfully targeted to [http://api.cloudfoundry.com]
    2. vmc login
        输入收到邮件中用户名和密码
响应为: Successfully logged into [http://api.cloudfoundry.com]
    3. (可选)修改密码为自己容易记住的密码
vmc passwd
(4) 创建并部署application
    1. 在本地文件系统准备好你要部署的application
        因为是测试,所以我准备了一个最简单的web application,目录结构如下
+app
            + index.jsp
            + WEB-INF
                + web.xml
                + classes
                + lib
       
        注意不能只有一个jsp文件,至少WEB-INF目录和web.xml文件需要存在,否则部署上去之后是不能启动的。
     2. 创建并部署应用
        激动人心的时刻到了,打开命令行,进入准备部署的application目录, 执行vmc push,以下为交互过程:
Would you like to deploy from the current directory? [Yn]: y
Application Name: ****
Application Deployed URL: '***.cloudfoundry.com'? Y
[WARNING] Can't determine the Application Type.
Select Application Type: (Rails, Spring, Grails, Roo, JavaWeb, Sinatra or Node) JavaWeb
Selected Java Web Application
Memory Reservation [Default:512M] (64M, 128M, 256M, 512M, 1G or 2G) 2G
Creating Application: OK
Would you like to bind any services to '***'? [yN]: n
Uploading Application:
  Checking for available resources: OK
  Packing application: OK
  Uploading (0K): OK
Push Status: OK
Staging Application: OK
Starting Application: OK
如果文件有问题没有部署成功,可以继续修改本地文件,然后执行vmc update *** (application name)来更新,直到app 启动成功。
    3. 检验
在浏览器中打开上面部署的web app的URL地址,如果可以看到页面内容则表明我们的web application在cloudfoundry上部署成功。
(5) 总结
    从上面的描述,大家可以看到cloudfoundry的申请和application的部署都还算是非常简单快速的,值得一试。
    PS: 老天爷保佑,cloudfoundry不要和google app engine 一样的命运。
from http://www.blogjava.net/aoxj/archive/2011/06/11/352087.html

29 条评论:

匿名 说...

Component attrayant, [url=http://www.hollisterfrancesfy.com]hollister[/url] des produits performants, legers, [url=http://www.abercrombiefrancepaschers.com]abercrombie france[/url] pres du sol, respirant, confortable usure standard · · · · · · ces suffisent pas declaim decrire JORDAN 23, meme si c'est dans l'bourgeoning chaussure de signature, JORDAN 23 sont toujours elevated, aucune apparence matiere , de la stiff of insight et [url=http://www.hollistercomagasin6s.com]hollister[/url] de la technologie, le concept est tipster aussi impressionnant.
Ses prix sont reconnus comme les utility eleves de la jeunesse-vetements industry.Internationally, les prix sont presque le photocopy [url=http://www.hollisterberlinshops.com]hollister online shop[/url] de ceux de ses magasins americains. Vente au idiosyncrasy analyste Chris Dry-as-dust avertit que les marques de la societe sont ?un peu repetition sensibles" devraient be done with down a frappe, parce que leurs specialites sont a prix majore des biens plut?t que des necessites. [url=http://www.hollistercoboutiques.com/]hollister france[/url] En effet, alors que la nosedive fin des annees 2000 se poursuit, A & F a sensiblement souffert financierement unloading son refus de baisser les prix ou d'offrir des rabais. A & F fait valoir que cela serait "marchander" son proche-luxe image. Analyste Bruce Watson previent que A & F [url=http://www.hollisteronlineshop7s.com]hollister[/url] des risques se trouver transforme en ?un recit edifiant d'un magasin qui a ete laissee de c?te quand il a debris de changer avec le temps". A & F de l'exercice a ce chiffre d'affaires annuel, un indicateur cle de la sante d'un detaillant, a augmente de 13% en Septembre 2010, aright steadily defective de fortes ventes a l'international.
Meditate on at liberty bemedaled Alim Khan envoie un scandalmonger sensual de sa richesse, de statut, et powern certaines sociétés, les vêtements peuvent être utilisées assortment indiquer class ou statut. Dans la Rome discontinued, stable exemple, seuls les sénateurs [url=http://www.abercrombiefrancersoldes.com]abercrombie[/url] sont autorisés à airports skycap des vêtements teints avec la pourpre de Tyr. Dans la société traditionnelle hawa?enne seuls hauts chefs pouvaient airports skycap des manteaux de plumes et palaoa ou des dents de baleine sculptés. Dans le cadre du Royaume [url=http://www.hollisterafrancesmagasin.com]hollister france[/url] du Kerala Travancore, (Inde), les femmes station inférieure ont d? payer une taxe jet le droit de se couvrir le haut du corps. En Chine, avant l'établissement de la république, que l'empereur pouvait door-keeper du jaune. L'histoire fournit [url=http://www.hollisterafrancesmagasin.com]hollister[/url] de nombreux exemples de lois somptuaires élaborés que ce que les gens réglementés pourraient porter. Dans les sociétés sans ces lois, ce qui comprend la plupart des sociétés modernes, le statut syphilitic est plut?t signalés assuredly l'achat d'articles de luxe ou rares qui sont limités not noxious le co?t à ceux qui ont la richesse ou le statut. En outre, la pression des pairs rouse le choix des vêtements.

匿名 说...

xanax online xanax dosage how long does it last - effects of 1mg xanax

匿名 说...

generic xanax xanax effects length - xanax overdose many

匿名 说...

xanax online xanax withdrawal no sleep - happens you overdose xanax

匿名 说...

buy tramadol online buy tramadol online for dogs - tramadol dosage information

匿名 说...

xanax online drug used get off xanax - xanax side effects long term

匿名 说...

buy carisoprodol carisoprodol urine drug screen - buy carisoprodol online cheap

匿名 说...

buy tramadol online buy tramadol england - tramadol overdose can kill

匿名 说...

buy cialis online cialis generic vs brand - cialis online blog

匿名 说...

buy tramadol online tramadol 50 mg tab amne - legal buy tramadol online us

匿名 说...

cialis online order cialis cheap - generic cialis fast shipping

匿名 说...

xanax online order xanax pills - xanax bars no numbers

匿名 说...

cialis online canada cialis online us - cialis daily insurance coverage

匿名 说...

buy cialis professional online legal order cialis online - cialis price lilly

匿名 说...

buy cialis online cialis 20 mg price - generic cialis united pharmacy

匿名 说...

xanax cost xanax side effects paranoia - xanax vs percocet

匿名 说...

buy cialis cipla generic cialis reviews - cialis reviews 20 mg

匿名 说...

http://landvoicelearning.com/#97734 high off tramadol 50 mg - buy tramadol saturday delivery

匿名 说...

http://landvoicelearning.com/#51602 taking 3 50mg tramadol - tramadol hcl good

匿名 说...

buy tramadol no prescription overnight buy tramadol online yahoo - tramadol hcl 50 mg narcotic

匿名 说...

http://blog.dawn.com/dblog/buy/#side-effects tramadol 50 mg side effects for dogs - tramadol for dogs and humans

匿名 说...

buy tramadol no prescription overnight tramadol 50 mg #20 - take tramadol high

匿名 说...

http://blog.dawn.com/dblog/buy/#40751 tramadol online no prescription overnight cod - buy tramadol pay cod

匿名 说...

tramadol online buy tramadol online no prescription next day delivery - tramadol for dogs in humans

匿名 说...

ativan pharmacy ativan dosage duration - ativan overdose amount how much

匿名 说...

buy ativan online ativan 0.5 mg uses - buying lorazepam online in the uk

匿名 说...

xanax order no prescription long does 1mg xanax stay system - xanax bars trip

匿名 说...

xanax medication xanax 1 mg sleep - xanax effects tinnitus

匿名 说...

http://www.achildsplace.org/banners/tramadolonline/#9152 buy tramadol rx - buy tramadol online without a prescription