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 com.xebia.blog --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.

4 thoughts on “Blog created in couple of minutes using Spring Roo and Cloud Foundry”

  1. please note that if you want to try it with the latest version: 1.2.0.M1 first you have to manually install the cloudfoundry add-on:

    pgp automatic trust
    addon install bundle –bundleSymbolicName org.springframework.roo.addon.cloud.foundry

  2. I like the valuable info you provide in your articles.
    I’ll bookmark your weblog and check again here regularly.
    I am quite certain I will learn a lot of new stuff right here!
    Good luck for the next!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: