Two Cloud Platerm Installation Guide Using Grails Plugin

   Install app on cloud-foundry Pass using Grails with cloud-foundry plugin  
1,grails install plugin cloud-foundry :install cloud-foundry plugin of grails

2,Config username and passwrod in Config.groovy file:
grails.plugin.cloudfoundry.username = 'your.email@server.com'
grails.plugin.cloudfoundry.password = 's3kr3t'

3,grails cf-services   :what services you can use. current services we can use are msyql,mongodb,redis.

4,grails cf-create-service mysql :create database service,return message like "Service 'mysql-xxxxxxx' provisioned."

5,grails prod cf-push --services=mysql-xxxxxxx 
 
 (this command not works well,but first run  'grails interactive' command,then  prod cf-push --services=mysql-xxxxxxx  ok )

  Now you app has install on the cloud-foundy

6, grails prod cf-update :to redeploy an application

7, grails cf-logs : see log


other grails command for reference:
grails cf-apps
grails cf-stats
grails cf-info
grails cf-stop,
grails cf-start,
grails cf-restart
grails cf-delete-app :to delete an application
grails cf-crashes
grails cf-crashlogs :to view log files for crashed instances
grails cf-logs :to view log files
grails cf-logs --stderr : to view log files,limit it to stderr log
grails cf-logs target/myapp.stderr.log --stderr :write a log to a file instead of the console
grails cf-list-files / :to view / directory listings
grails cf-get-file tomcat/webapps/ROOT/css/main.css :to view a file:

after installed app,I most often use the bellow grails command:
grails prod cf-update : to redeploy an application
grails cf-logs :to see log

another command I often use:
appcfg.cmd update war
 (Yes,this not a clound foundry plugin command,it's G#A#E# redeploy command,I use a G#A#E# app
as a bridge,because "Outbound connections in CloudFoundry are limited currently to HTTP(S) on ports 80 and 443.",
but G#A#E# supports  80-90, 440-450, 1024-65535.Why  use G#A#E#
as a bridge,why not directly use G#A#E#,you know.A Chinese popular catchword:你懂的!
And you should aslo know clound foundry's database mysql now not supports UTF8. I use encoding and decoding
to support Chinese )



   Install app on cloudbees Pass using Grails with cloud-bees plugin
1, register on cloudbees site.
2, get API Key and Secret Key on cloudbees site.
3, add API Key and Secret Key  in Config.groovy file:
  cloudbees.api.url='https://api.cloudbees.com/api'
  cloudbees.api.key='XXXXXXXXXXXXXXXXXXXXXXXXXX'
  cloudbees.api.secret='XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
4, create app and database on cloudbees site.
5, modify DataSource.groovy of database connection:
 production {
        dataSource {
            dbCreate = "update"
                  driverClassName = "com.mysql.jdbc.Driver"
                  username = "xxxx"   //(cloudbees site login name)
                   password = "xxxxxxxx"   //cloudbees site login password)        
                  url = "jdbc:cloudbees://xxxxx" //appId created on the cloudbees site)
        }
    }
6, run command: grails war
7, on the cloudbees site ,deploy the war file
8, Ok,now finish the app on the cloud, but use:
http://appId.loginname.cloudbees.net ,the browser give you "Network Error" message,Yes If you
are in Greate China.
   
   
After these z-turns,  I finally privide my Android app with a back data source.


posted @ 2011-06-10 11:34  ZhuangYinPing  阅读(331)  评论(0编辑  收藏  举报