Blog created in couple of minutes using Spring Roo and Cloud Foundry

Yesterday I gave a session on Cloud Foundry at SiliconIndia Cloud conference and I showed audience how they can create a blog in couple of minutes. I developed blog using Spring Roo and deployed to Cloud Foundry public cloud using roo cloud foundry add-on. The audience really liked the demo and saw the power of Spring Roo and Cloud Foundry. In case you want to create your blog using Spring Roo and Cloud Foundry . Open the roo shell and fire these commands.

project --topLevelPackage --projectName xebiablog
mongo setup
entity mongo --class ~.domain.Blog
field string --fieldName title --class ~.domain.Blog --notNull
field string --fieldName body --notNull --sizeMax 200000
field date --type java.util.Date --fieldName publishDate --notNull
field boolean --fieldName publish --primitive --notNull
field string --fieldName author --notNull
entity mongo --class ~.domain.Comment
field string --fieldName email --notNull --class ~.domain.Comment
field string --fieldName comment --notNull --sizeMax 4000
field set --type ~.domain.Comment --fieldName comments --class ~.domain.Blog
field reference --type ~.domain.Blog --fieldName blog --class ~.domain.Comment --notNull
repository mongo --interface ~.repository.BlogRepository --entity ~.domain.Blog
repository mongo --interface ~.repository.CommentRepository --entity ~.domain.Comment
service --interface ~.service.BlogService --entity ~.domain.Blog
service --interface ~.service.CommentService --entity ~.domain.Comment
web mvc setup
web mvc all --package ~.web
mongo setup --cloudFoundry true
perform package
cloud foundry login --email <username> --password <password>
cloud foundry deploy --appName xebiablog --path /target/xebiablog-0.1.0.BUILD-SNAPSHOT.war --memory 512
cloud foundry create service --serviceName xebiablog-mongo --serviceType mongodb
cloud foundry bind service --appName xebiablog --serviceName xebiablog-mongo
cloud foundry start app --appName xebiablog
cloud foundry list apps

This blog will use MongoDB as its datastore. If you already have Spring Roo and CloudFoundry addon installed it will take less than couple of minutes to have your blog created and deployed in cloud.